Extract general code from qemuPrepareHostUSBDevices to
virHostdevPrepareHostUSBDevices.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/qemu/qemu_hostdev.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index bb3dc69..25a34e8 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -377,19 +377,17 @@ out:
return 0;
}
-
-int
-qemuPrepareHostUSBDevices(virQEMUDriverPtr driver,
- const char *name,
- virDomainHostdevDefPtr *hostdevs,
- int nhostdevs,
- unsigned int flags)
+static int
+virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
+ const char *name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ unsigned int flags)
{
size_t i;
int ret = -1;
virUSBDeviceListPtr list;
virUSBDevicePtr tmp;
- virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
bool coldBoot = !!(flags & VIR_HOSTDEV_COLD_BOOT);
/* To prevent situation where USB device is assigned to two domains
@@ -449,6 +447,19 @@ cleanup:
return ret;
}
+int
+qemuPrepareHostUSBDevices(virQEMUDriverPtr driver,
+ const char *name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ unsigned int flags)
+{
+ virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+
+ return virHostdevPrepareUSBDevices(hostdev_mgr, name,
+ hostdevs, nhostdevs, flags);
+}
+
int
qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver,
--
1.9.0