From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCPyv-00025g-8I for qemu-devel@nongnu.org; Sun, 09 Feb 2014 03:43:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCPyn-0008DP-Ve for qemu-devel@nongnu.org; Sun, 09 Feb 2014 03:43:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCPyn-0008DG-O9 for qemu-devel@nongnu.org; Sun, 09 Feb 2014 03:43:09 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s198h7hZ003578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 9 Feb 2014 03:43:07 -0500 Message-ID: <52F73F98.6070601@redhat.com> Date: Sun, 09 Feb 2014 09:43:04 +0100 From: Laszlo Ersek MIME-Version: 1.0 References: <1391077232-14649-1-git-send-email-dgilbert@redhat.com> <1391077232-14649-2-git-send-email-dgilbert@redhat.com> In-Reply-To: <1391077232-14649-2-git-send-email-dgilbert@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 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, qemu-devel@nongnu.org, mst@redhat.com On 01/30/14 11:20, Dr. David Alan Gilbert (git) wrote: > From: "Dr. David Alan Gilbert" >=20 > Signed-off-by: Dr. David Alan Gilbert > Reviewed-by: Alex Benn=C3=A9e > --- > vl.c | 52 +++++++++++++++++++++++++++++++++++++++------------- > 1 file changed, 39 insertions(+), 13 deletions(-) >=20 > 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 =3D { > }, > }; > =20 > +static QemuOptsList qemu_name_opts =3D { > + .name =3D "name", > + .implied_opt_name =3D "guest", > + .merge_lists =3D true, > + .head =3D QTAILQ_HEAD_INITIALIZER(qemu_name_opts.head), > + .desc =3D { > + { > + .name =3D "guest", > + .type =3D QEMU_OPT_STRING, > + .help =3D "Sets the name of the guest.\n" > + "This name will be displayed in the SDL window cap= tion.\n" > + "The name will also be used for the VNC server", > + }, { > + .name =3D "process", > + .type =3D QEMU_OPT_STRING, > + .help =3D "Sets the name of the QEMU process, as shown in = top etc", > + }, > + { /* End of list */ } > + }, > +}; > + > /** > * Get machine options > * > @@ -981,6 +1002,18 @@ static int parse_sandbox(QemuOpts *opts, void *op= aque) > return 0; > } > =20 > +static void parse_name(QemuOpts *opts) > +{ > + const char *proc_name; > + > + qemu_name =3D qemu_opt_get(opts, "guest"); > + > + proc_name =3D qemu_opt_get(opts, "process"); > + if (proc_name) { > + os_set_proc_name(proc_name); > + } > +} > + > bool usb_enabled(bool default_usb) > { > return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_u= sb); > @@ -2895,6 +2928,7 @@ int main(int argc, char **argv, char **envp) > qemu_add_opts(&qemu_tpmdev_opts); > qemu_add_opts(&qemu_realtime_opts); > qemu_add_opts(&qemu_msg_opts); > + qemu_add_opts(&qemu_name_opts); > =20 > runstate_init(); > =20 > @@ -3630,19 +3664,11 @@ int main(int argc, char **argv, char **envp) > "is no longer supported.\n"); > break; > case QEMU_OPTION_name: > - qemu_name =3D g_strdup(optarg); > - { > - char *p =3D strchr(qemu_name, ','); > - if (p !=3D NULL) { > - *p++ =3D 0; > - if (strncmp(p, "process=3D", 8)) { > - fprintf(stderr, "Unknown subargument %s to -name\n", p); > - exit(1); > - } > - p +=3D 8; > - os_set_proc_name(p); > - } > - } > + opts =3D qemu_opts_parse(qemu_find_opts("name"), optar= g, 1); > + if (!opts) { > + exit(1); > + } > + parse_name(opts); > break; > case QEMU_OPTION_prom_env: > if (nb_prom_envs >=3D MAX_PROM_ENVS) { >=20 I have one question, but it doesn't block my R-b: Did you test (and if so, how) the new .help text for "guest"? Because it seems to be the only such text that has newline characters embedded. I looked around the tree a bit, and it seems that the only way to get these option texts is the "query-command-line-options" QMP command (apparently not available via HMP). If that's the case, then the embedded newlines could / should be dropped. But I don't really care about those. Reviewed-by: Laszlo Ersek Thanks Laszlo