[SCSI] ftrace: add __print_hex()
authorKei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Thu, 1 Apr 2010 11:40:58 +0000 (20:40 +0900)
committerJames Bottomley <James.Bottomley@suse.de>
Fri, 30 Apr 2010 17:50:22 +0000 (12:50 -0500)
__print_hex() prints values in an array in hex (w/o '0x') (space separated)
EX) 92 33 32 f3 ee 4d

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com>
Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
include/linux/ftrace_event.h
include/trace/ftrace.h
kernel/trace/trace_output.c

index c0f4b364c711d172c23919b010963620222a2344..c3c5aaaae53affdd98483def3fbabee5672b5814 100644 (file)
@@ -25,6 +25,9 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
 const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
                                     const struct trace_print_flags *symbol_array);
 
+const char *ftrace_print_hex_seq(struct trace_seq *p,
+                                const unsigned char *buf, int len);
+
 /*
  * The trace entry - the most basic unit of tracing. This is what
  * is printed in the end as a single line in the trace output, such as:
index ea6f9d4a20e9c849cbfdf99c4bf9e532a0058b70..c48320b3dabd4d265a07a733e9fbe898c3673840 100644 (file)
                ftrace_print_symbols_seq(p, value, symbols);            \
        })
 
+#undef __print_hex
+#define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len)
+
 #undef DECLARE_EVENT_CLASS
 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
 static notrace enum print_line_t                                       \
index 8e46b3323cdcdd91ad9833aa1eb8d0f1bf82f3af..7c4a0ca650b565004818d5ad08fc969711725eee 100644 (file)
@@ -355,6 +355,21 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
 }
 EXPORT_SYMBOL(ftrace_print_symbols_seq);
 
+const char *
+ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len)
+{
+       int i;
+       const char *ret = p->buffer + p->len;
+
+       for (i = 0; i < buf_len; i++)
+               trace_seq_printf(p, "%s%2.2x", i == 0 ? "" : " ", buf[i]);
+
+       trace_seq_putc(p, 0);
+
+       return ret;
+}
+EXPORT_SYMBOL(ftrace_print_hex_seq);
+
 #ifdef CONFIG_KRETPROBES
 static inline const char *kretprobed(const char *name)
 {