mirror_ubuntu-kernels/rust/kernel/alloc
Danilo Krummrich dd09538fb4 rust: alloc: implement Cmalloc in module allocator_test
So far the kernel's `Box` and `Vec` types can't be used by userspace
test cases, since all users of those types (e.g. `CString`) use kernel
allocators for instantiation.

In order to allow userspace test cases to make use of such types as
well, implement the `Cmalloc` allocator within the allocator_test module
and type alias all kernel allocators to `Cmalloc`. The `Cmalloc`
allocator uses libc's `realloc()` function as allocator backend.

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-26-dakr@kernel.org
[ Removed the temporary `allow(dead_code)` as discussed in the list and
  fixed typo, added backticks. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-10-15 23:10:32 +02:00
..
allocator_test.rs rust: alloc: implement Cmalloc in module allocator_test 2024-10-15 23:10:32 +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 collect for IntoIter 2024-10-15 23:10:32 +02:00
layout.rs rust: alloc: introduce ArrayLayout 2024-10-15 22:56:59 +02:00