diff options
| author | Peter Maydell | 2014-09-29 19:18:28 +0200 |
|---|---|---|
| committer | Peter Maydell | 2014-09-29 19:18:29 +0200 |
| commit | b60a7726cc0f5cbb2aecdbba67aeaf54ffc2c9cf (patch) | |
| tree | df518fd99409be22df46188174833b5fd317be5f /qapi/qapi-dealloc-visitor.c | |
| parent | libqos: use microseconds instead of iterations for virtio timeout (diff) | |
| parent | Add HMP command "info memory-devices" (diff) | |
| download | qemu-b60a7726cc0f5cbb2aecdbba67aeaf54ffc2c9cf.tar.gz qemu-b60a7726cc0f5cbb2aecdbba67aeaf54ffc2c9cf.tar.xz qemu-b60a7726cc0f5cbb2aecdbba67aeaf54ffc2c9cf.zip | |
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp:
Add HMP command "info memory-devices"
qemu-socket: Eliminate silly QERR_ macros
qemu-socket: Polish errors for connect() and listen() failure
qemu-iotests: Test missing "driver" key for blockdev-add
tests: add QMP input visitor test for unions with no discriminator
qapi: dealloc visitor, implement visit_start_union
qapi: add visit_start_union and visit_end_union
virtio-balloon: fix integer overflow in memory stats feature
monitor: Reset HMP mon->rs in CHR_EVENT_OPEN
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qapi/qapi-dealloc-visitor.c')
| -rw-r--r-- | qapi/qapi-dealloc-visitor.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index dc53545fa5..a14a1c7146 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -162,6 +162,31 @@ static void qapi_dealloc_type_enum(Visitor *v, int *obj, const char *strings[], { } +/* If there's no data present, the dealloc visitor has nothing to free. + * Thus, indicate to visitor code that the subsequent union fields can + * be skipped. This is not an error condition, since the cleanup of the + * rest of an object can continue unhindered, so leave errp unset in + * these cases. + * + * NOTE: In cases where we're attempting to deallocate an object that + * may have missing fields, the field indicating the union type may + * be missing. In such a case, it's possible we don't have enough + * information to differentiate data_present == false from a case where + * data *is* present but happens to be a scalar with a value of 0. + * This is okay, since in the case of the dealloc visitor there's no + * work that needs to done in either situation. + * + * The current inability in QAPI code to more thoroughly verify a union + * type in such cases will likely need to be addressed if we wish to + * implement this interface for other types of visitors in the future, + * however. + */ +static bool qapi_dealloc_start_union(Visitor *v, bool data_present, + Error **errp) +{ + return data_present; +} + Visitor *qapi_dealloc_get_visitor(QapiDeallocVisitor *v) { return &v->visitor; @@ -191,6 +216,7 @@ QapiDeallocVisitor *qapi_dealloc_visitor_new(void) v->visitor.type_str = qapi_dealloc_type_str; v->visitor.type_number = qapi_dealloc_type_number; v->visitor.type_size = qapi_dealloc_type_size; + v->visitor.start_union = qapi_dealloc_start_union; QTAILQ_INIT(&v->stack); |
