All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/6] rust: DebugFS Bindings
@ 2025-06-27 23:18 Matthew Maurer
  2025-06-27 23:18 ` [PATCH v8 1/6] rust: debugfs: Bind DebugFS directory creation Matthew Maurer
                   ` (6 more replies)
  0 siblings, 7 replies; 49+ messages in thread
From: Matthew Maurer @ 2025-06-27 23:18 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Greg Kroah-Hartman, Rafael J. Wysocki,
	Sami Tolvanen, Timur Tabi, Benno Lossin
  Cc: linux-kernel, rust-for-linux, Matthew Maurer, Dirk Behme

This series provides safe DebugFS bindings for Rust, with a sample
module using them.

Signed-off-by: Matthew Maurer <mmaurer@google.com>
---
Changes in v8:
- Switched from casts to `core::from_{ref, mut}` in type change
- Link to v7: https://lore.kernel.org/r/20250624-debugfs-rust-v7-0-9c8835a7a20f@google.com

Changes in v7:
- Rewrote `entry::Entry` -> `Entry`
- Use `c_int` and `c_void` from kernel prelude rather than core
- Removed unnecessary `display_open` cast
- Switched from `Deref` + an explicit box to `ForeignOwnable` for
  attaching owned data.
- Made `&'static` and `&'static mut` implement `ForeignOwnable`
- Swapped "driver" to "module" in sample code
- Link to v6: https://lore.kernel.org/r/20250618-debugfs-rust-v6-0-72cae211b133@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 (6):
      rust: debugfs: Bind DebugFS directory creation
      rust: debugfs: Bind file creation for long-lived Display
      rust: types: Support &'static and &'static mut ForeignOwnable
      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              | 268 ++++++++++++++++++++++++++++++++++++
 rust/kernel/debugfs/display_file.rs | 155 +++++++++++++++++++++
 rust/kernel/debugfs/entry.rs        |  66 +++++++++
 rust/kernel/lib.rs                  |   1 +
 rust/kernel/types.rs                |  58 ++++++++
 samples/rust/Kconfig                |  11 ++
 samples/rust/Makefile               |   1 +
 samples/rust/rust_debugfs.rs        |  76 ++++++++++
 10 files changed, 640 insertions(+)
---
base-commit: bd243cb5d922cc6343007a3f3918c8d1970541d2
change-id: 20250428-debugfs-rust-3cd5c97eb7d1

Best regards,
-- 
Matthew Maurer <mmaurer@google.com>


^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2025-07-03 14:04 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 23:18 [PATCH v8 0/6] rust: DebugFS Bindings Matthew Maurer
2025-06-27 23:18 ` [PATCH v8 1/6] rust: debugfs: Bind DebugFS directory creation Matthew Maurer
2025-06-27 23:18 ` [PATCH v8 2/6] rust: debugfs: Bind file creation for long-lived Display Matthew Maurer
2025-06-27 23:18 ` [PATCH v8 3/6] rust: types: Support &'static and &'static mut ForeignOwnable Matthew Maurer
2025-07-01 11:41   ` Dirk Behme
2025-07-01 11:46     ` Danilo Krummrich
2025-06-27 23:18 ` [PATCH v8 4/6] rust: debugfs: Support arbitrary owned backing for File Matthew Maurer
2025-06-30 17:29   ` Danilo Krummrich
2025-06-30 17:34     ` Matthew Maurer
2025-06-30 17:36       ` Matthew Maurer
2025-06-30 17:39       ` Danilo Krummrich
2025-06-30 17:49         ` Matthew Maurer
2025-06-30 18:16           ` Danilo Krummrich
2025-07-01 13:58             ` Greg Kroah-Hartman
2025-07-01 14:13               ` Danilo Krummrich
2025-07-01 14:21                 ` Greg Kroah-Hartman
2025-07-01 15:10                   ` Danilo Krummrich
2025-07-01 18:11                     ` Matthew Maurer
2025-07-01 19:21                       ` Danilo Krummrich
2025-07-01 19:46                         ` Benno Lossin
2025-07-01 19:58                           ` Danilo Krummrich
2025-07-01 20:03                             ` Benno Lossin
2025-07-01 20:09                               ` Benno Lossin
2025-07-01 20:16                                 ` Danilo Krummrich
2025-07-01 21:53                                   ` Matthew Maurer
2025-07-01 22:26                                     ` Danilo Krummrich
2025-07-01 20:07                     ` Benno Lossin
2025-07-03 10:02                     ` Alice Ryhl
2025-07-03 10:33                       ` Benno Lossin
2025-07-03 10:54                         ` Alice Ryhl
2025-07-03 11:41                           ` Greg Kroah-Hartman
2025-07-03 12:29                             ` Danilo Krummrich
2025-07-03 12:50                               ` Greg Kroah-Hartman
2025-07-03 14:00                                 ` Danilo Krummrich
2025-07-03 13:34                               ` Benno Lossin
2025-07-03 14:04                                 ` Danilo Krummrich
2025-07-03 13:35                               ` Benno Lossin
2025-07-03 13:38                                 ` Alice Ryhl
2025-07-03 12:34                             ` Benno Lossin
2025-07-03 12:45                               ` Greg Kroah-Hartman
2025-07-03 11:00                       ` Danilo Krummrich
2025-06-27 23:18 ` [PATCH v8 5/6] rust: debugfs: Support format hooks Matthew Maurer
2025-06-27 23:18 ` [PATCH v8 6/6] rust: samples: Add debugfs sample Matthew Maurer
2025-07-01 14:03   ` Greg Kroah-Hartman
2025-07-01 17:24     ` Matthew Maurer
2025-07-01 17:34       ` Danilo Krummrich
2025-07-01 18:32         ` Matthew Maurer
2025-07-01 19:40           ` Danilo Krummrich
2025-07-01 10:57 ` [PATCH v8 0/6] rust: DebugFS Bindings Alice Ryhl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.