[libvirt] [Qemu-devel] [PATCH 4/5] implement -no-user-config command-line option

Anthony Liguori anthony at codemonkey.ws
Tue Apr 24 14:34:41 UTC 2012


On 04/18/2012 03:02 PM, Eduardo Habkost wrote:
> Signed-off-by: Eduardo Habkost<ehabkost at redhat.com>
> ---
>   arch_init.c     |   10 +++++++---
>   arch_init.h     |    2 +-
>   qemu-options.hx |   16 +++++++++++++---
>   vl.c            |    6 +++++-
>   4 files changed, 26 insertions(+), 8 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 62332e9..c5fc00f 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -114,19 +114,23 @@ const uint32_t arch_type = QEMU_ARCH;
>
>   static struct defconfig_file {
>       const char *filename;
> +    /* If non-zero, this is a user config file (disabled by -no-user-config) */
> +    int userconfig;
>   } default_config_files[] = {
> -    { CONFIG_QEMU_CONFDIR "/qemu.conf" },
> -    { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf" },
> +    { CONFIG_QEMU_CONFDIR "/qemu.conf",                   1 },
> +    { CONFIG_QEMU_CONFDIR "/target-" TARGET_ARCH ".conf", 1 },
>       { NULL }, /* end of list */
>   };
>
>
> -int qemu_read_default_config_files(void)
> +int qemu_read_default_config_files(int userconfig)
>   {
>       int ret;
>       struct defconfig_file *f;
>
>       for (f = default_config_files; f->filename; f++) {
> +        if (!userconfig&&  f->userconfig)
> +            continue;

Coding style is off here.  While you're at it, you should make userconfig a bool.


>           ret = qemu_read_config_file(f->filename);
>           if (ret<  0&&  ret != -ENOENT) {
>               return ret;
> diff --git a/arch_init.h b/arch_init.h
> index 495871b..07510cf 100644
> --- a/arch_init.h
> +++ b/arch_init.h
> @@ -32,6 +32,6 @@ int xen_available(void);
>
>   /* Read default Qemu config files
>    */
> -int qemu_read_default_config_files(void);
> +int qemu_read_default_config_files(int userconfig);

Let's use a bool here and move this to qemu-config.h.  The declaration can live 
there even if the definition is in arch_init.c

Regards,

Anthony Liguori




More information about the libvir-list mailing list