Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NY25t-0006rD-Vo for qemu-devel@nongnu.org; Thu, 21 Jan 2010 13:49:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NY25p-0006ky-85 for qemu-devel@nongnu.org; Thu, 21 Jan 2010 13:49:25 -0500 Received: from [199.232.76.173] (port=59175 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NY25o-0006kb-7i for qemu-devel@nongnu.org; Thu, 21 Jan 2010 13:49:20 -0500 Received: from e31.co.us.ibm.com ([32.97.110.149]:57743) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NY25m-0000tu-NI for qemu-devel@nongnu.org; Thu, 21 Jan 2010 13:49:19 -0500 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e31.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o0LIf6q8029358 for ; Thu, 21 Jan 2010 11:41:06 -0700 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o0LIn55Y153202 for ; Thu, 21 Jan 2010 11:49:07 -0700 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o0LIn1pd028915 for ; Thu, 21 Jan 2010 11:49:01 -0700 From: Anthony Liguori Date: Thu, 21 Jan 2010 12:48:51 -0600 Message-Id: <1264099733-29666-3-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1264099733-29666-1-git-send-email-aliguori@us.ibm.com> References: <1264099733-29666-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 2/4] Load global config files by default List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: John Cooper , Anthony Liguori , Gerd Hoffman A new option, -nodefconfig is introduced to prevent loading from the default config location. Otherwise, two configuration files will be searched for, qemu.conf and target-.conf. The ordering is a little troubling. Command line options are parsed before loading the default configs which means that the command line configs will be loaded before the default config. The effect is that the default config will override -readconfig directives. It's unclear the best way to handle this. Signed-off-by: Anthony Liguori --- qemu-options.hx | 7 +++++++ vl.c | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index ee60d8a..57f453d 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1965,6 +1965,13 @@ STEXI @item -writeconfig @var{file} Write device configuration to @var{file}. ETEXI +DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig, + "-nodefconfig\n" + " do not load default config file\n") +STEXI +@item -nodefconfig +Do not load default config files. +ETEXI HXCOMM This is the last statement. Insert new options before this line! STEXI diff --git a/vl.c b/vl.c index e070ec9..cf12ab0 100644 --- a/vl.c +++ b/vl.c @@ -4690,6 +4690,7 @@ int main(int argc, char **argv, char **envp) #endif CPUState *env; int show_vnc_port = 0; + int defconfig = 1; init_clocks(); @@ -5457,6 +5458,9 @@ int main(int argc, char **argv, char **envp) fclose(fp); break; } + case QEMU_OPTION_nodefconfig: + defconfig=0; + break; } } } @@ -5471,6 +5475,25 @@ int main(int argc, char **argv, char **envp) data_dir = CONFIG_QEMU_SHAREDIR; } + if (defconfig) { + FILE *fp; + fp = fopen(CONFIG_QEMU_CONFDIR "/qemu.conf", "r"); + if (fp) { + if (qemu_config_parse(fp) != 0) { + exit(1); + } + fclose(fp); + } + + fp = fopen(CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", "r"); + if (fp) { + if (qemu_config_parse(fp) != 0) { + exit(1); + } + fclose(fp); + } + } + /* * Default to max_cpus = smp_cpus, in case the user doesn't * specify a max_cpus value. -- 1.6.5.2