RE: [PATCH v2 3/7] lib/hexdump.c: Optionally suppress lines of repeated bytes

From: Alastair D'Silva
Date: Mon May 13 2019 - 03:37:30 EST


> -----Original Message-----
> From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Sent: Monday, 13 May 2019 5:01 PM
> To: Alastair D'Silva <alastair@xxxxxxxxxxx>
> Cc: alastair@xxxxxxxxxxx; Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>; Joonas
> Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>; Rodrigo Vivi
> <rodrigo.vivi@xxxxxxxxx>; David Airlie <airlied@xxxxxxxx>; Daniel Vetter
> <daniel@xxxxxxxx>; Dan Carpenter <dan.carpenter@xxxxxxxxxx>; Karsten
> Keil <isdn@xxxxxxxxxxxxxx>; Jassi Brar <jassisinghbrar@xxxxxxxxx>; Tom
> Lendacky <thomas.lendacky@xxxxxxx>; David S. Miller
> <davem@xxxxxxxxxxxxx>; Jose Abreu <Jose.Abreu@xxxxxxxxxxxx>; Kalle
> Valo <kvalo@xxxxxxxxxxxxxx>; Stanislaw Gruszka <sgruszka@xxxxxxxxxx>;
> Benson Leung <bleung@xxxxxxxxxxxx>; Enric Balletbo i Serra
> <enric.balletbo@xxxxxxxxxxxxx>; James E.J. Bottomley
> <jejb@xxxxxxxxxxxxx>; Martin K. Petersen <martin.petersen@xxxxxxxxxx>;
> Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; Alexander Viro
> <viro@xxxxxxxxxxxxxxxxxx>; Petr Mladek <pmladek@xxxxxxxx>; Sergey
> Senozhatsky <sergey.senozhatsky@xxxxxxxxx>; Steven Rostedt
> <rostedt@xxxxxxxxxxx>; David Laight <David.Laight@xxxxxxxxxx>; Andrew
> Morton <akpm@xxxxxxxxxxxxxxxxxxxx>; Intel Graphics Development <intel-
> gfx@xxxxxxxxxxxxxxxxxxxxx>; DRI Development <dri-
> devel@xxxxxxxxxxxxxxxxxxxxx>; Linux Kernel Mailing List <linux-
> kernel@xxxxxxxxxxxxxxx>; netdev <netdev@xxxxxxxxxxxxxxx>;
> ath10k@xxxxxxxxxxxxxxxxxxx; linux-wireless <linux-wireless@xxxxxxxxxxxxxxx>;
> scsi <linux-scsi@xxxxxxxxxxxxxxx>; Linux Fbdev development list <linux-
> fbdev@xxxxxxxxxxxxxxx>; driverdevel <devel@xxxxxxxxxxxxxxxxxxxx>; Linux
> FS Devel <linux-fsdevel@xxxxxxxxxxxxxxx>
> Subject: Re: [PATCH v2 3/7] lib/hexdump.c: Optionally suppress lines of
> repeated bytes
>
> Hi Alastair,
>
> Thanks for your patch!

And thanks for your politeness :)

>
> On Wed, May 8, 2019 at 9:04 AM Alastair D'Silva <alastair@xxxxxxxxxxx>
> wrote:
> > From: Alastair D'Silva <alastair@xxxxxxxxxxx>
> >
> > Some buffers may only be partially filled with useful data, while the
> > rest is padded (typically with 0x00 or 0xff).
> >
> > This patch introduces a flag to allow the supression of lines of
> > repeated bytes,
>
> Given print_hex_dump() operates on entities of groupsize (1, 2, 4, or 8)
> bytes, wouldn't it make more sense to consider repeated groups instead of
> repeated bytes?

Maybe, it would mean that subsequent addresses may not be a multiple of rowsize though, which is useful.

> > which are replaced with '** Skipped %u bytes of value 0x%x **'
>
> Using a custom message instead of just "*", like "hexdump" uses, will require
> preprocessing the output when recovering the original binary data by
> feeding it to e.g. "xxd".
> This may sound worse than it is, though, as I never got "xxd" to work without
> preprocessing anyway ;-)

I think showing the details of the skipped values is useful when reading the output directly. In situations where binary extracts are desired, the feature can always be disabled.

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