From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux0V8-0006jK-LY for qemu-devel@nongnu.org; Wed, 10 Jul 2013 15:56:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ux0V7-00084o-Hv for qemu-devel@nongnu.org; Wed, 10 Jul 2013 15:56:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31245) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux0V7-00084i-9z for qemu-devel@nongnu.org; Wed, 10 Jul 2013 15:56:33 -0400 Message-ID: <51DDBC6B.3060407@redhat.com> Date: Wed, 10 Jul 2013 13:56:27 -0600 From: Eric Blake MIME-Version: 1.0 References: <1371547919-15654-1-git-send-email-wdongxu@linux.vnet.ibm.com> <1371547919-15654-7-git-send-email-wdongxu@linux.vnet.ibm.com> In-Reply-To: <1371547919-15654-7-git-send-email-wdongxu@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2JMCNIETTHSWXXJUEBCCA" Subject: Re: [Qemu-devel] [PATCH V16 6/7] query-command-line-options outputs def_value_str List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dong Xu Wang Cc: kwolf@redhat.com, wdongxu@cn.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2JMCNIETTHSWXXJUEBCCA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/18/2013 03:31 AM, Dong Xu Wang wrote: > QMP command query-command-line-options shows details information of > parameters, since added def_value_str, also output it in the QMP > command. >=20 > Signed-off-by: Dong Xu Wang > --- > qapi-schema.json | 5 ++++- > qmp-commands.hx | 2 ++ > util/qemu-config.c | 4 ++++ > 3 files changed, 10 insertions(+), 1 deletion(-) >=20 > diff --git a/qapi-schema.json b/qapi-schema.json > index a80ee40..a9202b0 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -3541,12 +3541,15 @@ > # > # @help: #optional human readable text string, not suitable for parsin= g. > # > +# @def_value_str: #optional default value string for the parameter Andreas called one aspect - please add '(since 1.6)'. New QMP interfaces favor '-' over '_', and we also favor full words rather than abbreviations. Furthermore, since this parameter is already typed as a string, I think the _str suffix is redundant. I think it is sufficient to just name it 'default', as in: # @default: #optional string representation of the default used # if the option is omitted > +++ b/qmp-commands.hx > @@ -2521,6 +2521,8 @@ Each array entry contains the following: > or 'size') > - "help": human readable description of the parameter > (json-string, optional) > + - "def_value_str": default value string for the parameter > + (json-string, optional) > =20 > Example: Is it worth picking an example that actually shows a default value? But I won't insist. > =20 > diff --git a/util/qemu-config.c b/util/qemu-config.c > index a59568d..538d743 100644 > --- a/util/qemu-config.c > +++ b/util/qemu-config.c > @@ -67,6 +67,10 @@ static CommandLineParameterInfoList *query_option_de= scs(const QemuOptDesc *desc) > info->has_help =3D true; > info->help =3D g_strdup(desc[i].help); > } > + if (desc[i].def_value_str) { > + info->has_def_value_str =3D true; > + info->def_value_str =3D g_strdup(desc[i].def_value_str); Of course, if you follow my naming suggestion, this would be desc[i].q_default (or whatever QAPI code generation munges it to), rather than desc[i].default, thanks to being a C keyword :) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2JMCNIETTHSWXXJUEBCCA 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.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR3bxrAAoJEKeha0olJ0NqfukH/17xGXnbPL24OBsdeAo9CRad 5UwCXadqcWacp6g5tNURGsdAvYDEvrXCtmy3JRPp0S0YjLhEPeY5WGwlaMg2jnHf w74zgZKkFyu0msGT1PwL8pucKeFS+sktpErijrbcgu0XcKFEhJ0g6Ibah3BRnEJd tC33IUOai8LtGHFme8QF/RuXIuHAddj2iUR2jm7QR2mWLST2ePGI/XB1QvrrFfRk lEJ8urvQPa8ZBEeCGYlY01hKn0GDrsDpO0LgP2ZGhjlOZV8SIDtEHzRjN+biGNIk gZlQB+w7X9Z/PhBjGYLWDVQVVaEnpOWB7M2DVzoYJQ/ytm0ijqdWT8isgn03ilQ= =7C5a -----END PGP SIGNATURE----- ------enig2JMCNIETTHSWXXJUEBCCA--