Skip to content

Binary Large Objects for Rust DebugFS

Danilo Krummrich linux-fsdevel lkml rust-for-linux 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest10 patches 29 repliesIn review
  2. v28 patches 22 repliesSuperseded
  3. v17 patches 24 repliesSuperseded

Changes in v3 from the cover letter

- 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.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10rust: fs: add new type file::Offsetrust/kernel/fs/file.rs+141 -14 replies
2/10rust: uaccess: add UserSliceReader::read_slice_partial()rust/kernel/uaccess.rs+16 -02 replies
3/10rust: uaccess: add UserSliceReader::read_slice_file()rust/kernel/uaccess.rs+25 -01 reply
4/10rust: uaccess: add UserSliceWriter::write_slice_partial()rust/kernel/uaccess.rs+16 -03 replies
5/10rust: uaccess: add UserSliceWriter::write_slice_file()rust/kernel/uaccess.rs+24 -011 replies
6/10rust: debugfs: support for binary large objectsrust/kernel/debugfs.rs rust/kernel/debugfs/file_ops.rs rust/kernel/debugfs/traits.rs+273 -74 replies
7/10rust: debugfs: support blobs from smart pointersrust/kernel/debugfs.rs rust/kernel/debugfs/traits.rs+173 -31 reply
8/10samples: rust: debugfs: add example for blobssamples/rust/rust_debugfs.rs+13 -00 replies
9/10rust: debugfs: support binary large objects for ScopedDirrust/kernel/debugfs.rs+44 -01 reply
10/10samples: rust: debugfs_scoped: add example for blobssamples/rust/rust_debugfs_scoped.rs+10 -40 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGreg Kroah-HartmanMatthew MaurerAlice RyhlMiguel OjedaAlexandre Courbot
SeriesA-b
1/10R-b R-b
2/10R-b R-b R-b R-b
3/10R-b
4/10R-b R-b R-b R-b
5/10R-b
6/10R-b R-b R-b
7/10R-b R-b R-b
8/10R-b R-b R-b
9/10R-b R-b R-b
10/10R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/10] Binary Large Objects for Rust DebugFS

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

Signature · 1 line
2.51.0