diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-06-01 14:43:05 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-06-09 14:26:22 -0400 |
commit | 9792ec88cf67462c1a3ddcbb31dee6392f9f02fc (patch) | |
tree | 078303dc7d7d26baab10814763604df7cd179c44 /include/linux/kernel.h | |
parent | 02c1aead2a7d47c9cba28bfcaf9b09f64a8fa667 (diff) |
lib/hexdump: Convert to printbuf
This converts most of the hexdump code to printbufs, along with some
significant cleanups and a bit of reorganization. The old non-printbuf
functions are mostly left as wrappers around the new printbuf versions.
Big note: byte swabbing behaviour
Previously, hex_dump_to_buffer() would byteswab the groups of bytes
being printed on little endian machines. This behaviour is... not
standard or typical for a hex dumper, and this behaviour was silently
added/changed without documentation (in 2007).
Given that the hex dumpers are just used for debugging output, nothing
is likely to break, and hopefully by reverting to more standard
behaviour the end result will be _less_ confusion, modulo a few kernel
developers who will certainly be annoyed by their tools changing.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 5c4f4b6d36ab..1906861ece7a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -293,6 +293,12 @@ extern int hex_to_bin(unsigned char ch); extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); extern char *bin2hex(char *dst, const void *src, size_t count); +struct printbuf; +void prt_hex_bytes(struct printbuf *, const void *, unsigned, unsigned, unsigned); +void prt_hex_line(struct printbuf *, const void *, size_t, int, int, bool); +void prt_hex_dump(struct printbuf *, const void *, size_t, + const char *, int, unsigned, unsigned, bool); + bool mac_pton(const char *s, u8 *mac); /* |