[PATCH v13 31/49] extract general code from qemuDomainReAttachHostUsbDevices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Extract general code from qemuDomainReAttachHostUsbDevices to
virHostdevDomainReAttachHostUsbDevices.

Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]