lkml.org 
[lkml]   [2009]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: RFC: introduce struct ksymbol
    From
    Date
    On Wed, 2009-04-15 at 07:58 +0200, Ingo Molnar wrote:
    > (Sam and Rusty Cc:-ed)
    > > Perhaps a conversion from
    > >
    > > "char str[KSYM_SYMBOL_LEN]"
    > > to
    > > "struct ksymbol sym"?
    > >
    > > could be useful.
    > >
    > > There are a few places that use a hard coded length of 128
    > > instead of KSYM_SYMBOL_LENGTH that are also converted.
    > >
    > > Compile tested only
    >
    > Why not 'struct ksym'? That name is unused right now, it is shorter
    > and just as descriptive.

    Either's ok with me.

    > Downsides would be loss of awareness of stack footprint impact. A
    > plain struct is easy to slap on, and it's not immediately visible
    > that it carries 128 bytes of weight.

    Stack footprint with KSYM_SYMBOL_LEN isn't very apparent.
    KSYM_SYMBOL_LEN is more than 200.

    #define KSYM_NAME_LEN 128
    #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
    2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)

    > It might also be confusing in
    > terms of the nature of the interface - whether it's a pointery
    > object or not.

    Specified type makes it hard to pass the wrong
    sized buffer.

    > Prior use:
    > char str[KSYM_SYMBOL_LEN];
    > kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
    > New use:
    > struct ksym sym;
    > kallsyms_lookup(rec->ip, NULL, NULL, NULL, &sym);

    cheers, Joe



    \
     
     \ /
      Last update: 2009-04-15 08:17    [W:3.930 / U:0.252 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site