lkml.org 
[lkml]   [2012]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [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


    \
     
     \ /
      Last update: 2012-05-09 07:03    [W:2.893 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site