Add a method to `GenDisk` to obtain a reference to the associated `TagSet`. Signed-off-by: Andreas Hindborg --- rust/kernel/block/mq/gen_disk.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs index c6b9839864012..b5291bc3e051d 100644 --- a/rust/kernel/block/mq/gen_disk.rs +++ b/rust/kernel/block/mq/gen_disk.rs @@ -236,7 +236,7 @@ pub fn build( // `__blk_mq_alloc_disk` above. let mut disk = UniqueArc::new( GenDisk { - _tagset: tagset, + tag_set: tagset, gendisk, backref: Arc::pin_init( // INVARIANT: We break `GenDiskRef` invariant here, but we restore it below. @@ -320,7 +320,7 @@ pub(crate) const fn build_vtable() -> &'static bindings::block_device_operations /// `bindings::device_add_disk`. /// - `self.gendisk.queue.queuedata` is initialized by a call to `ForeignOwnable::into_foreign`. pub struct GenDisk { - _tagset: Arc>, + tag_set: Arc>, gendisk: *mut bindings::gendisk, backref: Arc>>, } @@ -342,6 +342,11 @@ pub fn queue_data(&self) -> ::Borrowed<'_> { // SAFETY: By type invariant, self is a valid gendisk. unsafe { T::QueueData::borrow((*(*self.gendisk).queue).queuedata) } } + + /// Get a reference to the `TagSet` used by this `GenDisk`. + pub fn tag_set(&self) -> &Arc> { + &self.tag_set + } } // SAFETY: `GenDisk` is an owned pointer to a `struct gendisk` and an `Arc` to a -- 2.51.2