public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, Jens Axboe <jens.axboe@oracle.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Tom Zanussi <tzanussi@gmail.com>, "Theodore Ts'o" <tytso@mit.edu>,
	Steven Whitehouse <swhiteho@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Jeff Moyer <jmoyer@redhat.com>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] tracing/events: make __string() more general
Date: Wed, 27 May 2009 05:55:33 -0400	[thread overview]
Message-ID: <20090527095532.GA17236@infradead.org> (raw)
In-Reply-To: <4A1CF5F2.6050209@cn.fujitsu.com>

On Wed, May 27, 2009 at 04:12:34PM +0800, Li Zefan wrote:
> >         TP_fast_assign(
> > 		__entry->ino = args->dp->i_ino;
> > 		if (args->namelen)
> > 			memcpy(__entry->name, args->name,
> > 			       min(args->namelen, TRACE_MAXNAMELEN));
> 
> This string is not NULL-terminated?

As written a little above it's indeed not NULL-terminated.

> Then the above code can be rewrote:
> 
> TRACE_EVENT(xfs_dir2,
> 	TP_PROTO(struct xfs_da_args *args, int i, int j, int count),
> 	TP_ARGS(args, i, j, count),
> 
> 	TP_STRUCT__entry(
> 		__field(xfs_ino_t, ino)
> 		__string(name, args->namelen)
> 		__field(int, namelen)
> 		...
> 	),
> 
>         TP_fast_assign(
> 		__entry->ino = args->dp->i_ino;
> 		memcpy(__fetch_str(name), args->name, args->namelen);
> 		__entry->namelen = args->namelen;
> 		...
> 	),
> 
> 	TP_printk("ino 0x%lld %pF name %.*s namelen %d hashval 0x%x "
> 		  "inumber 0x%llx op_flags %s i %d j %d count %d",
> 		  __entry->ino,
> 		  (void *)__entry->caller_ip,
> 		  __entry->namelen,
> 		  __get_str(name),
> 		  __entry->namelen,

That's indeed wht I would love to see.

  reply	other threads:[~2009-05-27  9:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26  4:03 [PATCH v2 0/2] tracing/events: convert block trace points to TRACE_EVENT() Li Zefan
2009-05-26  4:04 ` [PATCH v2 1/2] tracing/events: make __string() more general Li Zefan
2009-05-26  6:02   ` Christoph Hellwig
2009-05-27  1:43     ` Li Zefan
2009-05-27  7:30       ` Christoph Hellwig
2009-05-27  8:12         ` Li Zefan
2009-05-27  9:55           ` Christoph Hellwig [this message]
2009-05-26 20:56   ` Steven Rostedt
2009-05-27  1:24     ` Li Zefan
2009-05-27  1:49       ` Steven Rostedt
2009-05-27  1:59         ` Li Zefan
2009-05-27  2:15           ` Steven Rostedt
2009-05-27  2:33             ` Li Zefan
2009-05-27  2:47               ` Steven Rostedt
2009-05-27  7:22       ` Christoph Hellwig
2009-05-26  4:05 ` [PATCH v2 2/2] tracing/events: convert block trace points to TRACE_EVENT() Li Zefan
2009-06-09  5:43 ` [PATCH v3] " Li Zefan
2009-06-10  9:22   ` [tip:tracing/core] " tip-bot for Li Zefan

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=20090527095532.GA17236@infradead.org \
    --to=hch@infradead.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=fweisbec@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=swhiteho@redhat.com \
    --cc=tytso@mit.edu \
    --cc=tzanussi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox