[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090527095532.GA17236@infradead.org>
Date: Wed, 27 May 2009 05:55:33 -0400
From: Christoph Hellwig <hch@...radead.org>
To: Li Zefan <lizf@...fujitsu.com>
Cc: Christoph Hellwig <hch@...radead.org>, Ingo Molnar <mingo@...e.hu>,
Jens Axboe <jens.axboe@...cle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Tom Zanussi <tzanussi@...il.com>,
Theodore Ts'o <tytso@....edu>,
Steven Whitehouse <swhiteho@...hat.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Jeff Moyer <jmoyer@...hat.com>,
FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] tracing/events: make __string() more general
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists