diff --git a/src/bin/uhyve.rs b/src/bin/uhyve.rs index 2d2f9a43..b471678d 100644 --- a/src/bin/uhyve.rs +++ b/src/bin/uhyve.rs @@ -63,11 +63,11 @@ struct Args { /// Paths that the kernel should be able to view, read or write. /// - /// Desired mount paths must be explicitly defined after a colon. + /// Desired paths must be explicitly defined after a colon. /// - /// Example: --mount host_dir:guest_dir --mount file.txt:guest_file.txt + /// Example: --file-mapping host_dir:guest_dir --file-mapping file.txt:guest_file.txt #[clap(long)] - mount: Vec, + file_mapping: Vec, /// The kernel to execute #[clap(value_parser)] @@ -256,7 +256,7 @@ impl From for Params { }, #[cfg(target_os = "linux")] gdb_port, - mount, + file_mapping, kernel: _, kernel_args, output, @@ -271,7 +271,7 @@ impl From for Params { cpu_count, #[cfg(target_os = "linux")] pit, - mount, + file_mapping, #[cfg(target_os = "linux")] gdb_port, #[cfg(target_os = "macos")] diff --git a/src/linux/x86_64/kvm_cpu.rs b/src/linux/x86_64/kvm_cpu.rs index 18b7735d..6399ef4d 100644 --- a/src/linux/x86_64/kvm_cpu.rs +++ b/src/linux/x86_64/kvm_cpu.rs @@ -448,7 +448,7 @@ impl VirtualCPU for KvmCpu { Hypercall::FileOpen(sysopen) => hypercall::open( &self.parent_vm.mem, sysopen, - &mut self.parent_vm.mount.lock().unwrap(), + &mut self.parent_vm.file_mapping.lock().unwrap(), &self.parent_vm.tempdir, ), Hypercall::FileRead(sysread) => { @@ -461,7 +461,7 @@ impl VirtualCPU for KvmCpu { Hypercall::FileUnlink(sysunlink) => hypercall::unlink( &self.parent_vm.mem, sysunlink, - &mut self.parent_vm.mount.lock().unwrap(), + &mut self.parent_vm.file_mapping.lock().unwrap(), ), Hypercall::SerialWriteByte(buf) => self .parent_vm diff --git a/src/macos/aarch64/vcpu.rs b/src/macos/aarch64/vcpu.rs index eae912d5..034851f5 100644 --- a/src/macos/aarch64/vcpu.rs +++ b/src/macos/aarch64/vcpu.rs @@ -239,7 +239,7 @@ impl VirtualCPU for XhyveCpu { Hypercall::FileOpen(sysopen) => hypercall::open( &self.parent_vm.mem, sysopen, - &mut self.parent_vm.mount.lock().unwrap(), + &mut self.parent_vm.file_mapping.lock().unwrap(), &self.parent_vm.tempdir, ), Hypercall::FileRead(sysread) => { @@ -251,7 +251,7 @@ impl VirtualCPU for XhyveCpu { Hypercall::FileUnlink(sysunlink) => hypercall::unlink( &self.parent_vm.mem, sysunlink, - &mut self.parent_vm.mount.lock().unwrap(), + &mut self.parent_vm.file_mapping.lock().unwrap(), ), _ => { panic! {"Hypercall {hypercall:?} not implemented on macos-aarch64"} diff --git a/src/macos/x86_64/vcpu.rs b/src/macos/x86_64/vcpu.rs index 71c70d0a..baff0ca4 100644 --- a/src/macos/x86_64/vcpu.rs +++ b/src/macos/x86_64/vcpu.rs @@ -777,7 +777,7 @@ impl VirtualCPU for XhyveCpu { Hypercall::FileOpen(sysopen) => hypercall::open( &self.parent_vm.mem, sysopen, - &mut self.parent_vm.mount.lock().unwrap(), + &mut self.parent_vm.file_mapping.lock().unwrap(), &self.parent_vm.tempdir, ), Hypercall::FileRead(sysread) => { @@ -789,7 +789,7 @@ impl VirtualCPU for XhyveCpu { Hypercall::FileUnlink(sysunlink) => hypercall::unlink( &self.parent_vm.mem, sysunlink, - &mut self.parent_vm.mount.lock().unwrap(), + &mut self.parent_vm.file_mapping.lock().unwrap(), ), Hypercall::SerialWriteByte(buf) => { diff --git a/src/params.rs b/src/params.rs index e26209e0..547bb918 100644 --- a/src/params.rs +++ b/src/params.rs @@ -35,8 +35,8 @@ pub struct Params { /// Arguments to forward to the kernel pub kernel_args: Vec, - /// Paths that should be mounted on-device - pub mount: Vec, + /// Mapped paths between the guest and host OS + pub file_mapping: Vec, /// Kernel output handling pub output: Output, @@ -58,7 +58,7 @@ impl Default for Params { pit: false, cpu_count: Default::default(), gdb_port: Default::default(), - mount: Default::default(), + file_mapping: Default::default(), kernel_args: Default::default(), output: Default::default(), stats: false, diff --git a/src/vm.rs b/src/vm.rs index 2b379646..85ffea68 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -152,7 +152,7 @@ pub struct UhyveVm { pub virtio_device: Arc>, #[allow(dead_code)] // gdb is not supported on macos pub(super) gdb_port: Option, - pub(crate) mount: Mutex, + pub(crate) file_mapping: Mutex, pub(crate) virt_backend: VirtBackend, params: Params, pub output: Output, @@ -187,7 +187,7 @@ impl UhyveVm { ); let tempdir = create_temp_dir(); - let mount = Mutex::new(UhyveFileMap::new(¶ms.mount)); + let file_mapping = Mutex::new(UhyveFileMap::new(¶ms.file_mapping)); let output = match params.output { params::Output::None => Output::None, @@ -222,7 +222,7 @@ impl UhyveVm { boot_info: ptr::null(), virtio_device, gdb_port: params.gdb_port, - mount, + file_mapping, virt_backend, params, output, @@ -388,7 +388,7 @@ impl fmt::Debug for UhyveVm { .field("boot_info", &self.boot_info) .field("virtio_device", &self.virtio_device) .field("params", &self.params) - .field("mount", &self.mount) + .field("file_mapping", &self.file_mapping) .field("tempdir", &self.tempdir) .finish() } diff --git a/tests/fs-test.rs b/tests/fs-test.rs index 1d7b84f3..f0efc29e 100644 --- a/tests/fs-test.rs +++ b/tests/fs-test.rs @@ -42,7 +42,7 @@ fn uhyvefilemap_test() { .unwrap() .try_into() .unwrap(), - mount: vec!["foo.txt:wrong.txt".to_string()], + file_mapping: vec!["foo.txt:wrong.txt".to_string()], ..Default::default() }; @@ -52,7 +52,7 @@ fn uhyvefilemap_test() { assert_eq!(res.code, 0); assert!(!output_path.exists()); - params.mount = vec!["foo.txt:foo.txt".to_string()]; + params.file_mapping = vec!["foo.txt:foo.txt".to_string()]; vm = UhyveVm::new(bin_path, params).unwrap(); res = vm.run(None); assert_eq!(res.code, 0); diff --git a/tests/serial.rs b/tests/serial.rs index 4aa2b85b..ed7588f7 100644 --- a/tests/serial.rs +++ b/tests/serial.rs @@ -37,7 +37,7 @@ fn serial_file_output_test() { .try_into() .unwrap(), output: Output::File(output_path.clone()), - mount: vec!["testserialout.txt:testserialout.txt".to_string()], + file_mapping: vec!["testserialout.txt:testserialout.txt".to_string()], ..Default::default() }; let vm = UhyveVm::new(bin_path, params).unwrap();