Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] ftrace: add __print_hex()

__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>

authored by

Kei Tokunaga and committed by
James Bottomley
5a2e3995 59c31b69

+21
+3
include/linux/ftrace_event.h
··· 25 25 const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, 26 26 const struct trace_print_flags *symbol_array); 27 27 28 + const char *ftrace_print_hex_seq(struct trace_seq *p, 29 + const unsigned char *buf, int len); 30 + 28 31 /* 29 32 * The trace entry - the most basic unit of tracing. This is what 30 33 * is printed in the end as a single line in the trace output, such as:
+3
include/trace/ftrace.h
··· 198 198 ftrace_print_symbols_seq(p, value, symbols); \ 199 199 }) 200 200 201 + #undef __print_hex 202 + #define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len) 203 + 201 204 #undef DECLARE_EVENT_CLASS 202 205 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 203 206 static notrace enum print_line_t \
+15
kernel/trace/trace_output.c
··· 355 355 } 356 356 EXPORT_SYMBOL(ftrace_print_symbols_seq); 357 357 358 + const char * 359 + ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len) 360 + { 361 + int i; 362 + const char *ret = p->buffer + p->len; 363 + 364 + for (i = 0; i < buf_len; i++) 365 + trace_seq_printf(p, "%s%2.2x", i == 0 ? "" : " ", buf[i]); 366 + 367 + trace_seq_putc(p, 0); 368 + 369 + return ret; 370 + } 371 + EXPORT_SYMBOL(ftrace_print_hex_seq); 372 + 358 373 #ifdef CONFIG_KRETPROBES 359 374 static inline const char *kretprobed(const char *name) 360 375 {