[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72=mNh415UG_nxDQc=9SCSVSPnqcAbgFZKzavnmsim_L0Q@mail.gmail.com>
Date: Mon, 14 Feb 2022 13:12:24 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Miguel Ojeda <ojeda@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
rust-for-linux <rust-for-linux@...r.kernel.org>,
linux-kernel <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>
Subject: Re: [PATCH v4 12/20] vsprintf: add new `%pA` format specifier
On Mon, Feb 14, 2022 at 11:52 AM Rasmus Villemoes
<linux@...musvillemoes.dk> wrote:
>
> I think the point is for vsnprintf() to call (back) into Rust code.
Indeed, this is the case.
> That said, I don't like the !CONFIG_RUST version to return NULL, that
> will surely crash moments later.
>
> So I prefer something like
>
> [rust.h]
> // no CONFIG_RUST conditional
> +char *rust_fmt_argument(char* buf, char* end, void *ptr);
>
> [vsprintf.c]
> + case 'A':
> + if (IS_ENABLED(CONFIG_RUST))
> + return rust_fmt_argument(buf, end, ptr);
> + else
> + return string_nocheck(buf, end, "[%pA in non-Rust
> code?!]", default_str_spec);
Sounds good. Or perhaps simply `break` and let it print the pointer
(to be consistent with `g` case and non-error `e` case).
Cheers,
Miguel
Powered by blists - more mailing lists