mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-03 20:15:45 +00:00
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 <sameo@linux.intel.com>
This commit is contained in:
parent
acfe5eb94f
commit
2012287611
@ -55,7 +55,7 @@ pub struct MemoryManager {
|
|||||||
next_kvm_memory_slot: u32,
|
next_kvm_memory_slot: u32,
|
||||||
start_of_device_area: GuestAddress,
|
start_of_device_area: GuestAddress,
|
||||||
end_of_device_area: GuestAddress,
|
end_of_device_area: GuestAddress,
|
||||||
pub fd: Arc<dyn hypervisor::Vm>,
|
pub vm: Arc<dyn hypervisor::Vm>,
|
||||||
hotplug_slots: Vec<HotPlugState>,
|
hotplug_slots: Vec<HotPlugState>,
|
||||||
selected_slot: usize,
|
selected_slot: usize,
|
||||||
backing_file: Option<PathBuf>,
|
backing_file: Option<PathBuf>,
|
||||||
@ -213,7 +213,7 @@ impl BusDevice for MemoryManager {
|
|||||||
|
|
||||||
impl MemoryManager {
|
impl MemoryManager {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
fd: Arc<dyn hypervisor::Vm>,
|
vm: Arc<dyn hypervisor::Vm>,
|
||||||
config: &MemoryConfig,
|
config: &MemoryConfig,
|
||||||
ext_regions: Option<Vec<MemoryRegion>>,
|
ext_regions: Option<Vec<MemoryRegion>>,
|
||||||
prefault: bool,
|
prefault: bool,
|
||||||
@ -323,7 +323,7 @@ impl MemoryManager {
|
|||||||
next_kvm_memory_slot: 0,
|
next_kvm_memory_slot: 0,
|
||||||
start_of_device_area,
|
start_of_device_area,
|
||||||
end_of_device_area,
|
end_of_device_area,
|
||||||
fd,
|
vm,
|
||||||
hotplug_slots,
|
hotplug_slots,
|
||||||
selected_slot: 0,
|
selected_slot: 0,
|
||||||
backing_file: config.file.clone(),
|
backing_file: config.file.clone(),
|
||||||
@ -380,7 +380,7 @@ impl MemoryManager {
|
|||||||
|
|
||||||
pub fn new_from_snapshot(
|
pub fn new_from_snapshot(
|
||||||
snapshot: &Snapshot,
|
snapshot: &Snapshot,
|
||||||
fd: Arc<dyn hypervisor::Vm>,
|
vm: Arc<dyn hypervisor::Vm>,
|
||||||
config: &MemoryConfig,
|
config: &MemoryConfig,
|
||||||
source_url: &str,
|
source_url: &str,
|
||||||
prefault: bool,
|
prefault: bool,
|
||||||
@ -416,10 +416,10 @@ impl MemoryManager {
|
|||||||
// allows for a faster VM restoration and does not require us to
|
// allows for a faster VM restoration and does not require us to
|
||||||
// fill the memory content, hence we can return right away.
|
// fill the memory content, hence we can return right away.
|
||||||
if config.file.is_none() {
|
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();
|
let guest_memory = memory_manager.lock().unwrap().guest_memory();
|
||||||
|
|
||||||
// In case the previous config was using a backing file, this means
|
// 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)
|
.set_user_memory_region(mem_region)
|
||||||
.map_err(Error::SetUserMemoryRegion)?;
|
.map_err(Error::SetUserMemoryRegion)?;
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ impl MemoryManager {
|
|||||||
flags: 0,
|
flags: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.fd
|
self.vm
|
||||||
.set_user_memory_region(mem_region)
|
.set_user_memory_region(mem_region)
|
||||||
.map_err(Error::SetUserMemoryRegion)?;
|
.map_err(Error::SetUserMemoryRegion)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user