lkml.org 
[lkml]   [2009]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/2] tracing/events: make __string() more general
Steven Rostedt wrote:
>
> On Tue, 26 May 2009, Li Zefan wrote:
>
>> This changes __string(..., src) to __string(..., len), thus makes it more
>> general, and then block TRACE_EVENT() can use it.
>>
>> Also introduce __fetch_str(), which is used in TP_assign() and returns
>> the address of the string, while __get_str() is used in TP_print().
>>
>> [ Impact: TRACE_EVENT api change ]
>
> What's the reason for the change?
>
> Is it to handle NULL pointers? If so, lets change the ftrace.h to handle
> it instead.
>

No, not for this purpose.

With __string(..., src), we need to have a source string, but sometimes no
source string is available, and what we know is how big the string will be.

Take block trace events for example, I want to convert an unsigned char array
into a string, after this patch, this can be done this way:

TP_STRUCT_entry(
__string( cmd, rq->cmd_len * 3 )
)

TP_fast_assign(
construct_str( cmd )
)

TP_prink("%s\n", get_str(cmd))

Seems Christoph also runs into this problem while doing his XFS tracing.
(and NULL str ptr that I'm not suffering)

> This is why I like the Impact line really be a "rational" line.
> "TRACE_EVENT api change" is meaningless to me.
>

So what should this impact be. :(


\
 
 \ /
  Last update: 2009-05-27 03:25    [from the cache]
©2003-2011 Jasper Spaans