Thread (21 messages) 21 messages, 4 authors, 2019-06-26

Re: [PATCH v4 5/7] lib/hexdump.c: Allow multiple groups to be separated by lines '|'

From: Joe Perches <joe@perches.com>
Date: 2019-06-25 05:37:21
Also in: dri-devel, intel-gfx, linux-fbdev, linux-fsdevel, linux-scsi, linux-wireless, lkml

On Tue, 2019-06-25 at 13:17 +1000, Alastair D'Silva wrote:
quoted hunk ↗ jump to hunk
From: Alastair D'Silva <redacted>

With the wider display format, it can become hard to identify how many
bytes into the line you are looking at.

The patch adds new flags to hex_dump_to_buffer() and print_hex_dump() to
print vertical lines to separate every N groups of bytes.

eg.
buf:00000000: 454d414e 43415053|4e495f45 00584544  NAMESPAC|E_INDEX.
buf:00000010: 00000000 00000002|00000000 00000000  ........|........

Signed-off-by: Alastair D'Silva <redacted>
---
 include/linux/printk.h |  3 +++
 lib/hexdump.c          | 59 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 54 insertions(+), 8 deletions(-)
diff --git a/include/linux/printk.h b/include/linux/printk.h
[]
quoted hunk ↗ jump to hunk
@@ -485,6 +485,9 @@ enum {
 
 #define HEXDUMP_ASCII			BIT(0)
 #define HEXDUMP_SUPPRESS_REPEATED	BIT(1)
+#define HEXDUMP_2_GRP_LINES		BIT(2)
+#define HEXDUMP_4_GRP_LINES		BIT(3)
+#define HEXDUMP_8_GRP_LINES		BIT(4)
These aren't really bits as only one value should be set
as 8 overrides 4 and 4 overrides 2.

I would also expect this to be a value of 2 in your above
example, rather than 8.  It's described as groups not bytes.

The example is showing a what would normally be a space ' '
separator as a vertical bar '|' every 2nd grouping.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help