diff options
author | Benno Lossin <benno.lossin@proton.me> | 2025-03-08 11:04:07 +0000 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2025-03-16 21:59:18 +0100 |
commit | 86f7dacadeecb9e6cc3e79571fed790b5147652a (patch) | |
tree | 81ac00cd7f736b02d178d3468026b4c6c88e62ea /rust/pin-init/src | |
parent | fbf8fb328d1bfe3bd17d5c5626cb485a1ca1a50d (diff) | |
download | linux-86f7dacadeecb9e6cc3e79571fed790b5147652a.tar.gz linux-86f7dacadeecb9e6cc3e79571fed790b5147652a.tar.bz2 linux-86f7dacadeecb9e6cc3e79571fed790b5147652a.zip |
rust: add extensions to the pin-init crate and move relevant documentation there
In preparation of splitting off the pin-init crate from the kernel
crate, move all kernel-specific documentation from pin-init back into
the kernel crate.
Also include an example from the user-space version [1] adapted to the
kernel.
The new `init.rs` file will also be populated by kernel-specific
extensions to the pin-init crate by the next commits.
Link: https://github.com/Rust-for-Linux/pin-init/blob/c1417c64c71229f0fd444d75e88f33e3c547c829/src/lib.rs#L161 [1]
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Link: https://lore.kernel.org/r/20250308110339.2997091-4-benno.lossin@proton.me
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/pin-init/src')
-rw-r--r-- | rust/pin-init/src/lib.rs | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs index aa8df0595585..0307a08ccee9 100644 --- a/rust/pin-init/src/lib.rs +++ b/rust/pin-init/src/lib.rs @@ -5,9 +5,6 @@ //! It also allows in-place initialization of big `struct`s that would otherwise produce a stack //! overflow. //! -//! Most `struct`s from the [`sync`] module need to be pinned, because they contain self-referential -//! `struct`s from C. [Pinning][pinning] is Rust's way of ensuring data does not move. -//! //! # Overview //! //! To initialize a `struct` with an in-place constructor you will need two things: @@ -188,15 +185,6 @@ //! } //! ``` //! -//! For the special case where initializing a field is a single FFI-function call that cannot fail, -//! there exist the helper function [`Opaque::ffi_init`]. This function initialize a single -//! [`Opaque`] field by just delegating to the supplied closure. You can use these in combination -//! with [`pin_init!`]. -//! -//! For more information on how to use [`pin_init_from_closure()`], take a look at the uses inside -//! the `kernel` crate. The [`sync`] module is a good starting point. -//! -//! [`sync`]: kernel::sync //! [pinning]: https://doc.rust-lang.org/std/pin/index.html //! [structurally pinned fields]: //! https://doc.rust-lang.org/std/pin/index.html#pinning-is-structural-for-field @@ -205,8 +193,6 @@ //! [`impl PinInit<Foo>`]: PinInit //! [`impl PinInit<T, E>`]: PinInit //! [`impl Init<T, E>`]: Init -//! [`Opaque`]: kernel::types::Opaque -//! [`Opaque::ffi_init`]: kernel::types::Opaque::ffi_init //! [`pin_data`]: ::macros::pin_data //! [`pin_init!`]: crate::pin_init! |