[0/2] hexdump: minimize the output width of address and offset

Message ID 20230805072116.1260-1-thunder.leizhen@huaweicloud.com
Headers
Series hexdump: minimize the output width of address and offset |

Message

Leizhen (ThunderTown) Aug. 5, 2023, 7:21 a.m. UTC
  From: Zhen Lei <thunder.leizhen@huawei.com>

The dump prefix is added to facilitate the reading of the dumped memory.
However, if the prefix content is too repeated or redundant, the readability
is reduced, and the ring buffer becomes full quickly and other prints are
overwritten.

For example: (DUMP_PREFIX_OFFSET)
Before:
dump_size=36:
00000000: c0 ba 8c 80 00 80 ff ff 6c 93 ee 2f ee bf ff ff
00000010: 00 50 1e 98 ff 27 ff ff 01 00 00 00 00 00 00 00
00000020: 80 ca 2f 98

After:
dump_size=36:
00: c0 3a 91 80 00 80 ff ff 6c 93 ae 76 30 ce ff ff
10: 00 60 cd 60 7d 4e ff ff 01 00 00 00 00 00 00 00
20: 40 9e 29 40


Zhen Lei (2):
  hexdump: minimize the output width of the offset
  hexdump: add a new dump prefix DUMP_PREFIX_ADDRESS_LOW16

 include/linux/printk.h |  1 +
 lib/hexdump.c          | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)