rust: alloc: add `NumaNode::id()` accessor
Subsystems (2)
Andreas Hindborg
reviewerPATCH v2 1/1 rust: alloc: add `NumaNode::id()` accessor
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.
---
Changes in v2:
- Rebase on v7.3-rc5.
- Add #[inline] attribute (Alice, Gary).
- Link to v1: https://msgid.link/[email protected]
---
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(+)
rust/kernel/alloc.rs +6 -0
@@ -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,
Signature · 1 line
Andreas Hindborg <[email protected]>
Quoted 7 lines · Andreas Hindborg
NumaNodewraps ani32but offers no way to read it back. Add a trivialid()getter so callers that need to pass the node id to a C binding can recover the underlyingc_intwithout reaching into the private field.Reviewed-by Alice Ryhl <[email protected]>Signed-off-by Andreas Hindborg <[email protected]>
Quoted 11 lines
---
Changes in v2:
- Rebase on v7.3-rc5.
- Add#[inline]attribute (Alice, Gary).
- Link to v1: https://msgid.link/[email protected]
---
This will be used by an upcoming change that adds a home node parameter to the block layerTagSet::new()constructor.--- rust/kernel/alloc.rs | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 1 line · Andreas Hindborg
[PATCH v2] rust: alloc: add
NumaNode::id()accessor
Applied, thanks!
Branch: alloc-next
Tree: [email protected]:Rust-for-Linux/linux.git
[1/1] rust: alloc: add NumaNode::id() accessor
commit: 6e8339118040
The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).
The patch is queued up for the upcoming merge window for the next major kernel release.