[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 11:12:15 UTC 2019


> -----Original Message-----
> From: David Laight <David.Laight at ACULAB.COM>
> Sent: Monday, 15 April 2019 9:04 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:45
> ...
> > > 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 was looking at the flags on one of my hexdump() functions...
> 
> > > 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.
> 
> If you are suppressing lines of zeros and dumping a buffer in several blocks
> then subsequent calls need to know that the last line of the previous call was
> suppressed zeros - and carry on with the same suppressed block.

Why wouldn't you do this with a single call to print_hex_dump? (that is where the repeated lines are suppressed)

That will already take chunks of the buffer until the whole thing is output, in what situation do you see a caller chunking the access themselves?

-- 
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 dri-devel mailing list