提交 fdb313c4 编写于 作者: C Chunyan Liu 提交者: Daniel P. Berrange

extract general code of NodeDeviceDetach

上级 a4797138
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册