lkml.org 
[lkml]   [2014]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] printk: Use symbolic defines for console loglevels
From
Date
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




\
 
 \ /
  Last update: 2014-05-23 19:21    [W:0.092 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site