Extract general code from qemuDomainReAttachHostUsbDevices to
virHostdevDomainReAttachHostUsbDevices.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/qemu/qemu_hostdev.c | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index add887f..64372a3 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -342,20 +342,13 @@ out:
virObjectUnref(cfg);
}
-
-void
-qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
- 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;
-
- hostdev_mgr = virHostdevManagerGetDefault();
- if (hostdev_mgr == NULL)
- return;
-
virObjectLock(hostdev_mgr->activeUsbHostdevs);
for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i];
@@ -413,6 +406,21 @@ qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver
ATTRIBUTE_UNUSED,
virObjectUnlock(hostdev_mgr->activeUsbHostdevs);
}
+void
+qemuDomainReAttachHostUsbDevices(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
+ const char *name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs)
+{
+ virHostdevManagerPtr hostdev_mgr;
+
+ hostdev_mgr = virHostdevManagerGetDefault();
+ if (hostdev_mgr == NULL)
+ return;
+
+ virHostdevReAttachUsbHostdevs(hostdev_mgr, name, hostdevs, nhostdevs);
+}
+
void
qemuDomainReAttachHostScsiDevices(virQEMUDriverPtr driver,
--
1.6.0.2