}
-/* @oldStateDir:
- * For upgrade purpose: see virHostdevRestoreNetConfig
- */
-void
-virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
- const char *drv_name,
- const char *dom_name,
- virDomainHostdevDefPtr *hostdevs,
- int nhostdevs,
- const char *oldStateDir)
+static void
+virHostdevReAttachPCIDevicesImpl(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ virPCIDeviceListPtr pcidevs,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ const char *oldStateDir)
{
- g_autoptr(virPCIDeviceList) pcidevs = NULL;
size_t i;
- if (!nhostdevs)
- return;
-
- if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
- VIR_ERROR(_("Failed to allocate PCI device list: %s"),
- virGetLastErrorMessage());
- virResetLastError();
- return;
- }
-
virObjectLock(mgr->activePCIHostdevs);
virObjectLock(mgr->inactivePCIHostdevs);
virObjectUnlock(mgr->inactivePCIHostdevs);
}
+
+/* @oldStateDir:
+ * For upgrade purpose: see virHostdevRestoreNetConfig
+ */
+void
+virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ const char *oldStateDir)
+{
+ g_autoptr(virPCIDeviceList) pcidevs = NULL;
+
+ if (!nhostdevs)
+ return;
+
+ if (!(pcidevs = virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))) {
+ VIR_ERROR(_("Failed to allocate PCI device list: %s"),
+ virGetLastErrorMessage());
+ virResetLastError();
+ return;
+ }
+
+ virHostdevReAttachPCIDevicesImpl(mgr, drv_name, dom_name, pcidevs,
+ hostdevs, nhostdevs, oldStateDir);
+}
+
+
int
virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
virDomainHostdevDefPtr *hostdevs,