[PATCH printk v2 4/7] printk: Add struct console_buffers

John Ogness
2022-11-23T23:14:33Z

From: Thomas Gleixner <tglx@linutronix.de>

Create a data structure to replace the open coded separate buffers for
regular, extended, and dropped message formatting.

A separate @ext_text buffer is needed because info_print_ext_header()
and msg_print_ext_body() are not able to add the needed extra
information in-place.

@ext_text can be used for dropped text because they are never used at
the same time.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
include/linux/console.h | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/include/linux/console.h b/include/linux/console.h
index b2cf256c23b6..641c1ca7fb67 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -178,6 +178,16 @@ enum cons_flags {
CON_EXTENDED = BIT(6),
};

+/**
+ * struct console_buffers - console output text buffers
+ * @ext_text: Buffer for extended log format or dropped text
+ * @text: Buffer for ringbuffer text
+ */
+struct console_buffers {
+ char ext_text[CONSOLE_EXT_LOG_MAX];
+ char text[CONSOLE_LOG_MAX];
+};
+
/**
* struct console - The console descriptor structure
* @name: The name of the console driver
--
2.30.2