summaryrefslogtreecommitdiff
path: root/kernel/printk/internal.h
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2023-01-09 11:13:56 +0106
committerPetr Mladek <pmladek@suse.com>2023-01-11 15:35:11 +0100
commitdaaab5b5bba36a5aef790230b610556b9bbd9cfc (patch)
tree6aaebc0568895db28e983544f5413a4fb31a38c2 /kernel/printk/internal.h
parent02b2396d7d0cf806e80c887b4c799d482d6977ed (diff)
printk: introduce struct printk_buffers
Introduce a new struct printk_buffers to contain all the buffers needed to read and format a printk message for output. Putting the buffers inside a struct reduces the number of buffer pointers that need to be tracked. Also, it allows usage of the sizeof() macro for the buffer sizes, rather than expecting certain sized buffers being passed in. Note that since the output buffer for normal consoles is now CONSOLE_EXT_LOG_MAX instead of CONSOLE_LOG_MAX, multi-line messages that may have been previously truncated will now be printed in full. This should be considered a feature and not a bug since the CONSOLE_LOG_MAX restriction was about limiting static buffer usage rather than limiting printed text. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20230109100800.1085541-5-john.ogness@linutronix.de
Diffstat (limited to 'kernel/printk/internal.h')
-rw-r--r--kernel/printk/internal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h
index f394332410c9..6080d289a342 100644
--- a/kernel/printk/internal.h
+++ b/kernel/printk/internal.h
@@ -82,3 +82,13 @@ u16 printk_parse_prefix(const char *text, int *level,
static inline bool printk_percpu_data_ready(void) { return false; }
#endif /* CONFIG_PRINTK */
+
+/**
+ * struct printk_buffers - Buffers to read/format/output printk messages.
+ * @outbuf: After formatting, contains text to output.
+ * @scratchbuf: Used as temporary ringbuffer reading and string-print space.
+ */
+struct printk_buffers {
+ char outbuf[CONSOLE_EXT_LOG_MAX];
+ char scratchbuf[LOG_LINE_MAX];
+};