[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0905262244580.27902@gandalf.stny.rr.com>
Date: Tue, 26 May 2009 22:47:09 -0400 (EDT)
From: Steven Rostedt <rostedt@...dmis.org>
To: Li Zefan <lizf@...fujitsu.com>
cc: Ingo Molnar <mingo@...e.hu>, Jens Axboe <jens.axboe@...cle.com>,
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>,
Christoph Hellwig <hch@...radead.org>,
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, 27 May 2009, Li Zefan wrote:
> Yeah, it does look somewhat ugly..
>
> > Could we instead perhaps add a __dynamic_array? That would take a length,
> > and append itself to after the strings?
> >
>
> I thought about this actually. ;)
>
> What troubled me is to give this new macro a better name.
>
> We have __array() which is fixed-size, but __dynamic_array() is not
> a dynamic-size version of __array(). How about __dyn_string() or
> __dynamic_string()?
String in many languages are non fixed size. But why not call it a dynamic
array. We can make it into a varible length array. But the assignment may
need to be careful.
>
> > stage 1:
> >
> > #define __dynamic_array(item, len) int __dyn_loc_##item;
> >
> > stage 2:
> >
> > #define __dynamic_array(item, len) int item;
> >
> > stage 3:
> >
> > #define __get_dynamic_array(item) \
> > ((void *)__entry + __entry->__str_loc_##field
> >
> > stage 4:
> >
> > #define __dynamic_array(item, len) \
> > __str_offsets.item = __str_size + \
> > offsetof(typeof(*entry), __str_data); \
> > __str_size += len;
> >
>
> Then we can make __string() reuse __dynamic_array().
Yeah, the __string() can end up being a wrapper around a __dynamic_array
macro that just adds the strlen().
-- Steve
--
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