Add a method to borrow the private queue data of the queue a `GenDisk` is associated with. Signed-off-by: Andreas Hindborg --- rust/kernel/block/mq/gen_disk.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs index 8a22767f1b916..fbda2f572e17f 100644 --- a/rust/kernel/block/mq/gen_disk.rs +++ b/rust/kernel/block/mq/gen_disk.rs @@ -246,6 +246,12 @@ pub fn queue(&self) -> &RequestQueue { // SAFETY: By type invariant, self is a valid gendisk. unsafe { RequestQueue::from_raw((*self.gendisk).queue) } } + + /// Get the queue data associated with this [`GenDisk`]. + pub fn queue_data(&self) -> ::Borrowed<'_> { + // SAFETY: By type invariant, self is a valid gendisk. + unsafe { T::QueueData::borrow((*(*self.gendisk).queue).queuedata) } + } } // SAFETY: `GenDisk` is an owned pointer to a `struct gendisk` and an `Arc` to a -- 2.51.2