[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/5] move code to read default config files to a sep
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 1/5] move code to read default config files to a separate function |
Date: |
Wed, 18 Apr 2012 17:02:36 -0300 |
Function added to arch_init.c because it depends on arch-specific
settings.
Signed-off-by: Eduardo Habkost <address@hidden>
---
arch_init.c | 18 ++++++++++++++++++
arch_init.h | 4 ++++
vl.c | 10 ++--------
3 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 9a35aee..4008115 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/arch_init.h b/arch_init.h
index 828256c..329faf7 100644
--- a/arch_init.h
+++ b/arch_init.h
@@ -32,4 +32,8 @@ int tcg_available(void);
int kvm_available(void);
int xen_available(void);
+/* Read default Qemu config files
+ */
+int qemu_read_default_config_files(void);
+
#endif
diff --git a/vl.c b/vl.c
index ae91a8a..1e5e593 100644
--- a/vl.c
+++ b/vl.c
@@ -2354,14 +2354,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);
}
}
--
1.7.3.2
- [Qemu-devel] [PATCH 0/5] -no-user-config option, move CPU models to /usr/share, Eduardo Habkost, 2012/04/18
- [Qemu-devel] [PATCH 2/5] eliminate arch_config_name variable, Eduardo Habkost, 2012/04/18
- [Qemu-devel] [PATCH 3/5] move list of default config files to an array, Eduardo Habkost, 2012/04/18
- [Qemu-devel] [PATCH 1/5] move code to read default config files to a separate function,
Eduardo Habkost <=
- [Qemu-devel] [PATCH 4/5] implement -no-user-config command-line option, Eduardo Habkost, 2012/04/18
- [Qemu-devel] [PATCH 5/5] move CPU definitions to /usr/share/qemu/cpus-x86_64.conf, Eduardo Habkost, 2012/04/18
- Re: [Qemu-devel] [PATCH 0/5] -no-user-config option, move CPU models to /usr/share, Jiri Denemark, 2012/04/19