mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <sha@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] vsprintf: add support for printing raw buffers as hex (%*ph)
Date: Mon, 3 Jan 2022 11:40:57 +0100	[thread overview]
Message-ID: <92020314-afcc-e694-e12c-07399f0747c8@pengutronix.de> (raw)
In-Reply-To: <20211214072747.GM6003@pengutronix.de>

Hello Sascha,

On 14.12.21 08:27, Sascha Hauer wrote:
> On Tue, Dec 14, 2021 at 07:57:01AM +0100, Ahmad Fatoum wrote:
>> On 13.12.21 23:28, Sascha Hauer wrote:
>>> On Thu, Dec 09, 2021 at 11:57:06AM +0100, Ahmad Fatoum wrote:
>>>> Import from Linux support for printing buffers as a hex string
>>>> with a certain separator. For larger buffers consider using
>>>> print_hex_dump(). Examples:
>>>>
>>>>   %*ph	00 01 02  ...  3f
>>>>   %*phC	00:01:02: ... :3f
>>>>   %*phD	00-01-02- ... -3f
>>>>   %*phN	000102 ... 3f
>>>>
>>>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>>>> ---
>>>>  lib/Kconfig    |  3 +++
>>>>  lib/vsprintf.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>  2 files changed, 53 insertions(+)
>>>>
>>>> diff --git a/lib/Kconfig b/lib/Kconfig
>>>> index 718033e56e64..27e7bea6852f 100644
>>>> --- a/lib/Kconfig
>>>> +++ b/lib/Kconfig
>>>> @@ -166,6 +166,9 @@ config PRINTF_UUID
>>>>  config PRINTF_WCHAR
>>>>  	bool
>>>>  
>>>> +config PRINTF_HEXSTR
>>>> +	bool
>>>
>>> So hexdumps are silently ignored when this option is disabled. Not sure
>>> if this should really be configurable, but I think when it is
>>> configurable it should be default y to avoid surprises.
>>
>> It will be printed as a raw pointer when the option is disabled.
>> There's no code in-tree that uses this format specifier yet,
>> so I prefer to not make this the default and increase binary size.
> 
> Ok for now, but we should revise it once this actually gets used.

This is still left after a rebase.

Cheers,
Ahmad

> 
> Sascha
> 
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


      reply	other threads:[~2022-01-03 10:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 10:57 Ahmad Fatoum
2021-12-09 10:57 ` [PATCH 2/3] common: add new PRINTF_FULL option Ahmad Fatoum
2021-12-09 10:57 ` [PATCH 3/3] of: implement new of_property_sprintf Ahmad Fatoum
2021-12-15 20:16   ` [PATCH] fixup! " Ahmad Fatoum
2021-12-13 22:28 ` [PATCH 1/3] vsprintf: add support for printing raw buffers as hex (%*ph) Sascha Hauer
2021-12-14  6:57   ` Ahmad Fatoum
2021-12-14  7:27     ` Sascha Hauer
2022-01-03 10:40       ` Ahmad Fatoum [this message]

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=92020314-afcc-e694-e12c-07399f0747c8@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.de \
    /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