diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2017-07-24 13:21:33 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2017-07-24 13:21:33 +0100 |
| commit | cf44d31d35df3de9d4f49339254050195f777f3e (patch) | |
| tree | 86c483b7cb76865aaa58786d917d68e9dab5a530 /qapi | |
| parent | 5dd8990841a9e331d9d4838a116291698208cbb6 (diff) | |
| parent | 01fa55982692fb51a16049b63b571651a1053989 (diff) | |
| download | focaccia-qemu-cf44d31d35df3de9d4f49339254050195f777f3e.tar.gz focaccia-qemu-cf44d31d35df3de9d4f49339254050195f777f3e.zip | |
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 'qapi')
| -rw-r--r-- | qapi/block-core.json | 29 | ||||
| -rw-r--r-- | qapi/qapi-clone-visitor.c | 5 | ||||
| -rw-r--r-- | qapi/qapi-dealloc-visitor.c | 6 | ||||
| -rw-r--r-- | qapi/qapi-visit-core.c | 7 | ||||
| -rw-r--r-- | qapi/qobject-input-visitor.c | 6 | ||||
| -rw-r--r-- | qapi/qobject-output-visitor.c | 5 | ||||
| -rw-r--r-- | qapi/string-input-visitor.c | 8 | ||||
| -rw-r--r-- | qapi/string-output-visitor.c | 3 | ||||
| -rw-r--r-- | qapi/trace-events | 2 |
9 files changed, 52 insertions, 19 deletions
diff --git a/qapi/block-core.json b/qapi/block-core.json index ff8e2ba0cb..6866ae8a38 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2273,15 +2273,14 @@ # besides their data source and an optional backing file. # # @backing: reference to or definition of the backing file block -# device (if missing, taken from the image file content). It is -# allowed to pass an empty string here in order to disable the -# default backing file. +# device, null disables the backing file entirely. +# Defaults to the backing file stored the image file. # # Since: 2.9 ## { 'struct': 'BlockdevOptionsGenericCOWFormat', 'base': 'BlockdevOptionsGenericFormat', - 'data': { '*backing': 'BlockdevRef' } } + 'data': { '*backing': 'BlockdevRefOrNull' } } ## # @Qcow2OverlapCheckMode: @@ -3120,9 +3119,7 @@ # Reference to a block device. # # @definition: defines a new block device inline -# @reference: references the ID of an existing block device. An -# empty string means that no block device should be -# referenced. +# @reference: references the ID of an existing block device # # Since: 2.9 ## @@ -3131,6 +3128,24 @@ 'reference': 'str' } } ## +# @BlockdevRefOrNull: +# +# Reference to a block device. +# +# @definition: defines a new block device inline +# @reference: references the ID of an existing block device. +# An empty string means that no block device should +# be referenced. Deprecated; use null instead. +# @null: No block device should be referenced (since 2.10) +# +# Since: 2.9 +## +{ 'alternate': 'BlockdevRefOrNull', + 'data': { 'definition': 'BlockdevOptions', + 'reference': 'str', + 'null': 'null' } } + +## # @blockdev-add: # # Creates a new block device. If the @id option is given at the top level, a diff --git a/qapi/qapi-clone-visitor.c b/qapi/qapi-clone-visitor.c index ed16d3a17f..d8b62792bc 100644 --- a/qapi/qapi-clone-visitor.c +++ b/qapi/qapi-clone-visitor.c @@ -127,12 +127,13 @@ static void qapi_clone_type_number(Visitor *v, const char *name, double *obj, /* Value was already cloned by g_memdup() */ } -static void qapi_clone_type_null(Visitor *v, const char *name, Error **errp) +static void qapi_clone_type_null(Visitor *v, const char *name, QNull **obj, + Error **errp) { QapiCloneVisitor *qcv = to_qcv(v); assert(qcv->depth); - /* Nothing to do */ + *obj = qnull(); } static void qapi_clone_free(Visitor *v) diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index fd6f9fb61c..ed70a0158b 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -103,8 +103,12 @@ static void qapi_dealloc_type_anything(Visitor *v, const char *name, } } -static void qapi_dealloc_type_null(Visitor *v, const char *name, Error **errp) +static void qapi_dealloc_type_null(Visitor *v, const char *name, + QNull **obj, Error **errp) { + if (obj) { + QDECREF(*obj); + } } static void qapi_dealloc_free(Visitor *v) diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 935a2c5bc9..ed6d2af462 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -325,10 +325,11 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp) error_propagate(errp, err); } -void visit_type_null(Visitor *v, const char *name, Error **errp) +void visit_type_null(Visitor *v, const char *name, QNull **obj, + Error **errp) { - trace_visit_type_null(v, name); - v->type_null(v, name, errp); + trace_visit_type_null(v, name, obj); + v->type_null(v, name, obj, errp); } static void output_type_enum(Visitor *v, const char *name, int *obj, diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index 35aff78f2b..ee9e47d911 100644 --- a/qapi/qobject-input-visitor.c +++ b/qapi/qobject-input-visitor.c @@ -587,11 +587,13 @@ static void qobject_input_type_any(Visitor *v, const char *name, QObject **obj, *obj = qobj; } -static void qobject_input_type_null(Visitor *v, const char *name, Error **errp) +static void qobject_input_type_null(Visitor *v, const char *name, + QNull **obj, Error **errp) { QObjectInputVisitor *qiv = to_qiv(v); QObject *qobj = qobject_input_get_object(qiv, name, true, errp); + *obj = NULL; if (!qobj) { return; } @@ -599,7 +601,9 @@ static void qobject_input_type_null(Visitor *v, const char *name, Error **errp) if (qobject_type(qobj) != QTYPE_QNULL) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, full_name(qiv, name), "null"); + return; } + *obj = qnull(); } static void qobject_input_type_size_keyval(Visitor *v, const char *name, diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c index 70be84ccb5..d325163e55 100644 --- a/qapi/qobject-output-visitor.c +++ b/qapi/qobject-output-visitor.c @@ -187,10 +187,11 @@ static void qobject_output_type_any(Visitor *v, const char *name, qobject_output_add_obj(qov, name, *obj); } -static void qobject_output_type_null(Visitor *v, const char *name, Error **errp) +static void qobject_output_type_null(Visitor *v, const char *name, + QNull **obj, Error **errp) { QObjectOutputVisitor *qov = to_qov(v); - qobject_output_add_obj(qov, name, qnull()); + qobject_output_add(qov, name, qnull()); } /* Finish building, and return the root object. diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 63ae115b2a..67a0a4a58b 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -326,14 +326,20 @@ static void parse_type_number(Visitor *v, const char *name, double *obj, *obj = val; } -static void parse_type_null(Visitor *v, const char *name, Error **errp) +static void parse_type_null(Visitor *v, const char *name, QNull **obj, + Error **errp) { StringInputVisitor *siv = to_siv(v); + *obj = NULL; + if (!siv->string || siv->string[0]) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", "null"); + return; } + + *obj = qnull(); } static void string_input_free(Visitor *v) diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c index af649e1d6e..7ab64468d9 100644 --- a/qapi/string-output-visitor.c +++ b/qapi/string-output-visitor.c @@ -256,7 +256,8 @@ static void print_type_number(Visitor *v, const char *name, double *obj, string_output_set(sov, g_strdup_printf("%f", *obj)); } -static void print_type_null(Visitor *v, const char *name, Error **errp) +static void print_type_null(Visitor *v, const char *name, QNull **obj, + Error **errp) { StringOutputVisitor *sov = to_sov(v); char *out; diff --git a/qapi/trace-events b/qapi/trace-events index 3b57abaa37..9e9008a1dc 100644 --- a/qapi/trace-events +++ b/qapi/trace-events @@ -31,4 +31,4 @@ visit_type_bool(void *v, const char *name, bool *obj) "v=%p name=%s obj=%p" visit_type_str(void *v, const char *name, char **obj) "v=%p name=%s obj=%p" visit_type_number(void *v, const char *name, double *obj) "v=%p name=%s obj=%p" visit_type_any(void *v, const char *name, void *obj) "v=%p name=%s obj=%p" -visit_type_null(void *v, const char *name) "v=%p name=%s" +visit_type_null(void *v, const char *name, void *obj) "v=%p name=%s obj=%p" |