Extract general code from qemuDomainReAttachHostUsbDevices to
virHostdevDomainReAttachHostUsbDevices.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/qemu/qemu_hostdev.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 32825a4..3d6396b 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -316,15 +316,13 @@ qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver,
virObjectUnref(cfg);
}
-
-void
-qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver,
- const char *name,
- virDomainHostdevDefPtr *hostdevs,
- int nhostdevs)
+static void
+virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
+ const char *name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs)
{
size_t i;
- virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
virObjectLock(hostdev_mgr->activeUsbHostdevs);
for (i = 0; i < nhostdevs; i++) {
@@ -383,6 +381,17 @@ qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver,
virObjectUnlock(hostdev_mgr->activeUsbHostdevs);
}
+void
+qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver,
+ const char *name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs)
+{
+ virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+
+ virHostdevReAttachUsbHostdevs(hostdev_mgr, name, hostdevs, nhostdevs);
+}
+
void
qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
--
1.9.0