Skip to content

Commit 8d89757

Browse files
committed
samples: rust: use module_fs macro in sample
This eliminates the need to implement the `kernel::Module` trait as one is provided by the fs module through the macro. Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
1 parent 3a59eac commit 8d89757

1 file changed

Lines changed: 3 additions & 17 deletions

File tree

samples/rust/rust_rofs.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
//! Rust read-only file system sample.
44
55
use kernel::prelude::*;
6-
use kernel::{c_str, fs, macros::pin_data};
6+
use kernel::{c_str, fs};
77

8-
module! {
9-
type: RoFsModule,
8+
kernel::module_fs! {
9+
type: RoFs,
1010
name: "rust_rofs",
1111
author: "Rust for Linux Contributors",
1212
description: "Rust read-only file system sample",
@@ -17,17 +17,3 @@ struct RoFs;
1717
impl fs::FileSystem for RoFs {
1818
const NAME: &'static CStr = c_str!("rust-fs");
1919
}
20-
21-
#[pin_data]
22-
struct RoFsModule {
23-
#[pin]
24-
fs_reg: fs::Registration,
25-
}
26-
27-
impl kernel::InPlaceModule for RoFsModule {
28-
fn init(module: &'static ThisModule) -> impl PinInit<Self, Error> {
29-
try_pin_init!(Self {
30-
fs_reg <- fs::Registration::new::<RoFs>(module),
31-
})
32-
}
33-
}

0 commit comments

Comments
 (0)