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@xxxxxxxxxx> Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx> > 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