]> xenbits.xensource.com Git - libvirt.git/commitdiff
virpci.c: use virPCIDeviceAddressPtr in virPCIDeviceListSteal()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 4 Jan 2021 12:54:42 +0000 (09:54 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 1 Mar 2021 15:25:33 +0000 (12:25 -0300)
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 c41ba26cc7ed156799585ad8f3b60f3e58dc5825..11423fa6da67c29f2f82ddf3f80b1db4915c9045 100644 (file)
@@ -822,7 +822,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mgr,
 
         VIR_DEBUG("Removing PCI device %s from inactive list",
                   virPCIDeviceGetName(pci));
-        actual = virPCIDeviceListSteal(mgr->inactivePCIHostdevs, pci);
+        actual = virPCIDeviceListSteal(mgr->inactivePCIHostdevs, virPCIDeviceGetAddress(pci));
 
         VIR_DEBUG("Adding PCI device %s to active list",
                   virPCIDeviceGetName(pci));
@@ -894,7 +894,8 @@ virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mgr,
 
         VIR_DEBUG("Removing PCI device %s from active list",
                   virPCIDeviceGetName(pci));
-        if (!(actual = virPCIDeviceListSteal(mgr->activePCIHostdevs, pci)))
+        if (!(actual = virPCIDeviceListSteal(mgr->activePCIHostdevs,
+                                             virPCIDeviceGetAddress(pci))))
             continue;
 
         VIR_DEBUG("Adding PCI device %s to inactive list",
@@ -997,7 +998,8 @@ virHostdevReAttachPCIDevicesImpl(virHostdevManagerPtr mgr,
 
         VIR_DEBUG("Removing PCI device %s from active list",
                   virPCIDeviceGetName(pci));
-        actual = virPCIDeviceListSteal(mgr->activePCIHostdevs, pci);
+        actual = virPCIDeviceListSteal(mgr->activePCIHostdevs,
+                                       virPCIDeviceGetAddress(pci));
 
         VIR_DEBUG("Adding PCI device %s to inactive list",
                   virPCIDeviceGetName(pci));
index 516187a097be6229c106b60efd193ab055541bdf..1de62ccede2dca6c5d43060632c4fd2326f57ccc 100644 (file)
@@ -1743,16 +1743,16 @@ virPCIDeviceListStealIndex(virPCIDeviceListPtr list,
 
 virPCIDevicePtr
 virPCIDeviceListSteal(virPCIDeviceListPtr list,
-                      virPCIDevicePtr dev)
+                      virPCIDeviceAddressPtr devAddr)
 {
-    return virPCIDeviceListStealIndex(list, virPCIDeviceListFindIndex(list, &dev->address));
+    return virPCIDeviceListStealIndex(list, virPCIDeviceListFindIndex(list, devAddr));
 }
 
 void
 virPCIDeviceListDel(virPCIDeviceListPtr list,
                     virPCIDevicePtr dev)
 {
-    virPCIDeviceFree(virPCIDeviceListSteal(list, dev));
+    virPCIDeviceFree(virPCIDeviceListSteal(list, &dev->address));
 }
 
 int
index 0b75cd17fe7edca3956c8045b0df947e57d2820b..6c59c67d7f8b3ea3c558e9fd47aa63b7ae14b173 100644 (file)
@@ -166,7 +166,7 @@ virPCIDevicePtr virPCIDeviceListGet(virPCIDeviceListPtr list,
                                     int idx);
 size_t virPCIDeviceListCount(virPCIDeviceListPtr list);
 virPCIDevicePtr virPCIDeviceListSteal(virPCIDeviceListPtr list,
-                                      virPCIDevicePtr dev);
+                                      virPCIDeviceAddressPtr devAddr);
 virPCIDevicePtr virPCIDeviceListStealIndex(virPCIDeviceListPtr list,
                                            int idx);
 void virPCIDeviceListDel(virPCIDeviceListPtr list,