seq_buf: Add seq_buf_do_printk() helper
authorSergey Senozhatsky <senozhatsky@chromium.org>
Sat, 15 Apr 2023 10:01:10 +0000 (19:01 +0900)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 26 Apr 2023 01:03:14 +0000 (21:03 -0400)
commit96928d9032a7c34f12a88df879665562bcebf59a
treeb25e52ee726d90ad73a4591b2eafa67d5cd3ae85
parentc7bdb07902e0b633795372665d0154e7267ecd0e
seq_buf: Add seq_buf_do_printk() helper

Sometimes we use seq_buf to format a string buffer, which
we then pass to printk(). However, in certain situations
the seq_buf string buffer can get too big, exceeding the
PRINTKRB_RECORD_MAX bytes limit, and causing printk() to
truncate the string.

Add a new seq_buf helper. This helper prints the seq_buf
string buffer line by line, using \n as a delimiter,
rather than passing the whole string buffer to printk()
at once.

Link: https://lkml.kernel.org/r/20230415100110.1419872-1-senozhatsky@chromium.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
include/linux/seq_buf.h
lib/seq_buf.c