Re: [PATCH 2/7] Initial implementation of the trec driver and include files

From: Johannes Weiner
Date: Wed Mar 21 2007 - 04:38:08 EST


Hi,

On Wed, Mar 21, 2007 at 09:22:39AM +0100, Johannes Weiner wrote:
> Your patch has broken lines where there shouldn't be any.

I mean, the attached patch. This is probably not an error in the patch
but in the way of posting it.

> > +static int snprint_address(char *b, int bsize, unsigned long address)
> > +{
> > +#ifdef CONFIG_KALLSYMS
> > + unsigned long offset = 0, symsize;
> > + const char *symname;
> > + char *modname;
> > + char *delim = ":";
> > + int n;
> > + char namebuf[128];
> > +
> > + symname = kallsyms_lookup(address, &symsize, &offset, &modname,
> > namebuf);
> > + if (!symname) {
> > + n = 0;
> > + } else {
> > + if (!modname)
> > + modname = delim = "";
> > + n = snprintf(b, bsize, "0x%016lx %s%s%s%s+0x%lx/0x%lx",
> > + address, delim, modname, delim, symname, offset,
> > symsize);
> > + }
> > + return n;
> > +#else
> > + return snprintf(b, bsize, "0x%016lx", address);
> > + return 0;
> > +#endif
> > +}
>
> Would it make sense to #ifdef the whole function?
> Make it static int (*)(...) if CONFIG_KALLSYMS and otherwise just a
> static inline int (*)(...) { return 0; }

Sorry, I meant:

[...]
#else /* !CONFIG_KALLSYMS */
static inline int snprint_address(char *b, int bsize, unsigned long addr)
{
return snprintf(b, bsize, "%#16x", addr);
}
#endif

=Hannes
-
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/