mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 23:51:02 +02:00
Alloc changes for 7.4-rc1
- Add Alice Ryhl as co-maintainer for Rust [ALLOC] - Allow different error types in KBox::pin_slice(), enabling use of infallible initializers - Add NumaNode::id() accessor to retrieve the underlying NUMA node identifier -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCaso6SAAKCRBFlHeO1qrK LiA9AQCOElh67wE67s3xFqNcyOSYgc+xq0APKRxALX3EFQNRMwD/bngREM6SlSdz WcrCyIXR7MDcji1MU0C9RkOXKKvHfgU= =AnZl -----END PGP SIGNATURE----- Merge tag 'alloc-7.4-rc1' of https://github.com/Rust-for-Linux/linux into rust-next Pull alloc updates from Danilo Krummrich: - Add Alice Ryhl as co-maintainer for Rust [ALLOC] - Allow different error types in KBox::pin_slice(), enabling use of infallible initializers - Add NumaNode::id() accessor to retrieve the underlying NUMA node identifier * tag 'alloc-7.4-rc1' of https://github.com/Rust-for-Linux/linux: rust: alloc: add `NumaNode::id()` accessor rust: alloc: allow different error types in `KBox::pin_slice` MAINTAINERS: add Alice Ryhl as co-maintainer for Rust [ALLOC]
This commit is contained in:
commit
334238e683
|
|
@ -23972,6 +23972,7 @@ K: \b(?i:rust)\b
|
|||
|
||||
RUST [ALLOC]
|
||||
M: Danilo Krummrich <dakr@kernel.org>
|
||||
M: Alice Ryhl <aliceryhl@google.com>
|
||||
R: Lorenzo Stoakes <ljs@kernel.org>
|
||||
R: Vlastimil Babka <vbabka@kernel.org>
|
||||
R: Liam R. Howlett <liam@infradead.org>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ pub fn pin(x: T, flags: Flags) -> Result<Pin<Box<T, A>>, 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<Pin<Box<T, A>>, AllocError>
|
|||
/// assert_eq!(s[3].d.lock().a, 20);
|
||||
/// # Ok::<(), Error>(())
|
||||
/// ```
|
||||
pub fn pin_slice<Func, Item, E>(
|
||||
pub fn pin_slice<Func, Item, E, E2>(
|
||||
mut init: Func,
|
||||
len: usize,
|
||||
flags: Flags,
|
||||
) -> Result<Pin<Box<[T], A>>, E>
|
||||
where
|
||||
Func: FnMut(usize) -> Item,
|
||||
Item: PinInit<T, E>,
|
||||
Item: PinInit<T, E2>,
|
||||
E: From<AllocError>,
|
||||
E: From<E2>,
|
||||
{
|
||||
let mut buffer = super::Vec::<T, A>::with_capacity(len, flags)?;
|
||||
for i in 0..len {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user