On Mon, 2014-07-07 at 09:25 -0700, Joe Perches wrote:
[trivial notes]
Thanks! Fixed locally, though am waiting for few more days if any other
comment comes.
On Mon, 2014-07-07 at 18:21 +0300, Andy Shevchenko wrote:
quoted
This allows user to print a given buffer as esaped string. The rules applied
as an escaped
quoted
accordingly to the mix of the flags provided by additional format letters.
rules are applied according to an optional mix of flags
quoted
For example, if the given buffer:
1b 62 20 5c 43 07 22 90 0d 5d
The result strings could be:
would be
quoted
%*pE "\eb \C\a"\220\r]"
Maybe say something about ssid's here.
Mentioned in the printk-formats.txt part.
or maybe add an %*pES just for the ssid type.
I gave a thought to it, and it seems to me we will increase complexity
of the code to get none beneficial. The SSID in most cases has a
variable-length, thus we will pass it anyway, what else could be differ
here? Default set of flags?
quoted
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
[]
quoted
@@ -70,6 +70,34 @@ DMA addresses types dma_addr_t:
For printing a dma_addr_t type which can vary based on build options,
regardless of the width of the CPU data path. Passed by reference.
+Raw buffer as an escaped string:
+
+ %*pE[achnops]
+
+ For printing raw buffer as an escaped string. For the following buffer
+
+ 1b 62 20 5c 43 07 22 90 0d 5d
+
+ few examples show how the conversion could be done (the result string
+ without embraced quotes):
'embraced' is a bit of an awkward word choice. Maybe surrounding.
quoted
+
+ %*pE "\eb \C\a"\220\r]"
Oh, the initial commit log comments above are really for this block
Phrasing is a bit different, though I rephrased above sentence.
quoted
+ %*pEhp "\x1bb \C\x07"\x90\x0d]"
+ %*pEa "\e\142\040\\\103\a\042\220\r\135"
+
+ The converion rules are defined by combination of the following flags
conversion
quoted
+ (see string_escape_mem() kernel documentation for the details):
+ a - ESCAPE_ANY
+ c - ESCAPE_SPECIAL
+ h - ESCAPE_HEX
+ n - ESCAPE_NULL
+ o - ESCAPE_OCTAL
+ p - ESCAPE_NP
+ s - ESCAPE_SPACE
+ By default ESCAPE_ANY_NP is used.
+
+ If field width is ommited the 1 byte only will be escaped.
omitted
--
Andy Shevchenko [off-list ref]
Intel Finland Oy