From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VyyuX-0001Gw-Ed for qemu-devel@nongnu.org; Fri, 03 Jan 2014 02:11:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VyyuH-00045T-5B for qemu-devel@nongnu.org; Fri, 03 Jan 2014 02:11:13 -0500 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:33928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VyyuE-00044v-TX for qemu-devel@nongnu.org; Fri, 03 Jan 2014 02:10:57 -0500 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Jan 2014 12:40:43 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id AF78BE005E for ; Fri, 3 Jan 2014 12:43:21 +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 s037AVQA8061016 for ; Fri, 3 Jan 2014 12:40:32 +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 s037Ac7E017360 for ; Fri, 3 Jan 2014 12:40:38 +0530 From: Wenchao Xia Date: Fri, 3 Jan 2014 07:10:29 +0800 Message-Id: <1388704234-22498-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH V2 0/5] add direct support of event in qapi schema List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Wenchao Xia , mreitz@redhat.com, armbru@redhat.com, lcapitulino@redhat.com This series add support for tag/keyword 'event' in qapi-schema. A new file was created to store some helper functions in patch 2, patch 4 is the test case, patch 5 is a convert example. The implemention is done by generate API and a batch of parameters for each event define, it doesn't generate a struture and visit function in the background for every event, so it doesn't support nested structure in the define to avoid trouble. A callback layer is added to control the behavior. More detail can be found in patch 3's message and incode comments. Since it is also touching qapi script, it is on top of series: http://lists.nongnu.org/archive/html/qemu-devel/2013-12/msg03840.html v2: Address Luiz's comments: patch 3: rename *err to *local_err, do not initialize *qmp = NULL, create a new function qmp_build_evet_dict(). Other change: reorgnized script in patch 3, it have a clear three steps, see patch 3's incode comments. Luiz, I have following change a bit different with your comments, please have a review: docs/writing-qmp-commands.txt is still missing, I will add that patch when this approach get positive feedback. Patch 3: API name is qapi_event_send_***(), instead of qapi_send_event_***(), to keep unified api prefix. when qapi_event_function.emit == NULL, still return instead of core dump or error. Before this series, the event function does invalid work silently, my patch change it to skip invalid work silently. If core dump code is there, then it still have a silently invalid work as before, since caller will set a emtpy emit function. Some code is still kepted in generated file, see incode comments for those code. Wenchao Xia (5): 1 os-posix: include sys/time.h 2 qapi: add event helper functions 3 qapi script: add event support by qapi-event.py 4 test: add test cases for qapi event 5 qapi event: convert RTC_CHANGE Makefile | 9 +- Makefile.objs | 2 +- include/qapi/qmp-event.h | 22 ++ include/sysemu/os-posix.h | 2 + monitor.c | 14 + qapi-schema.json | 3 + qapi/Makefile.objs | 1 + qapi/qmp-event.c | 56 ++++ scripts/qapi-event.py | 432 +++++++++++++++++++++++++++++++ tests/Makefile | 14 +- tests/qapi-schema/qapi-schema-test.json | 12 + tests/qapi-schema/qapi-schema-test.out | 10 +- tests/test-qmp-event.c | 254 ++++++++++++++++++ vl.c | 7 +- 14 files changed, 824 insertions(+), 14 deletions(-) create mode 100644 include/qapi/qmp-event.h create mode 100644 qapi/qmp-event.c create mode 100644 scripts/qapi-event.py create mode 100644 tests/test-qmp-event.c