Re: [PATCH] printk: Use symbolic defines for console loglevels

From: Borislav Petkov
Date: Mon May 19 2014 - 15:25:29 EST


On Mon, May 19, 2014 at 12:12:51PM -0700, Joe Perches wrote:
> On Mon, 2014-05-19 at 20:27 +0200, Borislav Petkov wrote:
> > ... instead of naked numbers.
>
> Seems sensible.
>
> > diff --git a/include/linux/printk.h b/include/linux/printk.h
> []
> > @@ -30,6 +30,17 @@ static inline const char *printk_skip_level(const char *buffer)
> > return buffer;
> > }
> >
> > +/* printk's without a loglevel use this.. */
> > +#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL
>
> Does anyone actually set CONFIG_DEFAULT_MESSAGE_LOGLEVEL
> to something other than 4?
>
> > +/* We show everything that is MORE important than this.. */
>
> It might be nice to show somewhere that larger values are
> less important.
>
> > +#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
> > +#define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */
> > +#define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */
> > +#define CONSOLE_LOGLEVEL_DEFAULT 7 /* anything MORE serious than KERN_DEBUG */
> > +#define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */
> > +#define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */
>
> It may be nicer to have #defines for the
> KERN_<LEVEL> numbers from kern_levels.h
> and use those here.
>
> Maybe add:
>
> #define LOGLEVEL_EMERG 0
> #define LOGLEVEL_ALERT 1
> #define LOGLEVEL_CRIT 2
> #define LOGLEVEL_ERR 3
> #define LOGLEVEL_WARNING 4
> #define LOGLEVEL_NOTICE 5
> #define LOGLEVEL_INFO 6
> #define LOGLEVEL_DEBUG 7
>
> That could clean up a few uses of
> magic numbers like 7 in dev_printk_emit

This patch is supposed to be as obvious as possible - all other things
which need/must/will be done should come ontop, not here.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
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/