| f74cf399 | 22-Oct-2025 |
Boqun Feng <boqun.feng@gmail.com> |
rust: debugfs: Replace the usage of Rust native atomics
Rust native atomics are not allowed to use in kernel due to the mismatch of memory model with Linux kernel memory model, hence remove the usag
rust: debugfs: Replace the usage of Rust native atomics
Rust native atomics are not allowed to use in kernel due to the mismatch of memory model with Linux kernel memory model, hence remove the usage of Rust native atomics in debufs.
Reviewed-by: Matthew Maurer <mmaurer@google.com> Acked-by: Danilo Krummrich <dakr@kernel.org> Tested-by: David Gow <davidgow@google.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Link: https://patch.msgid.link/20251022035324.70785-4-boqun.feng@gmail.com
show more ...
|
| 0bc60571 | 07-Nov-2025 |
Danilo Krummrich <dakr@kernel.org> |
rust: debugfs: Implement BinaryReader for Mutex<T> only when T is Unpin
Commit da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut") from tip/master adds an Unpin bound to T for Mutex<T
rust: debugfs: Implement BinaryReader for Mutex<T> only when T is Unpin
Commit da123f0ee40f ("rust: lock: guard: Add T: Unpin bound to DerefMut") from tip/master adds an Unpin bound to T for Mutex<T>, hence also restrict the implementation of BinaryReader for Mutex<T> accordingly.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Closes: https://lore.kernel.org/all/20251107134144.117905bd@canb.auug.org.au/ Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20251107091612.2557480-1-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
| a9fca8a7 | 22-Oct-2025 |
Danilo Krummrich <dakr@kernel.org> |
rust: debugfs: support blobs from smart pointers
Extend Rust debugfs binary support to allow exposing data stored in common smart pointers and heap-allocated collections.
- Implement BinaryWriter f
rust: debugfs: support blobs from smart pointers
Extend Rust debugfs binary support to allow exposing data stored in common smart pointers and heap-allocated collections.
- Implement BinaryWriter for Box<T>, Pin<Box<T>>, Arc<T>, and Vec<T>. - Introduce BinaryReaderMut for mutable binary access with outer locks. - Implement BinaryReaderMut for Box<T>, Vec<T>, and base types. - Update BinaryReader to delegate to BinaryReaderMut for Mutex<T>, Box<T>, Pin<Box<T>> and Arc<T>.
This enables debugfs files to directly expose or update data stored inside heap-allocated, reference-counted, or lock-protected containers without manual dereferencing or locking.
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Matthew Maurer <mmaurer@google.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
| 3b83f5d5 | 18-Oct-2025 |
Tamir Duberstein <tamird@gmail.com> |
rust: replace `CStr` with `core::ffi::CStr`
`kernel::ffi::CStr` was introduced in commit d126d2380131 ("rust: str: add `CStr` type") in November 2022 as an upstreaming of earlier work that was done
rust: replace `CStr` with `core::ffi::CStr`
`kernel::ffi::CStr` was introduced in commit d126d2380131 ("rust: str: add `CStr` type") in November 2022 as an upstreaming of earlier work that was done in May 2021[0]. That earlier work, having predated the inclusion of `CStr` in `core`, largely duplicated the implementation of `std::ffi::CStr`.
`std::ffi::CStr` was moved to `core::ffi::CStr` in Rust 1.64 in September 2022. Hence replace `kernel::str::CStr` with `core::ffi::CStr` to reduce our custom code footprint, and retain needed custom functionality through an extension trait.
Add `CStr` to `ffi` and the kernel prelude.
Link: https://github.com/Rust-for-Linux/linux/commit/faa3cbcca03d0dec8f8e43f1d8d5c0860d98a23f [0] Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Acked-by: Danilo Krummrich <dakr@kernel.org> Reviewed-by: Benno Lossin <lossin@kernel.org> Signed-off-by: Tamir Duberstein <tamird@gmail.com> Link: https://patch.msgid.link/20251018-cstr-core-v18-16-9378a54385f8@gmail.com [ Removed assert that would now depend on the Rust version. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
show more ...
|
| 5f094258 | 04-Sep-2025 |
Matthew Maurer <mmaurer@google.com> |
rust: debugfs: Add support for scoped directories
Introduces the concept of a `ScopedDir`, which allows for the creation of debugfs directories and files that are tied to the lifetime of a particula
rust: debugfs: Add support for scoped directories
Introduces the concept of a `ScopedDir`, which allows for the creation of debugfs directories and files that are tied to the lifetime of a particular data structure. This ensures that debugfs entries do not outlive the data they refer to.
The new `Dir::scope` method creates a new directory that is owned by a `Scope` handle. All files and subdirectories created within this scope are automatically cleaned up when the `Scope` is dropped.
Signed-off-by: Matthew Maurer <mmaurer@google.com> Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20250904-debugfs-rust-v11-6-7d12a165685a@google.com [ Fix up Result<(), Error> -> Result; fix spurious backtick in doc-comment. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
| 40ecc494 | 04-Sep-2025 |
Matthew Maurer <mmaurer@google.com> |
rust: debugfs: Add support for callback-based files
Extends the `debugfs` API to support creating files with content generated and updated by callbacks. This is done via the `read_callback_file`, `w
rust: debugfs: Add support for callback-based files
Extends the `debugfs` API to support creating files with content generated and updated by callbacks. This is done via the `read_callback_file`, `write_callback_file`, and `read_write_callback_file` methods.
These methods allow for more flexible file definition, either because the type already has a `Writer` or `Reader` method that doesn't do what you'd like, or because you cannot implement it (e.g. because it's a type defined in another crate or a primitive type).
Signed-off-by: Matthew Maurer <mmaurer@google.com> Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20250904-debugfs-rust-v11-4-7d12a165685a@google.com [ Fix up Result<(), Error> -> Result. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
| 839dc1d1 | 04-Sep-2025 |
Matthew Maurer <mmaurer@google.com> |
rust: debugfs: Add support for writable files
Extends the `debugfs` API to support creating writable files. This is done via the `Dir::write_only_file` and `Dir::read_write_file` methods, which take
rust: debugfs: Add support for writable files
Extends the `debugfs` API to support creating writable files. This is done via the `Dir::write_only_file` and `Dir::read_write_file` methods, which take a data object that implements the `Reader` trait.
Signed-off-by: Matthew Maurer <mmaurer@google.com> Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20250904-debugfs-rust-v11-3-7d12a165685a@google.com [ Fix up Result<()> -> Result. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|
| 5e40b591 | 04-Sep-2025 |
Matthew Maurer <mmaurer@google.com> |
rust: debugfs: Add support for read-only files
Extends the `debugfs` API to support creating read-only files. This is done via the `Dir::read_only_file` method, which takes a data object that implem
rust: debugfs: Add support for read-only files
Extends the `debugfs` API to support creating read-only files. This is done via the `Dir::read_only_file` method, which takes a data object that implements the `Writer` trait.
The file's content is generated by the `Writer` implementation, and the file is automatically removed when the returned `File` handle is dropped.
Signed-off-by: Matthew Maurer <mmaurer@google.com> Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20250904-debugfs-rust-v11-2-7d12a165685a@google.com [ Fixup build failure when CONFIG_DEBUGFS=n. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
show more ...
|