mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pci: Refactor bus.rs to better fit a PCI bus's semantics
This commit refactors the PCI bus struct. It has two major focuses. First, we change the type of `device_ids` in `PciBus` to an array. A fixed-size array better reflects real PCI bus constraints, especially its limited number of PCI devices. Moreover, it can't be grown accidentally. The second focus is changing the type of the key of `devices` in `PciBus` to `u8`, since device IDs are not allowed to exceed 31. We furthermore replace magic numbers with constants and make them publicly available so we can use them in a follow-up change when parsing user input. Signed-off-by: Pascal Scholz <pascal.scholz@cyberus-technology.de> On-behalf-of: SAP pascal.scholz@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
43b5a474f9
commit
afd155d578
@@ -4125,7 +4125,7 @@ impl DeviceManager {
|
||||
.unwrap();
|
||||
|
||||
pci_bus
|
||||
.add_device(bdf.device() as u32, pci_device)
|
||||
.add_device(bdf.device(), pci_device)
|
||||
.map_err(DeviceManagerError::AddPciDevice)?;
|
||||
|
||||
self.bus_devices.push(Arc::clone(&bus_device));
|
||||
|
||||
Reference in New Issue
Block a user