Re: [PATCH v6 13/26] rust: alloc: implement kernel `Vec` type

From: Benno Lossin
Date: Tue Sep 10 2024 - 16:08:05 EST


On 16.08.24 02:10, Danilo Krummrich wrote:
> `Vec` provides a contiguous growable array type (such as `Vec`) with
> contents allocated with the kernel's allocators (e.g. `Kmalloc`,
> `Vmalloc` or `KVmalloc`).
>
> In contrast to Rust's `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.
>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
> rust/kernel/alloc.rs | 6 +
> rust/kernel/alloc/kvec.rs | 629 ++++++++++++++++++++++++++++++++++++++
> rust/kernel/prelude.rs | 2 +-
> 3 files changed, 636 insertions(+), 1 deletion(-)
> create mode 100644 rust/kernel/alloc/kvec.rs

I noticed that you don't have a `pop` or `remove` function implemented,
I think it would be weird to have all the other functions but not those.

---
Cheers,
Benno