Re: [PATCH 2/9] ext4: Use pr_fmt and pr_<level>

From: Valdis . Kletnieks
Date: Tue Mar 20 2012 - 14:47:28 EST


On Tue, 20 Mar 2012 03:10:01 EDT, David Miller said:
> From: Valdis.Kletnieks@xxxxxx
> Date: Tue, 20 Mar 2012 01:46:06 -0400
>
> > OK. Say I'm a scraper. How do I distinguish between:
> >
> > pr_info("foo");
> > printk(KERN_INFO "foo");
> >
> > Oh my. seems that both result in exactly the same thing ending up in the
> > dmesg buffer
>
> No it doesn't result in the same output, read the definitions again.
>
> pr_info can be influenced by pr_fmt, plain printk cannot

So if nobody screws around with a #define pr_fmt, you can't tell the
difference, and if somebody *does* screw around wiht a #define pr_fmt, you have
no good way to know what *this* build of the kernel produces as output without
tracking down the actual define in use. Consider Joe Perche's example "you can
do things like" - you don't have a good programmatic way to tell what that
pr_info() actually outputs, so an actual human is going to have to review that
and figure out what needs to be pattern-matched.

Not a situation you want to be in if you're a scraper.

At least the perf subsystem is nice enough to *tell* you "I've added an extra
field you may not know about" and provides a mechanism to skip over it.
And I can see why Ted doesn't want to have code churn to do a half-assed
conversion, when there will just be *more* churn if and when we ever get off
our collective butts and deploy a structured solution.

Attachment: pgp00000.pgp
Description: PGP signature