mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
extract general code of NodeDeviceReset
This commit is contained in:
parent
1f12cef642
commit
de4aace4b0
@ -11450,6 +11450,25 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
virHostdevPciNodeDeviceReset(virHostdevManagerPtr hostdev_mgr,
|
||||
virPCIDevicePtr pci)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
virObjectLock(hostdev_mgr->activePciHostdevs);
|
||||
virObjectLock(hostdev_mgr->inactivePciHostdevs);
|
||||
if (virPCIDeviceReset(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
|
||||
qemuNodeDeviceReset(virNodeDevicePtr dev)
|
||||
{
|
||||
@ -11479,16 +11498,8 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
|
||||
if (!pci)
|
||||
goto cleanup;
|
||||
|
||||
virObjectLock(hostdev_mgr->activePciHostdevs);
|
||||
virObjectLock(hostdev_mgr->inactivePciHostdevs);
|
||||
if (virPCIDeviceReset(pci, hostdev_mgr->activePciHostdevs,
|
||||
hostdev_mgr->inactivePciHostdevs) < 0)
|
||||
goto out;
|
||||
ret = virHostdevPciNodeDeviceReset(hostdev_mgr, pci);
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
virObjectUnlock(hostdev_mgr->inactivePciHostdevs);
|
||||
virObjectUnlock(hostdev_mgr->activePciHostdevs);
|
||||
virPCIDeviceFree(pci);
|
||||
cleanup:
|
||||
virNodeDeviceDefFree(def);
|
||||
|
Loading…
Reference in New Issue
Block a user