[PATCH v13 18/49] extract general code from qemuUpdateActivePciHostdevs

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

 



Extract general code from qemuUpdateActivePciHostdevs to
virHostdevUpdateActivePciHostdevs.

Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
---
 src/qemu/qemu_hostdev.c |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index b0489e2..1730ed8 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -41,21 +41,16 @@
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
-int
-qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                            virDomainDefPtr def)
+static int
+virHostdevUpdateActivePciHostdevs(virHostdevManagerPtr mgr,
+                                  virDomainDefPtr def)
+
 {
     virDomainHostdevDefPtr hostdev = NULL;
     virPCIDevicePtr dev = NULL;
     size_t i;
     int ret = -1;
-    virHostdevManagerPtr mgr;
 
-    if (!def->nhostdevs)
-        return 0;
-    mgr = virHostdevManagerGetDefault();
-    if (mgr == NULL)
-        return -1;
     virObjectLock(mgr->activePciHostdevs);
     virObjectLock(mgr->inactivePciHostdevs);
 
@@ -106,6 +101,21 @@ cleanup:
 }
 
 int
+qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
+                            virDomainDefPtr def)
+{
+    virHostdevManagerPtr mgr;
+
+    if (!def->nhostdevs)
+        return 0;
+    mgr = virHostdevManagerGetDefault();
+    if (mgr == NULL)
+        return -1;
+
+    return virHostdevUpdateActivePciHostdevs(mgr, def);
+}
+
+int
 qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
                             virDomainDefPtr def)
 {
-- 
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]