2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/rust/kernel/alloc
Danilo Krummrich c8cfa8d0c0 rust: alloc: implement kernel Box
`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@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-12-dakr@kernel.org
[ Added backticks, fixed typos. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-10-15 22:56:59 +02:00
..
allocator_test.rs rust: alloc: implement KVmalloc allocator 2024-10-15 22:56:59 +02:00
allocator.rs rust: alloc: implement KVmalloc allocator 2024-10-15 22:56:59 +02:00
box_ext.rs Rust changes for v6.12 2024-09-25 10:25:40 -07:00
kbox.rs rust: alloc: implement kernel Box 2024-10-15 22:56:59 +02:00
vec_ext.rs rust: avoid unused import warning in rusttest 2024-06-11 23:33:28 +02:00