rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/10] Binary Large Objects for Rust DebugFS
@ 2025-10-22 14:30 Danilo Krummrich
  2025-10-22 14:30 ` [PATCH v3 01/10] rust: fs: add new type file::Offset Danilo Krummrich
                   ` (11 more replies)
  0 siblings, 12 replies; 40+ messages in thread
From: Danilo Krummrich @ 2025-10-22 14:30 UTC (permalink / raw)
  To: gregkh, rafael, ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh,
	lossin, a.hindborg, aliceryhl, tmgross, mmaurer
  Cc: rust-for-linux, linux-fsdevel, linux-kernel, Danilo Krummrich

This series adds support for exposing binary large objects via Rust debugfs.

The first two patches extend UserSliceReader and UserSliceWriter with partial
read/write helpers.

The series further introduces read_binary_file(), write_binary_file() and
read_write_binary_file() methods for the Dir and ScopedDir types.

It also introduces the BinaryWriter and BinaryReader traits, which are used to
read/write the implementing type's binary representation with the help of the
backing file operations from/to debugfs.

Additional to some more generic blanked implementations for the BinaryWriter and
BinaryReader traits it also provides implementations for common smart pointer
types.

Both samples (file-based and scoped) are updated with corresponding examples.

A branch containing the patches can be found in [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=debugfs_blobs

Changes in v3:
  - Add UserSliceReader::read_slice_file() and
    UserSliceWriter::write_slice_file() taking an &mut file::Offset to
    adjust it internally and make use of them.
  - Add a new type file::Offset, rather than a type alias.
  - Move affected delegate comments to previous patch.
  - Add a brief comment for BinaryReadFile, BinaryWriteFile and
    BinaryReadWriteFile.

Changes in v2:
  - Add file::Offset type alias.
  - uaccess:
    - Saturate at buffer length on offset overflow.
    - Use file::Offset instead of usize.
  - debugfs:
    - Use file::Offset instead of usize.
    - Handle potential overflow when updating ppos.
    - Use &T::FILE_OPS directly if possible.
    - Fix safety comment in BinaryReaderMut::read_from_slice_mut().

Danilo Krummrich (10):
  rust: fs: add new type file::Offset
  rust: uaccess: add UserSliceReader::read_slice_partial()
  rust: uaccess: add UserSliceReader::read_slice_file()
  rust: uaccess: add UserSliceWriter::write_slice_partial()
  rust: uaccess: add UserSliceWriter::write_slice_file()
  rust: debugfs: support for binary large objects
  rust: debugfs: support blobs from smart pointers
  samples: rust: debugfs: add example for blobs
  rust: debugfs: support binary large objects for ScopedDir
  samples: rust: debugfs_scoped: add example for blobs

 rust/kernel/debugfs.rs              | 110 ++++++++++++-
 rust/kernel/debugfs/file_ops.rs     | 146 ++++++++++++++++-
 rust/kernel/debugfs/traits.rs       | 238 +++++++++++++++++++++++++++-
 rust/kernel/fs/file.rs              | 142 ++++++++++++++++-
 rust/kernel/uaccess.rs              |  81 ++++++++++
 samples/rust/rust_debugfs.rs        |  13 ++
 samples/rust/rust_debugfs_scoped.rs |  14 +-
 7 files changed, 732 insertions(+), 12 deletions(-)


base-commit: e6901808a3b28d8bdabfa98a618b2eab6f8798e8
-- 
2.51.0


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

end of thread, other threads:[~2025-11-05  0:25 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 14:30 [PATCH v3 00/10] Binary Large Objects for Rust DebugFS Danilo Krummrich
2025-10-22 14:30 ` [PATCH v3 01/10] rust: fs: add new type file::Offset Danilo Krummrich
2025-10-22 14:42   ` Miguel Ojeda
2025-10-24 12:15   ` Alice Ryhl
2025-10-28 11:04   ` Danilo Krummrich
2025-11-01 14:16   ` Alexandre Courbot
2025-10-22 14:30 ` [PATCH v3 02/10] rust: uaccess: add UserSliceReader::read_slice_partial() Danilo Krummrich
2025-10-24 10:39   ` Alice Ryhl
2025-11-01 14:16   ` Alexandre Courbot
2025-10-22 14:30 ` [PATCH v3 03/10] rust: uaccess: add UserSliceReader::read_slice_file() Danilo Krummrich
2025-11-01 14:16   ` Alexandre Courbot
2025-10-22 14:30 ` [PATCH v3 04/10] rust: uaccess: add UserSliceWriter::write_slice_partial() Danilo Krummrich
2025-10-23  8:33   ` Alice Ryhl
2025-10-28 13:57     ` Miguel Ojeda
2025-11-01 14:19   ` Alexandre Courbot
2025-10-22 14:30 ` [PATCH v3 05/10] rust: uaccess: add UserSliceWriter::write_slice_file() Danilo Krummrich
2025-10-23  8:30   ` Alice Ryhl
2025-10-23 10:35     ` Danilo Krummrich
2025-10-23 10:37       ` Alice Ryhl
2025-10-23 11:03         ` Danilo Krummrich
2025-10-23 11:20           ` Alice Ryhl
2025-10-23 12:43             ` Danilo Krummrich
2025-10-24 10:37               ` Alice Ryhl
2025-10-24 18:02             ` Miguel Ojeda
2025-11-01 14:27               ` Alexandre Courbot
2025-11-01 15:06                 ` Miguel Ojeda
2025-10-28 14:07   ` Miguel Ojeda
2025-10-22 14:30 ` [PATCH v3 06/10] rust: debugfs: support for binary large objects Danilo Krummrich
2025-10-23  8:26   ` Alice Ryhl
2025-10-23 10:09     ` Danilo Krummrich
2025-10-23 10:21       ` Alice Ryhl
2025-10-24 10:36         ` Alice Ryhl
2025-10-22 14:30 ` [PATCH v3 07/10] rust: debugfs: support blobs from smart pointers Danilo Krummrich
2025-10-23  8:24   ` Alice Ryhl
2025-10-22 14:30 ` [PATCH v3 08/10] samples: rust: debugfs: add example for blobs Danilo Krummrich
2025-10-22 14:30 ` [PATCH v3 09/10] rust: debugfs: support binary large objects for ScopedDir Danilo Krummrich
2025-10-23  8:23   ` Alice Ryhl
2025-10-22 14:30 ` [PATCH v3 10/10] samples: rust: debugfs_scoped: add example for blobs Danilo Krummrich
2025-10-28 13:47 ` [PATCH v3 00/10] Binary Large Objects for Rust DebugFS Miguel Ojeda
2025-11-05  0:25 ` 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).