Re: [PATCH v2 2/2] rust: init: add `write_[pin_]init` functions
From: Gary Guo
Date: Thu Aug 01 2024 - 08:34:20 EST
On Mon, 08 Jul 2024 20:53:46 +0000
Benno Lossin <benno.lossin@xxxxxxxxx> wrote:
> Sometimes it is necessary to split allocation and initialization into
> two steps. One such situation is when reusing existing allocations
> obtained via `Box::drop_contents`. See [1] for an example.
> In order to support this use case add `write_[pin_]init` functions to the
> pin-init API. These functions operate on already allocated smart
> pointers that wrap `MaybeUninit<T>`.
>
> Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>
Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> Link: https://lore.kernel.org/rust-for-linux/f026532f-8594-4f18-9aa5-57ad3f5bc592@xxxxxxxxx/ [1]
> ---
> rust/kernel/init.rs | 84 ++++++++++++++++++++++++++++++------------
> rust/kernel/prelude.rs | 2 +-
> 2 files changed, 61 insertions(+), 25 deletions(-)