Skip to content

Commit 0448912

Browse files
committed
chore(vm): clean up initialization of VmPeripherals
1 parent ce3a8b5 commit 0448912

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/vm.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,17 +320,15 @@ impl<VirtBackend: VirtualizationBackend> UhyveVm<VirtBackend> {
320320
#[cfg(not(target_os = "linux"))]
321321
let mut mem = MmapMemory::new(memory_size, guest_address, false, false);
322322

323-
// TODO: file_mapping not in kernel_info
324323
let mounts: Vec<_> = file_mapping.get_all_guest_dirs().collect();
325-
let file_mapping = Mutex::new(file_mapping);
326324

327325
let serial = UhyveSerial::from_params(&params.output)?;
328326

329327
// Takes place before the kernel is actually loaded.
330328
#[cfg(target_os = "linux")]
331329
Self::landlock_init(
332330
&params.file_isolation,
333-
&file_mapping.lock().unwrap(),
331+
&file_mapping,
334332
&kernel_path,
335333
&params.output,
336334
#[cfg(feature = "instrument")]
@@ -362,13 +360,12 @@ impl<VirtBackend: VirtualizationBackend> UhyveVm<VirtBackend> {
362360
stack_address,
363361
});
364362

365-
// create virtio interface
366-
let virtio_device = Mutex::new(VirtioNetPciDevice::new());
367-
368363
let peripherals = Arc::new(VmPeripherals {
369364
mem,
370-
virtio_device,
371-
file_mapping,
365+
// create virtio interface
366+
virtio_device: Mutex::new(VirtioNetPciDevice::new()),
367+
// TODO: file_mapping not in kernel_info
368+
file_mapping: Mutex::new(file_mapping),
372369
serial,
373370
});
374371

0 commit comments

Comments
 (0)