virpci.c: use virPCIDeviceAddressPtr in virPCIDeviceListSteal()

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2021-01-04 09:54:42 -03:00
parent f1370f9ca6
commit de80a10738
3 changed files with 9 additions and 7 deletions

View 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));

View 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

View 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,