From: Li Zefan <lizf@cn.fujitsu.com>
To: rostedt@goodmis.org
Cc: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
James Bottomley <James.Bottomley@suse.de>,
Ingo Molnar <mingo@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com>,
lkml <linux-kernel@vger.kernel.org>,
Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Subject: Re: [PATCH 1/2 v4] scsi: add __print_hex() to ftrace
Date: Fri, 02 Apr 2010 10:40:53 +0800 [thread overview]
Message-ID: <4BB55935.9040100@cn.fujitsu.com> (raw)
In-Reply-To: <1270130265.19685.8933.camel@gandalf.stny.rr.com>
>> +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.
> 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);
next prev parent reply other threads:[~2010-04-02 2:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 11:37 [PATCH 0/2 v4] scsi: ftrace based scsi tracer Kei Tokunaga
2010-04-01 11:37 ` Kei Tokunaga
2010-04-01 11:40 ` [PATCH 1/2 v4] scsi: add __print_hex() to ftrace Kei Tokunaga
2010-04-01 11:40 ` Kei Tokunaga
2010-04-01 13:57 ` Steven Rostedt
2010-04-01 17:03 ` Joe Perches
2010-04-02 2:41 ` Li Zefan
2010-04-02 2:40 ` Li Zefan [this message]
2010-04-02 2:50 ` Steven Rostedt
2010-04-01 11:41 ` [PATCH 2/2 v4] scsi: add scsi trace core functions and put trace points Kei Tokunaga
2010-04-01 11:41 ` Kei Tokunaga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BB55935.9040100@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=James.Bottomley@suse.de \
--cc=fweisbec@gmail.com \
--cc=kusumi.tomohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tokunaga.keiich@jp.fujitsu.com \
--cc=xiaoguangrong@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.