[PATCH v2] rust: alloc: add `NumaNode::id()` accessor

From: Andreas Hindborg

Date: Tue Sep 29 2026 - 11:29:23 EST


`NumaNode` wraps an `i32` but offers no way to read it back. Add a
trivial `id()` getter so callers that need to pass the node id to a
C binding can recover the underlying `c_int` without reaching into
the private field.

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
Changes in v2:
- Rebase on v7.3-rc5.
- Add `#[inline]` attribute (Alice, Gary).
- Link to v1: https://msgid.link/20260608-numa-node-id-v1-1-28480299c62d@xxxxxxxxxx
---
This will be used by an upcoming change that adds a home node parameter to
the block layer `TagSet::new()` constructor.
---
rust/kernel/alloc.rs | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs
index 21067bde6860..68d80f3fa6c8 100644
--- a/rust/kernel/alloc.rs
+++ b/rust/kernel/alloc.rs
@@ -130,6 +130,12 @@ pub fn new(node: i32) -> Result<Self> {
}
Ok(Self(node))
}
+
+ /// Returns the raw NUMA node identifier as an `i32`.
+ #[inline]
+ pub fn id(&self) -> i32 {
+ self.0
+ }
}

/// Specify necessary constant to pass the information to Allocator that the caller doesn't care

---
base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
change-id: 20260608-numa-node-id-85de708d4e8d

Best regards,
--
Andreas Hindborg <a.hindborg@xxxxxxxxxx>