Re: [PATCH] export softirq_to_name symbol

From: Josh Stone
Date: Fri May 01 2009 - 17:26:02 EST


On 05/01/2009 01:22 PM, Christoph Hellwig wrote:
> On Fri, May 01, 2009 at 01:17:59PM -0700, Josh Stone wrote:
>> More precisely, it's the piece of code that copies the trace into an
>> __entry pointer. In my case, __entry has nothing to do with the ring
>> buffer.
>
> Well, it should be the ring buffer. If you want to do something more
> fancy rewrite it in proper C code and submit a patch for discussion to
> lkml.

It's not that fancy -- this is basically it:

#define __field(type, item) type item;
#define __array(type, item, len) type item[len];
#define __string(item, src) const char * __str_##item;
#define __assign_str(item, src) __entry->__str_##item = src
#define __get_str(item) __entry->__str_##item
#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
static inline int \
trace_snprintf_##name(char * __buf, size_t __size, proto) { \
struct { tstruct } __value, *__entry = &__value; \
assign; \
return snprintf(__buf, __size, print); \
}

I don't know if anyone would need this besides stap, but I can post it
as a patch if there's interest.

Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/