[PATCH 15/23] qemu_conf: split out virQEMUDriverConfigLoadSaveEntry

[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 | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 8bc653fa9e..e03c0b29e3 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -423,6 +423,26 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
 }
 
 
+static int
+virQEMUDriverConfigLoadSaveEntry(virQEMUDriverConfigPtr cfg,
+                                 virConfPtr conf)
+{
+    if (virConfGetValueString(conf, "save_image_format", &cfg->saveImageFormat) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "dump_image_format", &cfg->dumpImageFormat) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "snapshot_image_format", &cfg->snapshotImageFormat) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "auto_dump_path", &cfg->autoDumpPath) < 0)
+        return -1;
+    if (virConfGetValueBool(conf, "auto_dump_bypass_cache", &cfg->autoDumpBypassCache) < 0)
+        return -1;
+    if (virConfGetValueBool(conf, "auto_start_bypass_cache", &cfg->autoStartBypassCache) < 0)
+        return -1;
+
+    return 0;
+}
+
 static int
 virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg,
                                     virConfPtr conf)
@@ -967,20 +987,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
         goto cleanup;
     }
 
-
-    if (virConfGetValueString(conf, "save_image_format", &cfg->saveImageFormat) < 0)
-        goto cleanup;
-    if (virConfGetValueString(conf, "dump_image_format", &cfg->dumpImageFormat) < 0)
-        goto cleanup;
-    if (virConfGetValueString(conf, "snapshot_image_format", &cfg->snapshotImageFormat) < 0)
-        goto cleanup;
-
-    if (virConfGetValueString(conf, "auto_dump_path", &cfg->autoDumpPath) < 0)
-        goto cleanup;
-    if (virConfGetValueBool(conf, "auto_dump_bypass_cache", &cfg->autoDumpBypassCache) < 0)
-        goto cleanup;
-    if (virConfGetValueBool(conf, "auto_start_bypass_cache", &cfg->autoStartBypassCache) < 0)
-        goto cleanup;
+    if (virQEMUDriverConfigLoadSaveEntry(cfg, conf) < 0)
         goto cleanup;
 
     if (virQEMUDriverConfigLoadProcessEntry(cfg, conf) < 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