rust: alloc: implement `ReallocFunc`
authorDanilo Krummrich <dakr@kernel.org>
Fri, 4 Oct 2024 15:41:08 +0000 (17:41 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Tue, 15 Oct 2024 20:56:27 +0000 (22:56 +0200)
commit8a799831fc63c988eec90d334fdd68ff5f2c7eb5
tree17d05292dd8d54f2b73a45c94bec464f0e118bf8
parent941e65531446c1eb5d573c5d30172117ebe96112
rust: alloc: implement `ReallocFunc`

`ReallocFunc` is an abstraction for the kernel's realloc derivates, such
as `krealloc`, `vrealloc` and `kvrealloc`.

All of the named functions share the same function signature and
implement the same semantics. The `ReallocFunc` abstractions provides a
generalized wrapper around those, to trivialize the implementation of
`Kmalloc`, `Vmalloc` and `KVmalloc` in subsequent patches.

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-5-dakr@kernel.org
[ Added temporary `allow(dead_code)` for `dangling_from_layout` to clean
  warning in `rusttest` target as discussed in the list (but it is
  needed earlier, i.e. in this patch already). Added colon. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/alloc.rs
rust/kernel/alloc/allocator.rs