2022-11-23 23:21:47

by John Ogness

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

From: Thomas Gleixner <[email protected]>

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 <[email protected]>
Signed-off-by: John Ogness <[email protected]>
---
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


2022-11-24 15:20:24

by Petr Mladek

[permalink] [raw]
Subject: Re: [PATCH printk v2 4/7] printk: Add struct console_buffers

On Thu 2022-11-24 00:19:57, John Ogness wrote:
> From: Thomas Gleixner <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: John Ogness <[email protected]>

If we agree to use the static buffers in struct console, feel free to use:

Reviewed-by: Petr Mladek <[email protected]>

Otherwise, it should get moved into some internal header.

Best Regards,
Petr

2022-11-24 20:40:03

by John Ogness

[permalink] [raw]
Subject: Re: [PATCH printk v2 4/7] printk: Add struct console_buffers

On 2022-11-24, Petr Mladek <[email protected]> wrote:
> If we agree to use the static buffers in struct console, feel free to use:
>
> Reviewed-by: Petr Mladek <[email protected]>

I will move the struct definition and size defines into printk.c for v3.

John