From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Matthew Wood <thepacketgeek@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Breno Leito" <leitao@debian.org>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] rust: console: add abstraction for kernel console drivers
Date: Fri, 27 Feb 2026 18:14:43 -0500 [thread overview]
Message-ID: <2026022704-xbox-comfort-2493@gregkh> (raw)
In-Reply-To: <20260227215357.667257-1-thepacketgeek@gmail.com>
On Fri, Feb 27, 2026 at 01:53:56PM -0800, Matthew Wood wrote:
> Add a safe Rust abstraction for the kernel's `struct console`,
> enabling console drivers to be implemented in Rust that provides:
>
> - `ConsoleOps` trait with a required `write` callback and an
> optional `setup` callback, mirroring the C console_operations
> interface. The trait requires `Send + Sync` to reflect that
> console write may be called from any context including IRQ.
>
> - `Console<T>` struct that wraps `struct console` using pin-init
> and `Opaque<T>`, with automatic unregistration via `PinnedDrop`.
> Registration is performed through a pin-initializer returned by
> `Console::register()`, which uses `pin_chain` to set the data
> pointer and call `register_console()` after the struct is pinned.
>
> - `ConsoleOpsAdapter<T>` that provides the extern "C" callbacks
> bridging from the kernel's function pointers to the Rust trait
> methods. The `#[vtable]` attribute on `ConsoleOps` enables
> compile-time detection of whether `setup` is implemented via
> `T::HAS_SETUP`.
>
> - Console flag constants re-exported from the C `enum cons_flags`.
>
> C helper functions are added for `register_console()`,
> `unregister_console()`, and `console_is_registered()` as these are
> either inlines or macros that cannot be called directly from Rust
> through bindgen.
>
> This abstraction is a dependency for a Rust netconsole implementation
> I am working on.
I'd prefer to see it then, with the user, before even reviewing this
one, sorry. That way we "know" it at least works for you.
thanks,
greg k-h
next prev parent reply other threads:[~2026-02-27 23:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 21:53 [PATCH v1] rust: console: add abstraction for kernel console drivers Matthew Wood
2026-02-27 23:14 ` Greg Kroah-Hartman [this message]
2026-02-27 23:44 ` Matthew Wood
2026-02-28 0:17 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026022704-xbox-comfort-2493@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=thepacketgeek@gmail.com \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.