From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvZbs-0006mk-Gq for qemu-devel@nongnu.org; Fri, 13 Jun 2014 18:06:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvZbn-0005SG-Ue for qemu-devel@nongnu.org; Fri, 13 Jun 2014 18:06:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvZbn-0005S2-Mv for qemu-devel@nongnu.org; Fri, 13 Jun 2014 18:06:03 -0400 Message-ID: <539B75C6.8020303@redhat.com> Date: Fri, 13 Jun 2014 16:05:58 -0600 From: Eric Blake MIME-Version: 1.0 References: <1401970944-18735-1-git-send-email-wenchaoqemu@gmail.com> <1401970944-18735-18-git-send-email-wenchaoqemu@gmail.com> <539B7164.1030407@redhat.com> In-Reply-To: <539B7164.1030407@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dAg96dftDgRkMuNboDpoTe4g3NKeAmvf1" Subject: Re: [Qemu-devel] [PATCH V6 17/29] qapi event: convert WATCHDOG List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia , qemu-devel@nongnu.org Cc: lcapitulino@redhat.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --dAg96dftDgRkMuNboDpoTe4g3NKeAmvf1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/13/2014 03:47 PM, Eric Blake wrote: > On 06/05/2014 06:22 AM, Wenchao Xia wrote: >> Signed-off-by: Wenchao Xia >> --- >> docs/qmp/qmp-events.txt | 19 ------------------- >> hw/watchdog/watchdog.c | 23 +++++++---------------- >> monitor.c | 2 +- >> qapi-event.json | 15 +++++++++++++++ >> qapi-schema.json | 24 ++++++++++++++++++++++++ >> 5 files changed, 47 insertions(+), 36 deletions(-) >> >=20 >> + 'data': { 'action': 'WatchdogExpirationAction' } } >=20 > Hmm. You've managed to create error.json in such a manner that it is > not self-sufficient. If some other file includes error.json, it must > also define WatchdogExpirationAction or it will fail the generators. s/error.json/qapi-event.json/ >=20 >> +++ b/qapi-schema.json >=20 >> +## >> +# @WatchdogExpirationAction >=20 > I think you will be better off to ensure that error.json is and again qapi-event.json (not sure why I typed error.json). > self-sufficient, perhaps by sticking any data type it references > directly into common.json rather than qapi-schema.json, and having > error.json include common.json. (This is the first instance of > referencing an external type, but other events later in the series have= > the same issue). Oh weird! I've managed to run all four of scripts/qapi-{visit,types,commands,event}.py directly on qapi-event.json, and didn't get any complaints from the generator. BUT, the generated code is definitely different: -void qapi_event_send_watchdog(WatchdogExpirationAction action, +void qapi_event_send_watchdog(WatchdogExpirationAction * action, Error **errp) That is, when the enum type is known (because the parse was done on qapi-schema.json), the WatchdogExpirationAction argument is treated as an integer enum value; but when the enum type is unknown (because the parse was done directly on an incomplete qapi-event.json), the generator tries to treat it as a pointer to an otherwise unknown structure. (Never mind the odd formatting of the space after the '*' - I believe this pending patch fixes it: https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg02385.html). This little exercise raises red flags for me - we probably ought to enhance the code generators to error out instead of blindly act as if unknown types are pointers. But save it for another day - no need to stall this series just to wait for a robustness improvement to the generators. Meanwhile, my suggestion of making qapi-event.json to be self-sufficient is going to be a bit harder to test, but is still probably worth trying (just moving common types into a common shared include). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --dAg96dftDgRkMuNboDpoTe4g3NKeAmvf1 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/ iQEcBAEBCAAGBQJTm3XGAAoJEKeha0olJ0NqeiYH/jCF8majz2Ly2ziH4wLxmIlN aKLYI3++Oy85MCX+wOgFwxjUq6XDJ9lsJxsZqYUZRAsoSM8RP10d7LIYBJP/uX9l iHcn73sLViol3RL8hNEERBGdY/FL4WGvQdfN+9lZd/N+GWHTZQF0looMhqUMnvEl /ZOZXBKg1ESb5482wt5El121nz3g13L7PUGXwPWr6SKPQm/s6x3dUZLJas6enBYE HD6L8kfGRR7pUord/Xr1PwyT0B++S76U80IFzs9vYlzMVTm4V2Cigx752YpwxjJO ro6eoqEcQV5ZFekApBzti4QjCmV9P6iLdDUhJ6Wot6T6eOLvUSwNAQZ6+4D+rJE= =Cuor -----END PGP SIGNATURE----- --dAg96dftDgRkMuNboDpoTe4g3NKeAmvf1--