]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rust: init: add `PinnedDrop` trait and macros
authorBenno Lossin <benno.lossin@proton.me>
Sat, 8 Apr 2023 12:26:01 +0000 (12:26 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 12 Apr 2023 16:41:05 +0000 (18:41 +0200)
commitd0fdc3961270617826e4794fca1d092853847707
tree297fd0bcde51e9b9d7fef7c1bc7e12e0bf0ea155
parent92c4a1e7e81cc775b2ad6bedb348098230f7ed87
rust: init: add `PinnedDrop` trait and macros

The `PinnedDrop` trait that facilitates destruction of pinned types.
It has to be implemented via the `#[pinned_drop]` macro, since the
`drop` function should not be called by normal code, only by other
destructors. It also only works on structs that are annotated with
`#[pin_data(PinnedDrop)]`.

Co-developed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>
Link: https://lore.kernel.org/r/20230408122429.1103522-10-y86-dev@protonmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/init.rs
rust/kernel/init/__internal.rs
rust/kernel/init/macros.rs
rust/macros/lib.rs
rust/macros/pinned_drop.rs [new file with mode: 0644]