summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-02-09 11:42:43 +0000
committerPeter Maydell <peter.maydell@linaro.org>2016-02-09 11:42:43 +0000
commitac1be2ae6b2995b99430c48329eb971b0281acf1 (patch)
treed7dc957dfc587e8d58924d68eac691f9c9a084c2 /include
parent74f30f153f4289fa68e62cf7b63cae7ce4e19046 (diff)
parent423aeaf219890e8a7311dbeef1a925020027c2ea (diff)
downloadqemu-ac1be2ae6b2995b99430c48329eb971b0281acf1.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-02-09' into staging
QAPI patches for 2016-02-09 # gpg: Signature made Tue 09 Feb 2016 10:55:51 GMT using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-qapi-2016-02-09: (31 commits) qapi: Add missing JSON files in build dependencies qapi: Fix compilation failure on MIPS and SPARC qmp: Don't abuse stack to track qmp-output root qmp: Fix reference-counting of qnull on empty output visit qapi: Drop unused error argument for list and implicit struct qapi: Tighten qmp_input_end_list() qapi: Drop unused 'kind' for struct/enum visit qapi: Swap 'name' in visit_* callbacks to match public API qom: Swap 'name' next to visitor in ObjectPropertyAccessor qapi: Swap visit_* arguments for consistent 'name' placement qom: Use typedef for Visitor qapi: Don't cast Enum* to int* qapi: Consolidate visitor small integer callbacks qapi: Make all visitors supply uint64 callbacks qapi: Prefer type_int64 over type_int in visitors qapi-visit: Kill unused visit_end_union() qapi: Track all failures between visit_start/stop qapi: Improve generated event use of qapi visitor balloon: Improve use of qapi visitor vl: Ensure qapi visitor properly ends struct visit ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/qapi/visitor-impl.h63
-rw-r--r--include/qapi/visitor.h60
-rw-r--r--include/qom/object.h13
3 files changed, 73 insertions, 63 deletions
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index 44a21b79d6..ea252f8e3a 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -1,7 +1,7 @@
/*
* Core Definitions for QAPI Visitor implementations
*
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2012-2016 Red Hat, Inc.
*
* Author: Paolo Bonizni <pbonzini@redhat.com>
*
@@ -18,52 +18,53 @@
struct Visitor
{
/* Must be set */
- void (*start_struct)(Visitor *v, void **obj, const char *kind,
- const char *name, size_t size, Error **errp);
+ void (*start_struct)(Visitor *v, const char *name, void **obj,
+ size_t size, Error **errp);
void (*end_struct)(Visitor *v, Error **errp);
void (*start_implicit_struct)(Visitor *v, void **obj, size_t size,
Error **errp);
- void (*end_implicit_struct)(Visitor *v, Error **errp);
+ /* May be NULL */
+ void (*end_implicit_struct)(Visitor *v);
void (*start_list)(Visitor *v, const char *name, Error **errp);
- GenericList *(*next_list)(Visitor *v, GenericList **list, Error **errp);
- void (*end_list)(Visitor *v, Error **errp);
+ /* Must be set */
+ GenericList *(*next_list)(Visitor *v, GenericList **list);
+ /* Must be set */
+ void (*end_list)(Visitor *v);
- void (*type_enum)(Visitor *v, int *obj, const char * const strings[],
- const char *kind, const char *name, Error **errp);
+ void (*type_enum)(Visitor *v, const char *name, int *obj,
+ const char *const strings[], Error **errp);
/* May be NULL; only needed for input visitors. */
- void (*get_next_type)(Visitor *v, QType *type, bool promote_int,
- const char *name, Error **errp);
+ void (*get_next_type)(Visitor *v, const char *name, QType *type,
+ bool promote_int, Error **errp);
- void (*type_int)(Visitor *v, int64_t *obj, const char *name, Error **errp);
- void (*type_bool)(Visitor *v, bool *obj, const char *name, Error **errp);
- void (*type_str)(Visitor *v, char **obj, const char *name, Error **errp);
- void (*type_number)(Visitor *v, double *obj, const char *name,
+ /* Must be set. */
+ void (*type_int64)(Visitor *v, const char *name, int64_t *obj,
+ Error **errp);
+ /* Must be set. */
+ void (*type_uint64)(Visitor *v, const char *name, uint64_t *obj,
+ Error **errp);
+ /* Optional; fallback is type_uint64(). */
+ void (*type_size)(Visitor *v, const char *name, uint64_t *obj,
+ Error **errp);
+ /* Must be set. */
+ void (*type_bool)(Visitor *v, const char *name, bool *obj, Error **errp);
+ void (*type_str)(Visitor *v, const char *name, char **obj, Error **errp);
+ void (*type_number)(Visitor *v, const char *name, double *obj,
Error **errp);
- void (*type_any)(Visitor *v, QObject **obj, const char *name,
+ void (*type_any)(Visitor *v, const char *name, QObject **obj,
Error **errp);
/* May be NULL; most useful for input visitors. */
- void (*optional)(Visitor *v, bool *present, const char *name);
+ void (*optional)(Visitor *v, const char *name, bool *present);
- void (*type_uint8)(Visitor *v, uint8_t *obj, const char *name, Error **errp);
- void (*type_uint16)(Visitor *v, uint16_t *obj, const char *name, Error **errp);
- void (*type_uint32)(Visitor *v, uint32_t *obj, const char *name, Error **errp);
- void (*type_uint64)(Visitor *v, uint64_t *obj, const char *name, Error **errp);
- void (*type_int8)(Visitor *v, int8_t *obj, const char *name, Error **errp);
- void (*type_int16)(Visitor *v, int16_t *obj, const char *name, Error **errp);
- void (*type_int32)(Visitor *v, int32_t *obj, const char *name, Error **errp);
- void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp);
- /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */
- void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp);
bool (*start_union)(Visitor *v, bool data_present, Error **errp);
- void (*end_union)(Visitor *v, bool data_present, Error **errp);
};
-void input_type_enum(Visitor *v, int *obj, const char * const strings[],
- const char *kind, const char *name, Error **errp);
-void output_type_enum(Visitor *v, int *obj, const char * const strings[],
- const char *kind, const char *name, Error **errp);
+void input_type_enum(Visitor *v, const char *name, int *obj,
+ const char *const strings[], Error **errp);
+void output_type_enum(Visitor *v, const char *name, int *obj,
+ const char *const strings[], Error **errp);
#endif
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
index a14a16d755..5e581dcf7e 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -1,6 +1,7 @@
/*
* Core Definitions for QAPI Visitor Classes
*
+ * Copyright (C) 2012-2016 Red Hat, Inc.
* Copyright IBM, Corp. 2011
*
* Authors:
@@ -27,15 +28,16 @@ typedef struct GenericList
struct GenericList *next;
} GenericList;
-void visit_start_struct(Visitor *v, void **obj, const char *kind,
- const char *name, size_t size, Error **errp);
+void visit_start_struct(Visitor *v, const char *name, void **obj,
+ size_t size, Error **errp);
void visit_end_struct(Visitor *v, Error **errp);
void visit_start_implicit_struct(Visitor *v, void **obj, size_t size,
Error **errp);
-void visit_end_implicit_struct(Visitor *v, Error **errp);
+void visit_end_implicit_struct(Visitor *v);
+
void visit_start_list(Visitor *v, const char *name, Error **errp);
-GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp);
-void visit_end_list(Visitor *v, Error **errp);
+GenericList *visit_next_list(Visitor *v, GenericList **list);
+void visit_end_list(Visitor *v);
/**
* Check if an optional member @name of an object needs visiting.
@@ -43,7 +45,7 @@ void visit_end_list(Visitor *v, Error **errp);
* corresponding visit_type_*() needs calling; for other visitors,
* leave *@present unchanged. Return *@present for convenience.
*/
-bool visit_optional(Visitor *v, bool *present, const char *name);
+bool visit_optional(Visitor *v, const char *name, bool *present);
/**
* Determine the qtype of the item @name in the current object visit.
@@ -51,25 +53,33 @@ bool visit_optional(Visitor *v, bool *present, const char *name);
* alternate type; for other visitors, leave *@type unchanged.
* If @promote_int, treat integers as QTYPE_FLOAT.
*/
-void visit_get_next_type(Visitor *v, QType *type, bool promote_int,
- const char *name, Error **errp);
-void visit_type_enum(Visitor *v, int *obj, const char * const strings[],
- const char *kind, const char *name, Error **errp);
-void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp);
-void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp);
-void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp);
-void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp);
-void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp);
-void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp);
-void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp);
-void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp);
-void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp);
-void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp);
-void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp);
-void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp);
-void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp);
-void visit_type_any(Visitor *v, QObject **obj, const char *name, Error **errp);
+void visit_get_next_type(Visitor *v, const char *name, QType *type,
+ bool promote_int, Error **errp);
+void visit_type_enum(Visitor *v, const char *name, int *obj,
+ const char *const strings[], Error **errp);
+void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp);
+void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
+ Error **errp);
+void visit_type_uint16(Visitor *v, const char *name, uint16_t *obj,
+ Error **errp);
+void visit_type_uint32(Visitor *v, const char *name, uint32_t *obj,
+ Error **errp);
+void visit_type_uint64(Visitor *v, const char *name, uint64_t *obj,
+ Error **errp);
+void visit_type_int8(Visitor *v, const char *name, int8_t *obj, Error **errp);
+void visit_type_int16(Visitor *v, const char *name, int16_t *obj,
+ Error **errp);
+void visit_type_int32(Visitor *v, const char *name, int32_t *obj,
+ Error **errp);
+void visit_type_int64(Visitor *v, const char *name, int64_t *obj,
+ Error **errp);
+void visit_type_size(Visitor *v, const char *name, uint64_t *obj,
+ Error **errp);
+void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp);
+void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp);
+void visit_type_number(Visitor *v, const char *name, double *obj,
+ Error **errp);
+void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp);
bool visit_start_union(Visitor *v, bool data_present, Error **errp);
-void visit_end_union(Visitor *v, bool data_present, Error **errp);
#endif
diff --git a/include/qom/object.h b/include/qom/object.h
index d0dafe986c..698827d948 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -18,10 +18,9 @@
#include <stdint.h>
#include <stdbool.h>
#include "qemu/queue.h"
+#include "qemu/typedefs.h"
#include "qapi/error.h"
-struct Visitor;
-
struct TypeImpl;
typedef struct TypeImpl *Type;
@@ -291,16 +290,16 @@ typedef struct InterfaceInfo InterfaceInfo;
* ObjectPropertyAccessor:
* @obj: the object that owns the property
* @v: the visitor that contains the property data
- * @opaque: the object property opaque
* @name: the name of the property
+ * @opaque: the object property opaque
* @errp: a pointer to an Error that is filled if getting/setting fails.
*
* Called when trying to get/set a property.
*/
typedef void (ObjectPropertyAccessor)(Object *obj,
- struct Visitor *v,
- void *opaque,
+ Visitor *v,
const char *name,
+ void *opaque,
Error **errp);
/**
@@ -1025,7 +1024,7 @@ void object_unparent(Object *obj);
*
* Reads a property from a object.
*/
-void object_property_get(Object *obj, struct Visitor *v, const char *name,
+void object_property_get(Object *obj, Visitor *v, const char *name,
Error **errp);
/**
@@ -1161,7 +1160,7 @@ void object_property_get_uint16List(Object *obj, const char *name,
*
* Writes a property to a object.
*/
-void object_property_set(Object *obj, struct Visitor *v, const char *name,
+void object_property_set(Object *obj, Visitor *v, const char *name,
Error **errp);
/**