mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: DeviceConfig: Store path as Option<PathBuf>
Relax DeviceConfig::path from PathBuf to Option<PathBuf> in preparation to accept an externally-opened vfio cdev FD. The parser and OpenAPI spec still enforces that `path` is set, so callers see no behavior change. Signed-off-by: Bo Chen <bchen@crusoe.ai> Assisted-by: Claude:Opus-4.7
This commit is contained in:
@@ -3976,9 +3976,13 @@ impl DeviceManager {
|
||||
vfio_ops
|
||||
};
|
||||
|
||||
let vfio_device =
|
||||
VfioDevice::new(&device_cfg.path, Arc::clone(&vfio_ops) as Arc<dyn VfioOps>)
|
||||
.map_err(DeviceManagerError::VfioCreate)?;
|
||||
// The CLI parser and OpenAPI spec enforce that `path` is set
|
||||
let device_path = device_cfg
|
||||
.path
|
||||
.as_deref()
|
||||
.expect("DeviceConfig::parse enforces a path");
|
||||
let vfio_device = VfioDevice::new(device_path, Arc::clone(&vfio_ops) as Arc<dyn VfioOps>)
|
||||
.map_err(DeviceManagerError::VfioCreate)?;
|
||||
|
||||
if needs_dma_mapping {
|
||||
// Register DMA mapping in IOMMU.
|
||||
@@ -4063,7 +4067,7 @@ impl DeviceManager {
|
||||
.iter()
|
||||
.map(|bar| *bar as u8)
|
||||
.collect(),
|
||||
device_cfg.path.clone(),
|
||||
device_path.to_path_buf(),
|
||||
)
|
||||
.map_err(DeviceManagerError::VfioPciCreate)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user