File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,16 @@ menuconfig SAMPLES_RUST
1010
1111if SAMPLES_RUST
1212
13+ config SAMPLE_RUST_VDEV
14+ tristate "Virtual Device"
15+ help
16+ This option builds the Rust virtual device module sample.
17+
18+ To compile this as a module, choose M here:
19+ the module will be called rust_vdev.
20+
21+ If unsure, say N.
22+
1323config SAMPLE_RUST_MINIMAL
1424 tristate "Minimal"
1525 help
Original file line number Diff line number Diff line change @@ -15,5 +15,6 @@ obj-$(CONFIG_SAMPLE_RUST_NETFILTER) += rust_netfilter.o
1515obj-$(CONFIG_SAMPLE_RUST_ECHO_SERVER) += rust_echo_server.o
1616obj-$(CONFIG_SAMPLE_RUST_FS) += rust_fs.o
1717obj-$(CONFIG_SAMPLE_RUST_SELFTESTS) += rust_selftests.o
18+ obj-$(CONFIG_SAMPLE_RUST_VDEV) += rust_vdev.o
1819
1920subdir-$(CONFIG_SAMPLE_RUST_HOSTPROGS) += hostprogs
Original file line number Diff line number Diff line change 1+ //! Virtual Device Module
2+ use kernel:: prelude:: * ;
3+
4+ module ! {
5+ type : VDev ,
6+ name: b"vdev" ,
7+ license: b"GPL" ,
8+ }
9+
10+ struct VDev ;
11+
12+ impl kernel:: Module for VDev {
13+ fn init ( _name : & ' static CStr , _module : & ' static ThisModule ) -> Result < Self > {
14+ // Print a banner to make sure our moudle is working
15+ pr_info ! ( "------------------------\n " ) ;
16+ pr_info ! ( "starting virtual device!\n " ) ;
17+ pr_info ! ( "------------------------\n " ) ;
18+ Ok ( VDev )
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments