From 201228761192ea328b76a9258afdae30bd769aa2 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 3 Jul 2020 11:13:40 +0200 Subject: [PATCH] vmm: memory_manager: Rename fd variable into something more meaningful The fd naming is quite KVM specific. Since we're now using the hypervisor crate abstractions, we can rename those into something more readable and meaningful. Signed-off-by: Samuel Ortiz --- vmm/src/memory_manager.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vmm/src/memory_manager.rs b/vmm/src/memory_manager.rs index a34c18221..93e80c0e7 100644 --- a/vmm/src/memory_manager.rs +++ b/vmm/src/memory_manager.rs @@ -55,7 +55,7 @@ pub struct MemoryManager { next_kvm_memory_slot: u32, start_of_device_area: GuestAddress, end_of_device_area: GuestAddress, - pub fd: Arc, + pub vm: Arc, hotplug_slots: Vec, selected_slot: usize, backing_file: Option, @@ -213,7 +213,7 @@ impl BusDevice for MemoryManager { impl MemoryManager { pub fn new( - fd: Arc, + vm: Arc, config: &MemoryConfig, ext_regions: Option>, prefault: bool, @@ -323,7 +323,7 @@ impl MemoryManager { next_kvm_memory_slot: 0, start_of_device_area, end_of_device_area, - fd, + vm, hotplug_slots, selected_slot: 0, backing_file: config.file.clone(), @@ -380,7 +380,7 @@ impl MemoryManager { pub fn new_from_snapshot( snapshot: &Snapshot, - fd: Arc, + vm: Arc, config: &MemoryConfig, source_url: &str, prefault: bool, @@ -416,10 +416,10 @@ impl MemoryManager { // allows for a faster VM restoration and does not require us to // fill the memory content, hence we can return right away. if config.file.is_none() { - return MemoryManager::new(fd, config, Some(ext_regions), prefault); + return MemoryManager::new(vm, config, Some(ext_regions), prefault); }; - let memory_manager = MemoryManager::new(fd, config, None, false)?; + let memory_manager = MemoryManager::new(vm, config, None, false)?; let guest_memory = memory_manager.lock().unwrap().guest_memory(); // In case the previous config was using a backing file, this means @@ -688,7 +688,7 @@ impl MemoryManager { }, }; - self.fd + self.vm .set_user_memory_region(mem_region) .map_err(Error::SetUserMemoryRegion)?; @@ -741,7 +741,7 @@ impl MemoryManager { flags: 0, }; - self.fd + self.vm .set_user_memory_region(mem_region) .map_err(Error::SetUserMemoryRegion)?;