[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJ7tcmOHfFmHgrY9@google.com>
Date: Fri, 15 Aug 2025 08:18:58 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: Boqun Feng <boqun.feng@...il.com>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Gary Guo <gary@...yguo.net>,
"Björn Roy Baron" <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, Jens Axboe <axboe@...nel.dk>,
Breno Leitao <leitao@...ian.org>, linux-block@...r.kernel.org,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 15/18] rust: block: add `GenDisk` private data support
On Fri, Aug 15, 2025 at 09:30:50AM +0200, Andreas Hindborg wrote:
> Allow users of the rust block device driver API to install private data in
> the `GenDisk` structure.
>
> Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> self,
> name: fmt::Arguments<'_>,
> tagset: Arc<TagSet<T>>,
> + queue_data: T::QueueData,
> ) -> Result<GenDisk<T>> {
> + let data = queue_data.into_foreign();
> + let recover_data = ScopeGuard::new(|| {
> + // SAFETY: T::QueueData was created by the call to `into_foreign()` above
> + drop(unsafe { T::QueueData::from_foreign(data) });
> + });
> +
> // SAFETY: `bindings::queue_limits` contain only fields that are valid when zeroed.
> let mut lim: bindings::queue_limits = unsafe { core::mem::zeroed() };
>
> @@ -113,7 +121,7 @@ pub fn build<T: Operations>(
> bindings::__blk_mq_alloc_disk(
> tagset.raw_tag_set(),
> &mut lim,
> - core::ptr::null_mut(),
> + data.cast(),
Is the cast necessary?
Alice
Powered by blists - more mailing lists