From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Joe Perches <joe@perches.com>
Cc: "John W . Linville" <linville@tuxdriver.com>,
Johannes Berg <johannes@sipsolutions.net>,
devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 04/10] lib/vsprintf: add %*pE[achnops] format specifier
Date: Tue, 08 Jul 2014 11:50:00 +0300 [thread overview]
Message-ID: <1404809400.5102.90.camel@smile.fi.intel.com> (raw)
In-Reply-To: <1404750357.27043.78.camel@joe-AO725>
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:
> > This allows user to print a given buffer as esaped string. The rules applied
>
> as an escaped
>
> > accordingly to the mix of the flags provided by additional format letters.
>
> rules are applied according to an optional mix of flags
>
> > For example, if the given buffer:
> >
> > 1b 62 20 5c 43 07 22 90 0d 5d
> >
> > The result strings could be:
>
> would be
>
> > %*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?
>
> > diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
> []
> > @@ -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.
>
> > +
> > + %*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.
>
> > + %*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
>
> > + (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 <andriy.shevchenko@intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2014-07-08 8:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-07 15:21 [PATCH v2 00/10] lib: introduce string_escape_mem an %*pE specifier Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 01/10] lib / string_helpers: move documentation to c-file Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 02/10] lib / string_helpers: refactoring the test suite Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 03/10] lib / string_helpers: introduce string_escape_mem() Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 04/10] lib/vsprintf: add %*pE[achnops] format specifier Andy Shevchenko
2014-07-07 16:25 ` Joe Perches
2014-07-08 8:50 ` Andy Shevchenko [this message]
2014-07-07 16:50 ` Joe Perches
2014-07-08 8:24 ` Andy Shevchenko
2014-07-08 16:35 ` Joe Perches
2014-07-07 15:21 ` [PATCH v2 05/10] wireless: libertas: print esaped string via %*pE Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 06/10] wireless: ipw2x00: print SSID " Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 07/10] lib80211: remove unused print_ssid() Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 08/10] staging: wlan-ng: use %*pEhp to print SN Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 09/10] staging: rtl8192e: use %*pEn to escape buffer Andy Shevchenko
2014-07-07 15:21 ` [PATCH v2 10/10] staging: rtl8192u: " Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404809400.5102.90.camel@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).