[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YjSSI4cmGblm+6j7@smile.fi.intel.com>
Date: Fri, 18 Mar 2022 16:07:31 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
Gary Guo <gary@...yguo.net>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...gle.com>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH v5 12/20] vsprintf: add new `%pA` format specifier
On Thu, Mar 17, 2022 at 07:10:00PM +0100, Miguel Ojeda wrote:
> From: Gary Guo <gary@...yguo.net>
>
> This patch adds a format specifier `%pA` to `vsprintf` which formats
> a pointer as `core::fmt::Arguments`. Doing so allows us to directly
> format to the internal buffer of `printf`, so we do not have to use
> a temporary buffer on the stack to pre-assemble the message on
> the Rust side.
>
> This specifier is intended only to be used from Rust and not for C, so
> `checkpatch.pl` is intentionally unchanged to catch any misuse.
...
> + case 'A':
> + if (!IS_ENABLED(CONFIG_RUST)) {
> + WARN_ONCE(1, "Please remove %%pA from non-Rust code\n");
> + return error_string(buf, end, "(%pA?)", spec);
> + }
I'm wondering if the Big Scary Banner as trace_printk() does would be better
(in case we can tell that %pA is used in the code when RUST=n).
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists