qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] Rework --name to use QemuOpts


From: Alex Bennée
Subject: Re: [Qemu-devel] [PATCH 1/3] Rework --name to use QemuOpts
Date: Wed, 29 Jan 2014 08:49:01 +0000
User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.1

address@hidden writes:

> From: "Dr. David Alan Gilbert" <address@hidden>
>
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> ---
>  vl.c | 52 +++++++++++++++++++++++++++++++++++++++-------------
>  1 file changed, 39 insertions(+), 13 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 7f4fe0d..5f993e4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -531,6 +531,27 @@ static QemuOptsList qemu_msg_opts = {
>      },
>  };
>  
> +static QemuOptsList qemu_name_opts = {
> +    .name = "name",
> +    .implied_opt_name = "guest",
> +    .merge_lists = true,
> +    .head = QTAILQ_HEAD_INITIALIZER(qemu_name_opts.head),
> +    .desc = {
> +        {
> +            .name = "guest",
> +            .type = QEMU_OPT_STRING,
> +            .help = "Sets the name of the guest.\n"
> +                    "This name will be displayed in the SDL window 
> caption.\n"
> +                    "The name will also be used for the VNC server",
> +        }, {
> +            .name = "process",
> +            .type = QEMU_OPT_STRING,
> +            .help = "Sets the name of the QEMU process, as shown in top etc",
> +        },
> +        { /* End of list */ }
> +    },
> +};
> +
<snip>
>                  break;
>              case QEMU_OPTION_name:
> -                qemu_name = g_strdup(optarg);
> -              {
> -                  char *p = strchr(qemu_name, ',');
> -                  if (p != NULL) {
> -                     *p++ = 0;
> -                     if (strncmp(p, "process=", 8)) {
> -                         fprintf(stderr, "Unknown subargument %s to 
> -name\n", p);
> -                         exit(1);
> -                     }
> -                     p += 8;
> -                     os_set_proc_name(p);
> -                  }
> -              }
> +                opts = qemu_opts_parse(qemu_find_opts("name"), optarg, 1);
> +                if (!opts) {
> +                    exit(1);
> +                }
> +                parse_name(opts);
<snip>

Always good to see hand parsing replace with proper option handling ;-)

Reviewed-by: Alex Bennée <address@hidden>

-- 
Alex Bennée




reply via email to

[Prev in Thread] Current Thread [Next in Thread]