diff --git a/MAINTAINERS b/MAINTAINERS index 72294ddfa5b7..db263cefb46b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23972,6 +23972,7 @@ K: \b(?i:rust)\b RUST [ALLOC] M: Danilo Krummrich +M: Alice Ryhl R: Lorenzo Stoakes R: Vlastimil Babka R: Liam R. Howlett 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 { } 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 diff --git a/rust/kernel/alloc/kbox.rs b/rust/kernel/alloc/kbox.rs index c63d6acdbb6f..2c929eb1c3d6 100644 --- a/rust/kernel/alloc/kbox.rs +++ b/rust/kernel/alloc/kbox.rs @@ -345,7 +345,7 @@ pub fn pin(x: T, flags: Flags) -> Result>, AllocError> /// } /// /// // Allocate a boxed slice of 10 `Example`s. - /// let s = KBox::pin_slice( + /// let s = KBox::pin_slice::<_, _, Error, _>( /// | _i | Example::new(), /// 10, /// GFP_KERNEL @@ -355,15 +355,16 @@ pub fn pin(x: T, flags: Flags) -> Result>, AllocError> /// assert_eq!(s[3].d.lock().a, 20); /// # Ok::<(), Error>(()) /// ``` - pub fn pin_slice( + pub fn pin_slice( mut init: Func, len: usize, flags: Flags, ) -> Result>, E> where Func: FnMut(usize) -> Item, - Item: PinInit, + Item: PinInit, E: From, + E: From, { let mut buffer = super::Vec::::with_capacity(len, flags)?; for i in 0..len {