printk/kdb: handle more message headers
authorPetr Mladek <pmladek@suse.com>
Tue, 13 Dec 2016 00:45:47 +0000 (16:45 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 13 Dec 2016 02:55:09 +0000 (18:55 -0800)
Commit 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing
continuation lines") allows to define more message headers for a single
message.  The motivation is that continuous lines might get mixed.
Therefore it make sense to define the right log level for every piece of
a cont line.

This patch introduces printk_skip_headers() that will skip all headers
and uses it in the kdb code instead of printk_skip_level().

This approach helps to fix other printk_skip_level() users
independently.

Link: http://lkml.kernel.org/r/1478695291-12169-3-git-send-email-pmladek@suse.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Cc: Joe Perches <joe@perches.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/printk.h
kernel/debug/kdb/kdb_io.c

index eac1af8502bbffcf51ccfd31c59ce14830f6267f..a0859e169bc32260dc6cb0f76eb87e7698bd8ce0 100644 (file)
@@ -31,6 +31,14 @@ static inline const char *printk_skip_level(const char *buffer)
        return buffer;
 }
 
+static inline const char *printk_skip_headers(const char *buffer)
+{
+       while (printk_get_level(buffer))
+               buffer = printk_skip_level(buffer);
+
+       return buffer;
+}
+
 #define CONSOLE_EXT_LOG_MAX    8192
 
 /* printk's without a loglevel use this.. */
index fc1ef736253c79954686d018a2deca4c86300fa6..98c9011eac7802e105c90064c5a5a670b8a53153 100644 (file)
@@ -697,7 +697,7 @@ kdb_printit:
         * Write to all consoles.
         */
        retlen = strlen(kdb_buffer);
-       cp = (char *) printk_skip_level(kdb_buffer);
+       cp = (char *) printk_skip_headers(kdb_buffer);
        if (!dbg_kdb_mode && kgdb_connected) {
                gdbstub_msg_write(cp, retlen - (cp - kdb_buffer));
        } else {