From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbQBJ-0003zN-EO for qemu-devel@nongnu.org; Wed, 30 Oct 2013 03:27:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbQB7-0000HR-BU for qemu-devel@nongnu.org; Wed, 30 Oct 2013 03:27:09 -0400 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:45449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbQB6-0000Gv-PH for qemu-devel@nongnu.org; Wed, 30 Oct 2013 03:26:57 -0400 Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 30 Oct 2013 12:56:53 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 09259E001A for ; Wed, 30 Oct 2013 12:58:29 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r9U7QjoA18350272 for ; Wed, 30 Oct 2013 12:56:45 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r9U7Qn0G020654 for ; Wed, 30 Oct 2013 12:56:49 +0530 Message-ID: <5270B4B8.2030000@linux.vnet.ibm.com> Date: Wed, 30 Oct 2013 15:26:48 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1382321765-29052-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1382321765-29052-4-git-send-email-xiawenc@linux.vnet.ibm.com> <5265917D.3000903@redhat.com> <526E3FF1.7060305@redhat.com> <526F4631.50706@linux.vnet.ibm.com> <526FDDC4.9010803@redhat.com> In-Reply-To: <526FDDC4.9010803@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 3/6] qapi: rename prefix QEVENT to Q_EVENT List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Paolo Bonzini Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, lcapitulino@redhat.com 于 2013/10/30 0:09, Eric Blake 写道: > On 10/28/2013 11:22 PM, Wenchao Xia wrote: > >> MONITOR_EVENT seems tide to monitor too much, since it will be present >> in qapi-schema, I think Q_EVENT_ or QMP_EVENT_KIND would be better? > I don't have a strong enough opinion on the bikeshed color. > MONITOR_EVENT implies the event is always associated with delivery over > a monitor; but how else would you receive an event without a monitor? Block code emit event already, when it is packaged as a library it may need emit to other place. I think event doesn't have to be bond to monitor, I can modify the qapi script to generate name correctly, to avoid patch 2, Since it seems not right to have '_' between two capitals. >> I am coding v2, which fully support event define in qapi-schema. There >> is another thing I hope to know your opinion: >> Should we support use enum as discriminator? >> >> { 'enum': 'QEvent', >> 'data': [ 'SHUTDOWN', 'POWERDOWN'] >> >> { 'type': 'QmpEventBase', >> 'data': { 'event': 'QEvent', 'timestamp': 'EventTimestamp' } } >> >> { 'Union': 'QmpEvent', >> 'base': 'QmpEventBase', >> 'discriminator': 'event', > I raised that question when Kevin first added discriminated unions; if I > recall, the answer was along the lines: "yes, it would be a nice > addition, but someone would have to code it, and we'd have to teach the > generator.py to loudly fail if all branches of the enum are not covered > in the union's data". So go for it! OK, will send it soon. > >> 'data': { >> 'SHUTDOWN' : 'EventShutdown', >> 'POWERDOWN' : 'EventPowerdown' >> } >> } >> >> By default 'QmpEvent' will generate a hidden enum type 'QmpEventKind'. >> but the hidden type define is needed by query-event, so there is two way >> to archieve it: >> 1 just use the hidden type in qapi-schema.json. >> 2 modified the script to support use predefined enum type. >> In my draft code, both can work, but which one do you prefer? > I'd like to see the addition of an enum-typed discriminator, rather than > forcing the discriminator to be string-only. >