mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
extract general code of NodeDeviceDetach
This commit is contained in:
parent
a4797138ad
commit
fdb313c4b2
@ -11264,6 +11264,27 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
virHostdevPciNodeDeviceDetach(virHostdevManagerPtr hostdev_mgr,
|
||||
virPCIDevicePtr pci)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
virObjectLock(hostdev_mgr->activePciHostdevs);
|
||||
virObjectLock(hostdev_mgr->inactivePciHostdevs);
|
||||
|
||||
if (virPCIDeviceDetach(pci, hostdev_mgr->activePciHostdevs,
|
||||
hostdev_mgr->inactivePciHostdevs) < 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
virObjectUnlock(hostdev_mgr->inactivePciHostdevs);
|
||||
virObjectUnlock(hostdev_mgr->activePciHostdevs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
|
||||
const char *driverName,
|
||||
@ -11336,18 +11357,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
virObjectLock(hostdev_mgr->activePciHostdevs);
|
||||
virObjectLock(hostdev_mgr->inactivePciHostdevs);
|
||||
|
||||
if (virPCIDeviceDetach(pci, hostdev_mgr->activePciHostdevs,
|
||||
hostdev_mgr->inactivePciHostdevs) < 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
virObjectUnlock(hostdev_mgr->inactivePciHostdevs);
|
||||
virObjectUnlock(hostdev_mgr->activePciHostdevs);
|
||||
ret = virHostdevPciNodeDeviceDetach(hostdev_mgr, pci);
|
||||
cleanup:
|
||||
virPCIDeviceFree(pci);
|
||||
virNodeDeviceDefFree(def);
|
||||
|
Loading…
x
Reference in New Issue
Block a user