[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFxdvzhGOyA6SN-TcSvuKGyTAUWuDXEiVkpGPEBAZ7uHsg@mail.gmail.com>
Date: Thu, 5 Apr 2012 10:53:27 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Kay Sievers <kay@...y.org>
Cc: linux-kernel@...r.kernel.org, Greg Kroah-Hartmann <greg@...ah.com>
Subject: Re: [PATCH] printk: support structured and multi-facility log messages
On Thu, Apr 5, 2012 at 10:09 AM, Linus Torvalds
<torvalds@...ux-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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists