[PATCH v13 20/49] extract general code from qemuUpdateActiveScsiHostdevs

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

 



Extract general code from qemuUpdateActiveScsiHostdevs to
virHostdevUpdateActiveScsiHostdevs

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

diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 1992aa0..972ea09 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -172,22 +172,16 @@ qemuUpdateActiveUsbHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
     return virHostdevUpdateActiveUsbHostdevs(mgr, def);
 }
 
-int
-qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                             virDomainDefPtr def)
+static int
+virHostdevUpdateActiveScsiHostdevs(virHostdevManagerPtr mgr,
+                                   virDomainDefPtr def)
 {
     virDomainHostdevDefPtr hostdev = NULL;
     size_t i;
     int ret = -1;
     virSCSIDevicePtr scsi = NULL;
     virSCSIDevicePtr tmp = NULL;
-    virHostdevManagerPtr mgr;
 
-    if (!def->nhostdevs)
-        return 0;
-    mgr = virHostdevManagerGetDefault();
-    if (mgr == NULL)
-        return -1;
     virObjectLock(mgr->activeScsiHostdevs);
     for (i = 0; i < def->nhostdevs; i++) {
         hostdev = def->hostdevs[i];
@@ -227,6 +221,21 @@ cleanup:
 }
 
 
+int
+qemuUpdateActiveScsiHostdevs(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
+                             virDomainDefPtr def)
+{
+    virHostdevManagerPtr mgr;
+
+    if (!def->nhostdevs)
+        return 0;
+    mgr = virHostdevManagerGetDefault();
+    if (mgr == NULL)
+        return -1;
+
+    return virHostdevUpdateActiveScsiHostdevs(mgr, def);
+}
+
 bool
 qemuHostdevHostSupportsPassthroughVFIO(void)
 {
-- 
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]