[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0bde410-a688-fac0-f3d5-2d4261bcd5b5@infradead.org>
Date: Mon, 7 Aug 2023 15:37:13 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: thunder.leizhen@...weicloud.com, Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
linux-kernel@...r.kernel.org
Cc: Zhen Lei <thunder.leizhen@...wei.com>
Subject: Re: [PATCH 2/2] hexdump: add a new dump prefix
DUMP_PREFIX_ADDRESS_LOW16
On 8/5/23 00:21, thunder.leizhen@...weicloud.com wrote:
> From: Zhen Lei <thunder.leizhen@...wei.com>
>
>
> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
Reviewed-by: Randy Dunlap <rdunlap@...radead.org>
Thanks.
> ---
> include/linux/printk.h | 1 +
> lib/hexdump.c | 4 ++++
> 2 files changed, 5 insertions(+)
>
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index 8ef499ab3c1ed2e..ccad9e8eaaf0c31 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -704,6 +704,7 @@ extern const struct file_operations kmsg_fops;
> enum {
> DUMP_PREFIX_NONE,
> DUMP_PREFIX_ADDRESS,
> + DUMP_PREFIX_ADDRESS_LOW16,
> DUMP_PREFIX_OFFSET
> };
> extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
> diff --git a/lib/hexdump.c b/lib/hexdump.c
> index 86cb4cc3eec485a..eb33e477bc96df1 100644
> --- a/lib/hexdump.c
> +++ b/lib/hexdump.c
> @@ -290,6 +290,10 @@ void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
> printk("%s%s%p: %s\n",
> level, prefix_str, ptr + i, linebuf);
> break;
> + case DUMP_PREFIX_ADDRESS_LOW16:
> + printk("%s%s%04lx: %s\n", level,
> + prefix_str, 0xffff & (unsigned long)(ptr + i), linebuf);
> + break;
> case DUMP_PREFIX_OFFSET:
> printk("%s%s%0*x: %s\n", level, prefix_str, width, i, linebuf);
> break;
--
~Randy
Powered by blists - more mailing lists