lkml.org 
[lkml]   [2012]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] printk: support structured and multi-facility log messages
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


\
 
 \ /
  Last update: 2012-04-05 19:57    [W:0.262 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site