lkml.org 
[lkml]   [2011]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 25/26] dynamic_debug: add pr_fmt_dbg() for dynamic_pr_debug
On Tue, Sep 27, 2011 at 5:36 PM, Joe Perches <joe@perches.com> wrote:
> On Tue, 2011-09-27 at 14:37 -0600, Jim Cromie wrote:
>>
>> Done. Only wrinkle is wrt pr_warning() vs pr_warn()
>> I added to your suggestion:
>> +#define pr_fmt_warn pr_fmt_warning
>>
>> the imperfection is that user has 4 combos of warn/warning
>> rather than 2 pairs, but the latter seems less defensible.
>
> I'd just use pr_fmt_warn.
>
> Instead of all this other extra stuff:
>

trouble is that pr_warn & pr_warning are synonyms,
and not having matching synonyms for pr_fmt_warn*
creates a few corner-case oddities that I think
somebody will trip over eventually.

Cleanest way is to drop the original synonym, and just use
warn (its shorter), but that creates some churn (havent grepped to see
how much).

I picked what looked like least effort & fewest corner-cases.
ICBW..


> What did you think of avoiding all of this and
> having __dynamic_pr_debug move the fmt pointer over
> any initial KBUILD_MODULE ": "
>
> int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
> {
> [...]
>        size_t modsize = strlen(descriptor->modname);
>        if (0 == strncmp(fmt, descriptor->modname, modsize) &&
>            0 == strncmp(fmt + modsize, ": ", 2))
>                fmt += modsize + 2;
>
>        vprintk(fmt, ...)
>
> ?

I was getting to that... ;-)

Im not crazy about it. It feels like too much ..
Its a runtime workaround for what I think is a
problem in users' (or header's) #defines.

something like this would fix it at compile time,
similar to how I had it in dynamic-debug.h previously:

#if (CONFIG_DYNAMIC_DEBUG)
#define pr_fmt_debug(fmt) KBUILD_MODNAME ": " fmt
#endif
// defaulting to pr_fmt as given by user, or by printk.h

without dynamic-debug, pr_debug() would get same value
as as used by pr_info() etc.

With patchset as proposed, user needs to do the above
to get 'proper' output for both CONFIG_DYNAMIC_DEBUG=y/n.
It may be appropriate to do that in printk.h or dynamic_debug.h
TBDiscussed.

thanks
Jim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-09-28 04:57    [W:0.132 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site