From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu5K1-0006M3-Vs for qemu-devel@nongnu.org; Tue, 02 Jul 2013 14:29:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu5K0-0004y0-5T for qemu-devel@nongnu.org; Tue, 02 Jul 2013 14:29:01 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:35407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu5K0-0004xt-2P for qemu-devel@nongnu.org; Tue, 02 Jul 2013 14:29:00 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 2 Jul 2013 14:28:59 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 3609838C8045 for ; Tue, 2 Jul 2013 14:28:57 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r62IRbci336448 for ; Tue, 2 Jul 2013 14:27:37 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r62IRams019450 for ; Tue, 2 Jul 2013 15:27:36 -0300 From: Anthony Liguori In-Reply-To: <51D308A1.7080604@redhat.com> References: <1371644677-11041-1-git-send-email-akong@redhat.com> <878v1pqak4.fsf@codemonkey.ws> <51D2F1B3.1080903@redhat.com> <20130702153945.GZ2524@redhat.com> <51D3035A.1060605@redhat.com> <1408396387.2128564.1372784481475.JavaMail.root@redhat.com> <51D308A1.7080604@redhat.com> Date: Tue, 02 Jul 2013 13:27:32 -0500 Message-ID: <87d2r0om0b.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] full introspection support for QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Paolo Bonzini Cc: mdroth , qemu-devel@nongnu.org, armbru@redhat.com, lcapitulino@redhat.com, qiaonuohan@cn.fujitsu.com, Amos Kong Eric Blake writes: > On 07/02/2013 11:01 AM, Paolo Bonzini wrote: >>>> Arguably that rule of thumb would apply equally to the QEMU >>>> build scripts which already parse qapi-schema.json. It could >>>> be possible to normalize qapi-schema.json somewhat to remove >>>> this 2-stage parsing if we went down this route. >>> >>> Indeed, I wouldn't mind a one-time pass over qapi-schema.json to make it >>> follow a more rigid format if that made it easier to use it as-is with >>> less post-processing. It won't be very nice to backport such a >>> conversion, but I don't know how much distros are planning on >>> backporting introspection in the first place. >> >> How would the schema look like after this "one-time pass"? >> >> This: >> >>> [ >>> { "name": "protocol", >>> "type": "str" }, >>> { "name": "fdname", >>> "type": "str" }, >>> { "name": "skipauth", >>> "type": "bool", >>> "optional": true }, >>> { "name": "tls", >>> "type": "bool", >>> "optional": true } >>> ] >> >> Looks quite awful for a human to write and read. > > Which puts us back in favor of my original argument that keeping > qapi-schema.json compact for human use, qapi-schema.json is not "for human use". It's consumed by QAPI. It happens to be reasonably human readable but that's just a happy coincidence and because we document and format the heck out of it. > while expanding the QMP output > to be verbose for machine use, is probably what we'll have to live with. > While it is easy to document shortcuts that the qapi parser can use > when converting .json to code, it is harder to require that all other > QMP clients must implement those same shortcuts, instead of having > things already directly represented. qapi-schema.json is valid JSON except for the # style comments. Those are trivial to remove and we could simply post process it. Heck, if you use json_parser to parse the file, you'd end up with a list of QObjects that could be returned directly via QMP. I don't understand what all this talk of "post-processing" is. Regards, Anthony Liguori > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org