[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPeSoet6KY9kxzqX@google.com>
Date: Tue, 21 Oct 2025 14:03:13 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org, ojeda@...nel.org,
alex.gaynor@...il.com, boqun.feng@...il.com, gary@...yguo.net,
bjorn3_gh@...tonmail.com, lossin@...nel.org, a.hindborg@...nel.org,
tmgross@...ch.edu, mmaurer@...gle.com, rust-for-linux@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/8] rust: debugfs: support for binary large objects
On Tue, Oct 21, 2025 at 12:26:16AM +0200, Danilo Krummrich wrote:
> Introduce support for read-only, write-only, and read-write binary files
> in Rust debugfs. This adds:
>
> - BinaryWriter and BinaryReader traits for writing to and reading from
> user slices in binary form.
> - New Dir methods: read_binary_file(), write_binary_file(),
> `read_write_binary_file`.
> - Corresponding FileOps implementations: BinaryReadFile,
> BinaryWriteFile, BinaryReadWriteFile.
>
> This allows kernel modules to expose arbitrary binary data through
> debugfs, with proper support for offsets and partial reads/writes.
>
> Signed-off-by: Danilo Krummrich <dakr@...nel.org>
> +/// Trait for types that can be constructed from a binary representation.
> +pub trait BinaryReader {
> + /// Reads the binary form of `self` from `reader`.
> + ///
> + /// `offset` is the requested offset into the binary representation of `self`.
> + ///
> + /// On success, returns the number of bytes read from `reader`.
> + fn read_from_slice(&self, reader: &mut UserSliceReader, offset: file::Offset) -> Result<usize>;
Maybe this should just take a `&mut Offset` to fit what I suggested
under the uaccess slice patch?
Alice
Powered by blists - more mailing lists