diff options
Diffstat (limited to 'include/linux/printk.h')
-rw-r--r-- | include/linux/printk.h | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/include/linux/printk.h b/include/linux/printk.h index 1bec2f7a2d42..9afc01e5a0a6 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -2,27 +2,34 @@ | |||
2 | #define __KERNEL_PRINTK__ | 2 | #define __KERNEL_PRINTK__ |
3 | 3 | ||
4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
5 | #include <linux/kern_levels.h> | ||
5 | 6 | ||
6 | extern const char linux_banner[]; | 7 | extern const char linux_banner[]; |
7 | extern const char linux_proc_banner[]; | 8 | extern const char linux_proc_banner[]; |
8 | 9 | ||
9 | #define KERN_EMERG "<0>" /* system is unusable */ | 10 | static inline int printk_get_level(const char *buffer) |
10 | #define KERN_ALERT "<1>" /* action must be taken immediately */ | 11 | { |
11 | #define KERN_CRIT "<2>" /* critical conditions */ | 12 | if (buffer[0] == KERN_SOH_ASCII && buffer[1]) { |
12 | #define KERN_ERR "<3>" /* error conditions */ | 13 | switch (buffer[1]) { |
13 | #define KERN_WARNING "<4>" /* warning conditions */ | 14 | case '0' ... '7': |
14 | #define KERN_NOTICE "<5>" /* normal but significant condition */ | 15 | case 'd': /* KERN_DEFAULT */ |
15 | #define KERN_INFO "<6>" /* informational */ | 16 | return buffer[1]; |
16 | #define KERN_DEBUG "<7>" /* debug-level messages */ | 17 | } |
17 | 18 | } | |
18 | /* Use the default kernel loglevel */ | 19 | return 0; |
19 | #define KERN_DEFAULT "<d>" | 20 | } |
20 | /* | 21 | |
21 | * Annotation for a "continued" line of log printout (only done after a | 22 | static inline const char *printk_skip_level(const char *buffer) |
22 | * line that had no enclosing \n). Only to be used by core/arch code | 23 | { |
23 | * during early bootup (a continued line is not SMP-safe otherwise). | 24 | if (printk_get_level(buffer)) { |
24 | */ | 25 | switch (buffer[1]) { |
25 | #define KERN_CONT "<c>" | 26 | case '0' ... '7': |
27 | case 'd': /* KERN_DEFAULT */ | ||
28 | return buffer + 2; | ||
29 | } | ||
30 | } | ||
31 | return buffer; | ||
32 | } | ||
26 | 33 | ||
27 | extern int console_printk[]; | 34 | extern int console_printk[]; |
28 | 35 | ||