Re: [PATCH 2/2] printk: Remember the message level for multi-line output

From: Nick Andrew
Date: Mon Apr 14 2008 - 07:03:38 EST


On Mon, Apr 14, 2008 at 12:26:34PM +0200, Ingo Molnar wrote:
> * Nick Andrew <nick@xxxxxxxxxxxxxxx> wrote:
> > Yes, quite. The state of whether we're inside a line is retained
> > across calls to printk (from anywhere in the system) - this allows
> > code like this to usually do what you expect:
> >
> > printk(KERN_ERR "Error:");
> > for (i = 0; i < 16; ++i) {
> > printk(" %02x", i);
> > }
> > printk("\n");
> >
> > But in your example the first printk call contains a \n at the end of
> > the line and so upon entry to the second printk call the function
> > knows a new line is beginning.
>
> ok - i think your change is a good one.

Thank you.

> btw., we could also start emitting debug warnings that the printk is not
> conform. Something like:
>
> "INFO: the previous printk was done without a KERN_ annotation"

There are 20k+ instances of this in the codebase; we don't need a
runtime message to find them. If you annotate them all, that will
add up to 60k to the binary size. Perhaps it's best to retain the
default support.

Nick.
--
PGP Key ID = 0x418487E7 http://www.nick-andrew.net/
PGP Key fingerprint = B3ED 6894 8E49 1770 C24A 67E3 6266 6EB9 4184 87E7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/