Re: [PATCH v3 2/4] lib/hexdump.c: factor out generic hexdump formatting for reuse.

From: Andy Shevchenko
Date: Wed Mar 27 2019 - 03:47:02 EST


On Wed, Mar 27, 2019 at 3:49 AM Ronald TschalÃr <ronald@xxxxxxxxxxxxx> wrote:
>
> This introduces print_hex_dump_to_cb() which contains all the hexdump
> formatting minus the actual printk() call, allowing an arbitrary print
> function to be supplied instead. And print_hex_dump() is re-implemented
> using print_hex_dump_to_cb().
>
> This allows other hex-dump logging functions to be provided which call
> printk() differently or even log the hexdump somewhere entirely
> different.

No Sign-off?

In any case, don't do it like this. smaller non-recursive printf() is
better than one big receursive call.
When it looks like an optimization, it's actually a regression.

And yes, debugfs idea is not bad.

P.S. Also check %*ph specifier.

--
With Best Regards,
Andy Shevchenko