summaryrefslogtreecommitdiff
path: root/ayafs-core/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'ayafs-core/src/bin')
-rw-r--r--ayafs-core/src/bin/main.rs44
1 files changed, 44 insertions, 0 deletions
diff --git a/ayafs-core/src/bin/main.rs b/ayafs-core/src/bin/main.rs
new file mode 100644
index 0000000..25504b9
--- /dev/null
+++ b/ayafs-core/src/bin/main.rs
@@ -0,0 +1,44 @@
+use std::path::PathBuf;
+use std::sync::Arc;
+use clap::Parser;
+use fuser::MountOption;
+use log::LevelFilter;
+use aya::AyaFS;
+use aya::block_device::disk::Disk;
+
+#[derive(Parser, Debug)]
+#[command(author, version, about)]
+struct Args {
+ mount_point: Option<String>,
+ #[arg(short, action = clap::ArgAction::Count)]
+ verbosity: u8,
+ #[arg(long)]
+ auto_unmount: bool,
+ #[arg(long)]
+ allow_root: bool,
+}
+
+fn main() {
+ let args = Args::parse();
+ let mount_point = args.mount_point.unwrap();
+ let verbosity = args.verbosity;
+ let log_level = match verbosity {
+ 0 => LevelFilter::Error,
+ 1 => LevelFilter::Warn,
+ 2 => LevelFilter::Info,
+ 3 => LevelFilter::Debug,
+ _ => LevelFilter::Trace,
+ };
+ env_logger::builder().filter_level(log_level).init();
+ let options = vec![
+ // MountOption::RO,
+ MountOption::FSName("hello".to_string()),
+ MountOption::AutoUnmount,
+ MountOption::AllowRoot,
+ ];
+ let disk = Arc::new(Disk::new(PathBuf::from("/dev/nvme0n1p4")));
+ // let disk = Arc::new(MemoryDisk::new(16384));
+ let filesystem = AyaFS::new(disk, 7864320);
+
+ fuser::mount2(filesystem, mount_point, &options).unwrap();
+} \ No newline at end of file