diff options
author | Danilo Krummrich <dakr@kernel.org> | 2024-10-04 17:41:15 +0200 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2024-10-15 22:56:59 +0200 |
commit | c8cfa8d0c0b10be216861fe904ea68978b1dcc97 (patch) | |
tree | 14e1a23a8c4f8883e0243bb0e25d9cabd8da2da9 /rust/macros | |
parent | 01b2196e5aac8af9343282d0044fa0d6b07d484c (diff) |
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>
Diffstat (limited to 'rust/macros')
0 files changed, 0 insertions, 0 deletions