[PATCH] rust: sync: add `UniqueArc::as_ptr`
From: Andreas Hindborg
Date: Sun Feb 15 2026 - 15:38:44 EST
Add a method to `UniqueArc` for getting a raw pointer. The implementation
defers to the `Arc` implementation of the same method.
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
rust/kernel/sync/arc.rs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs
index 289f77abf415a..9c70fdd39bd2f 100644
--- a/rust/kernel/sync/arc.rs
+++ b/rust/kernel/sync/arc.rs
@@ -770,6 +770,11 @@ pub fn new_uninit(flags: Flags) -> Result<UniqueArc<MaybeUninit<T>>, AllocError>
inner: unsafe { Arc::from_inner(KBox::leak(inner).into()) },
})
}
+
+ /// Return a raw pointer to the data in this unique arc.
+ pub fn as_ptr(&self) -> *const T {
+ Arc::as_ptr(&self.inner)
+ }
}
impl<T> UniqueArc<MaybeUninit<T>> {
---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260215-unique-arc-as-ptr-32eb209dde1b
Best regards,
--
Andreas Hindborg <a.hindborg@xxxxxxxxxx>