[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <755a5049-d6ca-41de-ba49-16bda7822fe7@de.bosch.com>
Date: Tue, 1 Oct 2024 10:53:56 +0200
From: Dirk Behme <dirk.behme@...bosch.com>
To: Alice Ryhl <aliceryhl@...gle.com>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, Arnd Bergmann <arnd@...db.de>, Miguel Ojeda
<ojeda@...nel.org>, Alexander Viro <viro@...iv.linux.org.uk>, "Christian
Brauner" <brauner@...nel.org>, Jan Kara <jack@...e.cz>
CC: Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin
<benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, "Trevor
Gross" <tmgross@...ch.edu>, <rust-for-linux@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] rust: miscdevice: add base miscdevice abstraction
On 01.10.2024 10:22, Alice Ryhl wrote:
....
> diff --git a/rust/kernel/miscdevice.rs b/rust/kernel/miscdevice.rs
> new file mode 100644
> index 000000000000..cbd5249b5b45
> --- /dev/null
> +++ b/rust/kernel/miscdevice.rs
...
> +/// Trait implemented by the private data of an open misc device.
> +#[vtable]
> +pub trait MiscDevice {
> + /// What kind of pointer should `Self` be wrapped in.
> + type Ptr: ForeignOwnable + Send + Sync;
> +
> + /// Called when the misc device is opened.
> + ///
> + /// The returned pointer will be stored as the private data for the file.
> + fn open() -> Result<Self::Ptr>;
> +
> + /// Called when the misc device is released.
> + fn release(device: Self::Ptr) {
> + drop(device);
> + }
> +
> + /// Handler for ioctls.
> + ///
> + /// The `cmd` argument is usually manipulated using the utilties in [`kernel::ioctl`].
Nit: utilties -> utilities
Dirk
Powered by blists - more mailing lists