Messages in this thread | | | From | Linus Torvalds <> | Date | Tue, 8 May 2012 21:27:12 -0700 | Subject | Re: [PATCH RESEND 1/3] printk: convert byte-buffer to variable-length record buffer |
| |
On Tue, May 8, 2012 at 9:11 PM, Sasha Levin <levinsasha928@gmail.com> wrote: > > Is there a reason to keep KERN_CONT under this set of rules at all?
Yes, a very subtle and rare one.
If you want to print out a string that starts with "<%d>", you *have* to use a prefix, in order to not make printk think that the "<*>" is the prefix itself.
And if you don't want to start a new line, you need to use KERN_CONT.
So there is *one* case, and one case only, where KERN_CONT is useful, and it's when the string you are printing out could otherwise be mistaken for a prefix itself (the "<%d>" thing isn't the only such string, of course - it could be a "%s" where the string has those characters in it.
So think of KERN_CONT as a "quoting safety" thing. And in 99% of all cases it is obviously not actually needed. So in general, KERN_CONT is useless and should not be used, but that doesn't mean that it can be removed as a _concept_.
Linus
| |