summaryrefslogtreecommitdiffstats
path: root/include/qapi/visitor-impl.h
diff options
context:
space:
mode:
authorPeter Maydell2016-07-06 12:38:09 +0200
committerPeter Maydell2016-07-06 12:38:09 +0200
commit975b1c3ac6ae57b3e1356b0156c68f63a8a349dc (patch)
treeecd35419f10196800c44176645084c3691f660df /include/qapi/visitor-impl.h
parentMerge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' in... (diff)
parentreplay: Use new QAPI cloning (diff)
downloadqemu-975b1c3ac6ae57b3e1356b0156c68f63a8a349dc.tar.gz
qemu-975b1c3ac6ae57b3e1356b0156c68f63a8a349dc.tar.xz
qemu-975b1c3ac6ae57b3e1356b0156c68f63a8a349dc.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-07-06' into staging
QAPI patches for 2016-07-06 # gpg: Signature made Wed 06 Jul 2016 10:00:51 BST # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2016-07-06: replay: Use new QAPI cloning sockets: Use new QAPI cloning qapi: Add new clone visitor qapi: Add new visit_complete() function tests: Factor out common code in qapi output tests tests: Clean up test-string-output-visitor qmp-output-visitor: Favor new visit_free() function string-output-visitor: Favor new visit_free() function qmp-input-visitor: Favor new visit_free() function string-input-visitor: Favor new visit_free() function opts-visitor: Favor new visit_free() function qapi: Add new visit_free() function qapi: Add parameter to visit_end_* qemu-img: Don't leak errors when outputting JSON qapi: Improve use of qmp/types.h Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/qapi/visitor-impl.h')
-rw-r--r--include/qapi/visitor-impl.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index 145afd03e7..8bd47ee4bb 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -27,14 +27,18 @@
*/
/*
- * There are three classes of visitors; setting the class determines
+ * There are four classes of visitors; setting the class determines
* how QAPI enums are visited, as well as what additional restrictions
- * can be asserted.
+ * can be asserted. The values are intentionally chosen so as to
+ * permit some assertions based on whether a given bit is set (that
+ * is, some assertions apply to input and clone visitors, some
+ * assertions apply to output and clone visitors).
*/
typedef enum VisitorType {
- VISITOR_INPUT,
- VISITOR_OUTPUT,
- VISITOR_DEALLOC,
+ VISITOR_INPUT = 1,
+ VISITOR_OUTPUT = 2,
+ VISITOR_CLONE = 3,
+ VISITOR_DEALLOC = 4,
} VisitorType;
struct Visitor
@@ -47,7 +51,7 @@ struct Visitor
void (*check_struct)(Visitor *v, Error **errp);
/* Must be set to visit structs */
- void (*end_struct)(Visitor *v);
+ void (*end_struct)(Visitor *v, void **obj);
/* Must be set; implementations may require @list to be non-null,
* but must document it. */
@@ -58,7 +62,7 @@ struct Visitor
GenericList *(*next_list)(Visitor *v, GenericList *tail, size_t size);
/* Must be set */
- void (*end_list)(Visitor *v);
+ void (*end_list)(Visitor *v, void **list);
/* Must be set by input and dealloc visitors to visit alternates;
* optional for output visitors. */
@@ -67,7 +71,7 @@ struct Visitor
bool promote_int, Error **errp);
/* Optional, needed for dealloc visitor */
- void (*end_alternate)(Visitor *v);
+ void (*end_alternate)(Visitor *v, void **obj);
/* Must be set */
void (*type_int64)(Visitor *v, const char *name, int64_t *obj,
@@ -104,6 +108,12 @@ struct Visitor
/* Must be set */
VisitorType type;
+
+ /* Must be set for output visitors, optional otherwise. */
+ void (*complete)(Visitor *v, void *opaque);
+
+ /* Must be set */
+ void (*free)(Visitor *v);
};
#endif