[lkml]   [2009]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH v2 1/2] tracing/events: make __string() more general
    On Wed, May 27, 2009 at 09:43:32AM +0800, Li Zefan wrote:
    > I'm not suffering from NULL str, so I'm not quite sure how you want __string()
    > deal with it.

    The internals of __string is still magic to me, need to finish my
    advance cpp abuse degree first ;-)

    But the expected outcome would be that when we get a NULL pointer as
    input we get a NULL pointer as output again.

    What I currently do is:

    TP_PROTO(struct xfs_da_args *args, int i, int j, int count),
    TP_ARGS(args, i, j, count),

    __field(xfs_ino_t, ino)
    __array(char, name, TRACE_MAXNAMELEN)
    __field(int, namelen)

    __entry->ino = args->dp->i_ino;
    if (args->namelen)
    memcpy(__entry->name, args->name,
    min(args->namelen, TRACE_MAXNAMELEN));
    __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",
    (void *)__entry->caller_ip,
    min(__entry->namelen, TRACE_MAXNAMELEN),
    __entry->namelen ? __entry->name : NULL,

    ---end quoted text---

     \ /
      Last update: 2009-05-27 09:53    [W:0.020 / U:68.184 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site