From: Arvind Sankar <nivedita@alum.mit.edu>
To: Petr Mladek <pmladek@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Joe Perches <joe@perches.com>,
Chenggang Wang <wangchenggang@vivo.com>,
linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [RFC PATCH 2/2] init: Allow multi-line output of kernel command line
Date: Thu, 21 May 2020 11:08:17 -0400 [thread overview]
Message-ID: <20200521150817.GA502432@rani.riverdale.lan> (raw)
In-Reply-To: <20200521123117.GD8397@linux-b0ei>
On Thu, May 21, 2020 at 02:31:17PM +0200, Petr Mladek wrote:
> On Wed 2020-05-20 21:40:07, Andrew Morton wrote:
> > On Thu, 21 May 2020 13:36:28 +0900 Sergey Senozhatsky <sergey.senozhatsky@gmail.com> wrote:
> >
> > > On (20/05/20 18:00), Andrew Morton wrote:
> > > [..]
> > > > I'm wondering if we shold add a kernel puts() (putsk()? yuk) which can
> > > > puts() a string of any length.
> > > >
> > > > I'm counting around 150 instances of printk("%s", ...) and pr_foo("%s",
> > > > ...) which could perhaps be converted, thus saving an argument.
> > >
> > > Can you point me at some examples?
> > >
> >
> > ./arch/powerpc/kernel/udbg.c: printk("%s", s);
> > ./arch/powerpc/xmon/nonstdio.c: printk("%s", xmon_outbuf);
> > ./arch/um/os-Linux/drivers/ethertap_user.c: printk("%s", output);
> > ./arch/um/os-Linux/drivers/ethertap_user.c: printk("%s", output);
> > ./arch/um/os-Linux/drivers/tuntap_user.c: printk("%s", out
> >
> > etc.
> >
> > My point is, if we created a length-unlimited puts() function for printing the
> > kernel command line, it could be reused in such places, resulting in a
> > smaller kernel.
>
> Interesting idea. Well, such a generic function would need to be safe
> and do not modify the original string. We would need to implement
> printk() variant that would support strigs limited by size instead
> of the trailing '\0'. I am not sure if it is worth it.
>
> Best Regards,
> Petr
You don't need a printk variant for strings -- you'd only need one if
you wanted formatted output of unlimited length. Using printk("%.*s",
chunk_size, str) should print at most chunk_size characters from str.
The puts could then just be a loop around that.
Something like:
do {
printed = printk("%.*s", chunk_size, str);
str += printed;
} while (printed >= chunk_size);
next prev parent reply other threads:[~2020-05-21 15:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 3:29 [PATCH] init/main.c: Print all command line when boot 王程刚
2020-05-19 3:44 ` Andrew Morton
2020-05-19 5:09 ` Joe Perches
2020-05-19 14:34 ` Arvind Sankar
2020-05-19 19:42 ` [RFC PATCH 0/2] printk/init: multi-line kernel command line logging Joe Perches
2020-05-19 19:42 ` [RFC PATCH 1/2] printk: Move and rename maximum printk output line length defines Joe Perches
2020-05-21 13:49 ` Petr Mladek
2020-05-19 19:42 ` [RFC PATCH 2/2] init: Allow multi-line output of kernel command line Joe Perches
2020-05-20 4:41 ` Sergey Senozhatsky
2020-05-20 4:58 ` Joe Perches
2020-05-20 12:10 ` Sergey Senozhatsky
2020-05-20 20:36 ` Joe Perches
2020-05-21 1:00 ` Andrew Morton
2020-05-21 2:09 ` Joe Perches
2020-05-21 4:36 ` Sergey Senozhatsky
2020-05-21 4:40 ` Andrew Morton
2020-05-21 12:31 ` Petr Mladek
2020-05-21 15:08 ` Arvind Sankar [this message]
2020-05-21 12:48 ` Sergey Senozhatsky
2020-05-21 4:32 ` Sergey Senozhatsky
2020-05-21 13:46 ` Petr Mladek
2020-05-21 15:59 ` Arvind Sankar
2020-05-21 16:09 ` Joe Perches
2020-06-03 8:48 ` [init] d0bcc26c0d: BUG:kernel_hang_in_early-boot_stage,last_printk:early_console_in_setup_code kernel test robot
2020-05-21 18:40 ` [PATCH] printk: Move and rename maximum printk output line length defines Joe Perches
2020-05-25 8:38 ` Sergey Senozhatsky
2020-05-20 14:01 ` [PATCH] init/main.c: Print all command line when boot Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200521150817.GA502432@rani.riverdale.lan \
--to=nivedita@alum.mit.edu \
--cc=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=wangchenggang@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®