[PATCH qemu 3/6] move list of default config files to an array

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

 



More files will be added to the list, with additional attributes, later.

Signed-off-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
---
 arch_init.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 152cbbb..62332e9 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -112,20 +112,27 @@ const uint32_t arch_type = QEMU_ARCH;
 #endif
 
 
+static struct defconfig_file {
+    const char *filename;
+} default_config_files[] = {
+    { CONFIG_QEMU_CONFDIR "/qemu.conf" },
+    { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf" },
+    { NULL }, /* end of list */
+};
+
+
 int qemu_read_default_config_files(void)
 {
     int ret;
-    
-    ret = qemu_read_config_file(CONFIG_QEMU_CONFDIR "/qemu.conf");
-    if (ret < 0 && ret != -ENOENT) {
-        return ret;
-    }
+    struct defconfig_file *f;
 
-    ret = qemu_read_config_file(CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf");
-    if (ret < 0 && ret != -ENOENT) {
-        return ret;
+    for (f = default_config_files; f->filename; f++) {
+        ret = qemu_read_config_file(f->filename);
+        if (ret < 0 && ret != -ENOENT) {
+            return ret;
+        }
     }
-
+    
     return 0;
 }
 
-- 
1.7.3.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]