Re: [RFC] New kernel-message logging API (take 2)

From: Miguel Ojeda
Date: Fri Sep 28 2007 - 09:30:57 EST


On 9/28/07, Vegard Nossum <vegard.nossum@xxxxxxxxx> wrote:
> On 9/27/07, Vegard Nossum <vegard.nossum@xxxxxxxxx> wrote:
> > * Use SUBSYSTEM and KBUILD_MODNAME
>
> snip.
>
> > 2.1.5. Subsystem/driver tags
> >
> > Many parts of the kernel already prefix their log messages with a
> > subsystem and/or driver tag to identify the source of a particular
> > message. With the kprint interface, these tags are redundant. Instead,
> > the macros SUBSYSTEM and KBUILD_MODNAME are used and recorded along
> > with each log message. Therefore, each source file should define the
> > macro SUBSYSTEM before any of the kprint functions are used. If this
> > macro is not defined, the recorded subsystem will be an empty string.
> > [6][7]
>
> This changes to KPRINT_SUBSYSTEM and KPRINT_DRIVER. The KPRINT_ prefix
> is to clearly say that this is something related to logging. The

Nice. Although the word "DRIVER" may not represent every module, I
think it is the correct option as I suggested, as the word is
meaningful (speaks by itself) and almost every message in the kernel
is printed out by drivers (whatever the big subsystem they belong to:
drivers/, fs/, net/ ...).

> reason we can't use KBUILD_MODNAME is that this is defined on the
> command line. The declaration inside the header would thus be horribly
> wrong. We can, however, use KBUILD_MODNAME as a default value for
> KPRINT_DRIVER, like:
> static const char *KPRINT_DRIVER = KBUILD_MODNAME;
> which would pre-process to something like:
> static const char *KPRINT_DRIVER = "bcm43xx";
>
> This value can still be overridden using #define KPRINT_DRIVER "new
> name". In this case, it is possible that the original KPRINT_DRIVER
> symbol can cause an "unused variable"-warning. I guess this is fixable
> with the gcc "unused" variable attribute.

Yep, then, in a year or two, we will be able to delete such attribute.

Will there be a team to change main subsystems/drivers to the new API?

--
Miguel Ojeda
http://maxextreme.googlepages.com/index.htm
-
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/