Merge "Introduce authfs_service"
diff --git a/authfs/src/fusefs.rs b/authfs/src/fusefs.rs
index 77743bd..1b0e935 100644
--- a/authfs/src/fusefs.rs
+++ b/authfs/src/fusefs.rs
@@ -380,6 +380,7 @@
pub fn loop_forever(
file_pool: BTreeMap<Inode, FileConfig>,
mountpoint: &Path,
+ extra_options: &Option<String>,
) -> Result<(), fuse::Error> {
let max_read: u32 = 65536;
let max_write: u32 = 65536;
@@ -389,20 +390,20 @@
.open("/dev/fuse")
.expect("Failed to open /dev/fuse");
- fuse::mount(
- mountpoint,
- "authfs",
- libc::MS_NOSUID | libc::MS_NODEV,
- &[
- MountOption::FD(dev_fuse.as_raw_fd()),
- MountOption::RootMode(libc::S_IFDIR | libc::S_IXUSR | libc::S_IXGRP | libc::S_IXOTH),
- MountOption::AllowOther,
- MountOption::UserId(0),
- MountOption::GroupId(0),
- MountOption::MaxRead(max_read),
- ],
- )
- .expect("Failed to mount fuse");
+ let mut mount_options = vec![
+ MountOption::FD(dev_fuse.as_raw_fd()),
+ MountOption::RootMode(libc::S_IFDIR | libc::S_IXUSR | libc::S_IXGRP | libc::S_IXOTH),
+ MountOption::AllowOther,
+ MountOption::UserId(0),
+ MountOption::GroupId(0),
+ MountOption::MaxRead(max_read),
+ ];
+ if let Some(value) = extra_options {
+ mount_options.push(MountOption::Extra(value));
+ }
+
+ fuse::mount(mountpoint, "authfs", libc::MS_NOSUID | libc::MS_NODEV, &mount_options)
+ .expect("Failed to mount fuse");
fuse::worker::start_message_loop(
dev_fuse,
diff --git a/authfs/src/main.rs b/authfs/src/main.rs
index d583f92..32ea3de 100644
--- a/authfs/src/main.rs
+++ b/authfs/src/main.rs
@@ -56,6 +56,10 @@
#[structopt(long)]
cid: Option<u32>,
+ /// Extra options to FUSE
+ #[structopt(short = "o")]
+ extra_options: Option<String>,
+
/// A read-only remote file with integrity check. Can be multiple.
///
/// For example, `--remote-verified-file 5:10:1234:/path/to/cert` tells the filesystem to
@@ -339,6 +343,6 @@
);
let file_pool = prepare_file_pool(&args)?;
- fusefs::loop_forever(file_pool, &args.mount_point)?;
+ fusefs::loop_forever(file_pool, &args.mount_point, &args.extra_options)?;
bail!("Unexpected exit after the handler loop")
}