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

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

This series currently only supports referencing `'static` lifetime
objects, because we need to know the objects outlive the DebugFS files.
A subsequent series may be able to relax this.

Signed-off-by: Matthew Maurer <mmaurer@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 (4):
      rust: debugfs: Bind DebugFS directory creation
      rust: debugfs: Bind file creation for long-lived Display
      rust: debugfs: Support format hooks
      rust: samples: Add debugfs sample

 MAINTAINERS                     |   2 +
 rust/bindings/bindings_helper.h |   1 +
 rust/kernel/debugfs.rs          | 392 ++++++++++++++++++++++++++++++++++++++++
 rust/kernel/lib.rs              |   1 +
 samples/rust/Kconfig            |  11 ++
 samples/rust/Makefile           |   1 +
 samples/rust/rust_debugfs.rs    |  60 ++++++
 7 files changed, 468 insertions(+)
---
base-commit: b6a7783d306baf3150ac54cd5124f6e85dd375b0
change-id: 20250428-debugfs-rust-3cd5c97eb7d1

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


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

end of thread, other threads:[~2025-06-10 17:54 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-05 23:51 [PATCH v5 0/4] rust: DebugFS Bindings Matthew Maurer
2025-05-05 23:51 ` [PATCH v5 1/4] rust: debugfs: Bind DebugFS directory creation Matthew Maurer
2025-05-07 18:46   ` Timur Tabi
2025-05-14 22:26     ` Matthew Maurer
2025-05-14  7:33   ` Benno Lossin
2025-05-14  8:49     ` Greg Kroah-Hartman
2025-05-14  9:38       ` Benno Lossin
2025-05-05 23:51 ` [PATCH v5 2/4] rust: debugfs: Bind file creation for long-lived Display Matthew Maurer
2025-05-07 19:04   ` Timur Tabi
2025-05-07 19:41   ` Timur Tabi
2025-05-09 12:56   ` Alice Ryhl
2025-05-12 20:51   ` Timur Tabi
2025-05-14  8:06   ` Benno Lossin
2025-05-05 23:51 ` [PATCH v5 3/4] rust: debugfs: Support format hooks Matthew Maurer
2025-05-05 23:51 ` [PATCH v5 4/4] rust: samples: Add debugfs sample Matthew Maurer
2025-05-14  7:20   ` Benno Lossin
2025-05-14  9:07     ` Danilo Krummrich
2025-05-14  9:54       ` Benno Lossin
2025-05-14 11:24         ` Danilo Krummrich
2025-05-14 12:21           ` Benno Lossin
2025-05-14 13:04             ` Danilo Krummrich
2025-05-14 22:14           ` Matthew Maurer
2025-05-14 22:08         ` Matthew Maurer
2025-05-14 22:14           ` Danilo Krummrich
2025-05-14 22:23             ` Matthew Maurer
2025-05-14 22:32               ` Matthew Maurer
2025-05-14 22:40                 ` Timur Tabi
2025-05-14 22:42                   ` Matthew Maurer
2025-05-15  7:43                     ` gregkh
2025-05-15  8:50           ` Benno Lossin
2025-05-14 21:55       ` Matthew Maurer
2025-05-14 22:18         ` Danilo Krummrich
2025-05-15  8:59         ` Benno Lossin
2025-05-15 11:43           ` Greg Kroah-Hartman
2025-05-15 12:37             ` Danilo Krummrich
2025-05-15 12:55               ` Benno Lossin
2025-05-20 21:24             ` Alice Ryhl
2025-05-21  4:47               ` Greg Kroah-Hartman
2025-05-21 22:40                 ` Alice Ryhl
2025-05-21  7:57               ` Danilo Krummrich
2025-05-21 22:43                 ` Alice Ryhl
2025-05-22  6:25                   ` Danilo Krummrich
2025-05-22  8:28                     ` Greg Kroah-Hartman
2025-05-22 14:01                     ` Alice Ryhl
2025-05-22 14:15                       ` Greg Kroah-Hartman
2025-05-22 17:40                         ` Alice Ryhl
2025-05-22 20:26                           ` Benno Lossin
2025-05-23  9:15                           ` Greg Kroah-Hartman
2025-05-22 17:53                         ` Danilo Krummrich
2025-05-23  9:14                           ` Greg Kroah-Hartman
2025-05-23  9:42                             ` Danilo Krummrich
2025-05-23 10:22                               ` Greg Kroah-Hartman
2025-05-23 17:09                               ` Alice Ryhl
2025-05-24 12:25                                 ` Danilo Krummrich
2025-05-27 11:38                                   ` Alice Ryhl
2025-05-27 11:50                                     ` Danilo Krummrich
2025-06-10 17:54                                       ` Matthew Maurer
2025-05-23 17:06                             ` Alice Ryhl
2025-05-07 16:49 ` [PATCH v5 0/4] rust: DebugFS Bindings Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).