Messages in this thread | | | Date | Mon, 7 Aug 2023 15:37:13 -0700 | Subject | Re: [PATCH 2/2] hexdump: add a new dump prefix DUMP_PREFIX_ADDRESS_LOW16 | From | Randy Dunlap <> |
| |
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
| |