]> Gentwo Git Trees - linux/.git/commit
rust: pin-init: add pin projections to `#[pin_data]`
authorBenno Lossin <lossin@kernel.org>
Fri, 5 Sep 2025 17:12:07 +0000 (19:12 +0200)
committerBenno Lossin <lossin@kernel.org>
Thu, 11 Sep 2025 21:26:20 +0000 (23:26 +0200)
commit619db96daf942dad974c6c8157ed06d52f7bb969
tree8e55c27b5242b0c5c1a28c6b36e71f24fb1a11e2
parentd49c56368c0cc98cdf02ae21dd275eba92f1c333
rust: pin-init: add pin projections to `#[pin_data]`

Make the `#[pin_data]` macro generate a `*Projection` struct that holds
either `Pin<&mut Field>` or `&mut Field` for every field of the original
struct. Which version is chosen depends on weather there is a `#[pin]`
or not respectively. Access to this projected version is enabled through
generating `fn project(self: Pin<&mut Self>) -> SelfProjection<'_>`.

[ Adapt workqueue to use the new projection instead of its own, custom
  one - Benno ]

Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Benno Lossin <lossin@kernel.org>
rust/kernel/workqueue.rs
rust/pin-init/src/macros.rs