On Tue, 1 Oct 2024 16:59:46 +0200 Danilo Krummrich <dakr@xxxxxxxxxx> wrote: > `Box` provides the simplest way to allocate memory for a generic type > with one of the kernel's allocators, e.g. `Kmalloc`, `Vmalloc` or > `KVmalloc`. > > In contrast to Rust's `Box` type, the kernel `Box` type considers the > kernel's GFP flags for all appropriate functions, always reports > allocation failures through `Result<_, AllocError>` and remains > independent from unstable features. > > Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx> > Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx> Reviewed-by: Gary Guo <gary@xxxxxxxxxxx> > --- > rust/kernel/alloc.rs | 6 + > rust/kernel/alloc/kbox.rs | 455 ++++++++++++++++++++++++++++++++++++++ > rust/kernel/prelude.rs | 2 +- > 3 files changed, 462 insertions(+), 1 deletion(-) > create mode 100644 rust/kernel/alloc/kbox.rs