Re: [PATCH v8 16/29] rust: alloc: implement kernel `Vec` type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 02, 2024 at 03:02:18PM +0000, Benno Lossin wrote:
> On 01.10.24 16:59, Danilo Krummrich wrote:
> > `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.
> > 
> > Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> > ---
> >  rust/kernel/alloc.rs      |   6 +
> >  rust/kernel/alloc/kvec.rs | 637 ++++++++++++++++++++++++++++++++++++++
> 
> Any reason against naming this `vec.rs`?

I think I didn't rename kvec.rs and kbox.rs because we'd need to escape "box" in
various places, e.g. in rust/kernel/alloc.rs:

```
pub mod r#box;

pub use self::r#box::Box;
pub use self::r#box::KBox;
pub use self::r#box::VBox;
pub use self::r#box::KVBox;
```

And it's a kernel specific implementation, so kbox.rs and kvec.rs still makes
sense. :)

> 
> >  rust/kernel/prelude.rs    |   2 +-
> >  3 files changed, 644 insertions(+), 1 deletion(-)
> >  create mode 100644 rust/kernel/alloc/kvec.rs
> 
> I share Gary's opinion, let's do future improvements via
> good-first-issues/patches in the current cycle. But get this version
> merged now.
> 
> Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> 
> ---
> Cheers,
> Benno
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux