From 7a555613eb77c69eb6e48b61bc5f72dd42fa1780 Mon Sep 17 00:00:00 2001 From: Vladimir Kondratiev Date: Wed, 5 Dec 2012 16:48:27 -0500 Subject: dynamic_debug: dynamic hex dump Introduce print_hex_dump_debug() that can be dynamically controlled, similar to pr_debug. Also, make print_hex_dump_bytes() dynamically controlled Implement only 'p' flag (_DPRINTK_FLAGS_PRINT) to keep it simple since hex dump prints multiple lines and long prefix would impact readability. To provide line/file etc. information, use pr_debug or similar before/after print_hex_dump_debug() Signed-off-by: Vladimir Kondratiev Signed-off-by: Jason Baron Signed-off-by: Greg Kroah-Hartman --- include/linux/dynamic_debug.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/linux/dynamic_debug.h') diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 6dd4787a798a..2fe93b26b42f 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -95,6 +95,17 @@ do { \ ##__VA_ARGS__); \ } while (0) +#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ + groupsize, buf, len, ascii) \ +do { \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \ + __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ + print_hex_dump(KERN_DEBUG, prefix_str, \ + prefix_type, rowsize, groupsize, \ + buf, len, ascii); \ +} while (0) + #else #include -- cgit v1.2.3-59-g8ed1b