Re: [PATCH v2 1/2] seq_buf: Add printing formatted hex dumps

From: Steven Rostedt
Date: Wed Nov 13 2019 - 16:02:49 EST


On Thu, 7 Nov 2019 13:45:37 +0100
Piotr Maziarz <piotrx.maziarz@xxxxxxxxxxxxxxx> wrote:

> Provided function is an analogue of print_hex_dump().
>
> Implementing this function in seq_buf allows using for multiple
> purposes (e.g. for tracing) and therefore prevents from code duplication
> in every layer that uses seq_buf.
>
> print_hex_dump() is an essential part of logging data to dmesg. Adding
> similar capability for other purposes is beneficial to all users.
>
> Example usage:
> seq_buf_hex_dump(seq, "", DUMP_PREFIX_OFFSET, 16, 4, buf,
> ARRAY_SIZE(buf), true);
> Example output:
> 00000000: 00000000 ffffff10 ffffff32 ffff3210 ........2....2..
> 00000010: ffff3210 83d00437 c0700000 00000000 .2..7.....p.....
> 00000020: 02010004 0000000f 0000000f 00004002 .............@..
> 00000030: 00000fff 00000000 ........
>
> Signed-off-by: Piotr Maziarz <piotrx.maziarz@xxxxxxxxxxxxxxx>
> Signed-off-by: Cezary Rojewski <cezary.rojewski@xxxxxxxxx>

I'm curious about the two signed off bys? Was Cezary a co-author?


> ---
> v2
> Add kernel doc header
> Explain linebuf magic number size
>
> Decided not to change declaration order or remaining -= rowsize to
> remaining -= linelen in order to stay aligned with base print_hex_dump
> function. However I can change it if requested.

I don't care as much to make the change. Perhaps we can clean that up
in the future.

-- Steve

>
> include/linux/seq_buf.h | 3 +++
> lib/seq_buf.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 65 insertions(+)
>
>