Re: [PATCH 2/4] printk/kdb: Handle more message headers
From: Joe Perches
Date: Thu Oct 27 2016 - 12:58:00 EST
On Thu, 2016-10-27 at 17:52 +0200, Petr Mladek wrote:
> The commit 4bcc595ccd80decb4245096e ("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.
>
> Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
> ---
> include/linux/printk.h | 8 ++++++++
> kernel/debug/kdb/kdb_io.c | 2 +-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/printk.h b/include/linux/printk.h
[]
> @@ -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 += 2;
At some point a level might be more than 1 char and
it would be good to keep that check in just one place
so using printk_skip_level would be more consistent.