| 193b5a75 | 07-Apr-2025 |
Miguel Ojeda <[email protected]> |
rust: pin-init: use Markdown autolinks in Rust comments
"Normal" comments in Rust (`//`) are also formatted in Markdown, like the documentation (`///` and `//!`), see Documentation/rust/coding-guide
rust: pin-init: use Markdown autolinks in Rust comments
"Normal" comments in Rust (`//`) are also formatted in Markdown, like the documentation (`///` and `//!`), see Documentation/rust/coding-guidelines.rst
Thus use Markdown autolinks for a couple links that were missing it.
It also helps to get proper linking in some software like kitty [1].
Suggested-by: Benno Lossin <[email protected]> Link: https://github.com/Rust-for-Linux/pin-init/pull/32#discussion_r2023103712 [1] Signed-off-by: Miguel Ojeda <[email protected]> Link: https://github.com/Rust-for-Linux/pin-init/pull/32/commits/dd230d61bf0538281072fbff4bb71efc58f3420c Fixes: 84837cf6fa54 ("rust: pin-init: change examples to the user-space version") Cc: [email protected] [ Change case in title. Reworded commit message. - Benno ] Signed-off-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 1ab10101 | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: re-enable doctests
The pin-init crate is now compiled in a standalone fashion, so revert the earlier commit that disabled the doctests in pin-init in order to avoid build errors whil
rust: pin-init: re-enable doctests
The pin-init crate is now compiled in a standalone fashion, so revert the earlier commit that disabled the doctests in pin-init in order to avoid build errors while transitioning the crate into a standalone version.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 9b2299af | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: add `std` and `alloc` support from the user-space version
To synchronize the kernel's version of pin-init with the user-space version, introduce support for `std` and `alloc`. While
rust: pin-init: add `std` and `alloc` support from the user-space version
To synchronize the kernel's version of pin-init with the user-space version, introduce support for `std` and `alloc`. While the kernel uses neither, the user-space version has to support both. Thus include the required `#[cfg]`s and additional code.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Undo the temporary `--extern force:alloc` since now we have contents for `alloc` here. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| b321b938 | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: change the way the `paste!` macro is called
Change the paste macro path from `::kernel::macros::paste!` to use `$crate::init::macros::paste!` instead, which links to `::macros::paste
rust: pin-init: change the way the `paste!` macro is called
Change the paste macro path from `::kernel::macros::paste!` to use `$crate::init::macros::paste!` instead, which links to `::macros::paste!`. This is because the pin-init crate will be a dependency of the kernel, so it itself cannot have the kernel as a dependency.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 31547c98 | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: remove kernel-crate dependency
In order to make pin-init a standalone crate, remove dependencies on kernel-specific code such as `ScopeGuard` and `KBox`.
`ScopeGuard` is only used i
rust: pin-init: remove kernel-crate dependency
In order to make pin-init a standalone crate, remove dependencies on kernel-specific code such as `ScopeGuard` and `KBox`.
`ScopeGuard` is only used in the `[pin_]init_array_from_fn` functions and can easily be replaced by a primitive construct.
`KBox` is only used for type variance of unsized types and can also easily be replaced.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 129e97be | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: fix documentation links
Before switching to compile the `pin-init` crate directly, change any links that would be invalid to links that are valid both before and after the switch.
S
rust: pin-init: fix documentation links
Before switching to compile the `pin-init` crate directly, change any links that would be invalid to links that are valid both before and after the switch.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 5657c3a9 | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: add `ZeroableOption` and implement it instead of `Zeroable` for `Option<Box<T, A>>`
When making pin-init its own crate, `Zeroable` will no longer be defined by the kernel crate and thus implem
rust: add `ZeroableOption` and implement it instead of `Zeroable` for `Option<Box<T, A>>`
When making pin-init its own crate, `Zeroable` will no longer be defined by the kernel crate and thus implementing it for `Option<Box<T, A>>` is no longer possible due to the orphan rule. For this reason introduce a new `ZeroableOption` trait that circumvents this problem.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 9d29c682 | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: move impl `Zeroable` for `Opaque` and `Option<KBox<T>>` into the kernel crate
In order to make pin-init a standalone crate, move kernel-specific code directly into the kernel crate.
rust: pin-init: move impl `Zeroable` for `Opaque` and `Option<KBox<T>>` into the kernel crate
In order to make pin-init a standalone crate, move kernel-specific code directly into the kernel crate. Since `Opaque<T>` and `KBox<T>` are part of the kernel, move their `Zeroable` implementation into the kernel crate.
Signed-off-by: Benno Lossin <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 114ca41f | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: move `InPlaceInit` and impls of `InPlaceWrite` into the kernel crate
In order to make pin-init a standalone crate, move kernel-specific code directly into the kernel crate. This incl
rust: pin-init: move `InPlaceInit` and impls of `InPlaceWrite` into the kernel crate
In order to make pin-init a standalone crate, move kernel-specific code directly into the kernel crate. This includes the `InPlaceInit<T>` trait, its implementations and the implementations of `InPlaceWrite` for `Arc` and `UniqueArc`. All of these use the kernel's error type which will become unavailable in pin-init.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 578eb8b6 | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: move the default error behavior of `try_[pin_]init`
Move the ability to just write `try_pin_init!(Foo { a <- a_init })` (note the missing `? Error` at the end) into the kernel crate.
rust: pin-init: move the default error behavior of `try_[pin_]init`
Move the ability to just write `try_pin_init!(Foo { a <- a_init })` (note the missing `? Error` at the end) into the kernel crate. Remove this notation from the pin-init crate, since the default when no error is specified is the kernel-internal `Error` type. Instead add two macros in the kernel crate that serve this default and are used instead of the ones from `pin-init`.
This is done, because the `Error` type that is used as the default is from the kernel crate and it thus prevents making the pin-init crate standalone.
In order to not cause a build error due to a name overlap, the macros in the pin-init crate are renamed, but this change is reverted in a future commit when it is a standalone crate.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| c2ddbdbb | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: call `try_[pin_]init!` from `[pin_]init!` instead of `__init_internal!`
The `[pin_]init!` macros have the same behavior as the `try_[pin_]init!` macros, except that they set the erro
rust: pin-init: call `try_[pin_]init!` from `[pin_]init!` instead of `__init_internal!`
The `[pin_]init!` macros have the same behavior as the `try_[pin_]init!` macros, except that they set the error type to `Infallible`. Instead of calling the primitive `__init_internal!` with the correct parameters, the same can thus be achieved by calling `try_[pin_]init!`. Since this makes it more clear what their behavior is, simplify the implementations of `[pin_]init!`.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 4b11798e | 08-Mar-2025 |
Benno Lossin <[email protected]> |
rust: pin-init: move proc-macro documentation into pin-init crate
Move the documentation of proc-macros from pin-init-internal into pin-init. This is because documentation can only reference types f
rust: pin-init: move proc-macro documentation into pin-init crate
Move the documentation of proc-macros from pin-init-internal into pin-init. This is because documentation can only reference types from dependencies and pin-init-internal cannot have pin-init as a dependency, as that would be cyclic.
Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 86f7daca | 08-Mar-2025 |
Benno Lossin <[email protected]> |
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
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 <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|