Skip to contentSkip to conversation

clean up for qapi event

PATCH In review Wenchao Xia 5 participants 17 messages Jun 24, 2014 – Jul 1, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

cover clean up for qapi event

Paolo Bonzini (1):
tests/test-qmp-event: fix for GLib < 2.31

Wenchao Xia (4):
qapi: move event defines
qapi: ignore generated event files
qapi script: clean up in scripts
qapi event: clean up in callers

 .gitignore                              |    1 +
 Makefile                                |    2 +-
 docs/qapi-code-gen.txt                  |    8 +-
 hw/watchdog/watchdog.c                  |    2 +-
 include/block/blockjob.h                |    2 +-
 monitor.c                               |    2 +-
 qapi-event.json                         |  318 -------------------------------
 qapi-schema.json                        |   12 +-
 qapi/block-core.json                    |    3 +-
 qapi/event.json                         |  318 +++++++++++++++++++++++++++++++
 scripts/qapi-event.py                   |    5 +-
 scripts/qapi.py                         |    2 +-
 tests/qapi-schema/event-nest-struct.err |    2 +-
 tests/test-qmp-event.c                  |    1 +
 14 files changed, 341 insertions(+), 337 deletions(-)
 delete mode 100644 qapi-event.json
 create mode 100644 qapi/event.json
#1 lore raw

PATCH 1/5 tests/test-qmp-event: fix for GLib < 2.31

From: Paolo Bonzini <[email protected]>

On old GLib, the test needs a g_thread_init call.

---
 tests/test-qmp-event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/test-qmp-event.c +1 -0
index cb1e441..17c6444 100644
@@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+    g_thread_init(NULL);
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);
Signature · 1 line
1.7.1
#2 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 1/5] tests/test-qmp-event: fix for GLib < 2.31

Quoted 17 lines · On Tue, 24 Jun 2014 16:33:56 -0700 Wenchao Xia <[email protected]> wrote:

From: Paolo Bonzini <[email protected]>

On old GLib, the test needs a g_thread_init call.

---
 tests/test-qmp-event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/test-qmp-event.c +0 -0
index cb1e441..17c6444 100644

tests/test-qmp-event.c static void test_event_d(TestEventData *data, · line 257

Quoted 7 lines
tests/test-qmp-event.c +1 -0
@@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+    g_thread_init(NULL);
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);

This breaks make check on F20:

"""
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c: In function ‘main’:
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5: error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]

     g_thread_init(NULL);
     ^

cc1: all warnings being treated as errors
make: *** [tests/test-qmp-event.o] Error 1
"""

I think the best way to fix this is to make util/osdep.c:thread_init() public (maybe by moving it to include/glib-compat.h) and use that instead. Also, note that thread_init()'s body is duplicated in a few other places, so maybe those places should call it too.

You may want to do this in a different series, then I can skip this patch and apply the rest of the series.

#3 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 1/5] tests/test-qmp-event: fix for GLib < 2.31

Il 25/06/2014 15:13, Luiz Capitulino ha scritto:

Quoted 39 lines
Quoted 17 lines · On Tue, 24 Jun 2014 16:33:56 -0700 Wenchao Xia <[email protected]> wrote:

From: Paolo Bonzini <[email protected]>

On old GLib, the test needs a g_thread_init call.

---
 tests/test-qmp-event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/test-qmp-event.c +0 -0
index cb1e441..17c6444 100644

tests/test-qmp-event.c static void test_event_d(TestEventData *data, · line 257

Quoted 7 lines
tests/test-qmp-event.c +1 -0
@@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+    g_thread_init(NULL);
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);

This breaks make check on F20:

"""
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c: In function ‘main’:
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5: error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]

     g_thread_init(NULL);
     ^

cc1: all warnings being treated as errors
make: *** [tests/test-qmp-event.o] Error 1
"""

Quoted 8 lines

I think the best way to fix this is to make util/osdep.c:thread_init() public (maybe by moving it to include/glib-compat.h) and use that instead. Also, note that thread_init()'s body is duplicated in a few other places, so maybe those places should call it too.

You may want to do this in a different series, then I can skip this patch and apply the rest of the series.

Thanks Luiz, it's a good suggestion.

Paolo

#4 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 1/5] tests/test-qmp-event: fix for GLib < 2.31

Quoted 45 lines · On Wed, 25 Jun 2014 15:15:35 +0200 Paolo Bonzini <[email protected]> wrote:

Il 25/06/2014 15:13, Luiz Capitulino ha scritto:

Quoted 44 lines
Quoted 17 lines · On Tue, 24 Jun 2014 16:33:56 -0700 Wenchao Xia <[email protected]> wrote:

From: Paolo Bonzini <[email protected]>

On old GLib, the test needs a g_thread_init call.

---
 tests/test-qmp-event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/test-qmp-event.c +0 -0
index cb1e441..17c6444 100644

tests/test-qmp-event.c static void test_event_d(TestEventData *data, · line 257

Quoted 7 lines
tests/test-qmp-event.c +1 -0
@@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+    g_thread_init(NULL);
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);

This breaks make check on F20:

"""
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c: In function ‘main’:
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5: error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]

     g_thread_init(NULL);
     ^

cc1: all warnings being treated as errors
make: *** [tests/test-qmp-event.o] Error 1
"""

I think the best way to fix this is to make util/osdep.c:thread_init() public (maybe by moving it to include/glib-compat.h) and use that instead. Also, note that thread_init()'s body is duplicated in a few other places, so maybe those places should call it too.

Quoted 5 lines
Quoted 3 lines

You may want to do this in a different series, then I can skip this patch and apply the rest of the series.

Thanks Luiz, it's a good suggestion.

Paolo, Wenchao, are one of one going to work on this?

#5 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 1/5] tests/test-qmp-event: fix for GLib < 2.31

Quoted 48 lines · Luiz Capitulino
Quoted 45 lines · On Wed, 25 Jun 2014 15:15:35 +0200 Paolo Bonzini <[email protected]> wrote:

Il 25/06/2014 15:13, Luiz Capitulino ha scritto:

Quoted 44 lines
Quoted 17 lines · On Tue, 24 Jun 2014 16:33:56 -0700 Wenchao Xia <[email protected]> wrote:

From: Paolo Bonzini <[email protected]>

On old GLib, the test needs a g_thread_init call.

---
 tests/test-qmp-event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/test-qmp-event.c +0 -0
index cb1e441..17c6444 100644

tests/test-qmp-event.c static void test_event_d(TestEventData *data, · line 257

Quoted 7 lines
tests/test-qmp-event.c +1 -0
@@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+    g_thread_init(NULL);
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);

This breaks make check on F20:

"""
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c: In function ‘main’:
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5: error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]

     g_thread_init(NULL);
     ^

cc1: all warnings being treated as errors
make: *** [tests/test-qmp-event.o] Error 1
"""

I think the best way to fix this is to make util/osdep.c:thread_init() public (maybe by moving it to include/glib-compat.h) and use that instead. Also, note that thread_init()'s body is duplicated in a few other places, so maybe those places should call it too.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

You may want to do this in a different series, then I can skip this patch and apply the rest of the series.

Thanks Luiz, it's a good suggestion.

Paolo, Wenchao, are one of one going to work on this?

Ping! Can we have at least a local fix using glib version #ifdefs before Tuesday please? Otherwise we need to do something like this to avoid shipping an rc0 which doesn't pass make check on some systems.

tests/Makefile +0 -2
index 7e53d0d..a1a0dae 100644
@@ -27,8 +27,6 @@ check-unit-y += tests/test-string-input-visitor$(EXESUF)
 gcov-files-test-string-input-visitor-y = qapi/string-input-visitor.c
 check-unit-y += tests/test-string-output-visitor$(EXESUF)
 gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c
-check-unit-y += tests/test-qmp-event$(EXESUF)
-gcov-files-test-qmp-event-y += qapi/qmp-event.c
 check-unit-y += tests/test-opts-visitor$(EXESUF)
 gcov-files-test-opts-visitor-y = qapi/opts-visitor.c
 check-unit-y += tests/test-coroutine$(EXESUF)
@@ -213,7 +211,7 @@ test-obj-y = tests/check-qint.o
tests/check-qstring.o tests/check-qdict.o \
        tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
        tests/test-qmp-commands.o tests/test-visitor-serialization.o \
        tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \

- tests/test-opts-visitor.o tests/test-qmp-event.o
+ tests/test-opts-visitor.o

test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
tests/test-qapi-event.o

thanks
-- PMM

#6 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 1/5] tests/test-qmp-event: fix for GLib < 2.31

Il 29/06/2014 22:31, Peter Maydell ha scritto:

Quoted 53 lines · Luiz Capitulino
Quoted 52 lines
Quoted 49 lines · On Wed, 25 Jun 2014 15:15:35 +0200 Paolo Bonzini <[email protected]> wrote:

Il 25/06/2014 15:13, Luiz Capitulino ha scritto:

Quoted 47 lines
Quoted 17 lines · On Tue, 24 Jun 2014 16:33:56 -0700 Wenchao Xia <[email protected]> wrote:

From: Paolo Bonzini <[email protected]>

On old GLib, the test needs a g_thread_init call.

---
 tests/test-qmp-event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/test-qmp-event.c +0 -0
index cb1e441..17c6444 100644

tests/test-qmp-event.c static void test_event_d(TestEventData *data, · line 257

Quoted 7 lines
tests/test-qmp-event.c +1 -0
@@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+    g_thread_init(NULL);
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);

This breaks make check on F20:

"""
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c: In function ‘main’:
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5: error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]

     g_thread_init(NULL);
     ^

cc1: all warnings being treated as errors
make: *** [tests/test-qmp-event.o] Error 1
"""

I think the best way to fix this is to make util/osdep.c:thread_init() public (maybe by moving it to include/glib-compat.h) and use that instead. Also, note that thread_init()'s body is duplicated in a few other places, so maybe those places should call it too.

You may want to do this in a different series, then I can skip this patch and apply the rest of the series.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks Luiz, it's a good suggestion.

Paolo, Wenchao, are one of one going to work on this?

Ping! Can we have at least a local fix using glib version #ifdefs before Tuesday please? Otherwise we need to do something like this to avoid shipping an rc0 which doesn't pass make check on some systems.

I'll send the patch today. thread_init() is a bit tricky because it is a __constructor__ but it is not included in the binary because no other function is included from the same file.

BTW, the make check limitation is currently mentioned in the changelog.

Paolo

Quoted 28 lines
tests/Makefile +1 -3
index 7e53d0d..a1a0dae 100644
@@ -27,8 +27,6 @@ check-unit-y += tests/test-string-input-visitor$(EXESUF)
 gcov-files-test-string-input-visitor-y = qapi/string-input-visitor.c
 check-unit-y += tests/test-string-output-visitor$(EXESUF)
 gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c
-check-unit-y += tests/test-qmp-event$(EXESUF)
-gcov-files-test-qmp-event-y += qapi/qmp-event.c
 check-unit-y += tests/test-opts-visitor$(EXESUF)
 gcov-files-test-opts-visitor-y = qapi/opts-visitor.c
 check-unit-y += tests/test-coroutine$(EXESUF)
@@ -213,7 +211,7 @@ test-obj-y = tests/check-qint.o
 tests/check-qstring.o tests/check-qdict.o \
        tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
        tests/test-qmp-commands.o tests/test-visitor-serialization.o \
        tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
-       tests/test-opts-visitor.o tests/test-qmp-event.o
+       tests/test-opts-visitor.o
 
 test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \

tests/test-qapi-event.o

thanks
-- PMM

#7 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 1/5] tests/test-qmp-event: fix for GLib < 2.31

Quoted 70 lines · Paolo Bonzini

Il 29/06/2014 22:31, Peter Maydell ha scritto:

Quoted 60 lines · Luiz Capitulino
Quoted 59 lines
Quoted 56 lines · On Wed, 25 Jun 2014 15:15:35 +0200 Paolo Bonzini <[email protected]> wrote:

Il 25/06/2014 15:13, Luiz Capitulino ha scritto:

Quoted 54 lines
Quoted 17 lines · On Tue, 24 Jun 2014 16:33:56 -0700 Wenchao Xia <[email protected]> wrote:

From: Paolo Bonzini <[email protected]>

On old GLib, the test needs a g_thread_init call.

---
 tests/test-qmp-event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/test-qmp-event.c +0 -0
index cb1e441..17c6444 100644

tests/test-qmp-event.c static void test_event_d(TestEventData *data, · line 257

Quoted 7 lines
tests/test-qmp-event.c +1 -0
@@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+    g_thread_init(NULL);
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);

This breaks make check on F20:

""" /home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:
In function ‘main’:
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5:
error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]

     g_thread_init(NULL);
     ^

cc1: all warnings being treated as errors
make: *** [tests/test-qmp-event.o] Error 1
"""

I think the best way to fix this is to make util/osdep.c:thread_init() public (maybe by moving it to include/glib-compat.h) and use that instead.
Also, note that thread_init()'s body is duplicated in a few other places,
so maybe those places should call it too.

You may want to do this in a different series, then I can skip this patch
and apply the rest of the series.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks Luiz, it's a good suggestion.

Paolo, Wenchao, are one of one going to work on this?

Ping! Can we have at least a local fix using glib version #ifdefs before Tuesday please? Otherwise we need to do something like this to avoid shipping an rc0 which doesn't pass make check on some systems.

Quoted 8 lines

I'll send the patch today. thread_init() is a bit tricky because it is a __constructor__ but it is not included in the binary because no other function is included from the same file.

BTW, the make check limitation is currently mentioned in the changelog.

Paolo

I am not free these days for the issue, thanks for fixing it instead
of me!

Quoted 30 lines
Quoted 29 lines
tests/Makefile +0 -2
index 7e53d0d..a1a0dae 100644
@@ -27,8 +27,6 @@ check-unit-y +=
 tests/test-string-input-visitor$(EXESUF)
 gcov-files-test-string-input-visitor-y = qapi/string-input-visitor.c
 check-unit-y += tests/test-string-output-visitor$(EXESUF)
 gcov-files-test-string-output-visitor-y = qapi/string-output-visitor.c
-check-unit-y += tests/test-qmp-event$(EXESUF)
-gcov-files-test-qmp-event-y += qapi/qmp-event.c
 check-unit-y += tests/test-opts-visitor$(EXESUF)
 gcov-files-test-opts-visitor-y = qapi/opts-visitor.c

check-unit-y += tests/test-coroutine$(EXESUF)

tests/Makefile +1 -1
@@ -213,7 +211,7 @@ test-obj-y = tests/check-qint.o
 tests/check-qstring.o tests/check-qdict.o \
        tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
        tests/test-qmp-commands.o tests/test-visitor-serialization.o \
        tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
-       tests/test-opts-visitor.o tests/test-qmp-event.o
+       tests/test-opts-visitor.o
 
 test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \

tests/test-qapi-event.o

thanks
-- PMM

#8 lore raw

PATCH 2/5 qapi: move event defines

In reply to Wenchao Xia
---
 Makefile         |    2 +-
 qapi-event.json  |  318 ------------------------------------------------------
 qapi-schema.json |    5 +-
 qapi/event.json  |  318 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 322 insertions(+), 321 deletions(-)
 delete mode 100644 qapi-event.json
 create mode 100644 qapi/event.json
Makefile +1 -1
index 145adb6..1eea0c4 100644
@@ -248,7 +248,7 @@ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
 
 qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
                $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
-               $(SRC_PATH)/qapi-event.json
+               $(SRC_PATH)/qapi/event.json
 
 qapi-types.c qapi-types.h :\
 $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
qapi-event.json deleted +0 -318

318 lines not on this page · raw message

qapi-schema.json +3 -2
index e7727a1..37c2189 100644
@@ -8,6 +8,9 @@
 # QAPI block definitions
 { 'include': 'qapi/block.json' }
 
+# QAPI event definitions
+{ 'include': 'qapi/event.json' }
+
 ##
 # LostTickPolicy:
 #
@@ -3398,5 +3401,3 @@
 ##
 { 'enum': 'GuestPanicAction',
   'data': [ 'pause' ] }
-
-{ 'include': 'qapi-event.json' }
qapi/event.json new file +318 -0

318 lines not on this page · raw message

Signature · 1 line
1.7.1
Reviewed-by on v1 2/5
#9 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 2/5] qapi: move event defines

Quoted 9 lines · Wenchao Xia
---
 Makefile         |    2 +-
 qapi-event.json  |  318 ------------------------------------------------------
 qapi-schema.json |    5 +-
 qapi/event.json  |  318 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 322 insertions(+), 321 deletions(-)
 delete mode 100644 qapi-event.json
 create mode 100644 qapi/event.json

Please run:
git config diff.renames true

then this patch would be MUCH smaller on the list.

Fortunately, it was a fairly easy review.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#10 lore raw

PATCH 3/5 qapi: ignore generated event files

In reply to Wenchao Xia
---
 .gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
.gitignore +1 -0
index c658613..2286d0a 100644
@@ -26,6 +26,7 @@
 /qapi-generated
 /qapi-types.[ch]
 /qapi-visit.[ch]
+/qapi-event.[ch]
 /qmp-commands.h
 /qmp-marshal.c
 /qemu-doc.html
Signature · 1 line
1.7.1
Reviewed-by on v1 3/5
#11 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 3/5] qapi: ignore generated event files

Quoted 4 lines · Wenchao Xia
---
 .gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Quoted 14 lines
.gitignore +1 -0
index c658613..2286d0a 100644
@@ -26,6 +26,7 @@
 /qapi-generated
 /qapi-types.[ch]
 /qapi-visit.[ch]
+/qapi-event.[ch]
 /qmp-commands.h
 /qmp-marshal.c
 /qemu-doc.html
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#12 lore raw

PATCH 4/5 qapi script: clean up in scripts

In reply to Wenchao Xia

This patch improve docs and uses c_type(argentry, is_param=True) in script.

---
 docs/qapi-code-gen.txt                  |    8 ++++----
 scripts/qapi-event.py                   |    5 ++---
 scripts/qapi.py                         |    2 +-
 tests/qapi-schema/event-nest-struct.err |    2 +-
 4 files changed, 8 insertions(+), 9 deletions(-)
docs/qapi-code-gen.txt +4 -4
index 3a0c99e..a6197a9 100644
@@ -218,10 +218,10 @@ An example command is:
 === Events ===
 
 Events are defined with the keyword 'event'.  When 'data' is also specified,
-additional info will be carried on.  Finally there will be C API generated
-in qapi-event.h; when called by QEMU code, a message with timestamp will
-be emitted on the wire.  If timestamp is -1, it means failure to retrieve host
-time.
+additional info will be included in the event.  Finally there will be C API
+generated in qapi-event.h; when called by QEMU code, a message with timestamp
+will be emitted on the wire.  If timestamp is -1, it means failure to retrieve
+host time.
 
 An example event is:
 
scripts/qapi-event.py +2 -3
index 3a1cd61..601e307 100644
@@ -26,9 +26,8 @@ def _generate_event_api_name(event_name, params):
                 api_name += "bool has_%s,\n" % c_var(argname)
                 api_name += "".ljust(l)
 
-            if argentry == "str":
-                api_name += "const "
-            api_name += "%s %s,\n" % (c_type(argentry), c_var(argname))
+            api_name += "%s %s,\n" % (c_type(argentry, is_param=True),
+                                      c_var(argname))
             api_name += "".ljust(l)
 
     api_name += "Error **errp)"
scripts/qapi.py +1 -1
index 54b97cb..f2c6d1f 100644
@@ -255,7 +255,7 @@ def check_event(expr, expr_info):
             if structured:
                 raise QAPIExprError(expr_info,
                                     "Nested structure define in event is not "
-                                    "supported now, event '%s', argname '%s'"
+                                    "supported, event '%s', argname '%s'"
                                     % (expr['event'], argname))
 
 def check_union(expr, expr_info):
tests/qapi-schema/event-nest-struct.err +1 -1
index e4a0faa..91bde1c 100644
@@ -1 +1 @@
-tests/qapi-schema/event-nest-struct.json:1: Nested structure define in event is not supported now, event 'EVENT_A', argname 'a'
+tests/qapi-schema/event-nest-struct.json:1: Nested structure define in event is not supported, event 'EVENT_A', argname 'a'
Signature · 1 line
1.7.1
Reviewed-by on v1 4/5
#13 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 4/5] qapi script: clean up in scripts

Quoted 11 lines · Wenchao Xia

This patch improve docs and uses c_type(argentry, is_param=True) in script.

---
 docs/qapi-code-gen.txt                  |    8 ++++----
 scripts/qapi-event.py                   |    5 ++---
 scripts/qapi.py                         |    2 +-
 tests/qapi-schema/event-nest-struct.err |    2 +-
 4 files changed, 8 insertions(+), 9 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#14 lore raw

PATCH 5/5 qapi event: clean up in callers

In reply to Wenchao Xia

This patch improves docs and address small issues in event callers.

---
 hw/watchdog/watchdog.c   |    2 +-
 include/block/blockjob.h |    2 +-
 monitor.c                |    2 +-
 qapi-schema.json         |    7 ++++---
 qapi/block-core.json     |    3 ++-
 qapi/event.json          |    4 ++--
 6 files changed, 11 insertions(+), 9 deletions(-)
hw/watchdog/watchdog.c +1 -1
index 4aebd34..9f607d4 100644
@@ -106,7 +106,7 @@ int select_watchdog_action(const char *p)
  */
 void watchdog_perform_action(void)
 {
-    switch(watchdog_action) {
+    switch (watchdog_action) {
     case WDT_RESET:             /* same as 'system_reset' in monitor */
         qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_RESET, &error_abort);
         qemu_system_reset_request();
include/block/blockjob.h +1 -1
index e443987..cc765b5 100644
@@ -217,7 +217,7 @@ void block_job_pause(BlockJob *job);
 void block_job_resume(BlockJob *job);
 
 /**
- * block_job_event_cancle:
+ * block_job_event_cancelled:
  * @job: The job whose information is requested.
  *
  * Send a BLOCK_JOB_CANCELLED event for the specified job.
monitor.c +1 -1
index a8ab600..fd34ab7 100644
@@ -570,6 +570,7 @@ monitor_qapi_event_throttle(QAPIEvent event, int64_t rate)
 
     trace_monitor_protocol_event_throttle(event, rate);
     evstate->event = event;
+    assert(rate * SCALE_MS <= INT64_MAX);
     evstate->rate = rate * SCALE_MS;
     evstate->last = 0;
     evstate->data = NULL;
@@ -585,7 +586,6 @@ static void monitor_qapi_event_init(void)
     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);
-    /* limit the rate of quorum events to avoid hammering the management */
     monitor_qapi_event_throttle(QAPI_EVENT_QUORUM_REPORT_BAD, 1000);
     monitor_qapi_event_throttle(QAPI_EVENT_QUORUM_FAILURE, 1000);
 
qapi-schema.json +4 -3
index 37c2189..c68a17f 100644
@@ -657,8 +657,9 @@
 #
 # @host: IP address
 #
-# @service: The service name of vnc port. This may depend on the host system's
-#           service database so symbolic names should not be relied on.
+# @service: The service name of the vnc port. This may depend on the host
+#           system's service database so symbolic names should not be relied
+#           on.
 #
 # @family: address family
 #
@@ -697,7 +698,7 @@
 ##
 { 'type': 'VncClientInfo',
   'base': 'VncBasicInfo',
-  'data': { '*x509_dname'   : 'str', '*sasl_username': 'str' } }
+  'data': { '*x509_dname': 'str', '*sasl_username': 'str' } }
 
 ##
 # @VncInfo:
qapi/block-core.json +2 -1
index af6b436..925e53e 100644
@@ -1436,7 +1436,8 @@
 # @device: device name
 #
 # @msg: informative message for human consumption, such as the kind of
-#       corruption being detected
+#       corruption being detected. It should not be parsed by machine as it is
+#       not guaranteed to be stable
 #
 # @offset: #optional, if the corruption resulted from an image access, this is
 #          the access offset into the image
qapi/event.json +2 -2
index e7a47f9..8f817b1 100644
@@ -1,8 +1,8 @@
 ##
 # @SHUTDOWN
 #
-# Emitted when the virtual machine has shutdown, possibly indicating that QEMU
-# is about about to exit.
+# Emitted when the virtual machine has shut down, indicating that qemu is
+# 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
Signature · 1 line
1.7.1
Reviewed-by on v1 5/5
#15 lore raw

Re: [Qemu-devel] [PATCH FOR 2.1 5/5] qapi event: clean up in callers

Quoted 4 lines · Wenchao Xia

This patch improves docs and address small issues in event callers.

Quoted 9 lines
---
 hw/watchdog/watchdog.c   |    2 +-
 include/block/blockjob.h |    2 +-
 monitor.c                |    2 +-
 qapi-schema.json         |    7 ++++---
 qapi/block-core.json     |    3 ++-
 qapi/event.json          |    4 ++--
 6 files changed, 11 insertions(+), 9 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#16 lore raw
In reply to Wenchao Xia
Quoted 9 lines · On Tue, 24 Jun 2014 16:33:55 -0700 Wenchao Xia <[email protected]> wrote:

Paolo Bonzini (1):
tests/test-qmp-event: fix for GLib < 2.31

Wenchao Xia (4):
qapi: move event defines
qapi: ignore generated event files
qapi script: clean up in scripts
qapi event: clean up in callers

I've applied patches 2-5, as explained in the other email. Anyone interested in doing additional review still have time to do so though.

Thanks.

Quoted 19 lines
 .gitignore                              |    1 +
 Makefile                                |    2 +-
 docs/qapi-code-gen.txt                  |    8 +-
 hw/watchdog/watchdog.c                  |    2 +-
 include/block/blockjob.h                |    2 +-
 monitor.c                               |    2 +-
 qapi-event.json                         |  318 -------------------------------
 qapi-schema.json                        |   12 +-
 qapi/block-core.json                    |    3 +-
 qapi/event.json                         |  318 +++++++++++++++++++++++++++++++
 scripts/qapi-event.py                   |    5 +-
 scripts/qapi.py                         |    2 +-
 tests/qapi-schema/event-nest-struct.err |    2 +-
 tests/test-qmp-event.c                  |    1 +
 14 files changed, 341 insertions(+), 337 deletions(-)
 delete mode 100644 qapi-event.json
 create mode 100644 qapi/event.json