diff options
| author | Matthew Maurer <mmaurer@google.com> | 2025-09-04 21:13:58 +0000 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2025-09-10 21:05:11 +0200 |
| commit | d4a5d397c7fb1ca967e0da202cac196e7324f4ea (patch) | |
| tree | 458bbfcc6faa96487da678a9eb3b6452a1ebdd69 /samples/rust/Kconfig | |
| parent | 5f0942581dd0218c4449dac0639cf362e943c302 (diff) | |
samples: rust: Add scoped debugfs sample driver
Adds a new sample driver `rust_scoped_debugfs` that demonstrates the
use of the scoped debugfs APIs.
The driver creates a `control` directory with two write-only files,
`create` and `remove`. Writing a name and a series of numbers to
`create` will create a new subdirectory under a `dynamic` directory.
This new subdirectory will contain files that expose the numbers as
atomic values.
Writing a name to `remove` will remove the corresponding subdirectory
from the `dynamic` directory.
This sample serves as an example of how to use the `debugfs::Scope`
and `debugfs::ScopedDir` APIs to create and manage debugfs entries
that are tied to the lifetime of a data structure.
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-7-7d12a165685a@google.com
[ Rename "scoped_debugfs" -> "debugfs_scoped", fix up
Result<(), Error> -> Result. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'samples/rust/Kconfig')
| -rw-r--r-- | samples/rust/Kconfig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/samples/rust/Kconfig b/samples/rust/Kconfig index 01101db41ae3..66360cdf048f 100644 --- a/samples/rust/Kconfig +++ b/samples/rust/Kconfig @@ -73,6 +73,17 @@ config SAMPLE_RUST_DEBUGFS If unsure, say N. +config SAMPLE_RUST_DEBUGFS_SCOPED + tristate "Scoped DebugFS Test Module" + depends on DEBUG_FS + help + This option builds the Rust Scoped DebugFS Test module sample. + + To compile this as a module, choose M here: + the module will be called rust_debugfs_scoped. + + If unsure, say N. + config SAMPLE_RUST_DRIVER_PCI tristate "PCI Driver" depends on PCI |