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 2aac4cd7da rust: alloc: implement kernel Vec type
`Vec` provides a contiguous growable array type with contents allocated
with the kernel's allocators (e.g. `Kmalloc`, `Vmalloc` or `KVmalloc`).

In contrast to Rust's stdlib `Vec` type, the kernel `Vec` type considers
the kernel's GFP flags for all appropriate functions, always reports
allocation failures through `Result<_, AllocError>` and remains
independent from unstable features.

[ This patch starts using a new unstable feature, `inline_const`, but
  it was stabilized in Rust 1.79.0, i.e. the next version after the
  minimum one, thus it will not be an issue. - Miguel ]

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-17-dakr@kernel.org
[ Cleaned `rustdoc` unescaped backtick warning, added a couple more
  backticks elsewhere, fixed typos, sorted `feature`s, rewrapped
  documentation lines. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-10-15 23:10:32 +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
kbox.rs rust: alloc: implement kernel Box 2024-10-15 22:56:59 +02:00
kvec.rs rust: alloc: implement kernel Vec type 2024-10-15 23:10:32 +02:00
layout.rs rust: alloc: introduce ArrayLayout 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