]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rust: alloc: implement `ReallocFunc`
authorDanilo Krummrich <dakr@kernel.org>
Fri, 7 Mar 2025 22:49:30 +0000 (23:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:01:43 +0000 (13:01 +0100)
commite19e92087abab71494c3bc95d6467426e8de6e2b
tree480f9b6a2a25d1d7f6b03602804eb58cd9f2be0d
parentb3b7ea4b0d418b33ad77c569c83e6bf5796f2dfa
rust: alloc: implement `ReallocFunc`

commit 8a799831fc63c988eec90d334fdd68ff5f2c7eb5 upstream.

`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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
rust/kernel/alloc.rs
rust/kernel/alloc/allocator.rs