aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-07-24 13:21:33 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-07-24 13:21:33 +0100
commitcf44d31d35df3de9d4f49339254050195f777f3e (patch)
tree86c483b7cb76865aaa58786d917d68e9dab5a530 /include
parent5dd8990841a9e331d9d4838a116291698208cbb6 (diff)
parent01fa55982692fb51a16049b63b571651a1053989 (diff)
downloadqemu-cf44d31d35df3de9d4f49339254050195f777f3e.zip
qemu-cf44d31d35df3de9d4f49339254050195f777f3e.tar.gz
qemu-cf44d31d35df3de9d4f49339254050195f777f3e.tar.bz2
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-07-18-v2' into staging
QAPI patches for 2017-07-18 # gpg: Signature made Mon 24 Jul 2017 12:40:56 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-2017-07-18-v2: migration: Use JSON null instead of "" to reset parameter to default migration: Unshare MigrationParameters struct for now migration: Add TODO comments on duplication of QAPI_CLONE() migration: Clean up around tls_creds, tls_hostname hmp: Clean up and simplify hmp_migrate_set_parameter() block: Use JSON null instead of "" to disable backing file tests/test-qobject-input-visitor: Drop redundant test qapi: Introduce a first class 'null' type qapi: Use QNull for a more regular visit_type_null() qapi: Separate type QNull from QObject Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/qapi/qmp/qobject.h10
-rw-r--r--include/qapi/visitor-impl.h3
-rw-r--r--include/qapi/visitor.h8
-rw-r--r--include/qemu/typedefs.h1
4 files changed, 14 insertions, 8 deletions
diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
index b8ddbca..eab29ed 100644
--- a/include/qapi/qmp/qobject.h
+++ b/include/qapi/qmp/qobject.h
@@ -93,11 +93,15 @@ static inline QType qobject_type(const QObject *obj)
return obj->type;
}
-extern QObject qnull_;
+struct QNull {
+ QObject base;
+};
+
+extern QNull qnull_;
-static inline QObject *qnull(void)
+static inline QNull *qnull(void)
{
- qobject_incref(&qnull_);
+ QINCREF(&qnull_);
return &qnull_;
}
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index dcd656a..8ccb3b6 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -103,7 +103,8 @@ struct Visitor
Error **errp);
/* Must be set to visit explicit null values. */
- void (*type_null)(Visitor *v, const char *name, Error **errp);
+ void (*type_null)(Visitor *v, const char *name, QNull **obj,
+ Error **errp);
/* Must be set for input visitors to visit structs, optional otherwise.
The core takes care of the return type in the public interface. */
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
index 74768aa..fe9faf4 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -618,10 +618,10 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp);
* @name expresses the relationship of the null value to its parent
* container; see the general description of @name above.
*
- * Unlike all other visit_type_* functions, no obj parameter is
- * needed; rather, this is a witness that an explicit null value is
- * expected rather than any other type.
+ * @obj must be non-NULL. Input visitors set *@obj to the value;
+ * other visitors ignore *@obj.
*/
-void visit_type_null(Visitor *v, const char *name, Error **errp);
+void visit_type_null(Visitor *v, const char *name, QNull **obj,
+ Error **errp);
#endif
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 7b0d4e7..39bc835 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -89,6 +89,7 @@ typedef struct QEMUSGList QEMUSGList;
typedef struct QEMUTimer QEMUTimer;
typedef struct QEMUTimerListGroup QEMUTimerListGroup;
typedef struct QObject QObject;
+typedef struct QNull QNull;
typedef struct RAMBlock RAMBlock;
typedef struct Range Range;
typedef struct SerialState SerialState;