From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE9QR-0005tD-Va for qemu-devel@nongnu.org; Thu, 13 Feb 2014 22:27:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WE9QJ-0007Ki-Fo for qemu-devel@nongnu.org; Thu, 13 Feb 2014 22:26:51 -0500 Received: from e28smtp07.in.ibm.com ([122.248.162.7]:53643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE9QI-0007K6-PU for qemu-devel@nongnu.org; Thu, 13 Feb 2014 22:26:43 -0500 Received: from /spool/local by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Feb 2014 08:56:39 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 8953F394004E for ; Fri, 14 Feb 2014 08:56:36 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s1E3QcNS62980194 for ; Fri, 14 Feb 2014 08:56:38 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s1E3Qa2V009600 for ; Fri, 14 Feb 2014 08:56:36 +0530 Message-ID: <52FD8CFB.7090204@linux.vnet.ibm.com> Date: Fri, 14 Feb 2014 11:26:51 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1388704234-22498-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1388704234-22498-4-git-send-email-xiawenc@linux.vnet.ibm.com> <20140106181004.192b4472@redhat.com> <20140106181700.3215f8ae@redhat.com> <52CB736B.1060901@linux.vnet.ibm.com> In-Reply-To: <52CB736B.1060901@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC PATCH V2 3/5] qapi script: add event support by qapi-event.py List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: armbru@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 于 2014/1/7 11:24, Wenchao Xia 写道: >>>> + >>>> + >>>> +# Following are the functions that generate event behavior control >>>> functions. >>>> +# Those functions are put here in the qapi-event.c, since it need >>>> to include >>>> +# qapi-event.h for the event enum type declaration, put them in >>>> other file >>>> +# requiring other file include qapi-event.h, causing a cross >>>> including. For >>>> +# example: if we have qmp-event.c and qmp-event.h, then qmp-event.c >>>> +# ->qmp-event.h->qapi-event.h, qapi-event.c->qmp-event.h. Another >>>> problem >>>> +# follow: test-qapi-event.c will meet event enum double declaration >>>> since it >>>> +# include both test-qapi-event.h and qmp-event.h. One solution is >>>> putting event >>>> +# enum declaration in a separate header file, but then qmp-event.h >>>> need to >>>> +# include test-qapi-event.h or qapi-event.h on compile time >>>> condition. So the >>>> +# easist way is, just generate them here. >>>> + >>>> +def generate_event_behavior_control_decl(event_enum_name): >>>> + ret = mcgen(''' >>>> + >>>> +typedef void (*QAPIEventFuncEmit)(%(event_enum_name)s ev, >>>> + QDict *dict, >>>> + Error **errp); >> >> Why does the emit function need 'ev'? Doesn't 'dict' contain all the >> info it needs? Also, it's better to rename it to 'event' or 'qmp_event'. >> > > ev is for rate limit. I didn't move rate limit logic from callback to > internal, mainly because it is a generated function, which seems > too complex. And the genrated function was not moved into a separte > file mainly because the enum and including issue, see the comments > in script above. > The problem is enum is changing, so the new file include it need > to recompile, for example, test schema and qapi-schema.json may > force recompile twice, I am not sure if it is good to do > some tricks in build system. > I am going to respin this series after sync with upstream. "ev" will be removed, and will try use a runtime call to solve issue above.