From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDgvX-0000dr-Lb for qemu-devel@nongnu.org; Wed, 12 Feb 2014 16:01:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDgvS-0004Du-OX for qemu-devel@nongnu.org; Wed, 12 Feb 2014 16:01:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDgvS-0004DS-GK for qemu-devel@nongnu.org; Wed, 12 Feb 2014 16:00:58 -0500 Message-ID: <52FBE103.6000709@redhat.com> Date: Wed, 12 Feb 2014 14:00:51 -0700 From: Eric Blake MIME-Version: 1.0 References: <1390881230-14033-1-git-send-email-akong@redhat.com> <1390881230-14033-6-git-send-email-akong@redhat.com> In-Reply-To: <1390881230-14033-6-git-send-email-akong@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2JxPolLfVgEs6p3PRoe6TcSbvqCpNt8pt" Subject: Re: [Qemu-devel] [PATCH 5/5] query-command-line-options: return help message for legacy options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong , qemu-devel@nongnu.org Cc: jyang@redhat.com, laine@redhat.com, libvir-list@redhat.com, armbru@redhat.com, rjones@redhat.com, anthony@codemonkey.ws, pbonzini@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2JxPolLfVgEs6p3PRoe6TcSbvqCpNt8pt Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/27/2014 08:53 PM, Amos Kong wrote: > Some legacy options that have arguments weren't added to > vm_config_groups[], so query-command-line-options returns a > NULL parameters infolist. This patch try to return help message > for this kind of legacy options. >=20 > Example: > { > "helpmsg": "\"-vnc display start a VNC server on display\\n\"",= > "parameters": [ > ], > "option": "vnc" > }, >=20 > Signed-off-by: Amos Kong > --- > qapi-schema.json | 5 ++++- > util/qemu-config.c | 3 +++ > 2 files changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/qapi-schema.json b/qapi-schema.json > index 05ced9d..b3e6f46 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -3943,13 +3943,16 @@ > # Details about a command line option, including its list of parameter= details > # > # @option: option name > +# @helpmsg: help message for legacy options Missing "#optional" and "(since 2.0)" designations > # > # @parameters: an array of @CommandLineParameterInfo Might be worth documenting "#optional since 2.0" (we don't yet have good precedent for documenting when a formerly mandatory field became optional= ). Groan. This is an output struct. On input structs, changing a mandatory field to optional is safe - old callers will always supply the field. But on output structs, changing a mandatory field to optional is backwards-incompatible. Old callers may be blindly expecting the field, and crash when it is not present. Your approach needs to be modified. > # > # Since 1.5 > ## > { 'type': 'CommandLineOptionInfo', > - 'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'= ] } } > + 'data': { 'option': 'str', > + '*parameters': ['CommandLineParameterInfo'], > + '*helpmsg': 'str' } } I suggest: # @parameters: array of @CommandLineParameterInfo, possibly empty # @argument: @optional present if the @parameters array is empty. If # true, then the option takes unspecified arguments, if # false, then the option is merely a boolean flag (since 2.0) { 'type': 'CommandLineOptionInfo', 'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'], '*argument': 'bool' } } used as: [ { "option":"enable-fips", "parameters":[], "argument":false }, { "option":"smbios", "parameters":[], "argument":true }, { "option":"iscsi", "paramters":[ ... ] }, ... ] which adequately differentiates between -iscsi taking arguments (but where we haven't yet hooked it in to introspect those arguments) vs. -enable-fips being boolean. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2JxPolLfVgEs6p3PRoe6TcSbvqCpNt8pt 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/ iQEcBAEBCAAGBQJS++EEAAoJEKeha0olJ0NqNZAH/1Tobz2FOeI0se2vUuzTN8oS GBWjd5z06y0z+NiS6rgfIQSPAvWrxlOYulQYvM5hcNEbLZ0gbvdk3j0RWReO6ZrC YoZexLM9IataPICDjVylA3wgMAuytkM3y4utsrvSgf5FdCyFI/CyCPTc8BNamNGL Y7xCzkOjBeE0mjcAw3vqyK0ofFpK1A0V7ym14O/pHi4U/oj25n8QLXePAhkNLngw LC/I1aSbOtS3gFxaULC26sxK1fmH+aj3ibbX88O02RgQDtDRlnLxkP9cQagXOfj2 6lu31J/9z2vgLSdFM1yH8zMNEKj3fAe9qO++HMrs3bk+nGVj7gW4ANBEoQ86YLs= =5rFw -----END PGP SIGNATURE----- --2JxPolLfVgEs6p3PRoe6TcSbvqCpNt8pt--