rust: alloc: add `Allocator` trait
authorDanilo Krummrich <dakr@kernel.org>
Fri, 4 Oct 2024 15:41:05 +0000 (17:41 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Mon, 14 Oct 2024 15:55:40 +0000 (17:55 +0200)
commitb7a084ba4fbb8f416ce8d19c93a3a2bee63c9c89
tree9cb46d3a41670a42847f375a7159262bf1ac95a6
parentce1c54fdff7c4556b08f5b875a331d8952e8b6b7
rust: alloc: add `Allocator` trait

Add a kernel specific `Allocator` trait, that in contrast to the one in
Rust's core library doesn't require unstable features and supports GFP
flags.

Subsequent patches add the following trait implementors: `Kmalloc`,
`Vmalloc` and `KVmalloc`.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20241004154149.93856-2-dakr@kernel.org
[ Fixed typo. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/alloc.rs