diff mbox

[2.1,12/36] qapi event: convert STOP

Message ID 1403073840-32603-13-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini June 18, 2014, 6:43 a.m. UTC
From: Wenchao Xia <wenchaoqemu@gmail.com>

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpus.c                  |  5 +++--
 docs/qmp/qmp-events.txt | 12 ------------
 qapi-event.json         |  9 +++++++++
 3 files changed, 12 insertions(+), 14 deletions(-)

Comments

Luiz Capitulino June 19, 2014, 6:15 p.m. UTC | #1
On Wed, 18 Jun 2014 08:43:36 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> From: Wenchao Xia <wenchaoqemu@gmail.com>
> 
> Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  cpus.c                  |  5 +++--
>  docs/qmp/qmp-events.txt | 12 ------------
>  qapi-event.json         |  9 +++++++++
>  3 files changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index dd7ac13..87ac99f 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -25,7 +25,7 @@
>  /* Needed early for CONFIG_BSD etc. */
>  #include "config-host.h"
>  
> -#include "monitor/monitor.h"

Dropping monitor.h breaks the build with the following error:

"""
/home/lcapitulino/work/src/upstream/qmp-unstable/cpus.c: In function ‘qmp_inject_nmi’:
/home/lcapitulino/work/src/upstream/qmp-unstable/cpus.c:1490:9: error: implicit declaration of function ‘monitor_get_cpu_index’ [-Werror=implicit-function-declaration]
         if (cpu->env.cpu_num == monitor_get_cpu_index()) {
         ^
/home/lcapitulino/work/src/upstream/qmp-unstable/cpus.c:1490:9: error: nested extern declaration of ‘monitor_get_cpu_index’ [-Werror=nested-externs]
cc1: all warnings being treated as errors
make[1]: *** [cpus.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [subdir-s390x-softmmu] Error 2
"""

I've added it back then.

> +#include "qapi/qmp/qerror.h"
>  #include "sysemu/sysemu.h"
>  #include "exec/gdbstub.h"
>  #include "sysemu/dma.h"
> @@ -38,6 +38,7 @@
>  #include "qemu/main-loop.h"
>  #include "qemu/bitmap.h"
>  #include "qemu/seqlock.h"
> +#include "qapi-event.h"
>  
>  #ifndef _WIN32
>  #include "qemu/compatfd.h"
> @@ -530,7 +531,7 @@ static int do_vm_stop(RunState state)
>          pause_all_vcpus();
>          runstate_set(state);
>          vm_state_notify(0, state);
> -        monitor_protocol_event(QEVENT_STOP, NULL);
> +        qapi_event_send_stop(&error_abort);
>      }
>  
>      bdrv_drain_all();
> diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt
> index 20e3151..c241a07 100644
> --- a/docs/qmp/qmp-events.txt
> +++ b/docs/qmp/qmp-events.txt
> @@ -354,18 +354,6 @@ Example:
>                        "channel-id": 0, "tls": true}
>  }}
>  
> -STOP
> -----
> -
> -Emitted when the Virtual Machine is stopped.
> -
> -Data: None.
> -
> -Example:
> -
> -{ "event": "STOP",
> -    "timestamp": { "seconds": 1267041730, "microseconds": 281295 } }
> -
>  SUSPEND
>  -------
>  
> diff --git a/qapi-event.json b/qapi-event.json
> index f38669d..bac7fdc 100644
> --- a/qapi-event.json
> +++ b/qapi-event.json
> @@ -29,3 +29,12 @@
>  # Since: 0.12.0
>  ##
>  { 'event': 'RESET' }
> +
> +##
> +# @STOP
> +#
> +# Emitted when the virtual machine is stopped
> +#
> +# Since: 0.12.0
> +##
> +{ 'event': 'STOP' }
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index dd7ac13..87ac99f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -25,7 +25,7 @@ 
 /* Needed early for CONFIG_BSD etc. */
 #include "config-host.h"
 
-#include "monitor/monitor.h"
+#include "qapi/qmp/qerror.h"
 #include "sysemu/sysemu.h"
 #include "exec/gdbstub.h"
 #include "sysemu/dma.h"
@@ -38,6 +38,7 @@ 
 #include "qemu/main-loop.h"
 #include "qemu/bitmap.h"
 #include "qemu/seqlock.h"
+#include "qapi-event.h"
 
 #ifndef _WIN32
 #include "qemu/compatfd.h"
@@ -530,7 +531,7 @@  static int do_vm_stop(RunState state)
         pause_all_vcpus();
         runstate_set(state);
         vm_state_notify(0, state);
-        monitor_protocol_event(QEVENT_STOP, NULL);
+        qapi_event_send_stop(&error_abort);
     }
 
     bdrv_drain_all();
diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt
index 20e3151..c241a07 100644
--- a/docs/qmp/qmp-events.txt
+++ b/docs/qmp/qmp-events.txt
@@ -354,18 +354,6 @@  Example:
                       "channel-id": 0, "tls": true}
 }}
 
-STOP
-----
-
-Emitted when the Virtual Machine is stopped.
-
-Data: None.
-
-Example:
-
-{ "event": "STOP",
-    "timestamp": { "seconds": 1267041730, "microseconds": 281295 } }
-
 SUSPEND
 -------
 
diff --git a/qapi-event.json b/qapi-event.json
index f38669d..bac7fdc 100644
--- a/qapi-event.json
+++ b/qapi-event.json
@@ -29,3 +29,12 @@ 
 # Since: 0.12.0
 ##
 { 'event': 'RESET' }
+
+##
+# @STOP
+#
+# Emitted when the virtual machine is stopped
+#
+# Since: 0.12.0
+##
+{ 'event': 'STOP' }