Skip to content

Commit

Permalink
add option to specify the mount point of uhyve's filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Jan 4, 2024
1 parent 3816cff commit 604e3b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ impl Default for Cli {
let gateway = expect_arg(words.next(), word.as_str());
env_vars.insert(String::from("HERMIT_GATEWAY"), gateway);
}
"-mount" => {
let gateway = expect_arg(words.next(), word.as_str());
env_vars.insert(String::from("UHYVE_MOUNT"), gateway);
}
"--" => args.extend(&mut words),
_ if image_path.is_none() => image_path = Some(word),
word => panic!(
Expand Down
4 changes: 2 additions & 2 deletions src/fs/uhyve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,12 @@ impl VfsNode for UhyveDirectory {
pub(crate) fn init() {
info!("Try to initialize uhyve filesystem");
if is_uhyve() {
let mount_point = "/host".to_string();
let mount_point = hermit_var_or!("UHYVE_MOUNT", "/host").to_string();
info!("Mounting virtio-fs at {}", mount_point);
fs::FILESYSTEM
.get()
.unwrap()
.mount(mount_point.as_str(), Box::new(UhyveDirectory::new()))
.mount(&mount_point, Box::new(UhyveDirectory::new()))
.expect("Mount failed. Duplicate mount_point?");
}
}

0 comments on commit 604e3b4

Please sign in to comment.