diff --git a/src/bin/uhyve.rs b/src/bin/uhyve.rs index 2beb6ab5..3f7b962a 100644 --- a/src/bin/uhyve.rs +++ b/src/bin/uhyve.rs @@ -57,13 +57,11 @@ struct Args { /// Paths that the kernel should be able to view, read or write. /// - /// Files and directories are separated using commas. /// Desired mount paths must be explicitly defined after a colon. /// - /// Example: --file_map host_directory:/root/guest_directory,file.txt:/root/my_file.txt - #[arg(value_delimiter = ',')] - #[clap(long, env = "HERMIT_FILE_MAP")] - file_map: Option>, + /// Example: --mount host_dir:guest_dir --mount file.txt:guest_file.txt + #[clap(long)] + mount: Option>, /// The kernel to execute #[clap(value_parser)] @@ -253,7 +251,7 @@ impl From for Params { }, #[cfg(target_os = "linux")] gdb_port, - file_map, + mount, kernel: _, kernel_args, } = args; @@ -267,7 +265,7 @@ impl From for Params { cpu_count, #[cfg(target_os = "linux")] pit, - file_map, + mount, #[cfg(target_os = "linux")] gdb_port, #[cfg(target_os = "macos")] diff --git a/src/hypercall.rs b/src/hypercall.rs index 0d8470fe..4c2480e8 100644 --- a/src/hypercall.rs +++ b/src/hypercall.rs @@ -89,7 +89,7 @@ pub fn open(mem: &MmapMemory, sysopen: &mut OpenParams, file_map: &Option hypercall::open( &self.parent_vm.mem, sysopen, - &self.parent_vm.file_map, + &self.parent_vm.mount, ), Hypercall::FileRead(sysread) => { hypercall::read(&self.parent_vm.mem, sysread) diff --git a/src/macos/aarch64/vcpu.rs b/src/macos/aarch64/vcpu.rs index 11d1ee8d..26708910 100644 --- a/src/macos/aarch64/vcpu.rs +++ b/src/macos/aarch64/vcpu.rs @@ -193,7 +193,7 @@ impl VirtualCPU for XhyveCpu { Hypercall::FileOpen(sysopen) => hypercall::open( &self.parent_vm.mem, sysopen, - &self.parent_vm.file_map, + &self.parent_vm.mount, ), Hypercall::FileRead(sysread) => { hypercall::read(&self.parent_vm.mem, sysread) diff --git a/src/macos/x86_64/vcpu.rs b/src/macos/x86_64/vcpu.rs index 0e483ff9..df7dd348 100644 --- a/src/macos/x86_64/vcpu.rs +++ b/src/macos/x86_64/vcpu.rs @@ -737,11 +737,9 @@ impl VirtualCPU for XhyveCpu { } Hypercall::FileClose(sysclose) => hypercall::close(sysclose), Hypercall::FileLseek(syslseek) => hypercall::lseek(syslseek), - Hypercall::FileOpen(sysopen) => hypercall::open( - &self.parent_vm.mem, - sysopen, - &self.parent_vm.file_map, - ), + Hypercall::FileOpen(sysopen) => { + hypercall::open(&self.parent_vm.mem, sysopen, &self.parent_vm.mount) + } Hypercall::FileRead(sysread) => { hypercall::read(&self.parent_vm.mem, sysread) } diff --git a/src/params.rs b/src/params.rs index 0cd1a8a5..e067b59a 100644 --- a/src/params.rs +++ b/src/params.rs @@ -37,7 +37,7 @@ pub struct Params { pub kernel_args: Vec, /// Paths that should be mounted on-device - pub file_map: Option>, + pub mount: Option>, } #[allow(clippy::derivable_impls)] @@ -54,7 +54,7 @@ impl Default for Params { pit: false, cpu_count: Default::default(), gdb_port: Default::default(), - file_map: Default::default(), + mount: Default::default(), kernel_args: Default::default(), } } diff --git a/src/vm.rs b/src/vm.rs index 1b202df9..c39c0183 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -119,7 +119,7 @@ pub struct UhyveVm { pub virtio_device: Arc>, #[allow(dead_code)] // gdb is not supported on macos pub(super) gdb_port: Option, - pub(crate) file_map: Option, + pub(crate) mount: Option, _vcpu_type: PhantomData, } impl UhyveVm { @@ -151,7 +151,7 @@ impl UhyveVm { "gdbstub is only supported with one CPU" ); - let file_map = params.file_map.as_deref().and_then(UhyveFileMap::new); + let mount = params.mount.as_deref().and_then(UhyveFileMap::new); let mut vm = Self { offset: 0, @@ -165,7 +165,7 @@ impl UhyveVm { verbose: params.verbose, virtio_device, gdb_port: params.gdb_port, - file_map, + mount, _vcpu_type: PhantomData, }; diff --git a/tests/common.rs b/tests/common.rs index 11c21b8c..699d7537 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -69,7 +69,7 @@ pub fn run_vm_with_file_map(kernel_path: PathBuf, file_map: Vec) -> i32 .unwrap() .try_into() .unwrap(), - file_map: Some(file_map), + mount: Some(file_map), ..Default::default() };