aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorRandy Dunlap <randy.dunlap@oracle.com>2007-06-08 16:47:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-08 20:23:34 -0400
commitc7909234993973692414901055dfbebbca21e73f (patch)
treeb3c97eafa742f3170c01aadbf3295a2876b3bd6b /include/linux/kernel.h
parentabb49202ff37bf2eca7296c62ad18c77f636ec8e (diff)
hexdump: more output formatting
Add a prefix string parameter. Callers are responsible for any string length/alignment that they want to see in the output. I.e., callers should pad strings to achieve alignment if they want that. Add rowsize parameter. This is the number of raw data bytes to be printed per line. Must be 16 or 32. Add a groupsize parameter. This allows callers to dump values as 1-byte, 2-byte, 4-byte, or 8-byte numbers. Default is 1-byte numbers. If the total length is not an even multiple of groupsize, 1-byte numbers are printed. Add an "ascii" output parameter. This causes ASCII data output following the hex data output. Clean up some doc examples. Align the ASCII output on all lines that are produced by one call. Add a new interface, print_hex_dump_bytes(), that is a shortcut to print_hex_dump(), using default parameter values to print 16 bytes in byte-size chunks of hex + ASCII output, using printk level KERN_DEBUG. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 45353d757cd0..7a4852505914 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -218,10 +218,14 @@ enum {
218 DUMP_PREFIX_ADDRESS, 218 DUMP_PREFIX_ADDRESS,
219 DUMP_PREFIX_OFFSET 219 DUMP_PREFIX_OFFSET
220}; 220};
221extern void hex_dump_to_buffer(const void *buf, size_t len, char *linebuf, 221extern void hex_dump_to_buffer(const void *buf, size_t len,
222 size_t linebuflen); 222 int rowsize, int groupsize,
223extern void print_hex_dump(const char *level, int prefix_type, 223 char *linebuf, size_t linebuflen, bool ascii);
224 void *buf, size_t len); 224extern void print_hex_dump(const char *level, const char *prefix_str,
225 int prefix_type, int rowsize, int groupsize,
226 void *buf, size_t len, bool ascii);
227extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
228 void *buf, size_t len);
225#define hex_asc(x) "0123456789abcdef"[x] 229#define hex_asc(x) "0123456789abcdef"[x]
226 230
227#ifdef DEBUG 231#ifdef DEBUG