Re: [PATCH] rust: alloc: add `NumaNode::id()` accessor
From: Andreas Hindborg
Date: Mon Jun 08 2026 - 08:25:18 EST
"Gary Guo" <gary@xxxxxxxxxxx> writes:
> On Mon Jun 8, 2026 at 12:47 PM BST, Andreas Hindborg wrote:
>> `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.
>>
>> Signed-off-by: Andreas Hindborg <a.hindborg@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 | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs
>> index e38720349dcf..c02290bb79d9 100644
>> --- a/rust/kernel/alloc.rs
>> +++ b/rust/kernel/alloc.rs
>> @@ -126,6 +126,11 @@ pub fn new(node: i32) -> Result<Self> {
>> }
>> Ok(Self(node))
>> }
>> +
>> + /// Returns the raw NUMA node identifier as an `i32`.
>
> #[inline]
Sashiko will do this for you now 😆
Best regards,
Andreas Hindborg