[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLgj+KtgZWx8XxCLPCera4VaqfdyUucpj9HthFViq6_Df9g@mail.gmail.com>
Date: Tue, 1 Oct 2024 11:13:01 +0200
From: Alice Ryhl <aliceryhl@...gle.com>
To: Dirk Behme <dirk.behme@...bosch.com>
Cc: 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>, 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 Tue, Oct 1, 2024 at 10:54 AM Dirk Behme <dirk.behme@...bosch.com> wrote:
>
> 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
Thanks!
Alice
Powered by blists - more mailing lists