qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema
Date: Tue, 17 Jun 2014 12:57:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

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)
                                         job->len,
                                         job->offset,
                                         job->speed,
-                                        NULL);
+                                        &error_abort);
 }
 
 void block_job_event_completed(BlockJob *job, const char *msg)
@@ -251,12 +251,12 @@ void block_job_event_completed(BlockJob *job, const char 
*msg)
                                         job->speed,
                                         !!msg,
                                         msg,
-                                        NULL);
+                                        &error_abort);
 }
 
 void block_job_event_ready(BlockJob *job)
 {
-    qapi_event_send_block_job_ready(bdrv_get_device_name(job->bs), NULL);
+    qapi_event_send_block_job_ready(bdrv_get_device_name(job->bs), 
&error_abort);
 }
 
 BlockErrorAction block_job_error_action(BlockJob *job, BlockDriverState *bs,
@@ -285,7 +285,7 @@ BlockErrorAction block_job_error_action(BlockJob *job, 
BlockDriverState *bs,
     qapi_event_send_block_job_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) {
         block_job_pause(job);
         block_job_iostatus_set_err(job, error);
diff --git a/cpus.c b/cpus.c
index 28abb11..87ac99f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -531,7 +531,7 @@ static int do_vm_stop(RunState state)
         pause_all_vcpus();
         runstate_set(state);
         vm_state_notify(0, state);
-        qapi_event_send_stop(NULL);
+        qapi_event_send_stop(&error_abort);
     }
 
     bdrv_drain_all();
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index ace6438..a7368fb 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -550,7 +550,7 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)
             break;
         default:
             if (sus_typ == ar->pm1.cnt.s4_val) { /* S4 request */
-                qapi_event_send_suspend_disk(NULL);
+                qapi_event_send_suspend_disk(&error_abort);
                 qemu_system_shutdown_request();
             }
             break;
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index a6c62b2..cbe8bdd 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -958,7 +958,7 @@ static void device_unparent(Object *obj)
     if (have_realized) {
         gchar *path = object_get_canonical_path(OBJECT(dev));
 
-        qapi_event_send_device_deleted(!!dev->id, dev->id, path, NULL);
+        qapi_event_send_device_deleted(!!dev->id, dev->id, path, &error_abort);
         g_free(path);
     }
 }
diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index d396b74..994f8af 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -41,7 +41,7 @@ static void handle_event(int event)
     }
 
     if (event & PVPANIC_PANICKED) {
-        qapi_event_send_guest_panicked(GUEST_PANICK_ACTION_PAUSE, NULL);
+        qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);
         vm_stop(RUN_STATE_GUEST_PANICKED);
         return;
     }
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index f6d3447..a423a7b 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -201,7 +201,7 @@ static void rxfilter_notify(NetClientState *nc)
     if (nc->rxfilter_notify_enabled) {
         gchar *path = object_get_canonical_path(OBJECT(n->qdev));
         qapi_event_send_nic_rx_filter_changed(!!n->netclient_name,
-                                              n->netclient_name, path, NULL);
+                                              n->netclient_name, path, 
&error_abort);
         g_free(path);
 
         /* disable event notification to avoid events flooding */
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 7e4cffe..8d08539 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -94,7 +94,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, 
sPAPREnvironment *spapr,
     tm.tm_sec = rtas_ld(args, 5);
 
     /* Just generate a monitor event for the change */
-    qapi_event_send_rtc_change(qemu_timedate_diff(&tm), NULL);
+    qapi_event_send_rtc_change(qemu_timedate_diff(&tm), &error_abort);
     spapr->rtc_offset = qemu_timedate_diff(&tm);
 
     rtas_st(rets, 0, RTAS_OUT_SUCCESS);
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index bb91853..05002bf 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -531,7 +531,7 @@ static void rtc_set_time(RTCState *s)
     s->base_rtc = mktimegm(&tm);
     s->last_update = qemu_clock_get_ns(rtc_clock);
 
-    qapi_event_send_rtc_change(qemu_timedate_diff(&tm), NULL);
+    qapi_event_send_rtc_change(qemu_timedate_diff(&tm), &error_abort);
 }
 
 static void rtc_set_cmos(RTCState *s, const struct tm *tm)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index c65c6eb..2a2e58a 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -292,7 +292,7 @@ static void virtio_balloon_set_config(VirtIODevice *vdev,
     if (dev->actual != oldactual) {
         qapi_event_send_balloon_change(ram_size -
                         ((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SHIFT),
-                        NULL);
+                        &error_abort);
     }
 }
 
diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c
index 9284d3f..4aebd34 100644
--- a/hw/watchdog/watchdog.c
+++ b/hw/watchdog/watchdog.c
@@ -108,31 +108,31 @@ void watchdog_perform_action(void)
 {
     switch(watchdog_action) {
     case WDT_RESET:             /* same as 'system_reset' in monitor */
-        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_RESET, NULL);
+        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_RESET, 
&error_abort);
         qemu_system_reset_request();
         break;
 
     case WDT_SHUTDOWN:          /* same as 'system_powerdown' in monitor */
-        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_SHUTDOWN, NULL);
+        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_SHUTDOWN, 
&error_abort);
         qemu_system_powerdown_request();
         break;
 
     case WDT_POWEROFF:          /* same as 'quit' command in monitor */
-        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_POWEROFF, NULL);
+        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_POWEROFF, 
&error_abort);
         exit(0);
 
     case WDT_PAUSE:             /* same as 'stop' command in monitor */
-        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_PAUSE, NULL);
+        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_PAUSE, 
&error_abort);
         vm_stop(RUN_STATE_WATCHDOG);
         break;
 
     case WDT_DEBUG:
-        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_DEBUG, NULL);
+        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_DEBUG, 
&error_abort);
         fprintf(stderr, "watchdog: timer fired\n");
         break;
 
     case WDT_NONE:
-        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_NONE, NULL);
+        qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_NONE, 
&error_abort);
         break;
     }
 }
diff --git a/include/qapi/qmp-event.h b/include/qapi/qmp-event.h
index 02b6ce5..8a8ffb5 100644
--- a/include/qapi/qmp-event.h
+++ 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);
 
 void qmp_event_set_func_emit(QMPEventFuncEmit emit);
 
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index f131521..25d0b2a 100644
--- a/include/sysemu/os-posix.h
+++ 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);
 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 */
     QEMUTimer *timer;   /* Timer for handling delayed events */
-    QObject *data;        /* Event pending delayed dispatch */
+    QObject *data;      /* Event pending delayed dispatch */
 } MonitorQAPIEventState;
 
 struct Monitor {
@@ -451,7 +451,7 @@ static void monitor_qapi_event_emit(QAPIEvent event, 
QObject *data)
 {
     Monitor *mon;
 
-    trace_monitor_qapi_event_emit(event, data);
+    trace_monitor_protocol_event_emit(event, data);
     QLIST_FOREACH(mon, &mon_list, entry) {
         if (monitor_ctrl_mode(mon) && qmp_cmd_mode(mon)) {
             monitor_json_emitter(mon, data);
@@ -464,19 +464,18 @@ static void monitor_qapi_event_emit(QAPIEvent event, 
QObject *data)
  * applying any rate limiting if required.
  */
 static void
-monitor_qapi_event_queue(int event_kind, QDict *data, Error **errp)
+monitor_qapi_event_queue(QAPIEvent event, QDict *data, Error **errp)
 {
     MonitorQAPIEventState *evstate;
-    assert(event_kind < QAPI_EVENT_MAX);
-    QAPIEvent event = (QAPIEvent)event_kind;
+    assert(event < QAPI_EVENT_MAX);
     int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
 
     evstate = &(monitor_qapi_event_state[event]);
-    trace_monitor_qapi_event_queue(event,
-                                   data,
-                                   evstate->rate,
-                                   evstate->last,
-                                   now);
+    trace_monitor_protocol_event_queue(event,
+                                       data,
+                                       evstate->rate,
+                                       evstate->last,
+                                       now);
 
     /* Rate limit of 0 indicates no throttling */
     if (!evstate->rate) {
@@ -514,11 +513,10 @@ static void monitor_qapi_event_handler(void *opaque)
     MonitorQAPIEventState *evstate = opaque;
     int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
 
-
-    trace_monitor_qapi_event_handler(evstate->event,
-                                     evstate->data,
-                                     evstate->last,
-                                     now);
+    trace_monitor_protocol_event_handler(evstate->event,
+                                         evstate->data,
+                                         evstate->last,
+                                         now);
     if (evstate->data) {
         monitor_qapi_event_emit(evstate->event, evstate->data);
         qobject_decref(evstate->data);
@@ -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)
 {
     MonitorQAPIEventState *evstate;
     assert(event < QAPI_EVENT_MAX);
 
     evstate = &(monitor_qapi_event_state[event]);
 
-    trace_monitor_qapi_event_throttle(event, rate);
+    trace_monitor_protocol_event_throttle(event, rate);
     evstate->event = event;
     evstate->rate = rate * SCALE_MS;
     evstate->last = 0;
@@ -555,7 +554,7 @@ static void monitor_qapi_event_throttle(QAPIEvent event, 
int64_t rate)
 
 static void monitor_qapi_event_init(void)
 {
-    /* Limit RTC & BALLOON events to 1 per second */
+    /* Limit guest-triggerable events to 1 per second */
     monitor_qapi_event_throttle(QAPI_EVENT_RTC_CHANGE, 1000);
     monitor_qapi_event_throttle(QAPI_EVENT_WATCHDOG, 1000);
     monitor_qapi_event_throttle(QAPI_EVENT_BALLOON_CHANGE, 1000);
@@ -566,7 +565,6 @@ static void monitor_qapi_event_init(void)
     qmp_event_set_func_emit(monitor_qapi_event_queue);
 }
 
-
 static int do_qmp_capabilities(Monitor *mon, const QDict *params,
                                QObject **ret_data)
 {
diff --git a/qapi-event.json b/qapi-event.json
index 805a5a3..fbdda48 100644
--- a/qapi-event.json
+++ b/qapi-event.json
@@ -1,13 +1,13 @@
 ##
 # @SHUTDOWN
 #
-# Emitted when the virtual machine shutdown, qemu terminated the emulation and
-# is about to exit.
+# Emitted when the virtual machine has shutdown, possibly indicating that QEMU
+# is about about to exit.
 #
 # Note: If the command-line option "-no-shutdown" has been specified, qemu will
 # not exit, and a STOP event will eventually follow the SHUTDOWN event
 #
-# Since: 2.1
+# Since: 0.12.0
 ##
 { 'event': 'SHUTDOWN' }
 
@@ -17,7 +17,7 @@
 # Emitted when the virtual machine is powered down through the power control
 # system, such as via ACPI.
 #
-# Since: 2.1
+# Since: 0.12.0
 ##
 { 'event': 'POWERDOWN' }
 
@@ -26,7 +26,7 @@
 #
 # Emitted when the virtual machine is reset
 #
-# Since: 2.1
+# Since: 0.12.0
 ##
 { 'event': 'RESET' }
 
@@ -35,7 +35,7 @@
 #
 # Emitted when the virtual machine is stopped
 #
-# Since: 2.1
+# Since: 0.12.0
 ##
 { 'event': 'STOP' }
 
@@ -44,7 +44,7 @@
 #
 # Emitted when the virtual machine resumes execution
 #
-# Since: 2.1
+# Since: 0.12.0
 ##
 { 'event': 'RESUME' }
 
@@ -54,7 +54,7 @@
 # Emitted when guest enters a hardware suspension state, for example, S3 state,
 # which is sometimes called standby state
 #
-# Since: 2.1
+# Since: 1.1
 ##
 { 'event': 'SUSPEND' }
 
@@ -66,7 +66,7 @@
 #
 # Note: QEMU shuts down (similar to event @SHUTDOWN) when entering this state
 #
-# Since: 2.1
+# Since: 1.2
 ##
 { 'event': 'SUSPEND_DISK' }
 
@@ -75,7 +75,7 @@
 #
 # Emitted when the guest has woken up from suspend state and is running
 #
-# Since: 2.1
+# Since: 1.1
 ##
 { 'event': 'WAKEUP' }
 
@@ -87,7 +87,7 @@
 # @offset: offset between base RTC clock (as specified by -rtc base), and
 #          new RTC clock value
 #
-# Since: 2.1
+# Since: 0.13.0
 ##
 { 'event': 'RTC_CHANGE',
   'data': { 'offset': 'int' } }
@@ -102,7 +102,7 @@
 # Note: If action is "reset", "shutdown", or "pause" the WATCHDOG event is
 # followed respectively by the RESET, SHUTDOWN, or STOP events
 #
-# Since: 2.1
+# Since: 0.13.0
 ##
 { 'event': 'WATCHDOG',
   'data': { 'action': 'WatchdogExpirationAction' } }
@@ -118,7 +118,7 @@
 #
 # @path: device path
 #
-# Since: 2.1
+# Since: 1.5
 ##
 { 'event': 'DEVICE_DELETED',
   'data': { '*device': 'str', 'path': 'str' } }
@@ -133,7 +133,7 @@
 #
 # @path: device path
 #
-# Since: 2.1
+# Since: 1.6
 ##
 { 'event': 'NIC_RX_FILTER_CHANGED',
   'data': { '*name': 'str', 'path': 'str' } }
@@ -150,7 +150,7 @@
 # Note: This event is emitted before any authentication takes place, thus
 # the authentication ID is not provided
 #
-# Since: 2.1
+# Since: 0.13.0
 ##
 { 'event': 'VNC_CONNECTED',
   'data': { 'server': 'VncServerInfo',
@@ -166,7 +166,7 @@
 #
 # @client: client information
 #
-# Since: 2.1
+# Since: 0.13.0
 ##
 { 'event': 'VNC_INITIALIZED',
   'data': { 'server': 'VncServerInfo',
@@ -181,7 +181,7 @@
 #
 # @client: client information
 #
-# Since: 2.1
+# Since: 0.13.0
 ##
 { 'event': 'VNC_DISCONNECTED',
   'data': { 'server': 'VncServerInfo',
@@ -196,7 +196,7 @@
 #
 # @client: client information
 #
-# Since: 2.1
+# Since: 0.14.0
 ##
 { 'event': 'SPICE_CONNECTED',
   'data': { 'server': 'SpiceBasicInfo',
@@ -212,7 +212,7 @@
 #
 # @client: client information
 #
-# Since: 2.1
+# Since: 0.14.0
 ##
 { 'event': 'SPICE_INITIALIZED',
   'data': { 'server': 'SpiceServerInfo',
@@ -227,7 +227,7 @@
 #
 # @client: client information
 #
-# Since: 2.1
+# Since: 0.14.0
 ##
 { 'event': 'SPICE_DISCONNECTED',
   'data': { 'server': 'SpiceBasicInfo',
@@ -238,7 +238,7 @@
 #
 # Emitted when SPICE migration has completed
 #
-# Since: 2.1
+# Since: 1.3
 ##
 { 'event': 'SPICE_MIGRATE_COMPLETED' }
 
@@ -250,7 +250,7 @@
 #
 # @actual: actual level of the guest memory balloon in bytes
 #
-# Since: 2.1
+# Since: 1.2
 ##
 { 'event': 'BALLOON_CHANGE',
   'data': { 'actual': 'int' } }
@@ -262,10 +262,10 @@
 #
 # @action: action that has been taken, currently always "pause"
 #
-# Since: 2.1
+# Since: 1.5
 ##
 { 'event': 'GUEST_PANICKED',
-  'data': { 'action': 'GuestPanickAction' } }
+  'data': { 'action': 'GuestPanicAction' } }
 
 ##
 # @QUORUM_FAILURE
@@ -278,7 +278,7 @@
 #
 # @sector-count: failed read operation sector count
 #
-# Since: 2.1
+# Since: 2.0
 ##
 { 'event': 'QUORUM_FAILURE',
   'data': { 'reference': 'str', 'sector-num': 'int', 'sector-count': 'int' } }
@@ -299,7 +299,7 @@
 #
 # @sector-count: failed read operation sector count
 #
-# Since: 2.1
+# Since: 2.0
 ##
 { 'event': 'QUORUM_REPORT_BAD',
   'data': { '*error': 'str', 'node-name': 'str',
diff --git a/qapi-schema.json b/qapi-schema.json
index 96426c3..d62bb7d 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3180,7 +3180,7 @@
   'data': [ 'read', 'write' ] }
 
 ##
-# @GuestPanickAction
+# @GuestPanicAction
 #
 # An enumeration of the actions taken when guest OS panic is detected
 #
@@ -3188,7 +3188,7 @@
 #
 # Since: 2.1
 ##
-{ 'enum': 'GuestPanickAction',
+{ 'enum': 'GuestPanicAction',
   'data': [ 'pause' ] }
 
 { 'include': 'qapi-event.json' }
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 2b258e5..af6b436 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1435,14 +1435,16 @@
 #
 # @device: device name
 #
-# @msg: informative message, for example, reason for the corruption
+# @msg: informative message for human consumption, such as the kind of
+#       corruption being detected
 #
 # @offset: #optional, if the corruption resulted from an image access, this is
 #          the access offset into the image
+#
 # @size: #optional, if the corruption resulted from an image access, this is
 #        the access size
 #
-# Since: 2.1
+# Since: 1.7
 ##
 { 'event': 'BLOCK_IMAGE_CORRUPTED',
   'data': { 'device' : 'str',
@@ -1464,7 +1466,7 @@
 # Note: If action is "stop", a STOP event will eventually follow the
 # BLOCK_IO_ERROR event
 #
-# Since: 2.1
+# Since: 0.13.0
 ##
 { 'event': 'BLOCK_IO_ERROR',
   'data': { 'device': 'str', 'operation': 'IoOperationType',
@@ -1491,7 +1493,7 @@
 #         other than that streaming has failed and clients should not try to
 #         interpret the error string
 #
-# Since: 2.1
+# Since: 1.1
 ##
 { 'event': 'BLOCK_JOB_COMPLETED',
   'data': { 'type'  : 'BlockJobType',
@@ -1517,7 +1519,7 @@
 #
 # @speed: rate limit, bytes per second
 #
-# Since: 2.1
+# Since: 1.1
 ##
 { 'event': 'BLOCK_JOB_CANCELLED',
   'data': { 'type'  : 'BlockJobType',
@@ -1537,7 +1539,7 @@
 #
 # @action: action that has been taken
 #
-# Since: 2.1
+# Since: 1.3
 ##
 { 'event': 'BLOCK_JOB_ERROR',
   'data': { 'device'   : 'str',
@@ -1554,7 +1556,7 @@
 # Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR
 # event
 #
-# Since: 2.1
+# Since: 1.3
 ##
 { 'event': 'BLOCK_JOB_READY',
   'data': { 'device': 'str' } }
diff --git a/qapi/block.json b/qapi/block.json
index 1bdcba5..e313465 100644
--- a/qapi/block.json
+++ b/qapi/block.json
@@ -174,7 +174,7 @@
 #
 # @tray-open: true if the tray has been opened or false if it has been closed
 #
-# Since: 2.1
+# Since: 1.1
 ##
 { 'event': 'DEVICE_TRAY_MOVED',
   'data': { 'device': 'str', 'tray-open': 'bool' } }
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
index e1dcc43..3a1cd61 100644
--- a/scripts/qapi-event.py
+++ b/scripts/qapi-event.py
@@ -45,7 +45,7 @@ def generate_event_declaration(api_name):
                  api_name = api_name)
 
 def generate_event_implement(api_name, event_name, params):
-    # step 1: declare and variables
+    # step 1: declare any variables
     ret = mcgen("""
 
 %(api_name)s
@@ -85,7 +85,7 @@ def generate_event_implement(api_name, event_name, params):
     v = qmp_output_get_visitor(qov);
     g_assert(v);
 
-    /* Fake visit, as if all member are under a structure */
+    /* Fake visit, as if all members are under a structure */
     visit_start_struct(v, NULL, "", "%(event_name)s", 0, &local_err);
     if (local_err) {
         goto clean;
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index e57350f..a6e587b 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -1030,8 +1030,8 @@ static bool is_special_wait_psw(CPUState *cs)
 
 static void guest_panicked(void)
 {
-    qapi_event_send_guest_panicked(GUEST_PANICK_ACTION_PAUSE,
-                                   NULL);
+    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE,
+                                   &error_abort);
     vm_stop(RUN_STATE_GUEST_PANICKED);
 }
 
diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c
index c967d35..cb1e441 100644
--- a/tests/test-qmp-event.c
+++ b/tests/test-qmp-event.c
@@ -33,7 +33,7 @@ typedef struct QDictCmpData {
 } QDictCmpData;
 
 TestEventData *test_event_data;
-static GStaticMutex test_event_lock = G_STATIC_MUTEX_INIT;
+static CompatGMutex test_event_lock;
 
 /* Only compares bool, int, string */
 static
@@ -94,13 +94,13 @@ static bool qdict_cmp_simple(QDict *a, QDict *b)
 
 /* This function is hooked as final emit function, which can verify the
    correctness. */
-static void event_test_emit(int event_kind, QDict *d, Error **errp)
+static void event_test_emit(TEST_QAPIEvent event, QDict *d, Error **errp)
 {
     QObject *obj;
     QDict *t;
     int64_t s, ms;
 
-    /* Verify that we have timestamp, then remove it to compare other field */
+    /* Verify that we have timestamp, then remove it to compare other fields */
     obj = qdict_get(d, "timestamp");
     g_assert(obj);
     t = qobject_to_qdict(obj);
@@ -129,7 +129,7 @@ static void event_prepare(TestEventData *data,
 {
     /* Global variable test_event_data was used to pass the expectation, so
        test cases can't be executed at same time. */
-    g_static_mutex_lock(&test_event_lock);
+    g_mutex_lock(&test_event_lock);
 
     data->expect = qdict_new();
     test_event_data = data;
@@ -141,7 +141,7 @@ static void event_teardown(TestEventData *data,
     QDECREF(data->expect);
     test_event_data = NULL;
 
-    g_static_mutex_unlock(&test_event_lock);
+    g_mutex_unlock(&test_event_lock);
 }
 
 static void event_test_add(const char *testpath,
@@ -161,7 +161,7 @@ static void test_event_a(TestEventData *data,
     QDict *d;
     d = data->expect;
     qdict_put(d, "event", qstring_from_str("EVENT_A"));
-    qapi_event_send_event_a(NULL);
+    qapi_event_send_event_a(&error_abort);
 }
 
 static void test_event_b(TestEventData *data,
@@ -170,7 +170,7 @@ static void test_event_b(TestEventData *data,
     QDict *d;
     d = data->expect;
     qdict_put(d, "event", qstring_from_str("EVENT_B"));
-    qapi_event_send_event_b(NULL);
+    qapi_event_send_event_b(&error_abort);
 }
 
 static void test_event_c(TestEventData *data,
@@ -198,7 +198,7 @@ static void test_event_c(TestEventData *data,
     qdict_put(d, "event", qstring_from_str("EVENT_C"));
     qdict_put(d, "data", d_data);
 
-    qapi_event_send_event_c(true, 1, true, &b, "test2", NULL);
+    qapi_event_send_event_c(true, 1, true, &b, "test2", &error_abort);
 
     g_free(b.string);
 }
@@ -243,7 +243,7 @@ static void test_event_d(TestEventData *data,
     qdict_put(d, "data", d_data);
 
     qapi_event_send_event_d(&a, "test3", false, NULL, true, ENUM_ONE_VALUE3,
-                           NULL);
+                           &error_abort);
 
     g_free(struct1.string);
     g_free(a.string);
diff --git a/trace-events b/trace-events
index 06fe330..f8dff48 100644
--- a/trace-events
+++ b/trace-events
@@ -932,10 +932,6 @@ monitor_protocol_event_handler(uint32_t event, void *data, 
uint64_t last, uint64
 monitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p"
 monitor_protocol_event_queue(uint32_t event, void *data, uint64_t rate, 
uint64_t last, uint64_t now) "event=%d data=%p rate=%" PRId64 " last=%" PRId64 
" now=%" PRId64
 monitor_protocol_event_throttle(uint32_t event, uint64_t rate) "event=%d 
rate=%" PRId64
-monitor_qapi_event_emit(uint32_t event, void *data) "event=%d data=%p"
-monitor_qapi_event_queue(uint32_t event, void *data, uint64_t rate, uint64_t 
last, uint64_t now) "event=%d data=%p rate=%" PRId64 " last=%" PRId64 " now=%" 
PRId64
-monitor_qapi_event_handler(uint32_t event, void *data, uint64_t last, uint64_t 
now) "event=%d data=%p last=%" PRId64 " now=%" PRId64
-monitor_qapi_event_throttle(uint32_t event, uint64_t rate) "event=%d rate=%" 
PRId64
 
 # hw/net/opencores_eth.c
 open_eth_mii_write(unsigned idx, uint16_t v) "MII[%02x] <- %04x"
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 4605f80..70df446 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -229,7 +229,7 @@ static void channel_event(int event, SpiceChannelEventInfo 
*info)
 
     switch (event) {
     case SPICE_CHANNEL_EVENT_CONNECTED:
-        qapi_event_send_spice_connected(server->base, client->base, NULL);
+        qapi_event_send_spice_connected(server->base, client->base, 
&error_abort);
         break;
     case SPICE_CHANNEL_EVENT_INITIALIZED:
         if (auth) {
@@ -238,11 +238,11 @@ static void channel_event(int event, 
SpiceChannelEventInfo *info)
         }
         add_channel_info(client, info);
         channel_list_add(info);
-        qapi_event_send_spice_initialized(server, client, NULL);
+        qapi_event_send_spice_initialized(server, client, &error_abort);
         break;
     case SPICE_CHANNEL_EVENT_DISCONNECTED:
         channel_list_del(info);
-        qapi_event_send_spice_disconnected(server->base, client->base, NULL);
+        qapi_event_send_spice_disconnected(server->base, client->base, 
&error_abort);
         break;
     default:
         break;
@@ -307,7 +307,7 @@ static void 
migrate_connect_complete_cb(SpiceMigrateInstance *sin)
 
 static void migrate_end_complete_cb(SpiceMigrateInstance *sin)
 {
-    qapi_event_send_spice_migrate_completed(NULL);
+    qapi_event_send_spice_migrate_completed(&error_abort);
     spice_migration_completed = true;
 }
 
diff --git a/ui/vnc.c b/ui/vnc.c
index 67447c6..9ccd5e3 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -289,13 +289,13 @@ static void vnc_qmp_event(VncState *vs, QAPIEvent event)
 
     switch (event) {
     case QAPI_EVENT_VNC_CONNECTED:
-        qapi_event_send_vnc_connected(si, vs->info->base, NULL);
+        qapi_event_send_vnc_connected(si, vs->info->base, &error_abort);
         break;
     case QAPI_EVENT_VNC_INITIALIZED:
-        qapi_event_send_vnc_initialized(si, vs->info, NULL);
+        qapi_event_send_vnc_initialized(si, vs->info, &error_abort);
         break;
     case QAPI_EVENT_VNC_DISCONNECTED:
-        qapi_event_send_vnc_disconnected(si, vs->info, NULL);
+        qapi_event_send_vnc_disconnected(si, vs->info, &error_abort);
         break;
     default:
         break;
diff --git a/vl.c b/vl.c
index 6ede799..198c77a 100644
--- a/vl.c
+++ b/vl.c
@@ -1746,7 +1746,7 @@ void vm_start(void)
         runstate_set(RUN_STATE_RUNNING);
         vm_state_notify(1, RUN_STATE_RUNNING);
         resume_all_vcpus();
-        qapi_event_send_resume(NULL);
+        qapi_event_send_resume(&error_abort);
     }
 }
 
@@ -1898,7 +1898,7 @@ void qemu_system_reset(bool report)
         qemu_devices_reset();
     }
     if (report) {
-        qapi_event_send_reset(NULL);
+        qapi_event_send_reset(&error_abort);
     }
     cpu_synchronize_all_post_reset();
 }
@@ -1919,7 +1919,7 @@ static void qemu_system_suspend(void)
     pause_all_vcpus();
     notifier_list_notify(&suspend_notifiers, NULL);
     runstate_set(RUN_STATE_SUSPENDED);
-    qapi_event_send_suspend(NULL);
+    qapi_event_send_suspend(&error_abort);
 }
 
 void qemu_system_suspend_request(void)
@@ -1982,7 +1982,7 @@ void qemu_system_shutdown_request(void)
 
 static void qemu_system_powerdown(void)
 {
-    qapi_event_send_powerdown(NULL);
+    qapi_event_send_powerdown(&error_abort);
     notifier_list_notify(&powerdown_notifiers, NULL);
 }
 
@@ -2020,7 +2020,7 @@ static bool main_loop_should_exit(void)
     }
     if (qemu_shutdown_requested()) {
         qemu_kill_report();
-        qapi_event_send_shutdown(NULL);
+        qapi_event_send_shutdown(&error_abort);
         if (no_shutdown) {
             vm_stop(RUN_STATE_SHUTDOWN);
         } else {
@@ -2043,7 +2043,7 @@ static bool main_loop_should_exit(void)
         notifier_list_notify(&wakeup_notifiers, &wakeup_reason);
         wakeup_reason = QEMU_WAKEUP_REASON_NONE;
         resume_all_vcpus();
-        qapi_event_send_wakeup(NULL);
+        qapi_event_send_wakeup(&error_abort);
     }
     if (qemu_powerdown_requested()) {
         qemu_system_powerdown();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]