From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8Qpc-0006hK-Ft for qemu-devel@nongnu.org; Wed, 29 Jan 2014 03:49:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8QpX-0007r4-O0 for qemu-devel@nongnu.org; Wed, 29 Jan 2014 03:49:12 -0500 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:46583 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8QpW-0007px-Df for qemu-devel@nongnu.org; Wed, 29 Jan 2014 03:49:07 -0500 References: <1390922439-30750-1-git-send-email-dgilbert@redhat.com> <1390922439-30750-2-git-send-email-dgilbert@redhat.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1390922439-30750-2-git-send-email-dgilbert@redhat.com> Date: Wed, 29 Jan 2014 08:49:01 +0000 Message-ID: <87sis72mwy.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 1/3] Rework --name to use QemuOpts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" Cc: pbonzini@redhat.com, lersek@redhat.com, qemu-devel@nongnu.org, mst@redhat.com dgilbert@redhat.com writes: > From: "Dr. David Alan Gilbert" > > Signed-off-by: Dr. David Alan Gilbert > --- > 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 */ } > + }, > +}; > + > 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); Always good to see hand parsing replace with proper option handling ;-) Reviewed-by: Alex Bennée -- Alex Bennée