summaryrefslogtreecommitdiff
path: root/include/linux/seq_buf.h
diff options
context:
space:
mode:
authorSergey Senozhatsky <senozhatsky@chromium.org>2023-04-15 13:01:10 +0300
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-04-26 04:03:14 +0300
commit96928d9032a7c34f12a88df879665562bcebf59a (patch)
treeb25e52ee726d90ad73a4591b2eafa67d5cd3ae85 /include/linux/seq_buf.h
parentc7bdb07902e0b633795372665d0154e7267ecd0e (diff)
downloadlinux-96928d9032a7c34f12a88df879665562bcebf59a.tar.xz
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>
Diffstat (limited to 'include/linux/seq_buf.h')
-rw-r--r--include/linux/seq_buf.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
index 5b31c5147969..515d7fcb9634 100644
--- a/include/linux/seq_buf.h
+++ b/include/linux/seq_buf.h
@@ -159,4 +159,6 @@ extern int
seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary);
#endif
+void seq_buf_do_printk(struct seq_buf *s, const char *lvl);
+
#endif /* _LINUX_SEQ_BUF_H */