]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: debugfs: Add support for read-only files
authorMatthew Maurer <mmaurer@google.com>
Thu, 4 Sep 2025 21:13:53 +0000 (21:13 +0000)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 10 Sep 2025 16:58:11 +0000 (18:58 +0200)
commit5e40b591cb46c0379d5406fa5548c9b2a3801353
tree9426414a02a60cebd4d9638f5491de36cf192bc1
parent7f201ca18c825592e392596a2fca2374dd2a4dfe
rust: debugfs: Add support for read-only files

Extends the `debugfs` API to support creating read-only files. This
is done via the `Dir::read_only_file` method, which takes a data object
that implements the `Writer` trait.

The file's content is generated by the `Writer` implementation, and the
file is automatically removed when the returned `File` handle is
dropped.

Signed-off-by: Matthew Maurer <mmaurer@google.com>
Tested-by: Dirk Behme <dirk.behme@de.bosch.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250904-debugfs-rust-v11-2-7d12a165685a@google.com
[ Fixup build failure when CONFIG_DEBUGFS=n. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/debugfs.rs
rust/kernel/debugfs/entry.rs
rust/kernel/debugfs/file_ops.rs [new file with mode: 0644]
rust/kernel/debugfs/traits.rs [new file with mode: 0644]