virPCIDeviceListSteal(virPCIDeviceListPtr list,
virPCIDevicePtr dev)
{
- return virPCIDeviceListStealIndex(list, virPCIDeviceListFindIndex(list, dev));
+ return virPCIDeviceListStealIndex(list, virPCIDeviceListFindIndex(list, &dev->address));
}
void
}
int
-virPCIDeviceListFindIndex(virPCIDeviceListPtr list, virPCIDevicePtr dev)
+virPCIDeviceListFindIndex(virPCIDeviceListPtr list,
+ virPCIDeviceAddressPtr devAddr)
{
size_t i;
for (i = 0; i < list->count; i++) {
virPCIDevicePtr other = list->devs[i];
- if (other->address.domain == dev->address.domain &&
- other->address.bus == dev->address.bus &&
- other->address.slot == dev->address.slot &&
- other->address.function == dev->address.function)
+ if (other->address.domain == devAddr->domain &&
+ other->address.bus == devAddr->bus &&
+ other->address.slot == devAddr->slot &&
+ other->address.function == devAddr->function)
return i;
}
return -1;
{
int idx;
- if ((idx = virPCIDeviceListFindIndex(list, dev)) >= 0)
+ if ((idx = virPCIDeviceListFindIndex(list, &dev->address)) >= 0)
return list->devs[idx];
else
return NULL;
unsigned int slot,
unsigned int function);
int virPCIDeviceListFindIndex(virPCIDeviceListPtr list,
- virPCIDevicePtr dev);
+ virPCIDeviceAddressPtr devAddr);
/*
* Callback that will be invoked once for each file