From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVfQF-0003cP-K4 for qemu-devel@nongnu.org; Fri, 05 Aug 2016 09:44:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVfQ9-00041b-LH for qemu-devel@nongnu.org; Fri, 05 Aug 2016 09:44:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVfQ9-00041X-Cq for qemu-devel@nongnu.org; Fri, 05 Aug 2016 09:44:17 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE188C056793 for ; Fri, 5 Aug 2016 13:44:16 +0000 (UTC) From: Markus Armbruster References: <20160721140030.28383-1-marcandre.lureau@redhat.com> <20160721140030.28383-7-marcandre.lureau@redhat.com> <877fbvv0mn.fsf@dusky.pond.sub.org> <1663552743.1347944.1470402030216.JavaMail.zimbra@redhat.com> Date: Fri, 05 Aug 2016 15:44:13 +0200 In-Reply-To: <1663552743.1347944.1470402030216.JavaMail.zimbra@redhat.com> (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Fri, 5 Aug 2016 09:00:30 -0400 (EDT)") Message-ID: <8760rfs53m.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 06/12] monitor: remove mhandler.cmd_new List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: marcandre lureau , qemu-devel@nongnu.org Marc-Andr=C3=A9 Lureau writes: > Hi > > ----- Original Message ----- >> marcandre.lureau@redhat.com writes: >>=20 >> > From: Marc-Andr=C3=A9 Lureau >> > >> > This is no longer necessary, now that middle mode has been removed. >>=20 >> Well, middle mode hasn't been removed just yet, only its use. Perhaps: >>=20 >> This is no longer necessary now that we aren't using middle mode >> anymore. > > ok > >>=20 >> > Signed-off-by: Marc-Andr=C3=A9 Lureau >> > --- >> > monitor.c | 13 +-- >> > docs/writing-qmp-commands.txt | 8 +- >> > hmp-commands-info.hx | 118 ++++++++++++------------ >> > hmp-commands.hx | 208 >> > +++++++++++++++++++++--------------------- >> > 4 files changed, 170 insertions(+), 177 deletions(-) >> > >> > diff --git a/monitor.c b/monitor.c >> > index 5bbe4bb..642be2e 100644 >> > --- a/monitor.c >> > +++ b/monitor.c >> > @@ -130,13 +130,10 @@ typedef struct mon_cmd_t { >> > const char *args_type; >> > const char *params; >> > const char *help; >> > - union { >> > - void (*cmd)(Monitor *mon, const QDict *qdict); >> > - void (*cmd_new)(QDict *params, QObject **ret_data, Error **er= rp); >> > - } mhandler; >> > - /* @sub_table is a list of 2nd level of commands. If it do not ex= ist, >> > - * mhandler should be used. If it exist, sub_table[?].mhandler sh= ould >> > be >> > - * used, and mhandler of 1st level plays the role of help functio= n. >> > + void (*cmd)(Monitor *mon, const QDict *qdict); >> > + /* @sub_table is a list of 2nd level of commands. If it does not >> > exist, >> > + * cmd should be used. If it exists, sub_table[?].cmd should be >> > + * used, and cmd of 1st level plays the role of help function. >> > */ >> > struct mon_cmd_t *sub_table; >> > void (*command_completion)(ReadLineState *rs, int nb_args, const = char >> > *str); >> > @@ -2960,7 +2957,7 @@ static void handle_hmp_command(Monitor *mon, con= st >> > char *cmdline) >> > return; >> > } >> >=20=20 >> > - cmd->mhandler.cmd(mon, qdict); >> > + cmd->cmd(mon, qdict); >> > QDECREF(qdict); >> > } >> >=20=20 >> > diff --git a/docs/writing-qmp-commands.txt b/docs/writing-qmp-commands= .txt >> > index 59aa77a..6208715 100644 >> > --- a/docs/writing-qmp-commands.txt >> > +++ b/docs/writing-qmp-commands.txt >> > @@ -127,7 +127,6 @@ following at the bottom: >> > { >> > .name =3D "hello-world", >> > .args_type =3D "", >> > - .mhandler.cmd_new =3D qmp_marshal_hello_world, >> > }, >> >=20=20 >>=20 >> Uh, doesn't this belong to the previous commit? >>=20 >> > You're done. Now build qemu, run it as suggested in the "Testing" sec= tion, >> > @@ -179,7 +178,6 @@ The last step is to update the qmp-commands.hx fil= e: >> > { >> > .name =3D "hello-world", >> > .args_type =3D "message:s?", >> > - .mhandler.cmd_new =3D qmp_marshal_hello_world, >> > }, >> >=20=20 >>=20 >> Likewise. >>=20 >> > Notice that the "args_type" member got our "message" argument. The >> > character >> > @@ -337,7 +335,7 @@ we should add it to the hmp-commands.hx file: >> > .args_type =3D "message:s?", >> > .params =3D "hello-world [message]", >> > .help =3D "Print message to the standard output", >> > - .mhandler.cmd =3D hmp_hello_world, >> > + .cmd =3D hmp_hello_world, >> > }, >> >=20=20 >> > STEXI >> > @@ -459,7 +457,6 @@ The last step is to add the correspoding entry in = the >> > qmp-commands.hx file: >> > { >> > .name =3D "query-alarm-clock", >> > .args_type =3D "", >> > - .mhandler.cmd_new =3D qmp_marshal_query_alarm_clock, >> > }, >>=20 >> Likewise. >>=20 >> >=20=20 >> > Time to test the new command. Build qemu, run it as described in the >> > "Testing" >> > @@ -518,7 +515,7 @@ in the monitor.c file. The entry for the "info >> > alarmclock" follows: >> > .args_type =3D "", >> > .params =3D "", >> > .help =3D "show information about the alarm clock", >> > - .mhandler.info =3D hmp_info_alarm_clock, >> > + .cmd =3D hmp_info_alarm_clock, >> > }, >> >=20=20 >> > To test this, run qemu and type "info alarmclock" in the user monitor. >> > @@ -605,7 +602,6 @@ To test this you have to add the corresponding >> > qmp-commands.hx entry: >> > { >> > .name =3D "query-alarm-methods", >> > .args_type =3D "", >> > - .mhandler.cmd_new =3D qmp_marshal_query_alarm_methods, >> > }, >> >=20=20 >>=20 >> Likewise. > > > Ok those are from the documentation and can be moved to previous commit. > >>=20 >> > Now Build qemu, run it as explained in the "Testing" section and try = our >> > new >> > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx >> > index 74446c6..19729e5 100644 >> > --- a/hmp-commands-info.hx >> > +++ b/hmp-commands-info.hx >> > @@ -18,7 +18,7 @@ ETEXI >> > .args_type =3D "", >> > .params =3D "", >> > .help =3D "show the version of QEMU", >> > - .mhandler.cmd =3D hmp_info_version, >> > + .cmd =3D hmp_info_version, >> > }, >> >=20=20 >> > STEXI >> [More of the same snipped...] > > However those belong with this commit (I am not sure if you meant that th= ey should also be moved) No, I didn't mean to suggest that. They indeed belong to this commit.