From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9jFD-0001Ee-9R for qemu-devel@nongnu.org; Mon, 19 Mar 2012 16:31:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9jFB-0006MS-7l for qemu-devel@nongnu.org; Mon, 19 Mar 2012 16:31:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9jFA-0006M9-WA for qemu-devel@nongnu.org; Mon, 19 Mar 2012 16:31:53 -0400 Message-ID: <4F6797B3.7030405@redhat.com> Date: Mon, 19 Mar 2012 14:31:47 -0600 From: Eric Blake MIME-Version: 1.0 References: <1332169763-30665-1-git-send-email-aliguori@us.ibm.com> <1332169763-30665-8-git-send-email-aliguori@us.ibm.com> <4F6792B6.9080508@redhat.com> <4F6794CF.9070409@codemonkey.ws> In-Reply-To: <4F6794CF.9070409@codemonkey.ws> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig6B4F9A39FA42F99897704A3F" Subject: Re: [Qemu-devel] [PATCH 7/9] qmp: expose a command to query capabilities of config parser List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Anthony Liguori , Gerd Hoffman , Eduardo Habkost , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6B4F9A39FA42F99897704A3F Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/19/2012 02:19 PM, Anthony Liguori wrote: >>> +# @size: an integer followed by either 'K', 'M', 'G', or 'T'. >> >> Not quite - I found three different parsers, but none of them match th= is >> description. >=20 > Heh, I was going by the documentation in the code: >=20 > QEMU_OPT_SIZE, /* size, accepts (K)ilo, (M)ega, (G)iga, > (T)era postfix */ >=20 >=20 >> That is, qemu-option.c:parse_option_size() supports 'k' >> and 'b', as well as omitting a suffix, but does not support 'm'. >=20 > TBH, I'd prefer to not document 'k' and 'b' and explicitly document tha= t > the suffix is optional and bytes is implied (which I thought was implie= d > in my documentation, but I can see that it may not be). >=20 > I'd rather we support officially support one way of doing things and if= > we support more, do it under the mantra of being liberal in what we acc= ept. Okay, I can live with documenting less than we accept, but we definitely need to mention that the suffix is optional, and that when omitted, the unit is bytes (as originally written, I read it that the suffix was mandatory, and that there was no way to request bytes). I'm not sure whether documenting an explicit 'b' for bytes helps or hurts, and I'm not sure whether adding support for 'p' and 'e' as documented suffixes makes sense. >=20 >> Then >> there's cmd.c:cvtnum(), which is case-insensitive, and adds 'p' and 'e= ', >> but omits 'b'. Then there's the 'o' type in monitor.c that defers to >> cutils.c:strtosz(), which defaults to bytes but is case-insensitive an= d >> supports 'b' but not 'p'. Why are we using three different parsers, >> anyway? >=20 > Yes, I am aware of that, and yes, I'm going to fix it. One bit at a > time though. Fair enough :) It's just that I recently fixed a bug in libvirt where it was using a human interface with no suffix and getting 'M' behavior, where an explicit 'B' behavior fixed things to use bytes, and I was quite put off by the inconsistencies and lack of documentation when I finally discovered that a 'B' suffix did what I wanted. I'm glad that QMP defaults to 'B', not 'M'. (Libvirt had its own fair share of inconsistent scaling routines, where some interfaces default to 'k' instead of bytes, and I recently consolidated libvirt to use a single scaling routing for much the same reasons.) --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig6B4F9A39FA42F99897704A3F 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.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPZ5ezAAoJEKeha0olJ0NqozUH/iS+w16jSCChKZmjUJktHAcn 9nbSxA//CU/vAzZz1j3FwigufFSaN6p+WgzuhPKIsWVBKfdgxvM69yJ25oT3Wzq4 iVQ+ez8wwpKE0wcC9tNfsKv8t/3keDFrU1rsBT1sy7362cvlSTw4XHHFi9EVyMW5 z9cHLGMQ6epFQALc8Z8hNGgEzfdKePq5MuIiVbKR5+fAid3kiS7Xd1lIJm/a4N8/ fxR3X9FYK6WXWAPnSduhDnln2AL6hagMlp8KNumF6i+c2p4xxnbh2ZepOgacT7UX OuV39ek6P9sDcpKhC+0zOIvpkUeazZcnWty+dLbo03HGMfXbDxURA1XKdsk5ipA= =1IOH -----END PGP SIGNATURE----- --------------enig6B4F9A39FA42F99897704A3F--