Skip to content

Commit fb6844e

Browse files
committed
symlinks
Signed-off-by: Fabien Parent <[email protected]>
1 parent 16083a3 commit fb6844e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

samples/rust/rust_debugfs.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ debugfs::attribute_signed!(IncAttribute, "%#d\n");
6666
struct RustDebugfs {
6767
_sample_file: debugfs::PinnedRegistration,
6868
_inc_attribute: debugfs::PinnedRegistration<Arc<IncAttribute>>,
69+
_symlink: debugfs::Registration<()>,
6970
}
7071
impl kernel::Module for RustDebugfs {
7172
fn init(_module: &'static ThisModule) -> Result<Self> {
@@ -81,6 +82,12 @@ impl kernel::Module for RustDebugfs {
8182
Some(dir.clone()),
8283
)?;
8384

85+
let symlink = debugfs::Registration::register_symlink(
86+
c_str!("sample_symlink"),
87+
Some(dir.clone()),
88+
c_str!("sample"),
89+
)?;
90+
8491
let attribute = Arc::pin_init(pin_init!(IncAttribute {
8592
data <- kernel::new_spinlock!(0x42),
8693
}))?;
@@ -93,6 +100,7 @@ impl kernel::Module for RustDebugfs {
93100
Ok(Self {
94101
_sample_file: sample_file,
95102
_inc_attribute: inc_attribute,
103+
_symlink: symlink,
96104
})
97105
}
98106
}

0 commit comments

Comments
 (0)