MAINTAINERS | 3 + rust/bindings/bindings_helper.h | 1 + rust/kernel/debugfs.rs | 218 ++++++++++++++++++++++++++++++++++++ rust/kernel/debugfs/display_file.rs | 115 +++++++++++++++++++ rust/kernel/debugfs/entry.rs | 66 +++++++++++ rust/kernel/lib.rs | 1 + samples/rust/Kconfig | 11 ++ samples/rust/Makefile | 1 + samples/rust/rust_debugfs.rs | 76 +++++++++++++ 9 files changed, 492 insertions(+)
This series provides safe DebugFS bindings for Rust, with a sample driver using them. Signed-off-by: Matthew Maurer <mmaurer@google.com> --- Changes in v6: - Replaced explicit lifetimes with children keeping their parents alive. - Added support for attaching owned data. - Removed recomendation to only keep root handles and handles you want to delete around. - Refactored some code into separate files to improve clarity. - Link to v5: https://lore.kernel.org/r/20250505-debugfs-rust-v5-0-3e93ce7bb76e@google.com Changes in v5: - Made Dir + File wrappers around Entry - All functions return owning handles. To discard without drop, use `forget`. To keep a handle without drop, use `ManuallyDrop`. - Fixed bugs around `not(CONFIG_DEBUG_FS)` - Removed unnecessary `addr_of!` - Link to v4: https://lore.kernel.org/r/20250502-debugfs-rust-v4-0-788a9c6c2e77@google.com Changes in v4: - Remove SubDir, replace with type-level constant. - Add lifetime to Dir to prevent subdirectories and files from outliving their parents and triggering an Oops when accessed. - Split unsafe blocks with two calls into two blocks - Access `private` field through direct pointer dereference, avoiding creation of a reference to it. - Notably not changed - owning/non-owning handle defaults. The best read I had from the thread was to continue with this mode, but I'm willing to change if need be. - Comment changes - More comment markdown - Remove scopes from examples - Put `as_ptr` properties into a `# Guarantees` section. - Link to v3: https://lore.kernel.org/r/20250501-debugfs-rust-v3-0-850869fab672@google.com Changes in v3: - Split `Dir` into `Dir`/`SubDir`/`File` to improve API. - Add "." to end of all comments. - Convert INVARIANT to # Invariants on types. - Add backticks everywhere I found variables/types in my comments. - Promoted invariant comment to doc comment. - Extended sample commenting to make it clearer what is happening. - Link to v2: https://lore.kernel.org/r/20250430-debugfs-rust-v2-0-2e8d3985812b@google.com Changes in v2: - Drop support for builder / pinned bindings in initial series - Remove `ARef` usage to abstract the dentry nature of handles - Remove error handling to discourage users from caring whether DebugFS is enabled. - Support CONFIG_DEBUG_FS=n while leaving the API available - Fixed mistaken decimal/octal mixup - Doc/comment cleanup - Link to v1: https://lore.kernel.org/r/20250429-debugfs-rust-v1-0-6b6e7cb7929f@google.com --- Matthew Maurer (5): rust: debugfs: Bind DebugFS directory creation rust: debugfs: Bind file creation for long-lived Display rust: debugfs: Support arbitrary owned backing for File rust: debugfs: Support format hooks rust: samples: Add debugfs sample MAINTAINERS | 3 + rust/bindings/bindings_helper.h | 1 + rust/kernel/debugfs.rs | 218 ++++++++++++++++++++++++++++++++++++ rust/kernel/debugfs/display_file.rs | 115 +++++++++++++++++++ rust/kernel/debugfs/entry.rs | 66 +++++++++++ rust/kernel/lib.rs | 1 + samples/rust/Kconfig | 11 ++ samples/rust/Makefile | 1 + samples/rust/rust_debugfs.rs | 76 +++++++++++++ 9 files changed, 492 insertions(+) --- base-commit: 6a7635cd013da3b41bf1e66bbdb9ae4a570d7449 change-id: 20250428-debugfs-rust-3cd5c97eb7d1 Best regards, -- Matthew Maurer <mmaurer@google.com>
On 18/06/2025 04:28, Matthew Maurer wrote: > This series provides safe DebugFS bindings for Rust, with a sample > driver using them. > > Signed-off-by: Matthew Maurer <mmaurer@google.com> Having this series applied on top of v6.16-rc1 and adapting a proprietary driver exposing some simple u64 values via debugfs on ARM64 looks good. Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Thanks! Dirk > --- > Changes in v6: > - Replaced explicit lifetimes with children keeping their parents alive. > - Added support for attaching owned data. > - Removed recomendation to only keep root handles and handles you want > to delete around. > - Refactored some code into separate files to improve clarity. > - Link to v5: https://lore.kernel.org/r/20250505-debugfs-rust-v5-0-3e93ce7bb76e@google.com > > Changes in v5: > - Made Dir + File wrappers around Entry > - All functions return owning handles. To discard without drop, use > `forget`. To keep a handle without drop, use `ManuallyDrop`. > - Fixed bugs around `not(CONFIG_DEBUG_FS)` > - Removed unnecessary `addr_of!` > - Link to v4: https://lore.kernel.org/r/20250502-debugfs-rust-v4-0-788a9c6c2e77@google.com > > Changes in v4: > - Remove SubDir, replace with type-level constant. > - Add lifetime to Dir to prevent subdirectories and files from outliving > their parents and triggering an Oops when accessed. > - Split unsafe blocks with two calls into two blocks > - Access `private` field through direct pointer dereference, avoiding > creation of a reference to it. > - Notably not changed - owning/non-owning handle defaults. The best read > I had from the thread was to continue with this mode, but I'm willing > to change if need be. > - Comment changes > - More comment markdown > - Remove scopes from examples > - Put `as_ptr` properties into a `# Guarantees` section. > - Link to v3: https://lore.kernel.org/r/20250501-debugfs-rust-v3-0-850869fab672@google.com > > Changes in v3: > - Split `Dir` into `Dir`/`SubDir`/`File` to improve API. > - Add "." to end of all comments. > - Convert INVARIANT to # Invariants on types. > - Add backticks everywhere I found variables/types in my comments. > - Promoted invariant comment to doc comment. > - Extended sample commenting to make it clearer what is happening. > - Link to v2: https://lore.kernel.org/r/20250430-debugfs-rust-v2-0-2e8d3985812b@google.com > > Changes in v2: > - Drop support for builder / pinned bindings in initial series > - Remove `ARef` usage to abstract the dentry nature of handles > - Remove error handling to discourage users from caring whether DebugFS > is enabled. > - Support CONFIG_DEBUG_FS=n while leaving the API available > - Fixed mistaken decimal/octal mixup > - Doc/comment cleanup > - Link to v1: https://lore.kernel.org/r/20250429-debugfs-rust-v1-0-6b6e7cb7929f@google.com > > --- > Matthew Maurer (5): > rust: debugfs: Bind DebugFS directory creation > rust: debugfs: Bind file creation for long-lived Display > rust: debugfs: Support arbitrary owned backing for File > rust: debugfs: Support format hooks > rust: samples: Add debugfs sample > > MAINTAINERS | 3 + > rust/bindings/bindings_helper.h | 1 + > rust/kernel/debugfs.rs | 218 ++++++++++++++++++++++++++++++++++++ > rust/kernel/debugfs/display_file.rs | 115 +++++++++++++++++++ > rust/kernel/debugfs/entry.rs | 66 +++++++++++ > rust/kernel/lib.rs | 1 + > samples/rust/Kconfig | 11 ++ > samples/rust/Makefile | 1 + > samples/rust/rust_debugfs.rs | 76 +++++++++++++ > 9 files changed, 492 insertions(+) > --- > base-commit: 6a7635cd013da3b41bf1e66bbdb9ae4a570d7449 > change-id: 20250428-debugfs-rust-3cd5c97eb7d1 > > Best regards, -- ====================================================================== Dirk Behme Robert Bosch Car Multimedia GmbH CM/ESO2 Phone: +49 5121 49-3274 Dirk Behme Fax: +49 711 811 5053274 PO Box 77 77 77 mailto:dirk.behme@de.bosch.com D-31132 Hildesheim - Germany Bosch Group, Car Multimedia (CM) Engineering SW Operating Systems 2 (ESO2) Robert Bosch Car Multimedia GmbH - Ein Unternehmen der Bosch Gruppe Sitz: Hildesheim Registergericht: Amtsgericht Hildesheim HRB 201334 Aufsichtsratsvorsitzender: Dr. Dirk Hoheisel Geschäftsführung: Dr. Steffen Berns; Dr. Sven Ost, Jörg Pollak, Dr. Walter Schirm ======================================================================
On Wed, Jun 18, 2025 at 02:28:12AM +0000, Matthew Maurer wrote: > This series provides safe DebugFS bindings for Rust, with a sample > driver using them. > > Signed-off-by: Matthew Maurer <mmaurer@google.com> Overall I think this series looks great. I left one comment, but overall LGTM. Alice
© 2016 - 2025 Red Hat, Inc.