aboutsummaryrefslogtreecommitdiff
path: root/qapi/qobject-output-visitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'qapi/qobject-output-visitor.c')
-rw-r--r--qapi/qobject-output-visitor.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c
index ba6f6ac8a7..e4873308d4 100644
--- a/qapi/qobject-output-visitor.c
+++ b/qapi/qobject-output-visitor.c
@@ -13,6 +13,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/compat-policy.h"
#include "qapi/qobject-output-visitor.h"
#include "qapi/visitor-impl.h"
#include "qemu/queue.h"
@@ -31,6 +32,8 @@ typedef struct QStackEntry {
struct QObjectOutputVisitor {
Visitor visitor;
+ CompatPolicyOutput deprecated_policy;
+
QSLIST_HEAD(, QStackEntry) stack; /* Stack of unfinished containers */
QObject *root; /* Root of the output visit */
QObject **result; /* User's storage location for result */
@@ -207,6 +210,13 @@ static bool qobject_output_type_null(Visitor *v, const char *name,
return true;
}
+static bool qobject_output_deprecated(Visitor *v, const char *name)
+{
+ QObjectOutputVisitor *qov = to_qov(v);
+
+ return qov->deprecated_policy != COMPAT_POLICY_OUTPUT_HIDE;
+}
+
/* Finish building, and return the root object.
* The root object is never null. The caller becomes the object's
* owner, and should use qobject_unref() when done with it. */
@@ -256,6 +266,7 @@ Visitor *qobject_output_visitor_new(QObject **result)
v->visitor.type_number = qobject_output_type_number;
v->visitor.type_any = qobject_output_type_any;
v->visitor.type_null = qobject_output_type_null;
+ v->visitor.deprecated = qobject_output_deprecated;
v->visitor.complete = qobject_output_complete;
v->visitor.free = qobject_output_free;
@@ -264,3 +275,11 @@ Visitor *qobject_output_visitor_new(QObject **result)
return &v->visitor;
}
+
+void qobject_output_visitor_set_policy(Visitor *v,
+ CompatPolicyOutput deprecated)
+{
+ QObjectOutputVisitor *qov = to_qov(v);
+
+ qov->deprecated_policy = deprecated;
+}