lkml.org 
[lkml]   [2010]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2 v4] scsi: add __print_hex() to ftrace
From
Date
On Fri, 2010-04-02 at 10:40 +0800, Li Zefan wrote:
> >> +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'.
> >
>
> This is exactly what ftrace_print_flags_seq() and ftrace_print_symbols_seq()
> do, and exactly what we want.
>
> An example:
>
> TP_printk("%s,%s", __print_flags(...), __print_flags(...));
>
> We need 2 seperated strings, while trace_seq_terminate() will make it
> a single string.

You're right! But I still don't like it ;-)

I probably should have had that in the __print_flags() macro instead of
the function. Oh well. These are only helper functions for the
__print*() variants anyway.

OK, you can have my Acked-by: Steven Rostedt <rostedt@goodmis.org> for
this.

-- Steve




\
 
 \ /
  Last update: 2010-04-02 04:53    [W:0.397 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site