aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch_init.c18
-rw-r--r--qemu-config.h4
-rw-r--r--vl.c10
3 files changed, 24 insertions, 8 deletions
diff --git a/arch_init.c b/arch_init.c
index 9a35aeea30..4008115e35 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -112,6 +112,24 @@ const uint32_t arch_type = QEMU_ARCH;
#define ALL_EQ(v1, v2) ((v1) == (v2))
#endif
+
+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;
+ }
+
+ ret = qemu_read_config_file(arch_config_name);
+ if (ret < 0 && ret != -ENOENT) {
+ return ret;
+ }
+
+ return 0;
+}
+
static int is_dup_page(uint8_t *page)
{
VECTYPE *p = (VECTYPE *)page;
diff --git a/qemu-config.h b/qemu-config.h
index 20d707fa1f..ff934a1eda 100644
--- a/qemu-config.h
+++ b/qemu-config.h
@@ -16,4 +16,8 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname);
int qemu_read_config_file(const char *filename);
+/* Read default Qemu config files
+ */
+int qemu_read_default_config_files(void);
+
#endif /* QEMU_CONFIG_H */
diff --git a/vl.c b/vl.c
index 5e0080b98f..5d1d0f9993 100644
--- a/vl.c
+++ b/vl.c
@@ -2358,14 +2358,8 @@ int main(int argc, char **argv, char **envp)
if (defconfig) {
int ret;
-
- ret = qemu_read_config_file(CONFIG_QEMU_CONFDIR "/qemu.conf");
- if (ret < 0 && ret != -ENOENT) {
- exit(1);
- }
-
- ret = qemu_read_config_file(arch_config_name);
- if (ret < 0 && ret != -ENOENT) {
+ ret = qemu_read_default_config_files();
+ if (ret < 0) {
exit(1);
}
}