[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPI9-_6k4ZUKtA1C@google.com>
Date: Fri, 17 Oct 2025 13:00:43 +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-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] rust: debugfs: support binary large objects for ScopedDir
On Sat, Oct 04, 2025 at 12:26:43AM +0200, Danilo Krummrich wrote:
> Add support for creating binary debugfs files via ScopedDir. This
> mirrors the existing functionality for Dir, but without producing an
> owning handle -- files are automatically removed when the associated
> Scope is dropped.
>
> Signed-off-by: Danilo Krummrich <dakr@...nel.org>
> ---
> rust/kernel/debugfs.rs | 45 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
>
> diff --git a/rust/kernel/debugfs.rs b/rust/kernel/debugfs.rs
> index 3c3bbcc126ef..0eb1719e4953 100644
> --- a/rust/kernel/debugfs.rs
> +++ b/rust/kernel/debugfs.rs
> @@ -531,6 +531,20 @@ pub fn read_only_file<T: Writer + Send + Sync + 'static>(&self, name: &CStr, dat
> self.create_file(name, data, &T::FILE_OPS)
> }
>
> + /// Creates a read-only binary file in this directory.
> + ///
> + /// The file's contents are produced by invoking [`BinaryWriter::write_to_slice`].
> + ///
> + /// This function does not produce an owning handle to the file. The created file is removed
> + /// when the [`Scope`] that this directory belongs to is dropped.
> + pub fn read_binary_file<T: BinaryWriter + Send + Sync + 'static>(
> + &self,
> + name: &CStr,
> + data: &'data T,
> + ) {
> + self.create_file(name, data, &T::FILE_OPS)
Why isn't <T as MyTrait> need here when it's needed for the other
methods?
Alice
Powered by blists - more mailing lists