Skip to content

Commit

Permalink
symlinks
Browse files Browse the repository at this point in the history
Signed-off-by: Fabien Parent <[email protected]>
  • Loading branch information
Fabo committed Dec 7, 2023
1 parent 16083a3 commit fb6844e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samples/rust/rust_debugfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ debugfs::attribute_signed!(IncAttribute, "%#d\n");
struct RustDebugfs {
_sample_file: debugfs::PinnedRegistration,
_inc_attribute: debugfs::PinnedRegistration<Arc<IncAttribute>>,
_symlink: debugfs::Registration<()>,
}
impl kernel::Module for RustDebugfs {
fn init(_module: &'static ThisModule) -> Result<Self> {
Expand All @@ -81,6 +82,12 @@ impl kernel::Module for RustDebugfs {
Some(dir.clone()),
)?;

let symlink = debugfs::Registration::register_symlink(
c_str!("sample_symlink"),
Some(dir.clone()),
c_str!("sample"),
)?;

let attribute = Arc::pin_init(pin_init!(IncAttribute {
data <- kernel::new_spinlock!(0x42),
}))?;
Expand All @@ -93,6 +100,7 @@ impl kernel::Module for RustDebugfs {
Ok(Self {
_sample_file: sample_file,
_inc_attribute: inc_attribute,
_symlink: symlink,
})
}
}
Expand Down

0 comments on commit fb6844e

Please sign in to comment.