lkml.org 
[lkml]   [2012]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] printk: support structured and multi-facility log messages
From
Now that we're talking vsnprintf helpers... Wouldn't it be nice if those
key/value pairs could be used in the message?

const char* kvpairs = "key=value\n";
printk_emit(..., kvpairs, ... "Something went wrong with %{key}s")

... with a saner choice of specifiers, of course.

Stijn

On Thu, Apr 5, 2012 at 7:53 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Thu, Apr 5, 2012 at 10:09 AM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>>
>> If you want to escape something, you escape NUL and special characters
>> using the standard *text* escaping mechanisms, not using some random
>> hodge-podge that you just made up.
>
> Btw, we could certainly add more support for escaping into vsnprintf() itself.
>
> For example, we already do all those nice helpers for converting
> different forms of common binary data into ascii: "%pU" for uuid's,
> '%pS' for symbol addresses etc.
>
> If there really are cases where people want small blobs of data and it
> would make sense, we could easily do "%.*pQ" for "quoted blob" or
> whatever, where the precision is obviously the size of the blob (so
> "%.4pQ" would be a quoted four-byte entity.
>
> We could also extend on the current '%pm', which was really designed
> for mac-addresses, but the format is actually just a hex sequence. We
> could extend that too to just take the precision into account, and
> just default to a six-byte mac address. But we could trivially make
> "%.16pm" print out a 16-byte hex string instead.
>
> I would also be very open to having some auto-quoting support for
> '%s': it might even be something we could enable by default. So that
> if you print out strings that contain special characters (including
> '\n' etc), we could make sure that vsnprintf() actually quotes them.
> We don't have to follow the POSIX rules for things, after all.
>
> So I'm very open to making it easier to use ASCII.
>
> I'm *very* closed to making any kernel logging facility use binary
> data. If you want binary data, go somewhere else. Seriously.
>
>                  Linus
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-04-13 15:45    [W:0.111 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site