[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHmXi303WxVZzVwI@chrisdown.name>
Date: Fri, 16 Apr 2021 14:56:27 +0100
From: Chris Down <chris@...isdown.name>
To: Petr Mladek <pmladek@...e.com>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-kernel@...r.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
John Ogness <john.ogness@...utronix.de>,
Johannes Weiner <hannes@...xchg.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...omium.org>, kernel-team@...com
Subject: Re: [PATCH v5] printk: Userspace format enumeration support
Hey Petr, Rasmus,
Apologies for the delay, I've been out ill for a while so I'm just coming back
to look at this.
Petr Mladek writes:
>> Anyway, on to the other thing I mentioned on dev_err and friends: I
>> think it would improve readability and make it a lot easier to (probably
>> in a later patch) add support for all those dev_* and net_* and whatever
>> other subsystems have their own wrappers
>
>This is great point! There are many other subsystem specific wrappers,
>e,g, ata_dev_printk(), netdev_printk(), snd_printk(), dprintk().
>We should make it easy to index them as well.
These would be nice to have, but we should agree about how we store things
internally.
For example, in printk we typically store the level inline as part of the
format string at compile time. However, for `dev_printk`, it's passed entirely
separately from the format string after preprocessing is already concluded (or
at least, not in a way we can easily parse it the same way we do for
printk()):
void dev_printk(const char *level, const struct device *dev, const char *fmt, ...)
One (ugly) way to handle this would be to have a new "level" field in the
printk index entry, with semantics that if it's some sentinel value, look at
the format itself for the format, otherwise if it's some other value, the level
field itself is the level.
This will work, but it's pretty ugly. Any better suggestions? :-)
Thanks,
Chris
Powered by blists - more mailing lists