/* We need to look up the actual device because that's what
* virPCIDeviceReattach() expects as its argument */
- if (!(actual = virPCIDeviceListFind(mgr->inactivePCIHostdevs, pci)))
+ if (!(actual = virPCIDeviceListFind(mgr->inactivePCIHostdevs,
+ virPCIDeviceGetAddress(pci))))
continue;
if (virPCIDeviceGetManaged(actual)) {
/* Unmanaged devices should already have been marked as
* inactive: if that's the case, we can simply move on */
- if (virPCIDeviceListFind(mgr->inactivePCIHostdevs, pci)) {
+ if (virPCIDeviceListFind(mgr->inactivePCIHostdevs,
+ virPCIDeviceGetAddress(pci))) {
VIR_DEBUG("Not detaching unmanaged PCI device %s",
virPCIDeviceGetName(pci));
continue;
* there because 'pci' only contain address information and will
* be released at the end of the function */
pci = virPCIDeviceListGet(pcidevs, i);
- actual = virPCIDeviceListFind(mgr->activePCIHostdevs, pci);
+ actual = virPCIDeviceListFind(mgr->activePCIHostdevs,
+ virPCIDeviceGetAddress(pci));
VIR_DEBUG("Setting driver and domain information for PCI device %s",
virPCIDeviceGetName(pci));
* information such as by which domain and driver it is used. As a
* side effect, by looking it up we can also tell whether it was
* really active in the first place */
- actual = virPCIDeviceListFind(mgr->activePCIHostdevs, pci);
+ actual = virPCIDeviceListFind(mgr->activePCIHostdevs,
+ virPCIDeviceGetAddress(pci));
if (actual) {
const char *actual_drvname;
const char *actual_domname;
return 0;
/* same bus, but inactive, i.e. about to be assigned to guest */
- if (inactiveDevs && virPCIDeviceListFind(inactiveDevs, check))
+ if (inactiveDevs && virPCIDeviceListFind(inactiveDevs, &check->address))
return 0;
return 1;
return -1;
}
- if (activeDevs && virPCIDeviceListFind(activeDevs, dev)) {
+ if (activeDevs && virPCIDeviceListFind(activeDevs, &dev->address)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Not resetting active device %s"), dev->name);
return -1;
if (virPCIProbeStubDriver(dev->stubDriver) < 0)
return -1;
- if (activeDevs && virPCIDeviceListFind(activeDevs, dev)) {
+ if (activeDevs && virPCIDeviceListFind(activeDevs, &dev->address)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Not detaching active device %s"), dev->name);
return -1;
/* Add *a copy of* the dev into list inactiveDevs, if
* it's not already there.
*/
- if (inactiveDevs && !virPCIDeviceListFind(inactiveDevs, dev)) {
+ if (inactiveDevs && !virPCIDeviceListFind(inactiveDevs, &dev->address)) {
VIR_DEBUG("Adding PCI device %s to inactive list", dev->name);
if (virPCIDeviceListAddCopy(inactiveDevs, dev) < 0)
return -1;
virPCIDeviceListPtr activeDevs,
virPCIDeviceListPtr inactiveDevs)
{
- if (activeDevs && virPCIDeviceListFind(activeDevs, dev)) {
+ if (activeDevs && virPCIDeviceListFind(activeDevs, &dev->address)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Not reattaching active device %s"), dev->name);
return -1;
virPCIDeviceListAdd(virPCIDeviceListPtr list,
virPCIDevicePtr dev)
{
- if (virPCIDeviceListFind(list, dev)) {
+ if (virPCIDeviceListFind(list, &dev->address)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Device %s is already in use"), dev->name);
return -1;
virPCIDevicePtr
-virPCIDeviceListFind(virPCIDeviceListPtr list, virPCIDevicePtr dev)
+virPCIDeviceListFind(virPCIDeviceListPtr list, virPCIDeviceAddressPtr devAddr)
{
int idx;
- if ((idx = virPCIDeviceListFindIndex(list, &dev->address)) >= 0)
+ if ((idx = virPCIDeviceListFindIndex(list, devAddr)) >= 0)
return list->devs[idx];
else
return NULL;