move code to read default config files to a separate function (v2)

Function added to arch_init.c because it depends on arch-specific
settings.

Changes v1 -> v2:
 - Move qemu_read_default_config_file() prototype to qemu-config.h

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Eduardo Habkost 2012-05-02 13:07:25 -03:00 committed by Anthony Liguori
parent 04120e3bb0
commit b5a8fe5e8a
3 changed files with 24 additions and 8 deletions

View File

@ -112,6 +112,24 @@ const uint32_t arch_type = QEMU_ARCH;
#define ALL_EQ(v1, v2) ((v1) == (v2)) #define ALL_EQ(v1, v2) ((v1) == (v2))
#endif #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) static int is_dup_page(uint8_t *page)
{ {
VECTYPE *p = (VECTYPE *)page; VECTYPE *p = (VECTYPE *)page;

View File

@ -16,4 +16,8 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname);
int qemu_read_config_file(const char *filename); int qemu_read_config_file(const char *filename);
/* Read default Qemu config files
*/
int qemu_read_default_config_files(void);
#endif /* QEMU_CONFIG_H */ #endif /* QEMU_CONFIG_H */

10
vl.c
View File

@ -2358,14 +2358,8 @@ int main(int argc, char **argv, char **envp)
if (defconfig) { if (defconfig) {
int ret; int ret;
ret = qemu_read_default_config_files();
ret = qemu_read_config_file(CONFIG_QEMU_CONFDIR "/qemu.conf"); if (ret < 0) {
if (ret < 0 && ret != -ENOENT) {
exit(1);
}
ret = qemu_read_config_file(arch_config_name);
if (ret < 0 && ret != -ENOENT) {
exit(1); exit(1);
} }
} }