mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci, devices, virtio-devices, vmm: Refactor allocate_bars
Refactor PciDevice::allocate_bars trait and all implementations to take &mut SystemAllocator instead of &Arc<Mutex<SystemAllocator>>, removing double indirection. The caller in device_manager.rs now acquires the lock before calling allocate_bars. Signed-off-by: Chinmoy <daschinmoyy21@gmail.com>
This commit is contained in:
@@ -217,7 +217,7 @@ impl BusDevice for IvshmemDevice {
|
||||
impl PciDevice for IvshmemDevice {
|
||||
fn allocate_bars(
|
||||
&mut self,
|
||||
_allocator: &Arc<Mutex<SystemAllocator>>,
|
||||
_allocator: &mut SystemAllocator,
|
||||
mmio32_allocator: &mut AddressAllocator,
|
||||
mmio64_allocator: &mut AddressAllocator,
|
||||
resources: Option<Vec<Resource>>,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::CString;
|
||||
use std::sync::{Arc, Barrier, Mutex, RwLock};
|
||||
use std::sync::{Arc, Barrier, RwLock};
|
||||
use std::{io, result};
|
||||
|
||||
use log::{debug, warn};
|
||||
@@ -722,7 +722,7 @@ impl PciDevice for PvmemcontrolPciDevice {
|
||||
|
||||
fn allocate_bars(
|
||||
&mut self,
|
||||
_allocator: &Arc<Mutex<SystemAllocator>>,
|
||||
_allocator: &mut SystemAllocator,
|
||||
mmio32_allocator: &mut AddressAllocator,
|
||||
_mmio64_allocator: &mut AddressAllocator,
|
||||
resources: Option<Vec<Resource>>,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
use std::any::Any;
|
||||
use std::result;
|
||||
use std::sync::{Arc, Barrier, Mutex};
|
||||
use std::sync::{Arc, Barrier};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use event_monitor::event;
|
||||
@@ -174,7 +174,7 @@ impl PciDevice for PvPanicDevice {
|
||||
|
||||
fn allocate_bars(
|
||||
&mut self,
|
||||
_allocator: &Arc<Mutex<SystemAllocator>>,
|
||||
_allocator: &mut SystemAllocator,
|
||||
mmio32_allocator: &mut AddressAllocator,
|
||||
_mmio64_allocator: &mut AddressAllocator,
|
||||
resources: Option<Vec<Resource>>,
|
||||
|
||||
Reference in New Issue
Block a user