summaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
authorAlice Ryhl <aliceryhl@google.com>2025-12-03 14:48:08 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-12-29 12:11:32 +0100
commitc1093b85890693fa2d372468f279854c3624d2b1 (patch)
treedc1601bddf2c974a0e08d21ef949dc663b077806 /rust/kernel
parent0c4ce29612bcd1f74d924cbc4abd133dc002e5e6 (diff)
rust: sync: add Arc::DATA_OFFSET
This constant will be used to expose some offset constants from the Rust Binder driver to tracepoints which are implemented in C. The constant is usually equal to sizeof(refcount_t), but may be larger if T has a large alignment. Signed-off-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20251203-binder-trace1-v1-1-22d3ffddb44e@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r--rust/kernel/sync/arc.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs
index 289f77abf415..921e19333b89 100644
--- a/rust/kernel/sync/arc.rs
+++ b/rust/kernel/sync/arc.rs
@@ -240,6 +240,9 @@ impl<T> Arc<T> {
// `Arc` object.
Ok(unsafe { Self::from_inner(inner) })
}
+
+ /// The offset that the value is stored at.
+ pub const DATA_OFFSET: usize = core::mem::offset_of!(ArcInner<T>, data);
}
impl<T: ?Sized> Arc<T> {