Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-18 Thread Paolo Bonzini

Il 18/06/2014 06:00, Eric Blake ha scritto:

 -typedef void (*QMPEventFuncEmit)(int event_kind, QDict *dict, Error **errp);
 +typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error **errp);

It looks like you have some churn on this definition; patch 4/29 in your
qapi-event branch did:

-enum QAPIEvent;
-typedef void (*QMPEventFuncEmit)(enum QAPIEvent event, QDict *dict,
Error **errp);
+typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error
**errp);

Can you hoist the use of 'unsigned' directly into 2/29 to minimize the
churn?


Yes, will fix in a couple of hours.

Paolo



Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-17 Thread Paolo Bonzini
Il 15/06/2014 02:52, Wenchao Xia ha scritto:
 Unfortunately, this already does not apply anymore.

 I've placed the rebase on branch qapi-event of my github repository. The
 resolutions are trivial, so perhaps Luiz or Michael can pull from there?

 Paolo
 
 
   Thanks for testing my work:)
   Eric:
   I have looked the comments, most fix will arrive in my V7 next week,
 but still I have two issues without decision:
   1. Whether to use QAPIEvent in callback function type declartion,
 See my feedback in 6/29.
   2. Whether to make qapi-event.json self sufficent, see my comments
 in 17/29.

I am afraid that this will miss 2.1 (and so will dataplane 
rerror/werror that depends on it), so I went ahead and done all fixes in 
my qapi-event branch.

I have not yet applied Reviewed-by tags from Eric since some patches
are different and I want him to look at the interdiff first.

Regarding error handling, I have left the code in but switched all
callers to error_abort.

The interdiff is here.  I ensured that the result is 
bisectable, and the intermediate changes are responsible
for the spurious hunks of the interdiff:

diff --git a/Makefile b/Makefile
index 3e65525..f473cf5 100644
--- a/Makefile
+++ b/Makefile
@@ -246,8 +246,7 @@ $(SRC_PATH)/qga/qapi-schema.json 
$(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
$(gen-out-type) -o . -b -i $, \
  GEN   $@)
 qapi-event.c qapi-event.h :\
-$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi-event.json \
-$(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
+$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-event.py \
$(gen-out-type) -o . -b -i $, \
  GEN   $@)
diff --git a/block.c b/block.c
index 2885db4..041f17a 100644
--- a/block.c
+++ b/block.c
@@ -2140,12 +2140,12 @@ static void bdrv_dev_change_media_cb(BlockDriverState 
*bs, bool load)
 if (tray_was_closed) {
 /* tray open */
 qapi_event_send_device_tray_moved(bdrv_get_device_name(bs),
-  true, NULL);
+  true, error_abort);
 }
 if (load) {
 /* tray close */
 qapi_event_send_device_tray_moved(bdrv_get_device_name(bs),
-  false, NULL);
+  false, error_abort);
 }
 }
 }
@@ -3591,7 +3591,7 @@ void bdrv_error_action(BlockDriverState *bs, 
BlockErrorAction action,
 qapi_event_send_block_io_error(bdrv_get_device_name(bs),
is_read ? IO_OPERATION_TYPE_READ :
IO_OPERATION_TYPE_WRITE,
-   action, NULL);
+   action, error_abort);
 if (action == BLOCK_ERROR_ACTION_STOP) {
 vm_stop(RUN_STATE_IO_ERROR);
 bdrv_iostatus_set_err(bs, error);
@@ -5165,7 +5165,7 @@ void bdrv_eject(BlockDriverState *bs, bool eject_flag)
 
 if (bs-device_name[0] != '\0') {
 qapi_event_send_device_tray_moved(bdrv_get_device_name(bs),
-  eject_flag, NULL);
+  eject_flag, error_abort);
 }
 }
 
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 2fca5a1..cc6cf74 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1822,7 +1822,7 @@ int qcow2_pre_write_overlap_check(BlockDriverState *bs, 
int ign, int64_t offset,
   offset,
   true,
   size,
-  NULL);
+  error_abort);
 g_free(message);
 
 qcow2_mark_corrupt(bs);
diff --git a/block/quorum.c b/block/quorum.c
index 7f0f1bd..86802d3 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -204,7 +204,7 @@ static void quorum_report_bad(QuorumAIOCB *acb, char 
*node_name, int ret)
 msg = strerror(-ret);
 }
 qapi_event_send_quorum_report_bad(!!msg, msg, node_name,
-  acb-sector_num, acb-nb_sectors, NULL);
+  acb-sector_num, acb-nb_sectors, 
error_abort);
 }
 
 static void quorum_report_failure(QuorumAIOCB *acb)
@@ -214,7 +214,7 @@ static void quorum_report_failure(QuorumAIOCB *acb)
 acb-common.bs-node_name;
 
 qapi_event_send_quorum_failure(reference, acb-sector_num,
-   acb-nb_sectors, NULL);
+   acb-nb_sectors, error_abort);
 }
 
 static int quorum_vote_error(QuorumAIOCB *acb);
diff --git a/blockjob.c b/blockjob.c
index d21f51e..4da86cd 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -239,7 +239,7 @@ void block_job_event_cancelled(BlockJob *job)
   

Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-17 Thread Eric Blake
On 06/17/2014 04:57 AM, Paolo Bonzini wrote:
 Il 15/06/2014 02:52, Wenchao Xia ha scritto:
 Unfortunately, this already does not apply anymore.

 I've placed the rebase on branch qapi-event of my github repository. The
 resolutions are trivial, so perhaps Luiz or Michael can pull from there?

 Paolo


   Thanks for testing my work:)
   Eric:
   I have looked the comments, most fix will arrive in my V7 next week,
 but still I have two issues without decision:
   1. Whether to use QAPIEvent in callback function type declartion,
 See my feedback in 6/29.
   2. Whether to make qapi-event.json self sufficent, see my comments
 in 17/29.
 
 I am afraid that this will miss 2.1 (and so will dataplane 
 rerror/werror that depends on it), so I went ahead and done all fixes in 
 my qapi-event branch.
 
 I have not yet applied Reviewed-by tags from Eric since some patches
 are different and I want him to look at the interdiff first.

Here's my first glance through your interdiff; I will also respond once
I've looked at the commits leading to
8910d4c0f568d1eb46934ef16e9a275d97749973 (your current qapi-event branch
head at git://github.com/bonzini/qemu.git).

 
 Regarding error handling, I have left the code in but switched all
 callers to error_abort.

Works for me to use error_abort.

 
 The interdiff is here.  I ensured that the result is 
 bisectable, and the intermediate changes are responsible
 for the spurious hunks of the interdiff:
 
 diff --git a/Makefile b/Makefile
 index 3e65525..f473cf5 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -246,8 +246,7 @@ $(SRC_PATH)/qga/qapi-schema.json 
 $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
   $(gen-out-type) -o . -b -i $, \
 GEN   $@)
  qapi-event.c qapi-event.h :\
 -$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi-event.json \
 -$(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
 +$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)

Where's the change that adds qapi/event.json to $(qapi-modules)?  (Maybe
the interdiff doesn't show it?)


 +++ b/include/sysemu/os-posix.h
 @@ -26,8 +26,6 @@
  #ifndef QEMU_OS_POSIX_H
  #define QEMU_OS_POSIX_H
  
 -#include sys/time.h
 -
  void os_set_line_buffering(void);

Why this hunk? Did you accidentally forget to include Wenchao's 1/29 in
your series?

  void os_set_proc_name(const char *s);
  void os_setup_signal_handling(void);
 diff --git a/monitor.c b/monitor.c
 index 6b693ee..66a1db7 100644
 --- a/monitor.c
 +++ b/monitor.c
 @@ -183,10 +183,10 @@ typedef struct MonitorControl {
   */
  typedef struct MonitorQAPIEventState {
  QAPIEvent event;/* Event being tracked */
 -int64_t rate;   /* Period over which to throttle. 0 to disable */
 -int64_t last;   /* Time at which event was last emitted */
 +int64_t rate;   /* Minimum time (in ns) between two events */
 +int64_t last;   /* QEMU_CLOCK_REALTIME value at last emission */

I still like the 0 to disable comment; but I see that you dropped it
to keep line length manageable.  So I guess I can live with this change.

 @@ -535,14 +533,15 @@ static void monitor_qapi_event_handler(void *opaque)
   * more than 1 event will be emitted within @rate
   * milliseconds
   */
 -static void monitor_qapi_event_throttle(QAPIEvent event, int64_t rate)
 +static void
 +monitor_qapi_event_throttle(QAPIEvent event, int64_t rate)
  {

Not the usual qemu formatting style.

Overall the interdiff looks like it resolves most of my concerns on v6.
 Now for me to read the actual commits in your git repo...

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-17 Thread Paolo Bonzini

Il 17/06/2014 18:05, Eric Blake ha scritto:

diff --git a/Makefile b/Makefile
index 3e65525..f473cf5 100644
--- a/Makefile
+++ b/Makefile
@@ -246,8 +246,7 @@ $(SRC_PATH)/qga/qapi-schema.json 
$(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
$(gen-out-type) -o . -b -i $, \
  GEN   $@)
 qapi-event.c qapi-event.h :\
-$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi-event.json \
-$(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
+$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)


Where's the change that adds qapi/event.json to $(qapi-modules)?  (Maybe
the interdiff doesn't show it?)


Oops, it's not there.


+++ b/include/sysemu/os-posix.h
@@ -26,8 +26,6 @@
 #ifndef QEMU_OS_POSIX_H
 #define QEMU_OS_POSIX_H

-#include sys/time.h
-
 void os_set_line_buffering(void);


Why this hunk? Did you accidentally forget to include Wenchao's 1/29 in
your series?


Yes, fixing now.


@@ -535,14 +533,15 @@ static void monitor_qapi_event_handler(void *opaque)
  * more than 1 event will be emitted within @rate
  * milliseconds
  */
-static void monitor_qapi_event_throttle(QAPIEvent event, int64_t rate)
+static void
+monitor_qapi_event_throttle(QAPIEvent event, int64_t rate)
 {


Not the usual qemu formatting style.


Yeah, this happened because of __attribute__((__unused__)) and matches 
other monitor_qapi_ functions.  I kind of like the 
return-type-then-newline too. :)



Overall the interdiff looks like it resolves most of my concerns on v6.
 Now for me to read the actual commits in your git repo...


Will fix in a moment.

Paolo



Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-17 Thread Wenchao Xia

于 2014/6/18 0:30, Paolo Bonzini 写道:

Il 17/06/2014 18:05, Eric Blake ha scritto:

diff --git a/Makefile b/Makefile
index 3e65525..f473cf5 100644
--- a/Makefile
+++ b/Makefile
@@ -246,8 +246,7 @@ $(SRC_PATH)/qga/qapi-schema.json
$(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
 $(gen-out-type) -o . -b -i $, \
   GEN   $@)
 qapi-event.c qapi-event.h :\
-$(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi-event.json \
-$(SRC_PATH)/scripts/qapi-event.py $(qapi-py)
+$(qapi-modules) $(SRC_PATH)/scripts/qapi-event.py $(qapi-py)


Where's the change that adds qapi/event.json to $(qapi-modules)?  (Maybe
the interdiff doesn't show it?)


Oops, it's not there.


+++ b/include/sysemu/os-posix.h
@@ -26,8 +26,6 @@
 #ifndef QEMU_OS_POSIX_H
 #define QEMU_OS_POSIX_H

-#include sys/time.h
-
 void os_set_line_buffering(void);


Why this hunk? Did you accidentally forget to include Wenchao's 1/29 in
your series?


Yes, fixing now.


@@ -535,14 +533,15 @@ static void monitor_qapi_event_handler(void
*opaque)
  * more than 1 event will be emitted within @rate
  * milliseconds
  */
-static void monitor_qapi_event_throttle(QAPIEvent event, int64_t rate)
+static void
+monitor_qapi_event_throttle(QAPIEvent event, int64_t rate)
 {


Not the usual qemu formatting style.


Yeah, this happened because of __attribute__((__unused__)) and matches
other monitor_qapi_ functions.  I kind of like the
return-type-then-newline too. :)


Overall the interdiff looks like it resolves most of my concerns on v6.
 Now for me to read the actual commits in your git repo...


Will fix in a moment.

Paolo

  If you and Eric think v6 is OK to catch up 2.1, I can send a clean up
patch fixing the typo/doc issues after merge.



Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-17 Thread Eric Blake
On 06/17/2014 04:57 AM, Paolo Bonzini wrote:
 Il 15/06/2014 02:52, Wenchao Xia ha scritto:
 Unfortunately, this already does not apply anymore.

 I've placed the rebase on branch qapi-event of my github repository. The
 resolutions are trivial, so perhaps Luiz or Michael can pull from there?

 Paolo


I'm still reviewing your git tree; I raised a couple comments on 3/29
(see my replies there).  Also:

 +++ b/include/qapi/qmp-event.h
 @@ -17,7 +17,7 @@
  #include qapi/error.h
  #include qapi/qmp/qdict.h
  
 -typedef void (*QMPEventFuncEmit)(int event_kind, QDict *dict, Error **errp);
 +typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error **errp);

It looks like you have some churn on this definition; patch 4/29 in your
qapi-event branch did:

-enum QAPIEvent;
-typedef void (*QMPEventFuncEmit)(enum QAPIEvent event, QDict *dict,
Error **errp);
+typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error
**errp);

Can you hoist the use of 'unsigned' directly into 2/29 to minimize the
churn?

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-14 Thread Wenchao Xia

于 2014/6/10 13:48, Paolo Bonzini 写道:

Il 05/06/2014 14:21, Wenchao Xia ha scritto:

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.

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.

v3:
  Address Luiz's comments:
  2/5: use -1 when fail to get host timestamp.
  3/5: typo fix and better incode comments. all unchanged functions
are moved
into qmp-event.c, from generated file. To do so without include issue,
'int'
was used intead of 'enum' in function prototype declaration, since the
'enum'
define is a generated type.
  Address Eric's comments:
  2/5: use -1 when fail to get host timestamp.
  3/5: typo fix, add docs/qapi-code-gen.txt.
  4/5: typo fix, verify no other fields in member 'timestamp'.
  5/5: add doc in qapi-schema.json.
  fix license, all script using GPL2, all C code use LGPL, just as other
similar files in upstream.

v4:
  Address Eric's comments:
  2/5: typo fix, add copyright declaration, use a static function pointer
instead of a struct in C file, assign -1 in two line of codes to avoid
issue
when tv_sec and tv_usec are not in same data width, fix indention.
  3/5: typo fix, add copyright declaration.
  4/5: add copyright declaration, simplify string compare with
 d-result = g_strcmp0(...) == 0;, add check for tv_usec's range and
value.
  Other:
  3/5: all error check code was moved from qapi-event.py to qapi.py,
and it
reports better message with line number info. Added related test case.
  Note:
  Benoit's series which track input file better seems not the final
version,
so I didn't rebase this series ontop for now, will do it once Benoit's
ones
get ACKed.

v5:
  Address Eric and Markus's comments:
  2/28: use uint64_t for both sec and usec, to avoid type cast issue
in printf.
  Other:
  Remove RFC, add full coversion by patch 5-28.
  3/28: add prefix for event enum type name, to avoid double define of
QAPIEvent in test code.

v6:
  Address Eric's comments:
  3/29: employ modularization mechnism of schema file of Lluís
series, remove
error_is_set() usage.
  4/29: Makefile change for Lluís series.
  5/29: separate patch for refactoring the existing schema defines,
improve doc
for @service in VncBasicInfo.
  7/29-28/29: define and convert event caller one by one.
  Other change:
  6/29: new way to add event emit implemention. In v5 it breaks old event
mechnism, in v6 it touch nothing of old event mechnism but add a new
set of
functions for new event mechnism.
  7/29: Add new file qapi-event.json to store event defines, and all type
defines goes into qapi-schema.json.
  29/29: related clean up change.
  Note:
  I have no way to verify target-s390x/kvm.c touched by patch 27/29, and
block/quorum.c touched by patch 28/29, need a confirm from whom has
the test
env.

Wenchao Xia (29):
  1 os-posix: include sys/time.h
  2 qapi: add event helper functions
  3 qapi script: add event support
  4 test: add test cases for qapi event
  5 qapi: adjust existing defines
  6 monitor: add an implemention as qapi event emit method
  7 qapi: add new schema file qapi-event.json
  8 qapi event: convert SHUTDOWN
  9 qapi event: convert POWERDOWN
  10 qapi event: convert RESET
  11 qapi event: convert STOP
  12 qapi event: convert RESUME
  13 qapi event: convert SUSPEND
  14 qapi event: convert SUSPEND_DISK
  15 qapi event: convert WAKEUP
  16 qapi event: convert RTC_CHANGE
  17 qapi event: convert WATCHDOG
  18 qapi event: convert DEVICE_DELETED
  19 qapi event: convert DEVICE_TRAY_MOVED
  20 qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
  21 qapi event: convert BLOCK_IMAGE_CORRUPTED
  22 qapi event: convert other BLOCK_JOB events
  23 qapi event: convert NIC_RX_FILTER_CHANGED
  24 qapi event: convert VNC events
  25 qapi event: convert SPICE events
  26 qapi event: convert BALLOON_CHANGE
  27 qapi event: convert GUEST_PANICKED
  28 qapi event: convert QUORUM events
  29 qapi event: clean up

 Makefile |   21 +-
 Makefile.objs|2 +-
 balloon.c|   13 -
 block.c  |   68 +---
 block/backup.c   |2 +-
 block/mirror.c   |9 +-
 block/qcow2-refcount.c   |   14 +-
 block/quorum.c   |   25 +-
 

Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-09 Thread Paolo Bonzini

Il 05/06/2014 14:21, Wenchao Xia ha scritto:

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.

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.

v3:
  Address Luiz's comments:
  2/5: use -1 when fail to get host timestamp.
  3/5: typo fix and better incode comments. all unchanged functions are moved
into qmp-event.c, from generated file. To do so without include issue, 'int'
was used intead of 'enum' in function prototype declaration, since the 'enum'
define is a generated type.
  Address Eric's comments:
  2/5: use -1 when fail to get host timestamp.
  3/5: typo fix, add docs/qapi-code-gen.txt.
  4/5: typo fix, verify no other fields in member 'timestamp'.
  5/5: add doc in qapi-schema.json.
  fix license, all script using GPL2, all C code use LGPL, just as other
similar files in upstream.

v4:
  Address Eric's comments:
  2/5: typo fix, add copyright declaration, use a static function pointer
instead of a struct in C file, assign -1 in two line of codes to avoid issue
when tv_sec and tv_usec are not in same data width, fix indention.
  3/5: typo fix, add copyright declaration.
  4/5: add copyright declaration, simplify string compare with
 d-result = g_strcmp0(...) == 0;, add check for tv_usec's range and value.
  Other:
  3/5: all error check code was moved from qapi-event.py to qapi.py, and it
reports better message with line number info. Added related test case.
  Note:
  Benoit's series which track input file better seems not the final version,
so I didn't rebase this series ontop for now, will do it once Benoit's ones
get ACKed.

v5:
  Address Eric and Markus's comments:
  2/28: use uint64_t for both sec and usec, to avoid type cast issue in printf.
  Other:
  Remove RFC, add full coversion by patch 5-28.
  3/28: add prefix for event enum type name, to avoid double define of
QAPIEvent in test code.

v6:
  Address Eric's comments:
  3/29: employ modularization mechnism of schema file of Lluís series, remove
error_is_set() usage.
  4/29: Makefile change for Lluís series.
  5/29: separate patch for refactoring the existing schema defines, improve doc
for @service in VncBasicInfo.
  7/29-28/29: define and convert event caller one by one.
  Other change:
  6/29: new way to add event emit implemention. In v5 it breaks old event
mechnism, in v6 it touch nothing of old event mechnism but add a new set of
functions for new event mechnism.
  7/29: Add new file qapi-event.json to store event defines, and all type
defines goes into qapi-schema.json.
  29/29: related clean up change.
  Note:
  I have no way to verify target-s390x/kvm.c touched by patch 27/29, and
block/quorum.c touched by patch 28/29, need a confirm from whom has the test
env.

Wenchao Xia (29):
  1 os-posix: include sys/time.h
  2 qapi: add event helper functions
  3 qapi script: add event support
  4 test: add test cases for qapi event
  5 qapi: adjust existing defines
  6 monitor: add an implemention as qapi event emit method
  7 qapi: add new schema file qapi-event.json
  8 qapi event: convert SHUTDOWN
  9 qapi event: convert POWERDOWN
  10 qapi event: convert RESET
  11 qapi event: convert STOP
  12 qapi event: convert RESUME
  13 qapi event: convert SUSPEND
  14 qapi event: convert SUSPEND_DISK
  15 qapi event: convert WAKEUP
  16 qapi event: convert RTC_CHANGE
  17 qapi event: convert WATCHDOG
  18 qapi event: convert DEVICE_DELETED
  19 qapi event: convert DEVICE_TRAY_MOVED
  20 qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
  21 qapi event: convert BLOCK_IMAGE_CORRUPTED
  22 qapi event: convert other BLOCK_JOB events
  23 qapi event: convert NIC_RX_FILTER_CHANGED
  24 qapi event: convert VNC events
  25 qapi event: convert SPICE events
  26 qapi event: convert BALLOON_CHANGE
  27 qapi event: convert GUEST_PANICKED
  28 qapi event: convert QUORUM events
  29 qapi event: clean up

 Makefile |   21 +-
 Makefile.objs|2 +-
 balloon.c|   13 -
 block.c  |   68 +---
 block/backup.c   |2 +-
 block/mirror.c   |9 +-
 block/qcow2-refcount.c   |   14 +-
 block/quorum.c   |   25 +-
 block/stream.c   |  

[Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema

2014-06-05 Thread Wenchao Xia
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.

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.

v3:
  Address Luiz's comments:
  2/5: use -1 when fail to get host timestamp.
  3/5: typo fix and better incode comments. all unchanged functions are moved
into qmp-event.c, from generated file. To do so without include issue, 'int'
was used intead of 'enum' in function prototype declaration, since the 'enum'
define is a generated type.
  Address Eric's comments:
  2/5: use -1 when fail to get host timestamp.
  3/5: typo fix, add docs/qapi-code-gen.txt.
  4/5: typo fix, verify no other fields in member 'timestamp'.
  5/5: add doc in qapi-schema.json.
  fix license, all script using GPL2, all C code use LGPL, just as other
similar files in upstream.

v4:
  Address Eric's comments:
  2/5: typo fix, add copyright declaration, use a static function pointer
instead of a struct in C file, assign -1 in two line of codes to avoid issue
when tv_sec and tv_usec are not in same data width, fix indention.
  3/5: typo fix, add copyright declaration.
  4/5: add copyright declaration, simplify string compare with
 d-result = g_strcmp0(...) == 0;, add check for tv_usec's range and value.
  Other:
  3/5: all error check code was moved from qapi-event.py to qapi.py, and it
reports better message with line number info. Added related test case.
  Note:
  Benoit's series which track input file better seems not the final version,
so I didn't rebase this series ontop for now, will do it once Benoit's ones
get ACKed.

v5:
  Address Eric and Markus's comments:
  2/28: use uint64_t for both sec and usec, to avoid type cast issue in printf.
  Other:
  Remove RFC, add full coversion by patch 5-28.
  3/28: add prefix for event enum type name, to avoid double define of
QAPIEvent in test code.

v6:
  Address Eric's comments:
  3/29: employ modularization mechnism of schema file of Lluís series, remove
error_is_set() usage.
  4/29: Makefile change for Lluís series.
  5/29: separate patch for refactoring the existing schema defines, improve doc
for @service in VncBasicInfo.
  7/29-28/29: define and convert event caller one by one.
  Other change:
  6/29: new way to add event emit implemention. In v5 it breaks old event
mechnism, in v6 it touch nothing of old event mechnism but add a new set of
functions for new event mechnism.
  7/29: Add new file qapi-event.json to store event defines, and all type
defines goes into qapi-schema.json.
  29/29: related clean up change.
  Note:
  I have no way to verify target-s390x/kvm.c touched by patch 27/29, and
block/quorum.c touched by patch 28/29, need a confirm from whom has the test
env.

Wenchao Xia (29):
  1 os-posix: include sys/time.h
  2 qapi: add event helper functions
  3 qapi script: add event support
  4 test: add test cases for qapi event
  5 qapi: adjust existing defines
  6 monitor: add an implemention as qapi event emit method
  7 qapi: add new schema file qapi-event.json
  8 qapi event: convert SHUTDOWN
  9 qapi event: convert POWERDOWN
  10 qapi event: convert RESET
  11 qapi event: convert STOP
  12 qapi event: convert RESUME
  13 qapi event: convert SUSPEND
  14 qapi event: convert SUSPEND_DISK
  15 qapi event: convert WAKEUP
  16 qapi event: convert RTC_CHANGE
  17 qapi event: convert WATCHDOG
  18 qapi event: convert DEVICE_DELETED
  19 qapi event: convert DEVICE_TRAY_MOVED
  20 qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
  21 qapi event: convert BLOCK_IMAGE_CORRUPTED
  22 qapi event: convert other BLOCK_JOB events
  23 qapi event: convert NIC_RX_FILTER_CHANGED
  24 qapi event: convert VNC events
  25 qapi event: convert SPICE events
  26 qapi event: convert BALLOON_CHANGE
  27 qapi event: convert GUEST_PANICKED
  28 qapi event: convert QUORUM events
  29 qapi event: clean up

 Makefile |   21 +-
 Makefile.objs|2 +-
 balloon.c|   13 -
 block.c  |   68 +---
 block/backup.c   |2 +-
 block/mirror.c   |9 +-
 block/qcow2-refcount.c   |   14 +-
 block/quorum.c   |   25 +-
 block/stream.c   |4 +-
 blockdev.c