Patchwork [09/10] qapi: add trace statements to qapi-visit-core.c

login
register
mail settings
Submitter Michael Roth
Date Oct. 14, 2011, 6:20 p.m.
Message ID <1318616402-18474-10-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/119897/
State New
Headers show

Comments

Michael Roth - Oct. 14, 2011, 6:20 p.m.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 Makefile.objs          |    2 +-
 qapi/qapi-visit-core.c |   41 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 40 insertions(+), 3 deletions(-)

Patch

diff --git a/Makefile.objs b/Makefile.objs
index 75c5770..8137cbd 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -24,7 +24,7 @@  coroutine-obj-$(CONFIG_WIN32) += coroutine-win32.o
 # qapi
 qapi-nested-y = qapi-visit-core.o qmp-input-visitor.o qmp-output-visitor.o qapi-dealloc-visitor.o
 qapi-nested-y += qmp-registry.o qmp-dispatch.o
-qapi-obj-y = $(addprefix qapi/, $(qapi-nested-y))
+qapi-obj-y = $(addprefix qapi/, $(qapi-nested-y)) $(trace-obj-y)
 
 #######################################################################
 # block-obj-y is code used by both qemu system emulation and qemu-img
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index 58f11fe..7b70d6e 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -12,6 +12,7 @@ 
  */
 
 #include "qapi/qapi-visit-core.h"
+#include "trace.h"
 
 void visit_start_handle(Visitor *v, void **obj, const char *kind,
                         const char *name, Error **errp)
@@ -34,6 +35,7 @@  void visit_start_struct(Visitor *v, void **obj, const char *kind,
     if (!error_is_set(errp)) {
         v->start_struct(v, obj, kind, name, size, errp);
     }
+    trace_qapi_start_struct(v, name, obj, size, kind, errp ? *errp : NULL);
 }
 
 void visit_end_struct(Visitor *v, Error **errp)
@@ -41,6 +43,7 @@  void visit_end_struct(Visitor *v, Error **errp)
     if (!error_is_set(errp)) {
         v->end_struct(v, errp);
     }
+    trace_qapi_end_struct(v, errp ? *errp : NULL);
 }
 
 void visit_start_list(Visitor *v, const char *name, Error **errp)
@@ -48,15 +51,18 @@  void visit_start_list(Visitor *v, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->start_list(v, name, errp);
     }
+    trace_qapi_start_list(v, name, errp ? *errp : NULL);
 }
 
 GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp)
 {
+    GenericList *next = NULL;
     if (!error_is_set(errp)) {
-        return v->next_list(v, list, errp);
+        next = v->next_list(v, list, errp);
     }
+    trace_qapi_visit_next_list(v, list, errp ? *errp : NULL);
 
-    return 0;
+    return next;
 }
 
 void visit_end_list(Visitor *v, Error **errp)
@@ -64,6 +70,7 @@  void visit_end_list(Visitor *v, Error **errp)
     if (!error_is_set(errp)) {
         v->end_list(v, errp);
     }
+    trace_qapi_end_list(v, errp ? *errp : NULL);
 }
 
 void visit_start_array(Visitor *v, void **obj, const char *name, size_t elem_count,
@@ -72,6 +79,7 @@  void visit_start_array(Visitor *v, void **obj, const char *name, size_t elem_cou
     if (!error_is_set(errp)) {
         v->start_array(v, obj, name, elem_count, elem_size, errp);
     }
+    trace_qapi_start_array(v, name, obj, elem_count, elem_size, errp ? *errp : NULL);
 }
 
 void visit_next_array(Visitor *v, Error **errp)
@@ -79,6 +87,7 @@  void visit_next_array(Visitor *v, Error **errp)
     if (!error_is_set(errp)) {
         v->next_array(v, errp);
     }
+    trace_qapi_visit_next_array(v, errp ? *errp : NULL);
 }
 
 void visit_end_array(Visitor *v, Error **errp)
@@ -86,6 +95,7 @@  void visit_end_array(Visitor *v, Error **errp)
     if (!error_is_set(errp)) {
         v->end_array(v, errp);
     }
+    trace_qapi_end_array(v, errp ? *errp : NULL);
 }
 
 void visit_start_optional(Visitor *v, bool *present, const char *name,
@@ -94,6 +104,7 @@  void visit_start_optional(Visitor *v, bool *present, const char *name,
     if (!error_is_set(errp) && v->start_optional) {
         v->start_optional(v, present, name, errp);
     }
+    trace_qapi_start_optional(v, name, present, *present, errp ? *errp : NULL);
 }
 
 void visit_end_optional(Visitor *v, Error **errp)
@@ -101,6 +112,7 @@  void visit_end_optional(Visitor *v, Error **errp)
     if (!error_is_set(errp) && v->end_optional) {
         v->end_optional(v, errp);
     }
+    trace_qapi_end_optional(v, errp ? *errp : NULL);
 }
 
 void visit_type_enum(Visitor *v, int *obj, const char *strings[],
@@ -109,6 +121,7 @@  void visit_type_enum(Visitor *v, int *obj, const char *strings[],
     if (!error_is_set(errp)) {
         v->type_enum(v, obj, strings, kind, name, errp);
     }
+    trace_qapi_visit_type_enum(v, name, obj, *obj, strings, errp ? *errp : NULL);
 }
 
 void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp)
@@ -116,6 +129,8 @@  void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_int(v, obj, name, errp);
     }
+    trace_qapi_visit_type_int64(v, name, obj, obj ? *obj : 0,
+                                errp ? *errp : NULL);
 }
 
 void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp)
@@ -123,6 +138,8 @@  void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_uint8(v, obj, name, errp);
     }
+    trace_qapi_visit_type_uint8(v, name, obj, obj ? *obj : 0,
+                                errp ? *errp : NULL);
 }
 
 void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp)
@@ -130,6 +147,8 @@  void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp
     if (!error_is_set(errp)) {
         v->type_uint16(v, obj, name, errp);
     }
+    trace_qapi_visit_type_uint16(v, name, obj, obj ? *obj : 0,
+                                 errp ? *errp : NULL);
 }
 
 void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp)
@@ -137,6 +156,8 @@  void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp
     if (!error_is_set(errp)) {
         v->type_uint32(v, obj, name, errp);
     }
+    trace_qapi_visit_type_uint32(v, name, obj, obj ? *obj : 0,
+                                 errp ? *errp : NULL);
 }
 
 void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp)
@@ -144,6 +165,8 @@  void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp
     if (!error_is_set(errp)) {
         v->type_uint64(v, obj, name, errp);
     }
+    trace_qapi_visit_type_uint64(v, name, obj, obj ? *obj : 0,
+                                 errp ? *errp : NULL);
 }
 
 void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp)
@@ -151,6 +174,8 @@  void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_int8(v, obj, name, errp);
     }
+    trace_qapi_visit_type_int8(v, name, obj, obj ? *obj : 0,
+                               errp ? *errp : NULL);
 }
 
 void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp)
@@ -158,6 +183,8 @@  void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_int16(v, obj, name, errp);
     }
+    trace_qapi_visit_type_int16(v, name, obj, obj ? *obj : 0,
+                                errp ? *errp : NULL);
 }
 
 void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp)
@@ -165,6 +192,8 @@  void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_int32(v, obj, name, errp);
     }
+    trace_qapi_visit_type_int32(v, name, obj, obj ? *obj : 0,
+                                errp ? *errp : NULL);
 }
 
 void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp)
@@ -172,6 +201,8 @@  void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_int64(v, obj, name, errp);
     }
+    trace_qapi_visit_type_int64(v, name, obj, obj ? *obj : 0,
+                                errp ? *errp : NULL);
 }
 
 void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp)
@@ -179,6 +210,8 @@  void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_bool(v, obj, name, errp);
     }
+    trace_qapi_visit_type_bool(v, name, obj, obj ? *obj : 0,
+                               errp ? *errp : NULL);
 }
 
 void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp)
@@ -186,6 +219,8 @@  void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_str(v, obj, name, errp);
     }
+    trace_qapi_visit_type_str(v, name, obj, obj ? *obj : 0,
+                              errp ? *errp : NULL);
 }
 
 void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp)
@@ -193,4 +228,6 @@  void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp)
     if (!error_is_set(errp)) {
         v->type_number(v, obj, name, errp);
     }
+    trace_qapi_visit_type_double(v, name, obj, obj ? *obj : 0,
+                                 errp ? *errp : NULL);
 }