Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756668Ab0DAN54 (ORCPT ); Thu, 1 Apr 2010 09:57:56 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.124]:34826 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756602Ab0DAN5r (ORCPT ); Thu, 1 Apr 2010 09:57:47 -0400 X-Authority-Analysis: v=1.1 cv=pKw63bS+wPQ6BxbjPFuXko/1Hb8f7lpGL8zfzHecwYY= c=1 sm=0 a=j_jVqYyEI08A:10 a=7U3hwN5JcxgA:10 a=Q9fys5e9bTEA:10 a=gMqfjgEr1zLu/65IO0LwxA==:17 a=omOdbC7AAAAA:8 a=xhv7BQFhl0MnHogk4fQA:9 a=mFbYfFqLqGjkeTEi4wzIsqQ0BVYA:4 a=PUjeQqilurYA:10 a=gMqfjgEr1zLu/65IO0LwxA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 74.67.89.75 Subject: Re: [PATCH 1/2 v4] scsi: add __print_hex() to ftrace From: Steven Rostedt Reply-To: rostedt@goodmis.org To: Kei Tokunaga Cc: "linux-scsi@vger.kernel.org" , James Bottomley , Ingo Molnar , Frederic Weisbecker , "Martin K. Petersen" , Tomohiro Kusumi , lkml , Li Zefan , Xiao Guangrong In-Reply-To: <4BB4864A.3060406@jp.fujitsu.com> References: <4BB4855E.7030509@jp.fujitsu.com> <4BB4864A.3060406@jp.fujitsu.com> Content-Type: text/plain; charset="ISO-8859-15" Organization: Kihon Technologies Inc. Date: Thu, 01 Apr 2010 09:57:45 -0400 Message-ID: <1270130265.19685.8933.camel@gandalf.stny.rr.com> Mime-Version: 1.0 X-Mailer: Evolution 2.28.2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3646 Lines: 98 On Thu, 2010-04-01 at 20:40 +0900, Kei Tokunaga wrote: > This is the same patch from v1. > > __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 > Signed-off-by: Tomohiro Kusumi > Signed-off-by: Kei Tokunaga > > --- > > linux-2.6.34-rc3-trace-kei/include/linux/ftrace_event.h | 3 +++ > linux-2.6.34-rc3-trace-kei/include/trace/ftrace.h | 3 +++ > linux-2.6.34-rc3-trace-kei/kernel/trace/trace_output.c | 15 +++++++++++++++ > 3 files changed, 21 insertions(+) > > diff -puN include/linux/ftrace_event.h~add__print_hex_to_ftrace include/linux/ftrace_event.h > --- linux-2.6.34-rc3-trace/include/linux/ftrace_event.h~add__print_hex_to_ftrace 2010-03-31 10:03:14.000000000 +0900 > +++ linux-2.6.34-rc3-trace-kei/include/linux/ftrace_event.h 2010-03-31 10:03:14.000000000 +0900 > @@ -25,6 +25,9 @@ const char *ftrace_print_flags_seq(struc > 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: > diff -puN include/trace/ftrace.h~add__print_hex_to_ftrace include/trace/ftrace.h > --- linux-2.6.34-rc3-trace/include/trace/ftrace.h~add__print_hex_to_ftrace 2010-03-31 10:03:14.000000000 +0900 > +++ linux-2.6.34-rc3-trace-kei/include/trace/ftrace.h 2010-03-31 10:03:14.000000000 +0900 > @@ -198,6 +198,9 @@ > 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 \ > diff -puN kernel/trace/trace_output.c~add__print_hex_to_ftrace kernel/trace/trace_output.c > --- linux-2.6.34-rc3-trace/kernel/trace/trace_output.c~add__print_hex_to_ftrace 2010-03-31 10:03:14.000000000 +0900 > +++ linux-2.6.34-rc3-trace-kei/kernel/trace/trace_output.c 2010-04-01 20:38:30.000000000 +0900 > @@ -355,6 +355,21 @@ ftrace_print_symbols_seq(struct trace_se > } > 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); I would not put the putc(p, 0) into a helper function. This terminates the buffer, and strings added to the trace_seq will go after the '\0'. What we need is this in trace_seq.h: static inline trace_seq_terminate(struct trace_seq *s) { if (!s->full) s->buffer[s->len] = 0; } This will add a '0' to the buffer after the last string, but will not increment length while doing it. Thus, new data added to the buffer would still be appended correctly. -- Steve > + > + return ret; > +} > +EXPORT_SYMBOL(ftrace_print_hex_seq); > + > #ifdef CONFIG_KRETPROBES > static inline const char *kretprobed(const char *name) > { > > _ > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/