Rust pin-init for v6.16
Benno Lossin
reviewerHi Miguel,
Here is the first pin-init pull request! It contains more changes than I expected the first PR to have, but the new CI discovered a few smaller issues and I also got a contribution.
All commits have been in linux-next for a few days. The earlier commits have been in linux-next for a few weeks.
No conflicts expected.
Please pull for v6.16 -- thanks!
---
Cheers,
Benno
The following changes since commit 9c32cda43eb78f78c73aee4aa344b777714e259b:
Linux 6.15-rc3 (2025-04-20 13:43:47 -0700)
are available in the Git repository at:
https://github.com/Rust-for-Linux/linux.git tags/pin-init-v6.16
for you to fetch changes up to 9de1a293c8ece00d226b21a35751ec178be2a9fa:
rust: pin-init: improve documentation for Zeroable derive macros (2025-05-01 18:16:22 +0200)
----------------------------------------------------------------
pin-init changes for v6.16
Added:
- 'Wrapper<T>' trait for creating pin-initializers for wrapper structs with a structurally pinned value such as 'UnsafeCell<T>' or 'MaybeUninit<T>'.
- 'MaybeZeroable' derive macro to try to derive 'Zeroable', but not error if not all fields implement it. This is needed to derive 'Zeroable' for all bindgen-generated structs.
- 'unsafe fn cast_[pin_]init()' functions to unsafely change the initialized type of an initializer. These are utilized by the 'Wrapper<T>' implementations.
Changed:
- Added support for visibility in 'Zeroable' derive macro.
- Added support for 'union's in 'Zeroable' derive macro.
Upstream dev news:
- The CI has been streamlined & some bugs with it have been fixed. I also added new workflows to check if the user-space version and the one in the kernel tree have diverged.
- I also started to use the issues [1] tab to keep track of any problems or unexpected/unwanted things. This should help folks report and diagnose issues w.r.t. 'pin-init' better.
[1]: https://github.com/rust-for-linux/pin-init/issues
----------------------------------------------------------------
Benno Lossin (10):
rust: pin-init: synchronize README.md
rust: pin-init: internal: skip rustfmt formatting of kernel-only module
rust: pin-init: examples: conditionally enable feature(lint_reasons)
rust: pin-init: examples: use allow instead of expect
rust: pin-init: add cast_[pin_]init functions to change the initialized type
rust: pin-init: allow pub fields in derive(Zeroable)
rust: pin-init: allow Zeroable derive macro to also be applied to unions
rust: pin-init: add MaybeZeroable derive macro
rust: pin-init: fix typos
rust: pin-init: improve documentation for Zeroable derive macros
Christian Schrefl (4):
rust: pin-init: Add the Wrapper trait.
rust: pin-init: Implement Wrapper for UnsafePinned behind feature flag.
rust: pin-init: Update Changelog and Readme
rust: pin-init: Update the structural pinning link in readme.
rust/pin-init/README.md | 14 +++- rust/pin-init/examples/linked_list.rs | 1 + rust/pin-init/examples/mutex.rs | 1 + rust/pin-init/examples/pthread_mutex.rs | 4 +- rust/pin-init/examples/static_init.rs | 1 + rust/pin-init/internal/src/lib.rs | 6 ++ rust/pin-init/internal/src/zeroable.rs | 27 +++++- rust/pin-init/src/lib.rs | 144 +++++++++++++++++++++++++++++++- rust/pin-init/src/macros.rs | 91 +++++++++++++++++++- 9 files changed, 279 insertions(+), 10 deletions(-)
Miguel Ojeda
AppliedQuoted 2 lines · Benno Lossin
https://github.com/Rust-for-Linux/linux.git tags/pin-init-v6.16
Congratulations on your first PR!
Merged into rust-next -- thank you!
Cheers,
Miguel