Re: [PATCH printk v3 6/6] printk: introduce console_prepend_dropped() for dropped messages

From: John Ogness
Date: Tue Jan 03 2023 - 08:45:08 EST


On 2023-01-03, Petr Mladek <pmladek@xxxxxxxx> wrote:
> Well, what about making sure that something more useful is always
> printed. For example:
>
> /*
> * Make sure outbuf is sufficiently large before prepending.
> * Keep at least the prefix when the message has to be truncated.
> * It is a rather theoretical problem when someone tries to
> * use a minimalist buffer.
> */
> if (WARN_ON_ONCE(len + PREFIX_MAX + 1 >= outbuf_sz))
> return;

I am fine with this. We won't see this warning anyway. Few lines would
ever be printed correctly if anyone ever tries to use a buffer so small.

> If we want to use this way. It would probably make sense to
> rename PREFIX_MAX to CONSOLE_PREFIX_MAX.

Actually, I would like to rename all of those limit macros to something
that makes more sense for the new code base:

CONSOLE_EXT_LOG_MAX -> CONSOLE_MESSAGE_MAX

CONSOLE_LOG_MAX -> SYSLOG_MESSAGE_MAX

LOG_LINE_MAX -> PRINTK_RECORD_MAX

PREFIX_MAX -> CONSOLE_PREFIX_MAX

I have a patch to do this ready, but I did not want to post it until we
are finished with the thread/atomic work.

John