lkml.org 
[lkml]   [2023]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] hexdump: add a new dump prefix DUMP_PREFIX_ADDRESS_LOW16
From


On 8/5/23 00:21, thunder.leizhen@huaweicloud.com wrote:
> From: Zhen Lei <thunder.leizhen@huawei.com>
>
>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>


Reviewed-by: Randy Dunlap <rdunlap@infradead.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

\
 
 \ /
  Last update: 2023-08-08 00:37    [W:0.042 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site