mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +00:00
vmm: Make DeviceConfig owned
Convert Path to PathBuf and remove the associated lifetime. Fixes #298 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
36137232f0
commit
5f8a62f3d0
@ -451,14 +451,14 @@ impl ConsoleConfig {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DeviceConfig<'a> {
|
||||
pub path: &'a Path,
|
||||
pub struct DeviceConfig {
|
||||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
impl<'a> DeviceConfig<'a> {
|
||||
pub fn parse(device: &'a str) -> Result<Self> {
|
||||
impl DeviceConfig {
|
||||
pub fn parse(device: &str) -> Result<Self> {
|
||||
Ok(DeviceConfig {
|
||||
path: Path::new(device),
|
||||
path: PathBuf::from(device),
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -620,7 +620,7 @@ pub struct VmConfig<'a> {
|
||||
pub pmem: Option<Vec<PmemConfig>>,
|
||||
pub serial: ConsoleConfig,
|
||||
pub console: ConsoleConfig,
|
||||
pub devices: Option<Vec<DeviceConfig<'a>>>,
|
||||
pub devices: Option<Vec<DeviceConfig>>,
|
||||
pub vhost_user_net: Option<Vec<VhostUserNetConfig<'a>>>,
|
||||
pub vhost_user_blk: Option<Vec<VhostUserBlkConfig<'a>>>,
|
||||
pub vsock: Option<Vec<VsockConfig<'a>>>,
|
||||
|
@ -857,7 +857,7 @@ impl DeviceManager {
|
||||
|
||||
for device_cfg in device_list_cfg.iter() {
|
||||
let vfio_device =
|
||||
VfioDevice::new(device_cfg.path, device_fd.clone(), vm_info.memory.clone())
|
||||
VfioDevice::new(&device_cfg.path, device_fd.clone(), vm_info.memory.clone())
|
||||
.map_err(DeviceManagerError::VfioCreate)?;
|
||||
|
||||
let mut vfio_pci_device = VfioPciDevice::new(vm_info.vm_fd, allocator, vfio_device)
|
||||
|
Loading…
Reference in New Issue
Block a user