@@ -41,6 +41,16 @@ config SAMPLE_RUST_PRINT
If unsure, say N.
+config SAMPLE_RUST_ROFS
+ tristate "Read-only file system"
+ help
+ This option builds the Rust read-only file system sample.
+
+ To compile this as a module, choose M here:
+ the module will be called rust_rofs.
+
+ If unsure, say N.
+
config SAMPLE_RUST_HOSTPROGS
bool "Host programs"
help
@@ -3,5 +3,6 @@
obj-$(CONFIG_SAMPLE_RUST_MINIMAL) += rust_minimal.o
obj-$(CONFIG_SAMPLE_RUST_INPLACE) += rust_inplace.o
obj-$(CONFIG_SAMPLE_RUST_PRINT) += rust_print.o
+obj-$(CONFIG_SAMPLE_RUST_ROFS) += rust_rofs.o
subdir-$(CONFIG_SAMPLE_RUST_HOSTPROGS) += hostprogs
new file mode 100644
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+
+//! Rust read-only file system sample.
+
+use kernel::prelude::*;
+use kernel::{c_str, fs};
+
+kernel::module_fs! {
+ type: RoFs,
+ name: "rust_rofs",
+ author: "Rust for Linux Contributors",
+ description: "Rust read-only file system sample",
+ license: "GPL",
+}
+
+struct RoFs;
+impl fs::FileSystem for RoFs {
+ const NAME: &'static CStr = c_str!("rust_rofs");
+}