[PATCH 12/23] qemu_conf: split out virQEMUDriverConfigLoadRPCEntry

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

 



Split out parts of the config parsing code to make
the parent function easier to read.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_conf.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 8aa5157cd1..b555e33e7b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -423,6 +423,20 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
 }
 
 
+static int
+virQEMUDriverConfigLoadRPCEntry(virQEMUDriverConfigPtr cfg,
+                                virConfPtr conf)
+{
+    if (virConfGetValueUInt(conf, "max_queued", &cfg->maxQueuedJobs) < 0)
+        return -1;
+    if (virConfGetValueInt(conf, "keepalive_interval", &cfg->keepAliveInterval) < 0)
+        return -1;
+    if (virConfGetValueUInt(conf, "keepalive_count", &cfg->keepAliveCount) < 0)
+        return -1;
+
+    return 0;
+}
+
 static int
 virQEMUDriverConfigLoadNetworkEntry(virQEMUDriverConfigPtr cfg,
                                     virConfPtr conf,
@@ -946,12 +960,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
         VIR_FREE(stdioHandler);
     }
 
-    if (virConfGetValueUInt(conf, "max_queued", &cfg->maxQueuedJobs) < 0)
-        goto cleanup;
-
-    if (virConfGetValueInt(conf, "keepalive_interval", &cfg->keepAliveInterval) < 0)
-        goto cleanup;
-    if (virConfGetValueUInt(conf, "keepalive_count", &cfg->keepAliveCount) < 0)
+    if (virQEMUDriverConfigLoadRPCEntry(cfg, conf) < 0)
         goto cleanup;
 
     if (virQEMUDriverConfigLoadNetworkEntry(cfg, conf, filename) < 0)
-- 
2.20.1

--
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]

  Powered by Linux