[Intel-gfx] [PATCH 3/4] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags

Alastair D'Silva alastair at d-silva.org
Mon Apr 15 10:44:39 UTC 2019


> -----Original Message-----
> From: David Laight <David.Laight at ACULAB.COM>
> Sent: Monday, 15 April 2019 8:21 PM
> To: 'Alastair D'Silva' <alastair at d-silva.org>; 'Petr Mladek'
> <pmladek at suse.com>
> Cc: 'Alastair D'Silva' <alastair at au1.ibm.com>; 'Jani Nikula'
> <jani.nikula at linux.intel.com>; 'Joonas Lahtinen'
> <joonas.lahtinen at linux.intel.com>; 'Rodrigo Vivi' <rodrigo.vivi at intel.com>;
> 'David Airlie' <airlied at linux.ie>; 'Daniel Vetter' <daniel at ffwll.ch>; 'Karsten
> Keil' <isdn at linux-pingi.de>; 'Jassi Brar' <jassisinghbrar at gmail.com>; 'Tom
> Lendacky' <thomas.lendacky at amd.com>; 'David S. Miller'
> <davem at davemloft.net>; 'Jose Abreu' <Jose.Abreu at synopsys.com>; 'Kalle
> Valo' <kvalo at codeaurora.org>; 'Stanislaw Gruszka' <sgruszka at redhat.com>;
> 'Benson Leung' <bleung at chromium.org>; 'Enric Balletbo i Serra'
> <enric.balletbo at collabora.com>; 'James E.J. Bottomley'
> <jejb at linux.ibm.com>; 'Martin K. Petersen' <martin.petersen at oracle.com>;
> 'Greg Kroah-Hartman' <gregkh at linuxfoundation.org>; 'Alexander Viro'
> <viro at zeniv.linux.org.uk>; 'Sergey Senozhatsky'
> <sergey.senozhatsky at gmail.com>; 'Steven Rostedt'
> <rostedt at goodmis.org>; 'Andrew Morton' <akpm at linux-foundation.org>;
> intel-gfx at lists.freedesktop.org; dri-devel at lists.freedesktop.org; linux-
> kernel at vger.kernel.org; netdev at vger.kernel.org;
> ath10k at lists.infradead.org; linux-wireless at vger.kernel.org; linux-
> scsi at vger.kernel.org; linux-fbdev at vger.kernel.org;
> devel at driverdev.osuosl.org; linux-fsdevel at vger.kernel.org
> Subject: RE: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in
> hex_dump_to_buffer with flags
> 
> From: Alastair D'Silva
> > Sent: 15 April 2019 11:07
> ...
> > In the above example the author only wants the hex output, while in
> > other situations, both hex & ASCII output is desirable. If you just
> > want ASCII output, the caller should just use a printk or one of it's
> wrappers.
> 
> Hexdump will 'sanitise' the ASCII.
> 

This is functionality that doesn't exist in the current hexdump implementation (you always get the hex version).

I think a better option would be to factor out the sanitisation and expose that as a separate function.

> Although I think you'd want a 'no hex' flag to suppress the hex.
> 
> Probably more useful flags are ones to suppress the address column.

This is already supported by the prefix_type parameter - are you proposing that we eliminate the parameter & combine it with flags?

> I've also used flags to enable (or disable) suppression of multiple lines of
> zeros of constant bytes.
> In that case you may want hexdump to return the flags for the next call when
> a large buffer is being dumped in fragments.
 
I'm afraid I don't quite follow here, hex_dump_to_buffer doesn't alter the flags, so the caller already knows it. 

-- 
Alastair D'Silva           mob: 0423 762 819
skype: alastair_dsilva     msn: alastair at d-silva.org
blog: http://alastair.d-silva.org    Twitter: @EvilDeece






More information about the Intel-gfx mailing list