]> xenbits.xensource.com Git - libvirt.git/commitdiff
virpci.c: use virPCIDeviceAddressPtr in virPCIDeviceListDel()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 4 Jan 2021 12:54:43 +0000 (09:54 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 1 Mar 2021 15:25:33 +0000 (12:25 -0300)
This change will allow us to remove PCI devices from a list
without the need of a PCI Device object, which will be need
in the next patch.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/hypervisor/virhostdev.c
src/util/virpci.c
src/util/virpci.h

index 11423fa6da67c29f2f82ddf3f80b1db4915c9045..7ff25442a94a25e2a0e5530892ac9ebe7a5ea1d3 100644 (file)
@@ -980,11 +980,11 @@ virHostdevReAttachPCIDevicesImpl(virHostdevManagerPtr mgr,
             if (STRNEQ_NULLABLE(drv_name, actual_drvname) ||
                 STRNEQ_NULLABLE(dom_name, actual_domname)) {
 
-                virPCIDeviceListDel(pcidevs, pci);
+                virPCIDeviceListDel(pcidevs, virPCIDeviceGetAddress(pci));
                 continue;
             }
         } else {
-            virPCIDeviceListDel(pcidevs, pci);
+            virPCIDeviceListDel(pcidevs, virPCIDeviceGetAddress(pci));
             continue;
         }
 
@@ -2486,7 +2486,8 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManagerPtr hostdev_mgr,
     while (lastGoodPCIIdx >= 0) {
         virPCIDevicePtr actual = virPCIDeviceListGet(pciDevices, i);
 
-        virPCIDeviceListDel(hostdev_mgr->activePCIHostdevs, actual);
+        virPCIDeviceListDel(hostdev_mgr->activePCIHostdevs,
+                            virPCIDeviceGetAddress(actual));
 
         lastGoodPCIIdx--;
     }
index 1de62ccede2dca6c5d43060632c4fd2326f57ccc..8c144494c6989ef106bdf2add9bbb1331e64d56d 100644 (file)
@@ -1336,7 +1336,7 @@ virPCIDeviceReattach(virPCIDevicePtr dev,
     /* Steal the dev from list inactiveDevs */
     if (inactiveDevs) {
         VIR_DEBUG("Removing PCI device %s from inactive list", dev->name);
-        virPCIDeviceListDel(inactiveDevs, dev);
+        virPCIDeviceListDel(inactiveDevs, &dev->address);
     }
 
     return 0;
@@ -1750,9 +1750,9 @@ virPCIDeviceListSteal(virPCIDeviceListPtr list,
 
 void
 virPCIDeviceListDel(virPCIDeviceListPtr list,
-                    virPCIDevicePtr dev)
+                    virPCIDeviceAddressPtr devAddr)
 {
-    virPCIDeviceFree(virPCIDeviceListSteal(list, &dev->address));
+    virPCIDeviceFree(virPCIDeviceListSteal(list, devAddr));
 }
 
 int
index 6c59c67d7f8b3ea3c558e9fd47aa63b7ae14b173..9b37a12883668f14231c40fcf3f932065c71b7ba 100644 (file)
@@ -170,7 +170,7 @@ virPCIDevicePtr virPCIDeviceListSteal(virPCIDeviceListPtr list,
 virPCIDevicePtr virPCIDeviceListStealIndex(virPCIDeviceListPtr list,
                                            int idx);
 void virPCIDeviceListDel(virPCIDeviceListPtr list,
-                         virPCIDevicePtr dev);
+                         virPCIDeviceAddressPtr devAddr);
 virPCIDevicePtr virPCIDeviceListFind(virPCIDeviceListPtr list,
                                      virPCIDeviceAddressPtr devAddr);
 virPCIDevicePtr