[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1239776051.32241.17.camel@localhost>
Date: Tue, 14 Apr 2009 23:14:11 -0700
From: Joe Perches <joe@...ches.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: Sam Ravnborg <sam@...nborg.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Frederic Weisbecker <fweisbec@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Zhaolei <zhaolei@...fujitsu.com>,
Tom Zanussi <tzanussi@...il.com>,
Li Zefan <lizf@...fujitsu.com>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: RFC: introduce struct ksymbol
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
--
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