From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8AYV-0001eP-Vi for qemu-devel@nongnu.org; Fri, 18 Jul 2014 11:58:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X8AYQ-0002Bt-Ql for qemu-devel@nongnu.org; Fri, 18 Jul 2014 11:58:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8AYQ-0002Bh-ID for qemu-devel@nongnu.org; Fri, 18 Jul 2014 11:58:38 -0400 Message-ID: <53C94363.1000004@redhat.com> Date: Fri, 18 Jul 2014 09:55:15 -0600 From: Eric Blake MIME-Version: 1.0 References: <20140717110153.8352.80175.stgit@PASHA-ISP> <20140717110616.8352.95699.stgit@PASHA-ISP> In-Reply-To: <20140717110616.8352.95699.stgit@PASHA-ISP> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0AkIrCU5gF4LxBkOEfAq6DacXo3eSx8sP" Subject: Re: [Qemu-devel] [RFC PATCH v2 46/49] replay: replay_info command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, pbonzini@redhat.com, fred.konrad@greensocs.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --0AkIrCU5gF4LxBkOEfAq6DacXo3eSx8sP Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/17/2014 05:06 AM, Pavel Dovgalyuk wrote: > This patch adds support for replay_info monitor command. This command > returns the information about replay execution (replay mode and current= step). >=20 > Signed-off-by: Pavel Dovgalyuk > --- > +++ b/qapi-schema.json > @@ -3491,3 +3491,30 @@ > # Since: 2.1 > ## > { 'command': 'rtc-reset-reinjection' } > + > +## > +# @ReplayInfo: > +# > +# Information about replay process > +# > +# @mode: replay mode (none, play, record) > +# > +# @submode: play submode What are the valid submodes? Does the set of submodes differ according to the main mode? If so, is it better to use a flat union, where the subtype is strongly typed to the correct limited possibilities according to the mode? > +# > +# @step: current step of record or play > +# > +# Since: 2.2 > +## > +{ 'type': 'ReplayInfo', > + 'data': {'mode': 'str', 'submode': 'str', 'step': 'uint64'} } Using 'str' to open-code a finite set of strings is not nice. Please add= : { 'enum': 'ReplayMode', 'data': [ 'none', 'play', 'record' ] } then use 'mode': 'ReplayMode'. > +++ b/qmp-commands.hx > @@ -3755,3 +3755,17 @@ Example: > <- { "return": {} } > =20 > EQMP > + > + { > + .name =3D "replay_info", > + .args_type =3D "", > + .mhandler.cmd_new =3D qmp_marshal_input_replay_info, > + }, > + > +SQMP > +replay_info > +----------- > + > +Shows information about replay process. > + No example? > + > +const char *replay_get_mode_name(void) > +{ > + switch (replay_mode) { > + case REPLAY_NONE: > + return "none"; > + case REPLAY_PLAY: > + return "replay"; > + case REPLAY_SAVE: > + return "record"; > + default: > + return "unknown"; > + } > +} > + No need to open-code this. If you properly set up an enum type in the =2Ejson file, then you get the conversions between enum values and string= s for free from the generated QAPI framework. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --0AkIrCU5gF4LxBkOEfAq6DacXo3eSx8sP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTyUNjAAoJEKeha0olJ0NqH4kH/0YCYp94zmnSZdea8M11pIW3 49LRkZOmKOKGOUb6ze8NNfaIdiNS9JU3j0SnHFdQo5wKnexiAVZmDN5z2wd4C3DQ iWwo4eRulKzL8er07F4q3BYenz6UkMxZIfSXjaksQEx1zxPDouUXwEeFGs1sUFXQ 36KBLSl4jiac9SnnjQiliKx/4pSB4gNF7ftbz8btxOXcscx31LFxq6Jd+wyR4lAT 4UV3JfYbqHM2TbfjgYgGDKvRxNaWHj/qugQ5sHa8Jubfe9LpxKQlAXhAo08hDCe+ W23NOfuaO88vEzLlIylH3D48it7ylby0LWNwW2CgYLF2YiNqcqsiPcPmB5IEsIQ= =xjEF -----END PGP SIGNATURE----- --0AkIrCU5gF4LxBkOEfAq6DacXo3eSx8sP--