qapi: First integration of qapi definitions.
Brings headers (and some sources) related to the QEMU object
model up to date with regards to upstream. Note that this misses
several implementation files which are currently not used.
Also misses qemu/cpu.h since it defines CPUState in a completely
different way than our current sources.
Change-Id: I8ece10ff9fcab28cb2e7de3493be21b793b3c98a
diff --git a/Makefile.android b/Makefile.android
index a166ccb..7af2b48 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -147,6 +147,10 @@
MY_CFLAGS += -I$(LOCAL_PATH)/include
+# Need to include "qapi-types.h" and other auto-generated files from
+# android-configure.sh
+MY_CFLAGS += -I$(LOCAL_PATH)/qapi-auto-generated
+
# A useful function that can be used to start the declaration of a host
# module. Avoids repeating the same stuff again and again.
# Usage:
diff --git a/Makefile.common b/Makefile.common
index 7d49b49..dd07cd3 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -468,6 +468,7 @@
util/acl.c \
util/aes.c \
util/cutils.c \
+ util/error.c \
util/module.c \
util/notify.c \
util/osdep.c \
@@ -476,6 +477,7 @@
util/qemu-error.c \
util/qemu-option.c \
util/qemu-sockets-android.c \
+ util/unicode.c \
ifeq ($(HOST_ARCH),x86)
CORE_MISC_SOURCES += disas/i386.c
diff --git a/android-configure.sh b/android-configure.sh
index 36b5e9a..83bf7c0 100755
--- a/android-configure.sh
+++ b/android-configure.sh
@@ -731,4 +731,15 @@
log "Generate : $config_h"
+# Generate the QAPI headers and sources from qapi-schema.json
+# Ideally, this would be done in our Makefiles, but as far as I
+# understand, the platform build doesn't support a single tool
+# that generates several sources files, nor the standalone one.
+export PYTHONDONTWRITEBYTECODE=1
+AUTOGENERATED_DIR=qapi-auto-generated
+python scripts/qapi-types.py qapi.types --output-dir=$AUTOGENERATED_DIR -b < qapi-schema.json
+python scripts/qapi-visit.py --output-dir=$AUTOGENERATED_DIR -b < qapi-schema.json
+python scripts/qapi-commands.py --output-dir=$AUTOGENERATED_DIR -m < qapi-schema.json
+log "Generate : $AUTOGENERATED_DIR"
+
echo "Ready to go. Type 'make' to build emulator"
diff --git a/blockdev.c b/blockdev.c
index 08fdf57..d39453f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -592,7 +592,7 @@
bdrv_flags = bdrv_is_read_only(bs) ? 0 : BDRV_O_RDWR;
bdrv_flags |= bdrv_is_snapshot(bs) ? BDRV_O_SNAPSHOT : 0;
if (bdrv_open(bs, filename, bdrv_flags, drv) < 0) {
- qerror_report(QERR_OPEN_FILE_FAILED, filename);
+ qerror_report(QERR_IO_ERROR);
return -1;
}
return monitor_read_bdrv_key_start(mon, bs, NULL, NULL);
diff --git a/include/qapi/dealloc-visitor.h b/include/qapi/dealloc-visitor.h
new file mode 100644
index 0000000..cf4c36d
--- /dev/null
+++ b/include/qapi/dealloc-visitor.h
@@ -0,0 +1,26 @@
+/*
+ * Dealloc Visitor
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Michael Roth <mdroth@linux.vnet.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef QAPI_DEALLOC_VISITOR_H
+#define QAPI_DEALLOC_VISITOR_H
+
+#include "qapi/visitor.h"
+
+typedef struct QapiDeallocVisitor QapiDeallocVisitor;
+
+QapiDeallocVisitor *qapi_dealloc_visitor_new(void);
+void qapi_dealloc_visitor_cleanup(QapiDeallocVisitor *d);
+
+Visitor *qapi_dealloc_get_visitor(QapiDeallocVisitor *v);
+
+#endif
diff --git a/include/qapi/error.h b/include/qapi/error.h
new file mode 100644
index 0000000..7d4c696
--- /dev/null
+++ b/include/qapi/error.h
@@ -0,0 +1,98 @@
+/*
+ * QEMU Error Objects
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2. See
+ * the COPYING.LIB file in the top-level directory.
+ */
+#ifndef ERROR_H
+#define ERROR_H
+
+#include "qemu/compiler.h"
+#include "qapi-types.h"
+#include <stdbool.h>
+
+/**
+ * A class representing internal errors within QEMU. An error has a ErrorClass
+ * code and a human message.
+ */
+typedef struct Error Error;
+
+/**
+ * Set an indirect pointer to an error given a ErrorClass value and a
+ * printf-style human message. This function is not meant to be used outside
+ * of QEMU.
+ */
+void error_set(Error **err, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(3, 4);
+
+/**
+ * Set an indirect pointer to an error given a ErrorClass value and a
+ * printf-style human message, followed by a strerror() string if
+ * @os_error is not zero.
+ */
+void error_set_errno(Error **err, int os_error, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(4, 5);
+
+#ifdef _WIN32
+/**
+ * Set an indirect pointer to an error given a ErrorClass value and a
+ * printf-style human message, followed by a g_win32_error_message() string if
+ * @win32_err is not zero.
+ */
+void error_set_win32(Error **err, int win32_err, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(4, 5);
+#endif
+
+/**
+ * Same as error_set(), but sets a generic error
+ */
+#define error_setg(err, fmt, ...) \
+ error_set(err, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__)
+#define error_setg_errno(err, os_error, fmt, ...) \
+ error_set_errno(err, os_error, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__)
+#ifdef _WIN32
+#define error_setg_win32(err, win32_err, fmt, ...) \
+ error_set_win32(err, win32_err, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__)
+#endif
+
+/**
+ * Helper for open() errors
+ */
+void error_setg_file_open(Error **errp, int os_errno, const char *filename);
+
+/**
+ * Returns true if an indirect pointer to an error is pointing to a valid
+ * error object.
+ */
+bool error_is_set(Error **err);
+
+/*
+ * Get the error class of an error object.
+ */
+ErrorClass error_get_class(const Error *err);
+
+/**
+ * Returns an exact copy of the error passed as an argument.
+ */
+Error *error_copy(const Error *err);
+
+/**
+ * Get a human readable representation of an error object.
+ */
+const char *error_get_pretty(Error *err);
+
+/**
+ * Propagate an error to an indirect pointer to an error. This function will
+ * always transfer ownership of the error reference and handles the case where
+ * dst_err is NULL correctly. Errors after the first are discarded.
+ */
+void error_propagate(Error **dst_err, Error *local_err);
+
+/**
+ * Free an error object.
+ */
+void error_free(Error *err);
+
+#endif
diff --git a/include/qapi/opts-visitor.h b/include/qapi/opts-visitor.h
new file mode 100644
index 0000000..fd48c14
--- /dev/null
+++ b/include/qapi/opts-visitor.h
@@ -0,0 +1,37 @@
+/*
+ * Options Visitor
+ *
+ * Copyright Red Hat, Inc. 2012
+ *
+ * Author: Laszlo Ersek <lersek@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef OPTS_VISITOR_H
+#define OPTS_VISITOR_H
+
+#include "qapi/visitor.h"
+#include "qemu/option.h"
+
+/* Inclusive upper bound on the size of any flattened range. This is a safety
+ * (= anti-annoyance) measure; wrong ranges should not cause long startup
+ * delays nor exhaust virtual memory.
+ */
+#define OPTS_VISITOR_RANGE_MAX 65536
+
+typedef struct OptsVisitor OptsVisitor;
+
+/* Contrarily to qemu-option.c::parse_option_number(), OptsVisitor's "int"
+ * parser relies on strtoll() instead of strtoull(). Consequences:
+ * - string representations of negative numbers yield negative values,
+ * - values below INT64_MIN or LLONG_MIN are rejected,
+ * - values above INT64_MAX or LLONG_MAX are rejected.
+ */
+OptsVisitor *opts_visitor_new(const QemuOpts *opts);
+void opts_visitor_cleanup(OptsVisitor *nv);
+Visitor *opts_get_visitor(OptsVisitor *nv);
+
+#endif
diff --git a/include/qapi/qmp-input-visitor.h b/include/qapi/qmp-input-visitor.h
new file mode 100644
index 0000000..3ed499c
--- /dev/null
+++ b/include/qapi/qmp-input-visitor.h
@@ -0,0 +1,29 @@
+/*
+ * Input Visitor
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef QMP_INPUT_VISITOR_H
+#define QMP_INPUT_VISITOR_H
+
+#include "qapi/visitor.h"
+#include "qapi/qmp/qobject.h"
+
+typedef struct QmpInputVisitor QmpInputVisitor;
+
+QmpInputVisitor *qmp_input_visitor_new(QObject *obj);
+QmpInputVisitor *qmp_input_visitor_new_strict(QObject *obj);
+
+void qmp_input_visitor_cleanup(QmpInputVisitor *v);
+
+Visitor *qmp_input_get_visitor(QmpInputVisitor *v);
+
+#endif
diff --git a/include/qapi/qmp-output-visitor.h b/include/qapi/qmp-output-visitor.h
new file mode 100644
index 0000000..2266770
--- /dev/null
+++ b/include/qapi/qmp-output-visitor.h
@@ -0,0 +1,28 @@
+/*
+ * Output Visitor
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef QMP_OUTPUT_VISITOR_H
+#define QMP_OUTPUT_VISITOR_H
+
+#include "qapi/visitor.h"
+#include "qapi/qmp/qobject.h"
+
+typedef struct QmpOutputVisitor QmpOutputVisitor;
+
+QmpOutputVisitor *qmp_output_visitor_new(void);
+void qmp_output_visitor_cleanup(QmpOutputVisitor *v);
+
+QObject *qmp_output_get_qobject(QmpOutputVisitor *v);
+Visitor *qmp_output_get_visitor(QmpOutputVisitor *v);
+
+#endif
diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h
new file mode 100644
index 0000000..cea3818
--- /dev/null
+++ b/include/qapi/qmp/dispatch.h
@@ -0,0 +1,58 @@
+/*
+ * Core Definitions for QAPI/QMP Dispatch
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef QMP_CORE_H
+#define QMP_CORE_H
+
+#include "qapi/qmp/qobject.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/error.h"
+
+typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
+
+typedef enum QmpCommandType
+{
+ QCT_NORMAL,
+} QmpCommandType;
+
+typedef enum QmpCommandOptions
+{
+ QCO_NO_OPTIONS = 0x0,
+ QCO_NO_SUCCESS_RESP = 0x1,
+} QmpCommandOptions;
+
+typedef struct QmpCommand
+{
+ const char *name;
+ QmpCommandType type;
+ QmpCommandFunc *fn;
+ QmpCommandOptions options;
+ QTAILQ_ENTRY(QmpCommand) node;
+ bool enabled;
+} QmpCommand;
+
+void qmp_register_command(const char *name, QmpCommandFunc *fn,
+ QmpCommandOptions options);
+QmpCommand *qmp_find_command(const char *name);
+QObject *qmp_dispatch(QObject *request);
+void qmp_disable_command(const char *name);
+void qmp_enable_command(const char *name);
+bool qmp_command_is_enabled(const QmpCommand *cmd);
+const char *qmp_command_name(const QmpCommand *cmd);
+bool qmp_has_success_response(const QmpCommand *cmd);
+QObject *qmp_build_error_object(Error *errp);
+typedef void (*qmp_cmd_callback_fn)(QmpCommand *cmd, void *opaque);
+void qmp_for_each_command(qmp_cmd_callback_fn fn, void *opaque);
+
+#endif
+
diff --git a/include/qapi/qmp/json-lexer.h b/include/qapi/qmp/json-lexer.h
index cd81943..cdff046 100644
--- a/include/qapi/qmp/json-lexer.h
+++ b/include/qapi/qmp/json-lexer.h
@@ -25,6 +25,7 @@
JSON_STRING,
JSON_ESCAPE,
JSON_SKIP,
+ JSON_ERROR,
} JSONTokenType;
typedef struct JSONLexer JSONLexer;
diff --git a/include/qapi/qmp/json-parser.h b/include/qapi/qmp/json-parser.h
index 1bbac16..44d88f3 100644
--- a/include/qapi/qmp/json-parser.h
+++ b/include/qapi/qmp/json-parser.h
@@ -16,7 +16,9 @@
#include "qemu-common.h"
#include "qapi/qmp/qlist.h"
+#include "qapi/error.h"
QObject *json_parser_parse(QList *tokens, va_list *ap);
+QObject *json_parser_parse_err(QList *tokens, va_list *ap, Error **errp);
#endif
diff --git a/include/qapi/qmp/json-streamer.h b/include/qapi/qmp/json-streamer.h
index 209b0ec..823f7d7 100644
--- a/include/qapi/qmp/json-streamer.h
+++ b/include/qapi/qmp/json-streamer.h
@@ -24,6 +24,7 @@
int brace_count;
int bracket_count;
QList *tokens;
+ uint64_t token_size;
} JSONMessageParser;
void json_message_parser_init(JSONMessageParser *parser,
diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h
index 6d9a4be..5cefd80 100644
--- a/include/qapi/qmp/qdict.h
+++ b/include/qapi/qmp/qdict.h
@@ -64,4 +64,9 @@
int qdict_get_try_bool(const QDict *qdict, const char *key, int def_value);
const char *qdict_get_try_str(const QDict *qdict, const char *key);
+QDict *qdict_clone_shallow(const QDict *src);
+void qdict_flatten(QDict *qdict);
+
+void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start);
+
#endif /* QDICT_H */
diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
index 3b51948..c30c2f6 100644
--- a/include/qapi/qmp/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -15,163 +15,235 @@
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"
#include "qemu/error-report.h"
+#include "qapi/error.h"
+#include "qapi-types.h"
#include <stdarg.h>
-typedef struct QErrorStringTable {
- const char *desc;
- const char *error_fmt;
-} QErrorStringTable;
-
typedef struct QError {
QObject_HEAD;
- QDict *error;
Location loc;
- int linenr;
- const char *file;
- const char *func;
- const QErrorStringTable *entry;
+ char *err_msg;
+ ErrorClass err_class;
} QError;
-QError *qerror_new(void);
-QError *qerror_from_info(const char *file, int linenr, const char *func,
- const char *fmt, va_list *va) GCC_FMT_ATTR(4, 0);
QString *qerror_human(const QError *qerror);
-void qerror_print(QError *qerror);
-void qerror_report_internal(const char *file, int linenr, const char *func,
- const char *fmt, ...) GCC_FMT_ATTR(4, 5);
-#define qerror_report(fmt, ...) \
- qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
-QError *qobject_to_qerror(const QObject *obj);
+void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+void qerror_report_err(Error *err);
+void assert_no_error(Error *err);
/*
* QError class list
* Please keep the definitions in alphabetical order.
- * Use "grep '^#define QERR_' qerror.h | sort -c" to check.
+ * Use scripts/check-qerror.sh to check.
*/
-#define QERR_BAD_BUS_FOR_DEVICE \
- "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
+#define QERR_ADD_CLIENT_FAILED \
+ ERROR_CLASS_GENERIC_ERROR, "Could not add client"
-#define QERR_BUS_NOT_FOUND \
- "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
+#define QERR_AMBIGUOUS_PATH \
+ ERROR_CLASS_GENERIC_ERROR, "Path '%s' does not uniquely identify an object"
+
+#define QERR_BAD_BUS_FOR_DEVICE \
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' can't go on a %s bus"
+
+#define QERR_BASE_NOT_FOUND \
+ ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found"
+
+#define QERR_BLOCK_JOB_NOT_ACTIVE \
+ ERROR_CLASS_DEVICE_NOT_ACTIVE, "No active block job on device '%s'"
+
+#define QERR_BLOCK_JOB_PAUSED \
+ ERROR_CLASS_GENERIC_ERROR, "The block job for device '%s' is currently paused"
+
+#define QERR_BLOCK_JOB_NOT_READY \
+ ERROR_CLASS_GENERIC_ERROR, "The active block job for device '%s' cannot be completed"
+
+#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
+ ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by device '%s' does not support feature '%s'"
+
+#define QERR_BUFFER_OVERRUN \
+ ERROR_CLASS_GENERIC_ERROR, "An internal buffer overran"
#define QERR_BUS_NO_HOTPLUG \
- "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging"
+
+#define QERR_BUS_NOT_FOUND \
+ ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found"
+
+#define QERR_COMMAND_DISABLED \
+ ERROR_CLASS_GENERIC_ERROR, "The command %s has been disabled for this instance"
#define QERR_COMMAND_NOT_FOUND \
- "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
+ ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found"
#define QERR_DEVICE_ENCRYPTED \
- "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
+ ERROR_CLASS_DEVICE_ENCRYPTED, "'%s' (%s) is encrypted"
+
+#define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \
+ ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when using feature '%s' in device '%s'"
+
+#define QERR_DEVICE_HAS_NO_MEDIUM \
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium"
#define QERR_DEVICE_INIT_FAILED \
- "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized"
#define QERR_DEVICE_IN_USE \
- "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use"
+
+#define QERR_DEVICE_IS_READ_ONLY \
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' is read only"
#define QERR_DEVICE_LOCKED \
- "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' is locked"
#define QERR_DEVICE_MULTIPLE_BUSSES \
- "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
-
-#define QERR_DEVICE_NOT_ACTIVE \
- "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
-
-#define QERR_DEVICE_NOT_ENCRYPTED \
- "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
-
-#define QERR_DEVICE_NOT_FOUND \
- "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
-
-#define QERR_DEVICE_NOT_REMOVABLE \
- "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' has multiple child busses"
#define QERR_DEVICE_NO_BUS \
- "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no child bus"
#define QERR_DEVICE_NO_HOTPLUG \
- "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging"
+
+#define QERR_DEVICE_NOT_ACTIVE \
+ ERROR_CLASS_DEVICE_NOT_ACTIVE, "Device '%s' has not been activated"
+
+#define QERR_DEVICE_NOT_ENCRYPTED \
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not encrypted"
+
+#define QERR_DEVICE_NOT_FOUND \
+ ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found"
+
+#define QERR_DEVICE_NOT_REMOVABLE \
+ ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not removable"
#define QERR_DUPLICATE_ID \
- "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "Duplicate ID '%s' for %s"
#define QERR_FD_NOT_FOUND \
- "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"
#define QERR_FD_NOT_SUPPLIED \
- "{ 'class': 'FdNotSupplied', 'data': {} }"
-
-#define QERR_INVALID_BLOCK_FORMAT \
- "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
-
-#define QERR_INVALID_PARAMETER \
- "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
-
-#define QERR_INVALID_PARAMETER_TYPE \
- "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
-
-#define QERR_INVALID_PARAMETER_VALUE \
- "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
-
-#define QERR_INVALID_PASSWORD \
- "{ 'class': 'InvalidPassword', 'data': {} }"
-
-#define QERR_JSON_PARSING \
- "{ 'class': 'JSONParsing', 'data': {} }"
-
-#define QERR_KVM_MISSING_CAP \
- "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
-
-#define QERR_MIGRATION_EXPECTED \
- "{ 'class': 'MigrationExpected', 'data': {} }"
-
-#define QERR_MISSING_PARAMETER \
- "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
-
-#define QERR_NO_BUS_FOR_DEVICE \
- "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
-
-#define QERR_OPEN_FILE_FAILED \
- "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
-
-#define QERR_PROPERTY_NOT_FOUND \
- "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
-
-#define QERR_PROPERTY_VALUE_BAD \
- "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
-
-#define QERR_PROPERTY_VALUE_IN_USE \
- "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
-
-#define QERR_PROPERTY_VALUE_NOT_FOUND \
- "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
-
-#define QERR_QMP_BAD_INPUT_OBJECT \
- "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
-
-#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
- "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
-
-#define QERR_QMP_EXTRA_MEMBER \
- "{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }"
-
-#define QERR_SET_PASSWD_FAILED \
- "{ 'class': 'SetPasswdFailed', 'data': {} }"
-
-#define QERR_TOO_MANY_FILES \
- "{ 'class': 'TooManyFiles', 'data': {} }"
-
-#define QERR_UNDEFINED_ERROR \
- "{ 'class': 'UndefinedError', 'data': {} }"
-
-#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
- "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
-
-#define QERR_VNC_SERVER_FAILED \
- "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS"
#define QERR_FEATURE_DISABLED \
- "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
+ ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled"
+
+#define QERR_INVALID_BLOCK_FORMAT \
+ ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'"
+
+#define QERR_INVALID_OPTION_GROUP \
+ ERROR_CLASS_GENERIC_ERROR, "There is no option group '%s'"
+
+#define QERR_INVALID_PARAMETER \
+ ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'"
+
+#define QERR_INVALID_PARAMETER_COMBINATION \
+ ERROR_CLASS_GENERIC_ERROR, "Invalid parameter combination"
+
+#define QERR_INVALID_PARAMETER_TYPE \
+ ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s"
+
+#define QERR_INVALID_PARAMETER_VALUE \
+ ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s"
+
+#define QERR_INVALID_PASSWORD \
+ ERROR_CLASS_GENERIC_ERROR, "Password incorrect"
+
+#define QERR_IO_ERROR \
+ ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred"
+
+#define QERR_JSON_PARSE_ERROR \
+ ERROR_CLASS_GENERIC_ERROR, "JSON parse error, %s"
+
+#define QERR_JSON_PARSING \
+ ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
+
+#define QERR_KVM_MISSING_CAP \
+ ERROR_CLASS_K_V_M_MISSING_CAP, "Using KVM without %s, %s unavailable"
+
+#define QERR_MIGRATION_ACTIVE \
+ ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
+
+#define QERR_MIGRATION_NOT_SUPPORTED \
+ ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'"
+
+#define QERR_MISSING_PARAMETER \
+ ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
+
+#define QERR_NO_BUS_FOR_DEVICE \
+ ERROR_CLASS_GENERIC_ERROR, "No '%s' bus found for device '%s'"
+
+#define QERR_NOT_SUPPORTED \
+ ERROR_CLASS_GENERIC_ERROR, "Not supported"
+
+#define QERR_PERMISSION_DENIED \
+ ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation"
+
+#define QERR_PROPERTY_NOT_FOUND \
+ ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' not found"
+
+#define QERR_PROPERTY_VALUE_BAD \
+ ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'"
+
+#define QERR_PROPERTY_VALUE_IN_USE \
+ ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't take value '%s', it's in use"
+
+#define QERR_PROPERTY_VALUE_NOT_FOUND \
+ ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't find value '%s'"
+
+#define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \
+ ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2"
+
+#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
+ ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
+
+#define QERR_QGA_COMMAND_FAILED \
+ ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'"
+
+#define QERR_QGA_LOGGING_FAILED \
+ ERROR_CLASS_GENERIC_ERROR, "Guest agent failed to log non-optional log statement"
+
+#define QERR_QMP_BAD_INPUT_OBJECT \
+ ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input"
+
+#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
+ ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'"
+
+#define QERR_QMP_EXTRA_MEMBER \
+ ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected"
+
+#define QERR_RESET_REQUIRED \
+ ERROR_CLASS_GENERIC_ERROR, "Resetting the Virtual Machine is required"
+
+#define QERR_SET_PASSWD_FAILED \
+ ERROR_CLASS_GENERIC_ERROR, "Could not set password"
+
+#define QERR_TOO_MANY_FILES \
+ ERROR_CLASS_GENERIC_ERROR, "Too many open files"
+
+#define QERR_UNDEFINED_ERROR \
+ ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred"
+
+#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
+ ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s"
+
+#define QERR_UNSUPPORTED \
+ ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
+
+#define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \
+ ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when VirtFS export path '%s' is mounted in the guest using mount_tag '%s'"
+
+#define QERR_SOCKET_CONNECT_FAILED \
+ ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
+
+#define QERR_SOCKET_LISTEN_FAILED \
+ ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
+
+#define QERR_SOCKET_BIND_FAILED \
+ ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"
+
+#define QERR_SOCKET_CREATE_FAILED \
+ ERROR_CLASS_GENERIC_ERROR, "Failed to create socket"
#endif /* QERROR_H */
diff --git a/include/qapi/qmp/qjson.h b/include/qapi/qmp/qjson.h
index 0bebab4..73351ed 100644
--- a/include/qapi/qmp/qjson.h
+++ b/include/qapi/qmp/qjson.h
@@ -15,6 +15,7 @@
#define QJSON_H
#include <stdarg.h>
+#include "qemu/compiler.h"
#include "qapi/qmp/qobject.h"
#include "qapi/qmp/qstring.h"
diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h
index 08eaea1..6cc4831 100644
--- a/include/qapi/qmp/qlist.h
+++ b/include/qapi/qmp/qlist.h
@@ -15,7 +15,6 @@
#include "qapi/qmp/qobject.h"
#include "qemu/queue.h"
-#include "qemu-common.h"
typedef struct QListEntry {
QObject *value;
@@ -48,6 +47,17 @@
QObject *qlist_pop(QList *qlist);
QObject *qlist_peek(QList *qlist);
int qlist_empty(const QList *qlist);
+size_t qlist_size(const QList *qlist);
QList *qobject_to_qlist(const QObject *obj);
+static inline const QListEntry *qlist_first(const QList *qlist)
+{
+ return QTAILQ_FIRST(&qlist->head);
+}
+
+static inline const QListEntry *qlist_next(const QListEntry *entry)
+{
+ return QTAILQ_NEXT(entry, next);
+}
+
#endif /* QLIST_H */
diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
index d42386d..d0bbc7c 100644
--- a/include/qapi/qmp/qobject.h
+++ b/include/qapi/qmp/qobject.h
@@ -44,6 +44,7 @@
QTYPE_QFLOAT,
QTYPE_QBOOL,
QTYPE_QERROR,
+ QTYPE_MAX,
} qtype_code;
struct QObject;
@@ -71,7 +72,7 @@
/* High-level interface for qobject_decref() */
#define QDECREF(obj) \
- qobject_decref(QOBJECT(obj))
+ qobject_decref(obj ? QOBJECT(obj) : NULL)
/* Initialize an object to default values */
#define QOBJECT_INIT(obj, qtype_type) \
diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h
index 0e690f4..1bc3666 100644
--- a/include/qapi/qmp/qstring.h
+++ b/include/qapi/qmp/qstring.h
@@ -26,6 +26,7 @@
QString *qstring_new(void);
QString *qstring_from_str(const char *str);
QString *qstring_from_substr(const char *str, int start, int end);
+size_t qstring_get_length(const QString *qstring);
const char *qstring_get_str(const QString *qstring);
void qstring_append_int(QString *qstring, int64_t value);
void qstring_append(QString *qstring, const char *str);
diff --git a/include/qapi/string-input-visitor.h b/include/qapi/string-input-visitor.h
new file mode 100644
index 0000000..089243c
--- /dev/null
+++ b/include/qapi/string-input-visitor.h
@@ -0,0 +1,25 @@
+/*
+ * String parsing Visitor
+ *
+ * Copyright Red Hat, Inc. 2012
+ *
+ * Author: Paolo Bonzini <pbonzini@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef STRING_INPUT_VISITOR_H
+#define STRING_INPUT_VISITOR_H
+
+#include "qapi/visitor.h"
+
+typedef struct StringInputVisitor StringInputVisitor;
+
+StringInputVisitor *string_input_visitor_new(const char *str);
+void string_input_visitor_cleanup(StringInputVisitor *v);
+
+Visitor *string_input_get_visitor(StringInputVisitor *v);
+
+#endif
diff --git a/include/qapi/string-output-visitor.h b/include/qapi/string-output-visitor.h
new file mode 100644
index 0000000..ec81e42
--- /dev/null
+++ b/include/qapi/string-output-visitor.h
@@ -0,0 +1,26 @@
+/*
+ * String printing Visitor
+ *
+ * Copyright Red Hat, Inc. 2012
+ *
+ * Author: Paolo Bonzini <pbonzini@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef STRING_OUTPUT_VISITOR_H
+#define STRING_OUTPUT_VISITOR_H
+
+#include "qapi/visitor.h"
+
+typedef struct StringOutputVisitor StringOutputVisitor;
+
+StringOutputVisitor *string_output_visitor_new(void);
+void string_output_visitor_cleanup(StringOutputVisitor *v);
+
+char *string_output_get_string(StringOutputVisitor *v);
+Visitor *string_output_get_visitor(StringOutputVisitor *v);
+
+#endif
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
new file mode 100644
index 0000000..f3fa420
--- /dev/null
+++ b/include/qapi/visitor-impl.h
@@ -0,0 +1,69 @@
+/*
+ * Core Definitions for QAPI Visitor implementations
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * Author: Paolo Bonizni <pbonzini@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+#ifndef QAPI_VISITOR_IMPL_H
+#define QAPI_VISITOR_IMPL_H
+
+#include "qapi/error.h"
+#include "qapi/visitor.h"
+
+struct Visitor
+{
+ /* Must be set */
+ void (*start_struct)(Visitor *v, void **obj, const char *kind,
+ const char *name, size_t size, Error **errp);
+ void (*end_struct)(Visitor *v, Error **errp);
+
+ void (*start_implicit_struct)(Visitor *v, void **obj, size_t size,
+ Error **errp);
+ void (*end_implicit_struct)(Visitor *v, Error **errp);
+
+ void (*start_list)(Visitor *v, const char *name, Error **errp);
+ GenericList *(*next_list)(Visitor *v, GenericList **list, Error **errp);
+ void (*end_list)(Visitor *v, Error **errp);
+
+ void (*type_enum)(Visitor *v, int *obj, const char *strings[],
+ const char *kind, const char *name, Error **errp);
+ void (*get_next_type)(Visitor *v, int *kind, const int *qobjects,
+ const char *name, Error **errp);
+
+ void (*type_int)(Visitor *v, int64_t *obj, const char *name, Error **errp);
+ void (*type_bool)(Visitor *v, bool *obj, const char *name, Error **errp);
+ void (*type_str)(Visitor *v, char **obj, const char *name, Error **errp);
+ void (*type_number)(Visitor *v, double *obj, const char *name,
+ Error **errp);
+
+ /* May be NULL */
+ void (*start_optional)(Visitor *v, bool *present, const char *name,
+ Error **errp);
+ void (*end_optional)(Visitor *v, Error **errp);
+
+ void (*start_handle)(Visitor *v, void **obj, const char *kind,
+ const char *name, Error **errp);
+ void (*end_handle)(Visitor *v, Error **errp);
+ void (*type_uint8)(Visitor *v, uint8_t *obj, const char *name, Error **errp);
+ void (*type_uint16)(Visitor *v, uint16_t *obj, const char *name, Error **errp);
+ void (*type_uint32)(Visitor *v, uint32_t *obj, const char *name, Error **errp);
+ void (*type_uint64)(Visitor *v, uint64_t *obj, const char *name, Error **errp);
+ void (*type_int8)(Visitor *v, int8_t *obj, const char *name, Error **errp);
+ void (*type_int16)(Visitor *v, int16_t *obj, const char *name, Error **errp);
+ void (*type_int32)(Visitor *v, int32_t *obj, const char *name, Error **errp);
+ void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp);
+ /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */
+ void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp);
+};
+
+void input_type_enum(Visitor *v, int *obj, const char *strings[],
+ const char *kind, const char *name, Error **errp);
+void output_type_enum(Visitor *v, int *obj, const char *strings[],
+ const char *kind, const char *name, Error **errp);
+
+#endif
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
new file mode 100644
index 0000000..48a2a2e
--- /dev/null
+++ b/include/qapi/visitor.h
@@ -0,0 +1,64 @@
+/*
+ * Core Definitions for QAPI Visitor Classes
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+#ifndef QAPI_VISITOR_CORE_H
+#define QAPI_VISITOR_CORE_H
+
+#include "qapi/qmp/qobject.h"
+#include "qapi/error.h"
+#include <stdlib.h>
+
+typedef struct GenericList
+{
+ union {
+ void *value;
+ uint64_t padding;
+ };
+ struct GenericList *next;
+} GenericList;
+
+typedef struct Visitor Visitor;
+
+void visit_start_handle(Visitor *v, void **obj, const char *kind,
+ const char *name, Error **errp);
+void visit_end_handle(Visitor *v, Error **errp);
+void visit_start_struct(Visitor *v, void **obj, const char *kind,
+ const char *name, size_t size, Error **errp);
+void visit_end_struct(Visitor *v, Error **errp);
+void visit_start_implicit_struct(Visitor *v, void **obj, size_t size,
+ Error **errp);
+void visit_end_implicit_struct(Visitor *v, Error **errp);
+void visit_start_list(Visitor *v, const char *name, Error **errp);
+GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp);
+void visit_end_list(Visitor *v, Error **errp);
+void visit_start_optional(Visitor *v, bool *present, const char *name,
+ Error **errp);
+void visit_end_optional(Visitor *v, Error **errp);
+void visit_get_next_type(Visitor *v, int *obj, const int *qtypes,
+ const char *name, Error **errp);
+void visit_type_enum(Visitor *v, int *obj, const char *strings[],
+ const char *kind, const char *name, Error **errp);
+void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp);
+void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp);
+void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp);
+void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp);
+void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp);
+void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp);
+void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp);
+void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp);
+void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp);
+void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp);
+void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp);
+void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp);
+void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp);
+
+#endif
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index 1d07745..d433b90 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -1,9 +1,9 @@
/* $NetBSD: queue.h,v 1.52 2009/04/20 09:56:08 mschuett Exp $ */
/*
- * Qemu version: Copy from netbsd, removed debug code, removed some of
- * the implementations. Left in lists, simple queues, tail queues and
- * circular queues.
+ * QEMU version: Copy from netbsd, removed debug code, removed some of
+ * the implementations. Left in singly-linked lists, lists, simple
+ * queues, and tail queues.
*/
/*
@@ -41,8 +41,18 @@
#define QEMU_SYS_QUEUE_H_
/*
- * This file defines four types of data structures:
- * lists, simple queues, tail queues, and circular queues.
+ * This file defines four types of data structures: singly-linked lists,
+ * lists, simple queues, and tail queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list. Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction. Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
@@ -65,17 +75,11 @@
* after an existing element, at the head of the list, or at the end of
* the list. A tail queue may be traversed in either direction.
*
- * A circle queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or after
- * an existing element, at the head of the list, or at the end of the list.
- * A circle queue may be traversed in either direction, but has a more
- * complex end of list detection.
- *
* For details on the use of these macros, see the queue(3) manual page.
*/
+#include "qemu/atomic.h" /* for smp_wmb() */
+
/*
* List definitions.
*/
@@ -122,6 +126,17 @@
(elm)->field.le_prev = &(head)->lh_first; \
} while (/*CONSTCOND*/0)
+#define QLIST_INSERT_HEAD_RCU(head, elm, field) do { \
+ (elm)->field.le_prev = &(head)->lh_first; \
+ (elm)->field.le_next = (head)->lh_first; \
+ smp_wmb(); /* fill elm before linking it */ \
+ if ((head)->lh_first != NULL) { \
+ (head)->lh_first->field.le_prev = &(elm)->field.le_next; \
+ } \
+ (head)->lh_first = (elm); \
+ smp_wmb(); \
+} while (/* CONSTCOND*/0)
+
#define QLIST_REMOVE(elm, field) do { \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
@@ -148,6 +163,64 @@
/*
+ * Singly-linked List definitions.
+ */
+#define QSLIST_HEAD(name, type) \
+struct name { \
+ struct type *slh_first; /* first element */ \
+}
+
+#define QSLIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define QSLIST_ENTRY(type) \
+struct { \
+ struct type *sle_next; /* next element */ \
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#define QSLIST_INIT(head) do { \
+ (head)->slh_first = NULL; \
+} while (/*CONSTCOND*/0)
+
+#define QSLIST_INSERT_AFTER(slistelm, elm, field) do { \
+ (elm)->field.sle_next = (slistelm)->field.sle_next; \
+ (slistelm)->field.sle_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define QSLIST_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.sle_next = (head)->slh_first; \
+ (head)->slh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define QSLIST_REMOVE_HEAD(head, field) do { \
+ (head)->slh_first = (head)->slh_first->field.sle_next; \
+} while (/*CONSTCOND*/0)
+
+#define QSLIST_REMOVE_AFTER(slistelm, field) do { \
+ (slistelm)->field.sle_next = \
+ QSLIST_NEXT(QSLIST_NEXT((slistelm), field), field); \
+} while (/*CONSTCOND*/0)
+
+#define QSLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
+#define QSLIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = QSLIST_FIRST((head)); \
+ (var) && ((tvar) = QSLIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+/*
+ * Singly-linked List access methods.
+ */
+#define QSLIST_EMPTY(head) ((head)->slh_first == NULL)
+#define QSLIST_FIRST(head) ((head)->slh_first)
+#define QSLIST_NEXT(elm, field) ((elm)->field.sle_next)
+
+
+/*
* Simple queue definitions.
*/
#define QSIMPLEQ_HEAD(name, type) \
@@ -338,112 +411,4 @@
#define QTAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
-
-/*
- * Circular queue definitions.
- */
-#define QCIRCLEQ_HEAD(name, type) \
-struct name { \
- struct type *cqh_first; /* first element */ \
- struct type *cqh_last; /* last element */ \
-}
-
-#define QCIRCLEQ_HEAD_INITIALIZER(head) \
- { (void *)&head, (void *)&head }
-
-#define QCIRCLEQ_ENTRY(type) \
-struct { \
- struct type *cqe_next; /* next element */ \
- struct type *cqe_prev; /* previous element */ \
-}
-
-/*
- * Circular queue functions.
- */
-#define QCIRCLEQ_INIT(head) do { \
- (head)->cqh_first = (void *)(head); \
- (head)->cqh_last = (void *)(head); \
-} while (/*CONSTCOND*/0)
-
-#define QCIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
- (elm)->field.cqe_next = (listelm)->field.cqe_next; \
- (elm)->field.cqe_prev = (listelm); \
- if ((listelm)->field.cqe_next == (void *)(head)) \
- (head)->cqh_last = (elm); \
- else \
- (listelm)->field.cqe_next->field.cqe_prev = (elm); \
- (listelm)->field.cqe_next = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define QCIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
- (elm)->field.cqe_next = (listelm); \
- (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
- if ((listelm)->field.cqe_prev == (void *)(head)) \
- (head)->cqh_first = (elm); \
- else \
- (listelm)->field.cqe_prev->field.cqe_next = (elm); \
- (listelm)->field.cqe_prev = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define QCIRCLEQ_INSERT_HEAD(head, elm, field) do { \
- (elm)->field.cqe_next = (head)->cqh_first; \
- (elm)->field.cqe_prev = (void *)(head); \
- if ((head)->cqh_last == (void *)(head)) \
- (head)->cqh_last = (elm); \
- else \
- (head)->cqh_first->field.cqe_prev = (elm); \
- (head)->cqh_first = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define QCIRCLEQ_INSERT_TAIL(head, elm, field) do { \
- (elm)->field.cqe_next = (void *)(head); \
- (elm)->field.cqe_prev = (head)->cqh_last; \
- if ((head)->cqh_first == (void *)(head)) \
- (head)->cqh_first = (elm); \
- else \
- (head)->cqh_last->field.cqe_next = (elm); \
- (head)->cqh_last = (elm); \
-} while (/*CONSTCOND*/0)
-
-#define QCIRCLEQ_REMOVE(head, elm, field) do { \
- if ((elm)->field.cqe_next == (void *)(head)) \
- (head)->cqh_last = (elm)->field.cqe_prev; \
- else \
- (elm)->field.cqe_next->field.cqe_prev = \
- (elm)->field.cqe_prev; \
- if ((elm)->field.cqe_prev == (void *)(head)) \
- (head)->cqh_first = (elm)->field.cqe_next; \
- else \
- (elm)->field.cqe_prev->field.cqe_next = \
- (elm)->field.cqe_next; \
-} while (/*CONSTCOND*/0)
-
-#define QCIRCLEQ_FOREACH(var, head, field) \
- for ((var) = ((head)->cqh_first); \
- (var) != (const void *)(head); \
- (var) = ((var)->field.cqe_next))
-
-#define QCIRCLEQ_FOREACH_REVERSE(var, head, field) \
- for ((var) = ((head)->cqh_last); \
- (var) != (const void *)(head); \
- (var) = ((var)->field.cqe_prev))
-
-/*
- * Circular queue access methods.
- */
-#define QCIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
-#define QCIRCLEQ_FIRST(head) ((head)->cqh_first)
-#define QCIRCLEQ_LAST(head) ((head)->cqh_last)
-#define QCIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
-#define QCIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
-
-#define QCIRCLEQ_LOOP_NEXT(head, elm, field) \
- (((elm)->field.cqe_next == (void *)(head)) \
- ? ((head)->cqh_first) \
- : (elm->field.cqe_next))
-#define QCIRCLEQ_LOOP_PREV(head, elm, field) \
- (((elm)->field.cqe_prev == (void *)(head)) \
- ? ((head)->cqh_last) \
- : (elm->field.cqe_prev))
-
#endif /* !QEMU_SYS_QUEUE_H_ */
diff --git a/include/qom/object.h b/include/qom/object.h
new file mode 100644
index 0000000..a275db2
--- /dev/null
+++ b/include/qom/object.h
@@ -0,0 +1,1194 @@
+/*
+ * QEMU Object Model
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_OBJECT_H
+#define QEMU_OBJECT_H
+
+#include <glib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include "qemu/queue.h"
+#include "qapi/error.h"
+
+struct Visitor;
+
+struct TypeImpl;
+typedef struct TypeImpl *Type;
+
+typedef struct ObjectClass ObjectClass;
+typedef struct Object Object;
+
+typedef struct TypeInfo TypeInfo;
+
+typedef struct InterfaceClass InterfaceClass;
+typedef struct InterfaceInfo InterfaceInfo;
+
+#define TYPE_OBJECT "object"
+
+/**
+ * SECTION:object.h
+ * @title:Base Object Type System
+ * @short_description: interfaces for creating new types and objects
+ *
+ * The QEMU Object Model provides a framework for registering user creatable
+ * types and instantiating objects from those types. QOM provides the following
+ * features:
+ *
+ * - System for dynamically registering types
+ * - Support for single-inheritance of types
+ * - Multiple inheritance of stateless interfaces
+ *
+ * <example>
+ * <title>Creating a minimal type</title>
+ * <programlisting>
+ * #include "qdev.h"
+ *
+ * #define TYPE_MY_DEVICE "my-device"
+ *
+ * // No new virtual functions: we can reuse the typedef for the
+ * // superclass.
+ * typedef DeviceClass MyDeviceClass;
+ * typedef struct MyDevice
+ * {
+ * DeviceState parent;
+ *
+ * int reg0, reg1, reg2;
+ * } MyDevice;
+ *
+ * static const TypeInfo my_device_info = {
+ * .name = TYPE_MY_DEVICE,
+ * .parent = TYPE_DEVICE,
+ * .instance_size = sizeof(MyDevice),
+ * };
+ *
+ * static void my_device_register_types(void)
+ * {
+ * type_register_static(&my_device_info);
+ * }
+ *
+ * type_init(my_device_register_types)
+ * </programlisting>
+ * </example>
+ *
+ * In the above example, we create a simple type that is described by #TypeInfo.
+ * #TypeInfo describes information about the type including what it inherits
+ * from, the instance and class size, and constructor/destructor hooks.
+ *
+ * Every type has an #ObjectClass associated with it. #ObjectClass derivatives
+ * are instantiated dynamically but there is only ever one instance for any
+ * given type. The #ObjectClass typically holds a table of function pointers
+ * for the virtual methods implemented by this type.
+ *
+ * Using object_new(), a new #Object derivative will be instantiated. You can
+ * cast an #Object to a subclass (or base-class) type using
+ * object_dynamic_cast(). You typically want to define macro wrappers around
+ * OBJECT_CHECK() and OBJECT_CLASS_CHECK() to make it easier to convert to a
+ * specific type:
+ *
+ * <example>
+ * <title>Typecasting macros</title>
+ * <programlisting>
+ * #define MY_DEVICE_GET_CLASS(obj) \
+ * OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
+ * #define MY_DEVICE_CLASS(klass) \
+ * OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
+ * #define MY_DEVICE(obj) \
+ * OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
+ * </programlisting>
+ * </example>
+ *
+ * # Class Initialization #
+ *
+ * Before an object is initialized, the class for the object must be
+ * initialized. There is only one class object for all instance objects
+ * that is created lazily.
+ *
+ * Classes are initialized by first initializing any parent classes (if
+ * necessary). After the parent class object has initialized, it will be
+ * copied into the current class object and any additional storage in the
+ * class object is zero filled.
+ *
+ * The effect of this is that classes automatically inherit any virtual
+ * function pointers that the parent class has already initialized. All
+ * other fields will be zero filled.
+ *
+ * Once all of the parent classes have been initialized, #TypeInfo::class_init
+ * is called to let the class being instantiated provide default initialize for
+ * its virtual functions. Here is how the above example might be modified
+ * to introduce an overridden virtual function:
+ *
+ * <example>
+ * <title>Overriding a virtual function</title>
+ * <programlisting>
+ * #include "qdev.h"
+ *
+ * void my_device_class_init(ObjectClass *klass, void *class_data)
+ * {
+ * DeviceClass *dc = DEVICE_CLASS(klass);
+ * dc->reset = my_device_reset;
+ * }
+ *
+ * static const TypeInfo my_device_info = {
+ * .name = TYPE_MY_DEVICE,
+ * .parent = TYPE_DEVICE,
+ * .instance_size = sizeof(MyDevice),
+ * .class_init = my_device_class_init,
+ * };
+ * </programlisting>
+ * </example>
+ *
+ * Introducing new virtual methods requires a class to define its own
+ * struct and to add a .class_size member to the #TypeInfo. Each method
+ * will also have a wrapper function to call it easily:
+ *
+ * <example>
+ * <title>Defining an abstract class</title>
+ * <programlisting>
+ * #include "qdev.h"
+ *
+ * typedef struct MyDeviceClass
+ * {
+ * DeviceClass parent;
+ *
+ * void (*frobnicate) (MyDevice *obj);
+ * } MyDeviceClass;
+ *
+ * static const TypeInfo my_device_info = {
+ * .name = TYPE_MY_DEVICE,
+ * .parent = TYPE_DEVICE,
+ * .instance_size = sizeof(MyDevice),
+ * .abstract = true, // or set a default in my_device_class_init
+ * .class_size = sizeof(MyDeviceClass),
+ * };
+ *
+ * void my_device_frobnicate(MyDevice *obj)
+ * {
+ * MyDeviceClass *klass = MY_DEVICE_GET_CLASS(obj);
+ *
+ * klass->frobnicate(obj);
+ * }
+ * </programlisting>
+ * </example>
+ *
+ * # Interfaces #
+ *
+ * Interfaces allow a limited form of multiple inheritance. Instances are
+ * similar to normal types except for the fact that are only defined by
+ * their classes and never carry any state. You can dynamically cast an object
+ * to one of its #Interface types and vice versa.
+ *
+ * # Methods #
+ *
+ * A <emphasis>method</emphasis> is a function within the namespace scope of
+ * a class. It usually operates on the object instance by passing it as a
+ * strongly-typed first argument.
+ * If it does not operate on an object instance, it is dubbed
+ * <emphasis>class method</emphasis>.
+ *
+ * Methods cannot be overloaded. That is, the #ObjectClass and method name
+ * uniquely identity the function to be called; the signature does not vary
+ * except for trailing varargs.
+ *
+ * Methods are always <emphasis>virtual</emphasis>. Overriding a method in
+ * #TypeInfo.class_init of a subclass leads to any user of the class obtained
+ * via OBJECT_GET_CLASS() accessing the overridden function.
+ * The original function is not automatically invoked. It is the responsibility
+ * of the overriding class to determine whether and when to invoke the method
+ * being overridden.
+ *
+ * To invoke the method being overridden, the preferred solution is to store
+ * the original value in the overriding class before overriding the method.
+ * This corresponds to |[ {super,base}.method(...) ]| in Java and C#
+ * respectively; this frees the overriding class from hardcoding its parent
+ * class, which someone might choose to change at some point.
+ *
+ * <example>
+ * <title>Overriding a virtual method</title>
+ * <programlisting>
+ * typedef struct MyState MyState;
+ *
+ * typedef void (*MyDoSomething)(MyState *obj);
+ *
+ * typedef struct MyClass {
+ * ObjectClass parent_class;
+ *
+ * MyDoSomething do_something;
+ * } MyClass;
+ *
+ * static void my_do_something(MyState *obj)
+ * {
+ * // do something
+ * }
+ *
+ * static void my_class_init(ObjectClass *oc, void *data)
+ * {
+ * MyClass *mc = MY_CLASS(oc);
+ *
+ * mc->do_something = my_do_something;
+ * }
+ *
+ * static const TypeInfo my_type_info = {
+ * .name = TYPE_MY,
+ * .parent = TYPE_OBJECT,
+ * .instance_size = sizeof(MyState),
+ * .class_size = sizeof(MyClass),
+ * .class_init = my_class_init,
+ * };
+ *
+ * typedef struct DerivedClass {
+ * MyClass parent_class;
+ *
+ * MyDoSomething parent_do_something;
+ * } DerivedClass;
+ *
+ * static void derived_do_something(MyState *obj)
+ * {
+ * DerivedClass *dc = DERIVED_GET_CLASS(obj);
+ *
+ * // do something here
+ * dc->parent_do_something(obj);
+ * // do something else here
+ * }
+ *
+ * static void derived_class_init(ObjectClass *oc, void *data)
+ * {
+ * MyClass *mc = MY_CLASS(oc);
+ * DerivedClass *dc = DERIVED_CLASS(oc);
+ *
+ * dc->parent_do_something = mc->do_something;
+ * mc->do_something = derived_do_something;
+ * }
+ *
+ * static const TypeInfo derived_type_info = {
+ * .name = TYPE_DERIVED,
+ * .parent = TYPE_MY,
+ * .class_size = sizeof(DerivedClass),
+ * .class_init = my_class_init,
+ * };
+ * </programlisting>
+ * </example>
+ *
+ * Alternatively, object_class_by_name() can be used to obtain the class and
+ * its non-overridden methods for a specific type. This would correspond to
+ * |[ MyClass::method(...) ]| in C++.
+ *
+ * The first example of such a QOM method was #CPUClass.reset,
+ * another example is #DeviceClass.realize.
+ */
+
+
+/**
+ * ObjectPropertyAccessor:
+ * @obj: the object that owns the property
+ * @v: the visitor that contains the property data
+ * @opaque: the object property opaque
+ * @name: the name of the property
+ * @errp: a pointer to an Error that is filled if getting/setting fails.
+ *
+ * Called when trying to get/set a property.
+ */
+typedef void (ObjectPropertyAccessor)(Object *obj,
+ struct Visitor *v,
+ void *opaque,
+ const char *name,
+ Error **errp);
+
+/**
+ * ObjectPropertyRelease:
+ * @obj: the object that owns the property
+ * @name: the name of the property
+ * @opaque: the opaque registered with the property
+ *
+ * Called when a property is removed from a object.
+ */
+typedef void (ObjectPropertyRelease)(Object *obj,
+ const char *name,
+ void *opaque);
+
+typedef struct ObjectProperty
+{
+ gchar *name;
+ gchar *type;
+ ObjectPropertyAccessor *get;
+ ObjectPropertyAccessor *set;
+ ObjectPropertyRelease *release;
+ void *opaque;
+
+ QTAILQ_ENTRY(ObjectProperty) node;
+} ObjectProperty;
+
+/**
+ * ObjectUnparent:
+ * @obj: the object that is being removed from the composition tree
+ *
+ * Called when an object is being removed from the QOM composition tree.
+ * The function should remove any backlinks from children objects to @obj.
+ */
+typedef void (ObjectUnparent)(Object *obj);
+
+/**
+ * ObjectFree:
+ * @obj: the object being freed
+ *
+ * Called when an object's last reference is removed.
+ */
+typedef void (ObjectFree)(void *obj);
+
+#define OBJECT_CLASS_CAST_CACHE 4
+
+/**
+ * ObjectClass:
+ *
+ * The base for all classes. The only thing that #ObjectClass contains is an
+ * integer type handle.
+ */
+struct ObjectClass
+{
+ /*< private >*/
+ Type type;
+ GSList *interfaces;
+
+ const char *cast_cache[OBJECT_CLASS_CAST_CACHE];
+
+ ObjectUnparent *unparent;
+};
+
+/**
+ * Object:
+ *
+ * The base for all objects. The first member of this object is a pointer to
+ * a #ObjectClass. Since C guarantees that the first member of a structure
+ * always begins at byte 0 of that structure, as long as any sub-object places
+ * its parent as the first member, we can cast directly to a #Object.
+ *
+ * As a result, #Object contains a reference to the objects type as its
+ * first member. This allows identification of the real type of the object at
+ * run time.
+ *
+ * #Object also contains a list of #Interfaces that this object
+ * implements.
+ */
+struct Object
+{
+ /*< private >*/
+ ObjectClass *class;
+ ObjectFree *free;
+ QTAILQ_HEAD(, ObjectProperty) properties;
+ uint32_t ref;
+ Object *parent;
+};
+
+/**
+ * TypeInfo:
+ * @name: The name of the type.
+ * @parent: The name of the parent type.
+ * @instance_size: The size of the object (derivative of #Object). If
+ * @instance_size is 0, then the size of the object will be the size of the
+ * parent object.
+ * @instance_init: This function is called to initialize an object. The parent
+ * class will have already been initialized so the type is only responsible
+ * for initializing its own members.
+ * @instance_post_init: This function is called to finish initialization of
+ * an object, after all @instance_init functions were called.
+ * @instance_finalize: This function is called during object destruction. This
+ * is called before the parent @instance_finalize function has been called.
+ * An object should only free the members that are unique to its type in this
+ * function.
+ * @abstract: If this field is true, then the class is considered abstract and
+ * cannot be directly instantiated.
+ * @class_size: The size of the class object (derivative of #ObjectClass)
+ * for this object. If @class_size is 0, then the size of the class will be
+ * assumed to be the size of the parent class. This allows a type to avoid
+ * implementing an explicit class type if they are not adding additional
+ * virtual functions.
+ * @class_init: This function is called after all parent class initialization
+ * has occurred to allow a class to set its default virtual method pointers.
+ * This is also the function to use to override virtual methods from a parent
+ * class.
+ * @class_base_init: This function is called for all base classes after all
+ * parent class initialization has occurred, but before the class itself
+ * is initialized. This is the function to use to undo the effects of
+ * memcpy from the parent class to the descendents.
+ * @class_finalize: This function is called during class destruction and is
+ * meant to release and dynamic parameters allocated by @class_init.
+ * @class_data: Data to pass to the @class_init, @class_base_init and
+ * @class_finalize functions. This can be useful when building dynamic
+ * classes.
+ * @interfaces: The list of interfaces associated with this type. This
+ * should point to a static array that's terminated with a zero filled
+ * element.
+ */
+struct TypeInfo
+{
+ const char *name;
+ const char *parent;
+
+ size_t instance_size;
+ void (*instance_init)(Object *obj);
+ void (*instance_post_init)(Object *obj);
+ void (*instance_finalize)(Object *obj);
+
+ bool abstract;
+ size_t class_size;
+
+ void (*class_init)(ObjectClass *klass, void *data);
+ void (*class_base_init)(ObjectClass *klass, void *data);
+ void (*class_finalize)(ObjectClass *klass, void *data);
+ void *class_data;
+
+ InterfaceInfo *interfaces;
+};
+
+/**
+ * OBJECT:
+ * @obj: A derivative of #Object
+ *
+ * Converts an object to a #Object. Since all objects are #Objects,
+ * this function will always succeed.
+ */
+#define OBJECT(obj) \
+ ((Object *)(obj))
+
+/**
+ * OBJECT_CLASS:
+ * @class: A derivative of #ObjectClass.
+ *
+ * Converts a class to an #ObjectClass. Since all objects are #Objects,
+ * this function will always succeed.
+ */
+#define OBJECT_CLASS(class) \
+ ((ObjectClass *)(class))
+
+/**
+ * OBJECT_CHECK:
+ * @type: The C type to use for the return value.
+ * @obj: A derivative of @type to cast.
+ * @name: The QOM typename of @type
+ *
+ * A type safe version of @object_dynamic_cast_assert. Typically each class
+ * will define a macro based on this type to perform type safe dynamic_casts to
+ * this object type.
+ *
+ * If an invalid object is passed to this function, a run time assert will be
+ * generated.
+ */
+#define OBJECT_CHECK(type, obj, name) \
+ ((type *)object_dynamic_cast_assert(OBJECT(obj), (name), \
+ __FILE__, __LINE__, __func__))
+
+/**
+ * OBJECT_CLASS_CHECK:
+ * @class: The C type to use for the return value.
+ * @obj: A derivative of @type to cast.
+ * @name: the QOM typename of @class.
+ *
+ * A type safe version of @object_class_dynamic_cast_assert. This macro is
+ * typically wrapped by each type to perform type safe casts of a class to a
+ * specific class type.
+ */
+#define OBJECT_CLASS_CHECK(class, obj, name) \
+ ((class *)object_class_dynamic_cast_assert(OBJECT_CLASS(obj), (name), \
+ __FILE__, __LINE__, __func__))
+
+/**
+ * OBJECT_GET_CLASS:
+ * @class: The C type to use for the return value.
+ * @obj: The object to obtain the class for.
+ * @name: The QOM typename of @obj.
+ *
+ * This function will return a specific class for a given object. Its generally
+ * used by each type to provide a type safe macro to get a specific class type
+ * from an object.
+ */
+#define OBJECT_GET_CLASS(class, obj, name) \
+ OBJECT_CLASS_CHECK(class, object_get_class(OBJECT(obj)), name)
+
+/**
+ * InterfaceInfo:
+ * @type: The name of the interface.
+ *
+ * The information associated with an interface.
+ */
+struct InterfaceInfo {
+ const char *type;
+};
+
+/**
+ * InterfaceClass:
+ * @parent_class: the base class
+ *
+ * The class for all interfaces. Subclasses of this class should only add
+ * virtual methods.
+ */
+struct InterfaceClass
+{
+ ObjectClass parent_class;
+ /*< private >*/
+ ObjectClass *concrete_class;
+};
+
+#define TYPE_INTERFACE "interface"
+
+/**
+ * INTERFACE_CLASS:
+ * @klass: class to cast from
+ * Returns: An #InterfaceClass or raise an error if cast is invalid
+ */
+#define INTERFACE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(InterfaceClass, klass, TYPE_INTERFACE)
+
+/**
+ * INTERFACE_CHECK:
+ * @interface: the type to return
+ * @obj: the object to convert to an interface
+ * @name: the interface type name
+ *
+ * Returns: @obj casted to @interface if cast is valid, otherwise raise error.
+ */
+#define INTERFACE_CHECK(interface, obj, name) \
+ ((interface *)object_dynamic_cast_assert(OBJECT((obj)), (name), \
+ __FILE__, __LINE__, __func__))
+
+/**
+ * object_new:
+ * @typename: The name of the type of the object to instantiate.
+ *
+ * This function will initialize a new object using heap allocated memory.
+ * The returned object has a reference count of 1, and will be freed when
+ * the last reference is dropped.
+ *
+ * Returns: The newly allocated and instantiated object.
+ */
+Object *object_new(const char *typename);
+
+/**
+ * object_new_with_type:
+ * @type: The type of the object to instantiate.
+ *
+ * This function will initialize a new object using heap allocated memory.
+ * The returned object has a reference count of 1, and will be freed when
+ * the last reference is dropped.
+ *
+ * Returns: The newly allocated and instantiated object.
+ */
+Object *object_new_with_type(Type type);
+
+/**
+ * object_initialize_with_type:
+ * @data: A pointer to the memory to be used for the object.
+ * @size: The maximum size available at @data for the object.
+ * @type: The type of the object to instantiate.
+ *
+ * This function will initialize an object. The memory for the object should
+ * have already been allocated. The returned object has a reference count of 1,
+ * and will be finalized when the last reference is dropped.
+ */
+void object_initialize_with_type(void *data, size_t size, Type type);
+
+/**
+ * object_initialize:
+ * @obj: A pointer to the memory to be used for the object.
+ * @size: The maximum size available at @obj for the object.
+ * @typename: The name of the type of the object to instantiate.
+ *
+ * This function will initialize an object. The memory for the object should
+ * have already been allocated. The returned object has a reference count of 1,
+ * and will be finalized when the last reference is dropped.
+ */
+void object_initialize(void *obj, size_t size, const char *typename);
+
+/**
+ * object_dynamic_cast:
+ * @obj: The object to cast.
+ * @typename: The @typename to cast to.
+ *
+ * This function will determine if @obj is-a @typename. @obj can refer to an
+ * object or an interface associated with an object.
+ *
+ * Returns: This function returns @obj on success or #NULL on failure.
+ */
+Object *object_dynamic_cast(Object *obj, const char *typename);
+
+/**
+ * object_dynamic_cast_assert:
+ *
+ * See object_dynamic_cast() for a description of the parameters of this
+ * function. The only difference in behavior is that this function asserts
+ * instead of returning #NULL on failure if QOM cast debugging is enabled.
+ * This function is not meant to be called directly, but only through
+ * the wrapper macro OBJECT_CHECK.
+ */
+Object *object_dynamic_cast_assert(Object *obj, const char *typename,
+ const char *file, int line, const char *func);
+
+/**
+ * object_get_class:
+ * @obj: A derivative of #Object
+ *
+ * Returns: The #ObjectClass of the type associated with @obj.
+ */
+ObjectClass *object_get_class(Object *obj);
+
+/**
+ * object_get_typename:
+ * @obj: A derivative of #Object.
+ *
+ * Returns: The QOM typename of @obj.
+ */
+const char *object_get_typename(Object *obj);
+
+/**
+ * type_register_static:
+ * @info: The #TypeInfo of the new type.
+ *
+ * @info and all of the strings it points to should exist for the life time
+ * that the type is registered.
+ *
+ * Returns: 0 on failure, the new #Type on success.
+ */
+Type type_register_static(const TypeInfo *info);
+
+/**
+ * type_register:
+ * @info: The #TypeInfo of the new type
+ *
+ * Unlike type_register_static(), this call does not require @info or its
+ * string members to continue to exist after the call returns.
+ *
+ * Returns: 0 on failure, the new #Type on success.
+ */
+Type type_register(const TypeInfo *info);
+
+/**
+ * object_class_dynamic_cast_assert:
+ * @klass: The #ObjectClass to attempt to cast.
+ * @typename: The QOM typename of the class to cast to.
+ *
+ * See object_class_dynamic_cast() for a description of the parameters
+ * of this function. The only difference in behavior is that this function
+ * asserts instead of returning #NULL on failure if QOM cast debugging is
+ * enabled. This function is not meant to be called directly, but only through
+ * the wrapper macros OBJECT_CLASS_CHECK and INTERFACE_CHECK.
+ */
+ObjectClass *object_class_dynamic_cast_assert(ObjectClass *klass,
+ const char *typename,
+ const char *file, int line,
+ const char *func);
+
+/**
+ * object_class_dynamic_cast:
+ * @klass: The #ObjectClass to attempt to cast.
+ * @typename: The QOM typename of the class to cast to.
+ *
+ * Returns: If @typename is a class, this function returns @klass if
+ * @typename is a subtype of @klass, else returns #NULL.
+ *
+ * If @typename is an interface, this function returns the interface
+ * definition for @klass if @klass implements it unambiguously; #NULL
+ * is returned if @klass does not implement the interface or if multiple
+ * classes or interfaces on the hierarchy leading to @klass implement
+ * it. (FIXME: perhaps this can be detected at type definition time?)
+ */
+ObjectClass *object_class_dynamic_cast(ObjectClass *klass,
+ const char *typename);
+
+/**
+ * object_class_get_parent:
+ * @klass: The class to obtain the parent for.
+ *
+ * Returns: The parent for @klass or %NULL if none.
+ */
+ObjectClass *object_class_get_parent(ObjectClass *klass);
+
+/**
+ * object_class_get_name:
+ * @klass: The class to obtain the QOM typename for.
+ *
+ * Returns: The QOM typename for @klass.
+ */
+const char *object_class_get_name(ObjectClass *klass);
+
+/**
+ * object_class_is_abstract:
+ * @klass: The class to obtain the abstractness for.
+ *
+ * Returns: %true if @klass is abstract, %false otherwise.
+ */
+bool object_class_is_abstract(ObjectClass *klass);
+
+/**
+ * object_class_by_name:
+ * @typename: The QOM typename to obtain the class for.
+ *
+ * Returns: The class for @typename or %NULL if not found.
+ */
+ObjectClass *object_class_by_name(const char *typename);
+
+void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),
+ const char *implements_type, bool include_abstract,
+ void *opaque);
+
+/**
+ * object_class_get_list:
+ * @implements_type: The type to filter for, including its derivatives.
+ * @include_abstract: Whether to include abstract classes.
+ *
+ * Returns: A singly-linked list of the classes in reverse hashtable order.
+ */
+GSList *object_class_get_list(const char *implements_type,
+ bool include_abstract);
+
+/**
+ * object_ref:
+ * @obj: the object
+ *
+ * Increase the reference count of a object. A object cannot be freed as long
+ * as its reference count is greater than zero.
+ */
+void object_ref(Object *obj);
+
+/**
+ * qdef_unref:
+ * @obj: the object
+ *
+ * Decrease the reference count of a object. A object cannot be freed as long
+ * as its reference count is greater than zero.
+ */
+void object_unref(Object *obj);
+
+/**
+ * object_property_add:
+ * @obj: the object to add a property to
+ * @name: the name of the property. This can contain any character except for
+ * a forward slash. In general, you should use hyphens '-' instead of
+ * underscores '_' when naming properties.
+ * @type: the type name of the property. This namespace is pretty loosely
+ * defined. Sub namespaces are constructed by using a prefix and then
+ * to angle brackets. For instance, the type 'virtio-net-pci' in the
+ * 'link' namespace would be 'link<virtio-net-pci>'.
+ * @get: The getter to be called to read a property. If this is NULL, then
+ * the property cannot be read.
+ * @set: the setter to be called to write a property. If this is NULL,
+ * then the property cannot be written.
+ * @release: called when the property is removed from the object. This is
+ * meant to allow a property to free its opaque upon object
+ * destruction. This may be NULL.
+ * @opaque: an opaque pointer to pass to the callbacks for the property
+ * @errp: returns an error if this function fails
+ */
+void object_property_add(Object *obj, const char *name, const char *type,
+ ObjectPropertyAccessor *get,
+ ObjectPropertyAccessor *set,
+ ObjectPropertyRelease *release,
+ void *opaque, Error **errp);
+
+void object_property_del(Object *obj, const char *name, Error **errp);
+
+/**
+ * object_property_find:
+ * @obj: the object
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Look up a property for an object and return its #ObjectProperty if found.
+ */
+ObjectProperty *object_property_find(Object *obj, const char *name,
+ Error **errp);
+
+void object_unparent(Object *obj);
+
+/**
+ * object_property_get:
+ * @obj: the object
+ * @v: the visitor that will receive the property value. This should be an
+ * Output visitor and the data will be written with @name as the name.
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Reads a property from a object.
+ */
+void object_property_get(Object *obj, struct Visitor *v, const char *name,
+ Error **errp);
+
+/**
+ * object_property_set_str:
+ * @value: the value to be written to the property
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Writes a string value to a property.
+ */
+void object_property_set_str(Object *obj, const char *value,
+ const char *name, Error **errp);
+
+/**
+ * object_property_get_str:
+ * @obj: the object
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Returns: the value of the property, converted to a C string, or NULL if
+ * an error occurs (including when the property value is not a string).
+ * The caller should free the string.
+ */
+char *object_property_get_str(Object *obj, const char *name,
+ Error **errp);
+
+/**
+ * object_property_set_link:
+ * @value: the value to be written to the property
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Writes an object's canonical path to a property.
+ */
+void object_property_set_link(Object *obj, Object *value,
+ const char *name, Error **errp);
+
+/**
+ * object_property_get_link:
+ * @obj: the object
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Returns: the value of the property, resolved from a path to an Object,
+ * or NULL if an error occurs (including when the property value is not a
+ * string or not a valid object path).
+ */
+Object *object_property_get_link(Object *obj, const char *name,
+ Error **errp);
+
+/**
+ * object_property_set_bool:
+ * @value: the value to be written to the property
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Writes a bool value to a property.
+ */
+void object_property_set_bool(Object *obj, bool value,
+ const char *name, Error **errp);
+
+/**
+ * object_property_get_bool:
+ * @obj: the object
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Returns: the value of the property, converted to a boolean, or NULL if
+ * an error occurs (including when the property value is not a bool).
+ */
+bool object_property_get_bool(Object *obj, const char *name,
+ Error **errp);
+
+/**
+ * object_property_set_int:
+ * @value: the value to be written to the property
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Writes an integer value to a property.
+ */
+void object_property_set_int(Object *obj, int64_t value,
+ const char *name, Error **errp);
+
+/**
+ * object_property_get_int:
+ * @obj: the object
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Returns: the value of the property, converted to an integer, or NULL if
+ * an error occurs (including when the property value is not an integer).
+ */
+int64_t object_property_get_int(Object *obj, const char *name,
+ Error **errp);
+
+/**
+ * object_property_set:
+ * @obj: the object
+ * @v: the visitor that will be used to write the property value. This should
+ * be an Input visitor and the data will be first read with @name as the
+ * name and then written as the property value.
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Writes a property to a object.
+ */
+void object_property_set(Object *obj, struct Visitor *v, const char *name,
+ Error **errp);
+
+/**
+ * object_property_parse:
+ * @obj: the object
+ * @string: the string that will be used to parse the property value.
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Parses a string and writes the result into a property of an object.
+ */
+void object_property_parse(Object *obj, const char *string,
+ const char *name, Error **errp);
+
+/**
+ * object_property_print:
+ * @obj: the object
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Returns a string representation of the value of the property. The
+ * caller shall free the string.
+ */
+char *object_property_print(Object *obj, const char *name,
+ Error **errp);
+
+/**
+ * object_property_get_type:
+ * @obj: the object
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Returns: The type name of the property.
+ */
+const char *object_property_get_type(Object *obj, const char *name,
+ Error **errp);
+
+/**
+ * object_get_root:
+ *
+ * Returns: the root object of the composition tree
+ */
+Object *object_get_root(void);
+
+/**
+ * object_get_canonical_path:
+ *
+ * Returns: The canonical path for a object. This is the path within the
+ * composition tree starting from the root.
+ */
+gchar *object_get_canonical_path(Object *obj);
+
+/**
+ * object_resolve_path:
+ * @path: the path to resolve
+ * @ambiguous: returns true if the path resolution failed because of an
+ * ambiguous match
+ *
+ * There are two types of supported paths--absolute paths and partial paths.
+ *
+ * Absolute paths are derived from the root object and can follow child<> or
+ * link<> properties. Since they can follow link<> properties, they can be
+ * arbitrarily long. Absolute paths look like absolute filenames and are
+ * prefixed with a leading slash.
+ *
+ * Partial paths look like relative filenames. They do not begin with a
+ * prefix. The matching rules for partial paths are subtle but designed to make
+ * specifying objects easy. At each level of the composition tree, the partial
+ * path is matched as an absolute path. The first match is not returned. At
+ * least two matches are searched for. A successful result is only returned if
+ * only one match is found. If more than one match is found, a flag is
+ * returned to indicate that the match was ambiguous.
+ *
+ * Returns: The matched object or NULL on path lookup failure.
+ */
+Object *object_resolve_path(const char *path, bool *ambiguous);
+
+/**
+ * object_resolve_path_type:
+ * @path: the path to resolve
+ * @typename: the type to look for.
+ * @ambiguous: returns true if the path resolution failed because of an
+ * ambiguous match
+ *
+ * This is similar to object_resolve_path. However, when looking for a
+ * partial path only matches that implement the given type are considered.
+ * This restricts the search and avoids spuriously flagging matches as
+ * ambiguous.
+ *
+ * For both partial and absolute paths, the return value goes through
+ * a dynamic cast to @typename. This is important if either the link,
+ * or the typename itself are of interface types.
+ *
+ * Returns: The matched object or NULL on path lookup failure.
+ */
+Object *object_resolve_path_type(const char *path, const char *typename,
+ bool *ambiguous);
+
+/**
+ * object_resolve_path_component:
+ * @parent: the object in which to resolve the path
+ * @part: the component to resolve.
+ *
+ * This is similar to object_resolve_path with an absolute path, but it
+ * only resolves one element (@part) and takes the others from @parent.
+ *
+ * Returns: The resolved object or NULL on path lookup failure.
+ */
+Object *object_resolve_path_component(Object *parent, const gchar *part);
+
+/**
+ * object_property_add_child:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @child: the child object
+ * @errp: if an error occurs, a pointer to an area to store the area
+ *
+ * Child properties form the composition tree. All objects need to be a child
+ * of another object. Objects can only be a child of one object.
+ *
+ * There is no way for a child to determine what its parent is. It is not
+ * a bidirectional relationship. This is by design.
+ *
+ * The value of a child property as a C string will be the child object's
+ * canonical path. It can be retrieved using object_property_get_str().
+ * The child object itself can be retrieved using object_property_get_link().
+ */
+void object_property_add_child(Object *obj, const char *name,
+ Object *child, Error **errp);
+
+/**
+ * object_property_add_link:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @type: the qobj type of the link
+ * @child: a pointer to where the link object reference is stored
+ * @errp: if an error occurs, a pointer to an area to store the area
+ *
+ * Links establish relationships between objects. Links are unidirectional
+ * although two links can be combined to form a bidirectional relationship
+ * between objects.
+ *
+ * Links form the graph in the object model.
+ *
+ * Ownership of the pointer that @child points to is transferred to the
+ * link property. The reference count for <code>*@child</code> is
+ * managed by the property from after the function returns till the
+ * property is deleted with object_property_del().
+ */
+void object_property_add_link(Object *obj, const char *name,
+ const char *type, Object **child,
+ Error **errp);
+
+/**
+ * object_property_add_str:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @get: the getter or NULL if the property is write-only. This function must
+ * return a string to be freed by g_free().
+ * @set: the setter or NULL if the property is read-only
+ * @errp: if an error occurs, a pointer to an area to store the error
+ *
+ * Add a string property using getters/setters. This function will add a
+ * property of type 'string'.
+ */
+void object_property_add_str(Object *obj, const char *name,
+ char *(*get)(Object *, Error **),
+ void (*set)(Object *, const char *, Error **),
+ Error **errp);
+
+/**
+ * object_property_add_bool:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @get: the getter or NULL if the property is write-only.
+ * @set: the setter or NULL if the property is read-only
+ * @errp: if an error occurs, a pointer to an area to store the error
+ *
+ * Add a bool property using getters/setters. This function will add a
+ * property of type 'bool'.
+ */
+void object_property_add_bool(Object *obj, const char *name,
+ bool (*get)(Object *, Error **),
+ void (*set)(Object *, bool, Error **),
+ Error **errp);
+
+/**
+ * object_property_add_uint8_ptr:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @v: pointer to value
+ * @errp: if an error occurs, a pointer to an area to store the error
+ *
+ * Add an integer property in memory. This function will add a
+ * property of type 'uint8'.
+ */
+void object_property_add_uint8_ptr(Object *obj, const char *name,
+ const uint8_t *v, Error **errp);
+
+/**
+ * object_property_add_uint16_ptr:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @v: pointer to value
+ * @errp: if an error occurs, a pointer to an area to store the error
+ *
+ * Add an integer property in memory. This function will add a
+ * property of type 'uint16'.
+ */
+void object_property_add_uint16_ptr(Object *obj, const char *name,
+ const uint16_t *v, Error **errp);
+
+/**
+ * object_property_add_uint32_ptr:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @v: pointer to value
+ * @errp: if an error occurs, a pointer to an area to store the error
+ *
+ * Add an integer property in memory. This function will add a
+ * property of type 'uint32'.
+ */
+void object_property_add_uint32_ptr(Object *obj, const char *name,
+ const uint32_t *v, Error **errp);
+
+/**
+ * object_property_add_uint64_ptr:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @v: pointer to value
+ * @errp: if an error occurs, a pointer to an area to store the error
+ *
+ * Add an integer property in memory. This function will add a
+ * property of type 'uint64'.
+ */
+void object_property_add_uint64_ptr(Object *obj, const char *name,
+ const uint64_t *v, Error **Errp);
+
+/**
+ * object_child_foreach:
+ * @obj: the object whose children will be navigated
+ * @fn: the iterator function to be called
+ * @opaque: an opaque value that will be passed to the iterator
+ *
+ * Call @fn passing each child of @obj and @opaque to it, until @fn returns
+ * non-zero.
+ *
+ * Returns: The last value returned by @fn, or 0 if there is no child.
+ */
+int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
+ void *opaque);
+
+/**
+ * container_get:
+ * @root: root of the #path, e.g., object_get_root()
+ * @path: path to the container
+ *
+ * Return a container object whose path is @path. Create more containers
+ * along the path if necessary.
+ *
+ * Returns: the container object.
+ */
+Object *container_get(Object *root, const char *path);
+
+
+#endif
diff --git a/include/qom/qom-qobject.h b/include/qom/qom-qobject.h
new file mode 100644
index 0000000..77cd717
--- /dev/null
+++ b/include/qom/qom-qobject.h
@@ -0,0 +1,42 @@
+/*
+ * QEMU Object Model - QObject wrappers
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * Author: Paolo Bonzini <pbonzini@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_QOM_QOBJECT_H
+#define QEMU_QOM_QOBJECT_H
+
+#include "qom/object.h"
+
+/*
+ * object_property_get_qobject:
+ * @obj: the object
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Returns: the value of the property, converted to QObject, or NULL if
+ * an error occurs.
+ */
+struct QObject *object_property_get_qobject(Object *obj, const char *name,
+ struct Error **errp);
+
+/**
+ * object_property_set_qobject:
+ * @obj: the object
+ * @ret: The value that will be written to the property.
+ * @name: the name of the property
+ * @errp: returns an error if this function fails
+ *
+ * Writes a property to a object.
+ */
+void object_property_set_qobject(Object *obj, struct QObject *qobj,
+ const char *name, struct Error **errp);
+
+#endif
diff --git a/qapi-auto-generated/qapi-types.c b/qapi-auto-generated/qapi-types.c
new file mode 100644
index 0000000..da75232
--- /dev/null
+++ b/qapi-auto-generated/qapi-types.c
@@ -0,0 +1,4025 @@
+/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * deallocation functions for schema-defined QAPI types
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ * Michael Roth <mdroth@linux.vnet.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include "qapi/dealloc-visitor.h"
+#include "qapi-types.h"
+#include "qapi-visit.h"
+
+const char *ErrorClass_lookup[] = {
+ "GenericError",
+ "CommandNotFound",
+ "DeviceEncrypted",
+ "DeviceNotActive",
+ "DeviceNotFound",
+ "KVMMissingCap",
+ NULL,
+};
+
+const char *RunState_lookup[] = {
+ "debug",
+ "inmigrate",
+ "internal-error",
+ "io-error",
+ "paused",
+ "postmigrate",
+ "prelaunch",
+ "finish-migrate",
+ "restore-vm",
+ "running",
+ "save-vm",
+ "shutdown",
+ "suspended",
+ "watchdog",
+ "guest-panicked",
+ NULL,
+};
+
+const char *ImageInfoSpecificKind_lookup[] = {
+ "qcow2",
+ "vmdk",
+ NULL,
+};
+
+const char *DataFormat_lookup[] = {
+ "utf8",
+ "base64",
+ NULL,
+};
+
+const char *MigrationCapability_lookup[] = {
+ "xbzrle",
+ "x-rdma-pin-all",
+ "auto-converge",
+ "zero-blocks",
+ NULL,
+};
+
+const char *BlockDeviceIoStatus_lookup[] = {
+ "ok",
+ "failed",
+ "nospace",
+ NULL,
+};
+
+const char *SpiceQueryMouseMode_lookup[] = {
+ "client",
+ "server",
+ "unknown",
+ NULL,
+};
+
+const char *BlockdevOnError_lookup[] = {
+ "report",
+ "ignore",
+ "enospc",
+ "stop",
+ NULL,
+};
+
+const char *MirrorSyncMode_lookup[] = {
+ "top",
+ "full",
+ "none",
+ NULL,
+};
+
+const char *BlockJobType_lookup[] = {
+ "commit",
+ "stream",
+ "mirror",
+ "backup",
+ NULL,
+};
+
+const char *NewImageMode_lookup[] = {
+ "existing",
+ "absolute-paths",
+ NULL,
+};
+
+const char *TransactionActionKind_lookup[] = {
+ "blockdev-snapshot-sync",
+ "drive-backup",
+ "abort",
+ "blockdev-snapshot-internal-sync",
+ NULL,
+};
+
+const char *NetClientOptionsKind_lookup[] = {
+ "none",
+ "nic",
+ "user",
+ "tap",
+ "socket",
+ "vde",
+ "dump",
+ "bridge",
+ "hubport",
+ "netmap",
+ NULL,
+};
+
+const char *SocketAddressKind_lookup[] = {
+ "inet",
+ "unix",
+ "fd",
+ NULL,
+};
+
+const char *QKeyCode_lookup[] = {
+ "shift",
+ "shift_r",
+ "alt",
+ "alt_r",
+ "altgr",
+ "altgr_r",
+ "ctrl",
+ "ctrl_r",
+ "menu",
+ "esc",
+ "1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
+ "0",
+ "minus",
+ "equal",
+ "backspace",
+ "tab",
+ "q",
+ "w",
+ "e",
+ "r",
+ "t",
+ "y",
+ "u",
+ "i",
+ "o",
+ "p",
+ "bracket_left",
+ "bracket_right",
+ "ret",
+ "a",
+ "s",
+ "d",
+ "f",
+ "g",
+ "h",
+ "j",
+ "k",
+ "l",
+ "semicolon",
+ "apostrophe",
+ "grave_accent",
+ "backslash",
+ "z",
+ "x",
+ "c",
+ "v",
+ "b",
+ "n",
+ "m",
+ "comma",
+ "dot",
+ "slash",
+ "asterisk",
+ "spc",
+ "caps_lock",
+ "f1",
+ "f2",
+ "f3",
+ "f4",
+ "f5",
+ "f6",
+ "f7",
+ "f8",
+ "f9",
+ "f10",
+ "num_lock",
+ "scroll_lock",
+ "kp_divide",
+ "kp_multiply",
+ "kp_subtract",
+ "kp_add",
+ "kp_enter",
+ "kp_decimal",
+ "sysrq",
+ "kp_0",
+ "kp_1",
+ "kp_2",
+ "kp_3",
+ "kp_4",
+ "kp_5",
+ "kp_6",
+ "kp_7",
+ "kp_8",
+ "kp_9",
+ "less",
+ "f11",
+ "f12",
+ "print",
+ "home",
+ "pgup",
+ "pgdn",
+ "end",
+ "left",
+ "up",
+ "down",
+ "right",
+ "insert",
+ "delete",
+ "stop",
+ "again",
+ "props",
+ "undo",
+ "front",
+ "copy",
+ "open",
+ "paste",
+ "find",
+ "cut",
+ "lf",
+ "help",
+ "meta_l",
+ "meta_r",
+ "compose",
+ NULL,
+};
+
+const char *KeyValueKind_lookup[] = {
+ "number",
+ "qcode",
+ NULL,
+};
+
+const char *ChardevBackendKind_lookup[] = {
+ "file",
+ "serial",
+ "parallel",
+ "pipe",
+ "socket",
+ "udp",
+ "pty",
+ "null",
+ "mux",
+ "msmouse",
+ "braille",
+ "stdio",
+ "console",
+ "spicevmc",
+ "spiceport",
+ "vc",
+ "ringbuf",
+ "memory",
+ NULL,
+};
+
+const char *TpmModel_lookup[] = {
+ "tpm-tis",
+ NULL,
+};
+
+const char *TpmType_lookup[] = {
+ "passthrough",
+ NULL,
+};
+
+const char *TpmTypeOptionsKind_lookup[] = {
+ "passthrough",
+ NULL,
+};
+
+const char *CommandLineParameterType_lookup[] = {
+ "string",
+ "boolean",
+ "number",
+ "size",
+ NULL,
+};
+
+const char *X86CPURegister32_lookup[] = {
+ "EAX",
+ "EBX",
+ "ECX",
+ "EDX",
+ "ESP",
+ "EBP",
+ "ESI",
+ "EDI",
+ NULL,
+};
+
+const char *RxState_lookup[] = {
+ "normal",
+ "none",
+ "all",
+ NULL,
+};
+
+const char *BlockdevDiscardOptions_lookup[] = {
+ "ignore",
+ "unmap",
+ NULL,
+};
+
+const char *BlockdevAioOptions_lookup[] = {
+ "threads",
+ "native",
+ NULL,
+};
+
+const char *BlockdevOptionsKind_lookup[] = {
+ "file",
+ "http",
+ "https",
+ "ftp",
+ "ftps",
+ "tftp",
+ "vvfat",
+ "bochs",
+ "cloop",
+ "cow",
+ "dmg",
+ "parallels",
+ "qcow",
+ "qcow2",
+ "qed",
+ "raw",
+ "vdi",
+ "vhdx",
+ "vmdk",
+ "vpc",
+ NULL,
+};
+
+const char *BlockdevRefKind_lookup[] = {
+ "definition",
+ "reference",
+ NULL,
+};
+
+const int BlockdevRef_qtypes[QTYPE_MAX] = {
+ [ QTYPE_QDICT ] = BLOCKDEV_REF_KIND_DEFINITION,
+ [ QTYPE_QSTRING ] = BLOCKDEV_REF_KIND_REFERENCE,
+};
+
+#ifndef QAPI_TYPES_BUILTIN_CLEANUP_DEF_H
+#define QAPI_TYPES_BUILTIN_CLEANUP_DEF_H
+
+
+void qapi_free_strList(strList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_strList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_intList(intList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_intList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_numberList(numberList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_numberList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_boolList(boolList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_boolList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_int8List(int8List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int8List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_int16List(int16List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int16List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_int32List(int32List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int32List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_int64List(int64List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int64List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_uint8List(uint8List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_uint8List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_uint16List(uint16List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_uint16List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_uint32List(uint32List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_uint32List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+void qapi_free_uint64List(uint64List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_uint64List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+#endif /* QAPI_TYPES_BUILTIN_CLEANUP_DEF_H */
+
+
+void qapi_free_ErrorClassList(ErrorClassList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ErrorClassList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NameInfoList(NameInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NameInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NameInfo(NameInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NameInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_VersionInfoList(VersionInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_VersionInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_VersionInfo(VersionInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_VersionInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_KvmInfoList(KvmInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_KvmInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_KvmInfo(KvmInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_KvmInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_RunStateList(RunStateList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_RunStateList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SnapshotInfoList(SnapshotInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SnapshotInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SnapshotInfo(SnapshotInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SnapshotInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageInfoSpecificQCow2List(ImageInfoSpecificQCow2List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageInfoSpecificQCow2List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageInfoSpecificQCow2(ImageInfoSpecificQCow2 * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageInfoSpecificQCow2(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageInfoSpecificVmdkList(ImageInfoSpecificVmdkList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageInfoSpecificVmdkList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageInfoSpecificVmdk(ImageInfoSpecificVmdk * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageInfoSpecificVmdk(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageInfoSpecificList(ImageInfoSpecificList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageInfoSpecificList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageInfoSpecific(ImageInfoSpecific * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageInfoSpecific(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageInfoList(ImageInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageInfo(ImageInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageCheckList(ImageCheckList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageCheckList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ImageCheck(ImageCheck * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ImageCheck(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_StatusInfoList(StatusInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_StatusInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_StatusInfo(StatusInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_StatusInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_UuidInfoList(UuidInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_UuidInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_UuidInfo(UuidInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_UuidInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevInfoList(ChardevInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevInfo(ChardevInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_DataFormatList(DataFormatList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_DataFormatList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CommandInfoList(CommandInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CommandInfo(CommandInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_EventInfoList(EventInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_EventInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_EventInfo(EventInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_EventInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MigrationStatsList(MigrationStatsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationStatsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MigrationStats(MigrationStats * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationStats(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_XBZRLECacheStatsList(XBZRLECacheStatsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_XBZRLECacheStatsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_XBZRLECacheStats(XBZRLECacheStats * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_XBZRLECacheStats(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MigrationInfoList(MigrationInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MigrationInfo(MigrationInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MigrationCapabilityList(MigrationCapabilityList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationCapabilityList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MigrationCapabilityStatusList(MigrationCapabilityStatusList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationCapabilityStatusList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MigrationCapabilityStatus(MigrationCapabilityStatus * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationCapabilityStatus(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MouseInfoList(MouseInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MouseInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MouseInfo(MouseInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MouseInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CpuInfoList(CpuInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CpuInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CpuInfo(CpuInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CpuInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDeviceInfoList(BlockDeviceInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDeviceInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDeviceInfo(BlockDeviceInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDeviceInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDeviceIoStatusList(BlockDeviceIoStatusList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDeviceIoStatusList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDeviceMapEntryList(BlockDeviceMapEntryList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDeviceMapEntryList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDeviceMapEntry(BlockDeviceMapEntry * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDeviceMapEntry(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDirtyInfoList(BlockDirtyInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDirtyInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDirtyInfo(BlockDirtyInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDirtyInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockInfoList(BlockInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockInfo(BlockInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDeviceStatsList(BlockDeviceStatsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDeviceStatsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockDeviceStats(BlockDeviceStats * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockDeviceStats(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockStatsList(BlockStatsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockStatsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockStats(BlockStats * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockStats(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_VncClientInfoList(VncClientInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_VncClientInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_VncClientInfo(VncClientInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_VncClientInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_VncInfoList(VncInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_VncInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_VncInfo(VncInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_VncInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SpiceChannelList(SpiceChannelList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SpiceChannelList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SpiceChannel(SpiceChannel * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SpiceChannel(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SpiceQueryMouseModeList(SpiceQueryMouseModeList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SpiceQueryMouseModeList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SpiceInfoList(SpiceInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SpiceInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SpiceInfo(SpiceInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SpiceInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BalloonInfoList(BalloonInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BalloonInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BalloonInfo(BalloonInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BalloonInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciMemoryRangeList(PciMemoryRangeList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciMemoryRangeList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciMemoryRange(PciMemoryRange * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciMemoryRange(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciMemoryRegionList(PciMemoryRegionList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciMemoryRegionList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciMemoryRegion(PciMemoryRegion * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciMemoryRegion(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciBridgeInfoList(PciBridgeInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciBridgeInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciBridgeInfo(PciBridgeInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciBridgeInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciDeviceInfoList(PciDeviceInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciDeviceInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciDeviceInfo(PciDeviceInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciDeviceInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciInfoList(PciInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_PciInfo(PciInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOnErrorList(BlockdevOnErrorList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOnErrorList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MirrorSyncModeList(MirrorSyncModeList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MirrorSyncModeList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockJobTypeList(BlockJobTypeList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockJobTypeList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockJobInfoList(BlockJobInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockJobInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockJobInfo(BlockJobInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockJobInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NewImageModeList(NewImageModeList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NewImageModeList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevSnapshotList(BlockdevSnapshotList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevSnapshotList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevSnapshot(BlockdevSnapshot * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevSnapshot(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevSnapshotInternalList(BlockdevSnapshotInternalList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevSnapshotInternalList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevSnapshotInternal(BlockdevSnapshotInternal * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevSnapshotInternal(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_DriveBackupList(DriveBackupList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_DriveBackupList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_DriveBackup(DriveBackup * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_DriveBackup(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_AbortList(AbortList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_AbortList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_Abort(Abort * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_Abort(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TransactionActionList(TransactionActionList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TransactionActionList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TransactionAction(TransactionAction * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TransactionAction(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ObjectPropertyInfoList(ObjectPropertyInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ObjectPropertyInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ObjectPropertyInfo(ObjectPropertyInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ObjectPropertyInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ObjectTypeInfoList(ObjectTypeInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ObjectTypeInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ObjectTypeInfo(ObjectTypeInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ObjectTypeInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_DevicePropertyInfoList(DevicePropertyInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_DevicePropertyInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_DevicePropertyInfo(DevicePropertyInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_DevicePropertyInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevNoneOptionsList(NetdevNoneOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevNoneOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevNoneOptions(NetdevNoneOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevNoneOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetLegacyNicOptionsList(NetLegacyNicOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetLegacyNicOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetLegacyNicOptions(NetLegacyNicOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetLegacyNicOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_StringList(StringList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_StringList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_String(String * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_String(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevUserOptionsList(NetdevUserOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevUserOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevUserOptions(NetdevUserOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevUserOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevTapOptionsList(NetdevTapOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevTapOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevTapOptions(NetdevTapOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevTapOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevSocketOptionsList(NetdevSocketOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevSocketOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevSocketOptions(NetdevSocketOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevSocketOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevVdeOptionsList(NetdevVdeOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevVdeOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevVdeOptions(NetdevVdeOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevVdeOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevDumpOptionsList(NetdevDumpOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevDumpOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevDumpOptions(NetdevDumpOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevDumpOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevBridgeOptionsList(NetdevBridgeOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevBridgeOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevBridgeOptions(NetdevBridgeOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevBridgeOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevHubPortOptionsList(NetdevHubPortOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevHubPortOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevHubPortOptions(NetdevHubPortOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevHubPortOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevNetmapOptionsList(NetdevNetmapOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevNetmapOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevNetmapOptions(NetdevNetmapOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevNetmapOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetClientOptionsList(NetClientOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetClientOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetClientOptions(NetClientOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetClientOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetLegacyList(NetLegacyList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetLegacyList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetLegacy(NetLegacy * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetLegacy(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_NetdevList(NetdevList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NetdevList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_Netdev(Netdev * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_Netdev(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_InetSocketAddressList(InetSocketAddressList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_InetSocketAddressList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_InetSocketAddress(InetSocketAddress * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_InetSocketAddress(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_UnixSocketAddressList(UnixSocketAddressList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_UnixSocketAddressList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_UnixSocketAddress(UnixSocketAddress * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_UnixSocketAddress(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SocketAddressList(SocketAddressList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SocketAddressList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_SocketAddress(SocketAddress * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SocketAddress(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MachineInfoList(MachineInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MachineInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_MachineInfo(MachineInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MachineInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CpuDefinitionInfoList(CpuDefinitionInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CpuDefinitionInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CpuDefinitionInfo(CpuDefinitionInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CpuDefinitionInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_AddfdInfoList(AddfdInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_AddfdInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_AddfdInfo(AddfdInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_AddfdInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_FdsetFdInfoList(FdsetFdInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_FdsetFdInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_FdsetFdInfo(FdsetFdInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_FdsetFdInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_FdsetInfoList(FdsetInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_FdsetInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_FdsetInfo(FdsetInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_FdsetInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TargetInfoList(TargetInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TargetInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TargetInfo(TargetInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TargetInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_QKeyCodeList(QKeyCodeList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_QKeyCodeList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_KeyValueList(KeyValueList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_KeyValueList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_KeyValue(KeyValue * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_KeyValue(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevFileList(ChardevFileList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevFileList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevFile(ChardevFile * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevFile(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevHostdevList(ChardevHostdevList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevHostdevList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevHostdev(ChardevHostdev * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevHostdev(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevSocketList(ChardevSocketList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevSocketList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevSocket(ChardevSocket * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevSocket(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevUdpList(ChardevUdpList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevUdpList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevUdp(ChardevUdp * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevUdp(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevMuxList(ChardevMuxList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevMuxList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevMux(ChardevMux * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevMux(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevStdioList(ChardevStdioList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevStdioList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevStdio(ChardevStdio * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevStdio(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevSpiceChannelList(ChardevSpiceChannelList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevSpiceChannelList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevSpiceChannel(ChardevSpiceChannel * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevSpiceChannel(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevSpicePortList(ChardevSpicePortList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevSpicePortList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevSpicePort(ChardevSpicePort * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevSpicePort(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevVCList(ChardevVCList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevVCList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevVC(ChardevVC * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevVC(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevRingbufList(ChardevRingbufList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevRingbufList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevRingbuf(ChardevRingbuf * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevRingbuf(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevDummyList(ChardevDummyList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevDummyList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevDummy(ChardevDummy * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevDummy(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevBackendList(ChardevBackendList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevBackendList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevBackend(ChardevBackend * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevBackend(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevReturnList(ChardevReturnList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevReturnList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_ChardevReturn(ChardevReturn * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevReturn(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TpmModelList(TpmModelList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TpmModelList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TpmTypeList(TpmTypeList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TpmTypeList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TPMPassthroughOptionsList(TPMPassthroughOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TPMPassthroughOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TPMPassthroughOptions(TPMPassthroughOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TPMPassthroughOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TpmTypeOptionsList(TpmTypeOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TpmTypeOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TpmTypeOptions(TpmTypeOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TpmTypeOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TPMInfoList(TPMInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TPMInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_TPMInfo(TPMInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TPMInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_AcpiTableOptionsList(AcpiTableOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_AcpiTableOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_AcpiTableOptions(AcpiTableOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_AcpiTableOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CommandLineParameterTypeList(CommandLineParameterTypeList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandLineParameterTypeList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CommandLineParameterInfoList(CommandLineParameterInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandLineParameterInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CommandLineParameterInfo(CommandLineParameterInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandLineParameterInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CommandLineOptionInfoList(CommandLineOptionInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandLineOptionInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_CommandLineOptionInfo(CommandLineOptionInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandLineOptionInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_X86CPURegister32List(X86CPURegister32List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_X86CPURegister32List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_X86CPUFeatureWordInfoList(X86CPUFeatureWordInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_X86CPUFeatureWordInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_X86CPUFeatureWordInfo(X86CPUFeatureWordInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_X86CPUFeatureWordInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_RxStateList(RxStateList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_RxStateList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_RxFilterInfoList(RxFilterInfoList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_RxFilterInfoList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_RxFilterInfo(RxFilterInfo * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_RxFilterInfo(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevDiscardOptionsList(BlockdevDiscardOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevDiscardOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevAioOptionsList(BlockdevAioOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevAioOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevCacheOptionsList(BlockdevCacheOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevCacheOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevCacheOptions(BlockdevCacheOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevCacheOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsBaseList(BlockdevOptionsBaseList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsBaseList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsBase(BlockdevOptionsBase * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsBase(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsFileList(BlockdevOptionsFileList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsFileList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsFile(BlockdevOptionsFile * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsFile(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsVVFATList(BlockdevOptionsVVFATList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsVVFATList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsVVFAT(BlockdevOptionsVVFAT * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsVVFAT(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsGenericFormatList(BlockdevOptionsGenericFormatList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsGenericFormatList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsGenericFormat(BlockdevOptionsGenericFormat * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsGenericFormat(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsGenericCOWFormatList(BlockdevOptionsGenericCOWFormatList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsGenericCOWFormatList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsGenericCOWFormat(BlockdevOptionsGenericCOWFormat * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsGenericCOWFormat(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsQcow2List(BlockdevOptionsQcow2List * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsQcow2List(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsQcow2(BlockdevOptionsQcow2 * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsQcow2(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptionsList(BlockdevOptionsList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptionsList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevOptions(BlockdevOptions * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptions(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevRefList(BlockdevRefList * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevRefList(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+
+void qapi_free_BlockdevRef(BlockdevRef * obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevRef(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
diff --git a/qapi-auto-generated/qapi-types.h b/qapi-auto-generated/qapi-types.h
new file mode 100644
index 0000000..3837683
--- /dev/null
+++ b/qapi-auto-generated/qapi-types.h
@@ -0,0 +1,3313 @@
+/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QAPI types
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef QAPI_TYPES_H
+#define QAPI_TYPES_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+
+#ifndef QAPI_TYPES_BUILTIN_STRUCT_DECL_H
+#define QAPI_TYPES_BUILTIN_STRUCT_DECL_H
+
+
+typedef struct strList
+{
+ union {
+ char * value;
+ uint64_t padding;
+ };
+ struct strList *next;
+} strList;
+
+typedef struct intList
+{
+ union {
+ int64_t value;
+ uint64_t padding;
+ };
+ struct intList *next;
+} intList;
+
+typedef struct numberList
+{
+ union {
+ double value;
+ uint64_t padding;
+ };
+ struct numberList *next;
+} numberList;
+
+typedef struct boolList
+{
+ union {
+ bool value;
+ uint64_t padding;
+ };
+ struct boolList *next;
+} boolList;
+
+typedef struct int8List
+{
+ union {
+ int8_t value;
+ uint64_t padding;
+ };
+ struct int8List *next;
+} int8List;
+
+typedef struct int16List
+{
+ union {
+ int16_t value;
+ uint64_t padding;
+ };
+ struct int16List *next;
+} int16List;
+
+typedef struct int32List
+{
+ union {
+ int32_t value;
+ uint64_t padding;
+ };
+ struct int32List *next;
+} int32List;
+
+typedef struct int64List
+{
+ union {
+ int64_t value;
+ uint64_t padding;
+ };
+ struct int64List *next;
+} int64List;
+
+typedef struct uint8List
+{
+ union {
+ uint8_t value;
+ uint64_t padding;
+ };
+ struct uint8List *next;
+} uint8List;
+
+typedef struct uint16List
+{
+ union {
+ uint16_t value;
+ uint64_t padding;
+ };
+ struct uint16List *next;
+} uint16List;
+
+typedef struct uint32List
+{
+ union {
+ uint32_t value;
+ uint64_t padding;
+ };
+ struct uint32List *next;
+} uint32List;
+
+typedef struct uint64List
+{
+ union {
+ uint64_t value;
+ uint64_t padding;
+ };
+ struct uint64List *next;
+} uint64List;
+
+#endif /* QAPI_TYPES_BUILTIN_STRUCT_DECL_H */
+
+
+extern const char *ErrorClass_lookup[];
+typedef enum ErrorClass
+{
+ ERROR_CLASS_GENERIC_ERROR = 0,
+ ERROR_CLASS_COMMAND_NOT_FOUND = 1,
+ ERROR_CLASS_DEVICE_ENCRYPTED = 2,
+ ERROR_CLASS_DEVICE_NOT_ACTIVE = 3,
+ ERROR_CLASS_DEVICE_NOT_FOUND = 4,
+ ERROR_CLASS_K_V_M_MISSING_CAP = 5,
+ ERROR_CLASS_MAX = 6,
+} ErrorClass;
+
+typedef struct ErrorClassList
+{
+ union {
+ ErrorClass value;
+ uint64_t padding;
+ };
+ struct ErrorClassList *next;
+} ErrorClassList;
+
+
+typedef struct NameInfo NameInfo;
+
+typedef struct NameInfoList
+{
+ union {
+ NameInfo *value;
+ uint64_t padding;
+ };
+ struct NameInfoList *next;
+} NameInfoList;
+
+
+typedef struct VersionInfo VersionInfo;
+
+typedef struct VersionInfoList
+{
+ union {
+ VersionInfo *value;
+ uint64_t padding;
+ };
+ struct VersionInfoList *next;
+} VersionInfoList;
+
+
+typedef struct KvmInfo KvmInfo;
+
+typedef struct KvmInfoList
+{
+ union {
+ KvmInfo *value;
+ uint64_t padding;
+ };
+ struct KvmInfoList *next;
+} KvmInfoList;
+
+extern const char *RunState_lookup[];
+typedef enum RunState
+{
+ RUN_STATE_DEBUG = 0,
+ RUN_STATE_INMIGRATE = 1,
+ RUN_STATE_INTERNAL_ERROR = 2,
+ RUN_STATE_IO_ERROR = 3,
+ RUN_STATE_PAUSED = 4,
+ RUN_STATE_POSTMIGRATE = 5,
+ RUN_STATE_PRELAUNCH = 6,
+ RUN_STATE_FINISH_MIGRATE = 7,
+ RUN_STATE_RESTORE_VM = 8,
+ RUN_STATE_RUNNING = 9,
+ RUN_STATE_SAVE_VM = 10,
+ RUN_STATE_SHUTDOWN = 11,
+ RUN_STATE_SUSPENDED = 12,
+ RUN_STATE_WATCHDOG = 13,
+ RUN_STATE_GUEST_PANICKED = 14,
+ RUN_STATE_MAX = 15,
+} RunState;
+
+typedef struct RunStateList
+{
+ union {
+ RunState value;
+ uint64_t padding;
+ };
+ struct RunStateList *next;
+} RunStateList;
+
+
+typedef struct SnapshotInfo SnapshotInfo;
+
+typedef struct SnapshotInfoList
+{
+ union {
+ SnapshotInfo *value;
+ uint64_t padding;
+ };
+ struct SnapshotInfoList *next;
+} SnapshotInfoList;
+
+
+typedef struct ImageInfoSpecificQCow2 ImageInfoSpecificQCow2;
+
+typedef struct ImageInfoSpecificQCow2List
+{
+ union {
+ ImageInfoSpecificQCow2 *value;
+ uint64_t padding;
+ };
+ struct ImageInfoSpecificQCow2List *next;
+} ImageInfoSpecificQCow2List;
+
+
+typedef struct ImageInfoSpecificVmdk ImageInfoSpecificVmdk;
+
+typedef struct ImageInfoSpecificVmdkList
+{
+ union {
+ ImageInfoSpecificVmdk *value;
+ uint64_t padding;
+ };
+ struct ImageInfoSpecificVmdkList *next;
+} ImageInfoSpecificVmdkList;
+
+
+typedef struct ImageInfoSpecific ImageInfoSpecific;
+
+typedef struct ImageInfoSpecificList
+{
+ union {
+ ImageInfoSpecific *value;
+ uint64_t padding;
+ };
+ struct ImageInfoSpecificList *next;
+} ImageInfoSpecificList;
+
+extern const char *ImageInfoSpecificKind_lookup[];
+typedef enum ImageInfoSpecificKind
+{
+ IMAGE_INFO_SPECIFIC_KIND_QCOW2 = 0,
+ IMAGE_INFO_SPECIFIC_KIND_VMDK = 1,
+ IMAGE_INFO_SPECIFIC_KIND_MAX = 2,
+} ImageInfoSpecificKind;
+
+
+typedef struct ImageInfo ImageInfo;
+
+typedef struct ImageInfoList
+{
+ union {
+ ImageInfo *value;
+ uint64_t padding;
+ };
+ struct ImageInfoList *next;
+} ImageInfoList;
+
+
+typedef struct ImageCheck ImageCheck;
+
+typedef struct ImageCheckList
+{
+ union {
+ ImageCheck *value;
+ uint64_t padding;
+ };
+ struct ImageCheckList *next;
+} ImageCheckList;
+
+
+typedef struct StatusInfo StatusInfo;
+
+typedef struct StatusInfoList
+{
+ union {
+ StatusInfo *value;
+ uint64_t padding;
+ };
+ struct StatusInfoList *next;
+} StatusInfoList;
+
+
+typedef struct UuidInfo UuidInfo;
+
+typedef struct UuidInfoList
+{
+ union {
+ UuidInfo *value;
+ uint64_t padding;
+ };
+ struct UuidInfoList *next;
+} UuidInfoList;
+
+
+typedef struct ChardevInfo ChardevInfo;
+
+typedef struct ChardevInfoList
+{
+ union {
+ ChardevInfo *value;
+ uint64_t padding;
+ };
+ struct ChardevInfoList *next;
+} ChardevInfoList;
+
+extern const char *DataFormat_lookup[];
+typedef enum DataFormat
+{
+ DATA_FORMAT_UTF8 = 0,
+ DATA_FORMAT_BASE64 = 1,
+ DATA_FORMAT_MAX = 2,
+} DataFormat;
+
+typedef struct DataFormatList
+{
+ union {
+ DataFormat value;
+ uint64_t padding;
+ };
+ struct DataFormatList *next;
+} DataFormatList;
+
+
+typedef struct CommandInfo CommandInfo;
+
+typedef struct CommandInfoList
+{
+ union {
+ CommandInfo *value;
+ uint64_t padding;
+ };
+ struct CommandInfoList *next;
+} CommandInfoList;
+
+
+typedef struct EventInfo EventInfo;
+
+typedef struct EventInfoList
+{
+ union {
+ EventInfo *value;
+ uint64_t padding;
+ };
+ struct EventInfoList *next;
+} EventInfoList;
+
+
+typedef struct MigrationStats MigrationStats;
+
+typedef struct MigrationStatsList
+{
+ union {
+ MigrationStats *value;
+ uint64_t padding;
+ };
+ struct MigrationStatsList *next;
+} MigrationStatsList;
+
+
+typedef struct XBZRLECacheStats XBZRLECacheStats;
+
+typedef struct XBZRLECacheStatsList
+{
+ union {
+ XBZRLECacheStats *value;
+ uint64_t padding;
+ };
+ struct XBZRLECacheStatsList *next;
+} XBZRLECacheStatsList;
+
+
+typedef struct MigrationInfo MigrationInfo;
+
+typedef struct MigrationInfoList
+{
+ union {
+ MigrationInfo *value;
+ uint64_t padding;
+ };
+ struct MigrationInfoList *next;
+} MigrationInfoList;
+
+extern const char *MigrationCapability_lookup[];
+typedef enum MigrationCapability
+{
+ MIGRATION_CAPABILITY_XBZRLE = 0,
+ MIGRATION_CAPABILITY_X_RDMA_PIN_ALL = 1,
+ MIGRATION_CAPABILITY_AUTO_CONVERGE = 2,
+ MIGRATION_CAPABILITY_ZERO_BLOCKS = 3,
+ MIGRATION_CAPABILITY_MAX = 4,
+} MigrationCapability;
+
+typedef struct MigrationCapabilityList
+{
+ union {
+ MigrationCapability value;
+ uint64_t padding;
+ };
+ struct MigrationCapabilityList *next;
+} MigrationCapabilityList;
+
+
+typedef struct MigrationCapabilityStatus MigrationCapabilityStatus;
+
+typedef struct MigrationCapabilityStatusList
+{
+ union {
+ MigrationCapabilityStatus *value;
+ uint64_t padding;
+ };
+ struct MigrationCapabilityStatusList *next;
+} MigrationCapabilityStatusList;
+
+
+typedef struct MouseInfo MouseInfo;
+
+typedef struct MouseInfoList
+{
+ union {
+ MouseInfo *value;
+ uint64_t padding;
+ };
+ struct MouseInfoList *next;
+} MouseInfoList;
+
+
+typedef struct CpuInfo CpuInfo;
+
+typedef struct CpuInfoList
+{
+ union {
+ CpuInfo *value;
+ uint64_t padding;
+ };
+ struct CpuInfoList *next;
+} CpuInfoList;
+
+
+typedef struct BlockDeviceInfo BlockDeviceInfo;
+
+typedef struct BlockDeviceInfoList
+{
+ union {
+ BlockDeviceInfo *value;
+ uint64_t padding;
+ };
+ struct BlockDeviceInfoList *next;
+} BlockDeviceInfoList;
+
+extern const char *BlockDeviceIoStatus_lookup[];
+typedef enum BlockDeviceIoStatus
+{
+ BLOCK_DEVICE_IO_STATUS_OK = 0,
+ BLOCK_DEVICE_IO_STATUS_FAILED = 1,
+ BLOCK_DEVICE_IO_STATUS_NOSPACE = 2,
+ BLOCK_DEVICE_IO_STATUS_MAX = 3,
+} BlockDeviceIoStatus;
+
+typedef struct BlockDeviceIoStatusList
+{
+ union {
+ BlockDeviceIoStatus value;
+ uint64_t padding;
+ };
+ struct BlockDeviceIoStatusList *next;
+} BlockDeviceIoStatusList;
+
+
+typedef struct BlockDeviceMapEntry BlockDeviceMapEntry;
+
+typedef struct BlockDeviceMapEntryList
+{
+ union {
+ BlockDeviceMapEntry *value;
+ uint64_t padding;
+ };
+ struct BlockDeviceMapEntryList *next;
+} BlockDeviceMapEntryList;
+
+
+typedef struct BlockDirtyInfo BlockDirtyInfo;
+
+typedef struct BlockDirtyInfoList
+{
+ union {
+ BlockDirtyInfo *value;
+ uint64_t padding;
+ };
+ struct BlockDirtyInfoList *next;
+} BlockDirtyInfoList;
+
+
+typedef struct BlockInfo BlockInfo;
+
+typedef struct BlockInfoList
+{
+ union {
+ BlockInfo *value;
+ uint64_t padding;
+ };
+ struct BlockInfoList *next;
+} BlockInfoList;
+
+
+typedef struct BlockDeviceStats BlockDeviceStats;
+
+typedef struct BlockDeviceStatsList
+{
+ union {
+ BlockDeviceStats *value;
+ uint64_t padding;
+ };
+ struct BlockDeviceStatsList *next;
+} BlockDeviceStatsList;
+
+
+typedef struct BlockStats BlockStats;
+
+typedef struct BlockStatsList
+{
+ union {
+ BlockStats *value;
+ uint64_t padding;
+ };
+ struct BlockStatsList *next;
+} BlockStatsList;
+
+
+typedef struct VncClientInfo VncClientInfo;
+
+typedef struct VncClientInfoList
+{
+ union {
+ VncClientInfo *value;
+ uint64_t padding;
+ };
+ struct VncClientInfoList *next;
+} VncClientInfoList;
+
+
+typedef struct VncInfo VncInfo;
+
+typedef struct VncInfoList
+{
+ union {
+ VncInfo *value;
+ uint64_t padding;
+ };
+ struct VncInfoList *next;
+} VncInfoList;
+
+
+typedef struct SpiceChannel SpiceChannel;
+
+typedef struct SpiceChannelList
+{
+ union {
+ SpiceChannel *value;
+ uint64_t padding;
+ };
+ struct SpiceChannelList *next;
+} SpiceChannelList;
+
+extern const char *SpiceQueryMouseMode_lookup[];
+typedef enum SpiceQueryMouseMode
+{
+ SPICE_QUERY_MOUSE_MODE_CLIENT = 0,
+ SPICE_QUERY_MOUSE_MODE_SERVER = 1,
+ SPICE_QUERY_MOUSE_MODE_UNKNOWN = 2,
+ SPICE_QUERY_MOUSE_MODE_MAX = 3,
+} SpiceQueryMouseMode;
+
+typedef struct SpiceQueryMouseModeList
+{
+ union {
+ SpiceQueryMouseMode value;
+ uint64_t padding;
+ };
+ struct SpiceQueryMouseModeList *next;
+} SpiceQueryMouseModeList;
+
+
+typedef struct SpiceInfo SpiceInfo;
+
+typedef struct SpiceInfoList
+{
+ union {
+ SpiceInfo *value;
+ uint64_t padding;
+ };
+ struct SpiceInfoList *next;
+} SpiceInfoList;
+
+
+typedef struct BalloonInfo BalloonInfo;
+
+typedef struct BalloonInfoList
+{
+ union {
+ BalloonInfo *value;
+ uint64_t padding;
+ };
+ struct BalloonInfoList *next;
+} BalloonInfoList;
+
+
+typedef struct PciMemoryRange PciMemoryRange;
+
+typedef struct PciMemoryRangeList
+{
+ union {
+ PciMemoryRange *value;
+ uint64_t padding;
+ };
+ struct PciMemoryRangeList *next;
+} PciMemoryRangeList;
+
+
+typedef struct PciMemoryRegion PciMemoryRegion;
+
+typedef struct PciMemoryRegionList
+{
+ union {
+ PciMemoryRegion *value;
+ uint64_t padding;
+ };
+ struct PciMemoryRegionList *next;
+} PciMemoryRegionList;
+
+
+typedef struct PciBridgeInfo PciBridgeInfo;
+
+typedef struct PciBridgeInfoList
+{
+ union {
+ PciBridgeInfo *value;
+ uint64_t padding;
+ };
+ struct PciBridgeInfoList *next;
+} PciBridgeInfoList;
+
+
+typedef struct PciDeviceInfo PciDeviceInfo;
+
+typedef struct PciDeviceInfoList
+{
+ union {
+ PciDeviceInfo *value;
+ uint64_t padding;
+ };
+ struct PciDeviceInfoList *next;
+} PciDeviceInfoList;
+
+
+typedef struct PciInfo PciInfo;
+
+typedef struct PciInfoList
+{
+ union {
+ PciInfo *value;
+ uint64_t padding;
+ };
+ struct PciInfoList *next;
+} PciInfoList;
+
+extern const char *BlockdevOnError_lookup[];
+typedef enum BlockdevOnError
+{
+ BLOCKDEV_ON_ERROR_REPORT = 0,
+ BLOCKDEV_ON_ERROR_IGNORE = 1,
+ BLOCKDEV_ON_ERROR_ENOSPC = 2,
+ BLOCKDEV_ON_ERROR_STOP = 3,
+ BLOCKDEV_ON_ERROR_MAX = 4,
+} BlockdevOnError;
+
+typedef struct BlockdevOnErrorList
+{
+ union {
+ BlockdevOnError value;
+ uint64_t padding;
+ };
+ struct BlockdevOnErrorList *next;
+} BlockdevOnErrorList;
+
+extern const char *MirrorSyncMode_lookup[];
+typedef enum MirrorSyncMode
+{
+ MIRROR_SYNC_MODE_TOP = 0,
+ MIRROR_SYNC_MODE_FULL = 1,
+ MIRROR_SYNC_MODE_NONE = 2,
+ MIRROR_SYNC_MODE_MAX = 3,
+} MirrorSyncMode;
+
+typedef struct MirrorSyncModeList
+{
+ union {
+ MirrorSyncMode value;
+ uint64_t padding;
+ };
+ struct MirrorSyncModeList *next;
+} MirrorSyncModeList;
+
+extern const char *BlockJobType_lookup[];
+typedef enum BlockJobType
+{
+ BLOCK_JOB_TYPE_COMMIT = 0,
+ BLOCK_JOB_TYPE_STREAM = 1,
+ BLOCK_JOB_TYPE_MIRROR = 2,
+ BLOCK_JOB_TYPE_BACKUP = 3,
+ BLOCK_JOB_TYPE_MAX = 4,
+} BlockJobType;
+
+typedef struct BlockJobTypeList
+{
+ union {
+ BlockJobType value;
+ uint64_t padding;
+ };
+ struct BlockJobTypeList *next;
+} BlockJobTypeList;
+
+
+typedef struct BlockJobInfo BlockJobInfo;
+
+typedef struct BlockJobInfoList
+{
+ union {
+ BlockJobInfo *value;
+ uint64_t padding;
+ };
+ struct BlockJobInfoList *next;
+} BlockJobInfoList;
+
+extern const char *NewImageMode_lookup[];
+typedef enum NewImageMode
+{
+ NEW_IMAGE_MODE_EXISTING = 0,
+ NEW_IMAGE_MODE_ABSOLUTE_PATHS = 1,
+ NEW_IMAGE_MODE_MAX = 2,
+} NewImageMode;
+
+typedef struct NewImageModeList
+{
+ union {
+ NewImageMode value;
+ uint64_t padding;
+ };
+ struct NewImageModeList *next;
+} NewImageModeList;
+
+
+typedef struct BlockdevSnapshot BlockdevSnapshot;
+
+typedef struct BlockdevSnapshotList
+{
+ union {
+ BlockdevSnapshot *value;
+ uint64_t padding;
+ };
+ struct BlockdevSnapshotList *next;
+} BlockdevSnapshotList;
+
+
+typedef struct BlockdevSnapshotInternal BlockdevSnapshotInternal;
+
+typedef struct BlockdevSnapshotInternalList
+{
+ union {
+ BlockdevSnapshotInternal *value;
+ uint64_t padding;
+ };
+ struct BlockdevSnapshotInternalList *next;
+} BlockdevSnapshotInternalList;
+
+
+typedef struct DriveBackup DriveBackup;
+
+typedef struct DriveBackupList
+{
+ union {
+ DriveBackup *value;
+ uint64_t padding;
+ };
+ struct DriveBackupList *next;
+} DriveBackupList;
+
+
+typedef struct Abort Abort;
+
+typedef struct AbortList
+{
+ union {
+ Abort *value;
+ uint64_t padding;
+ };
+ struct AbortList *next;
+} AbortList;
+
+
+typedef struct TransactionAction TransactionAction;
+
+typedef struct TransactionActionList
+{
+ union {
+ TransactionAction *value;
+ uint64_t padding;
+ };
+ struct TransactionActionList *next;
+} TransactionActionList;
+
+extern const char *TransactionActionKind_lookup[];
+typedef enum TransactionActionKind
+{
+ TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC = 0,
+ TRANSACTION_ACTION_KIND_DRIVE_BACKUP = 1,
+ TRANSACTION_ACTION_KIND_ABORT = 2,
+ TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC = 3,
+ TRANSACTION_ACTION_KIND_MAX = 4,
+} TransactionActionKind;
+
+
+typedef struct ObjectPropertyInfo ObjectPropertyInfo;
+
+typedef struct ObjectPropertyInfoList
+{
+ union {
+ ObjectPropertyInfo *value;
+ uint64_t padding;
+ };
+ struct ObjectPropertyInfoList *next;
+} ObjectPropertyInfoList;
+
+
+typedef struct ObjectTypeInfo ObjectTypeInfo;
+
+typedef struct ObjectTypeInfoList
+{
+ union {
+ ObjectTypeInfo *value;
+ uint64_t padding;
+ };
+ struct ObjectTypeInfoList *next;
+} ObjectTypeInfoList;
+
+
+typedef struct DevicePropertyInfo DevicePropertyInfo;
+
+typedef struct DevicePropertyInfoList
+{
+ union {
+ DevicePropertyInfo *value;
+ uint64_t padding;
+ };
+ struct DevicePropertyInfoList *next;
+} DevicePropertyInfoList;
+
+
+typedef struct NetdevNoneOptions NetdevNoneOptions;
+
+typedef struct NetdevNoneOptionsList
+{
+ union {
+ NetdevNoneOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevNoneOptionsList *next;
+} NetdevNoneOptionsList;
+
+
+typedef struct NetLegacyNicOptions NetLegacyNicOptions;
+
+typedef struct NetLegacyNicOptionsList
+{
+ union {
+ NetLegacyNicOptions *value;
+ uint64_t padding;
+ };
+ struct NetLegacyNicOptionsList *next;
+} NetLegacyNicOptionsList;
+
+
+typedef struct String String;
+
+typedef struct StringList
+{
+ union {
+ String *value;
+ uint64_t padding;
+ };
+ struct StringList *next;
+} StringList;
+
+
+typedef struct NetdevUserOptions NetdevUserOptions;
+
+typedef struct NetdevUserOptionsList
+{
+ union {
+ NetdevUserOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevUserOptionsList *next;
+} NetdevUserOptionsList;
+
+
+typedef struct NetdevTapOptions NetdevTapOptions;
+
+typedef struct NetdevTapOptionsList
+{
+ union {
+ NetdevTapOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevTapOptionsList *next;
+} NetdevTapOptionsList;
+
+
+typedef struct NetdevSocketOptions NetdevSocketOptions;
+
+typedef struct NetdevSocketOptionsList
+{
+ union {
+ NetdevSocketOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevSocketOptionsList *next;
+} NetdevSocketOptionsList;
+
+
+typedef struct NetdevVdeOptions NetdevVdeOptions;
+
+typedef struct NetdevVdeOptionsList
+{
+ union {
+ NetdevVdeOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevVdeOptionsList *next;
+} NetdevVdeOptionsList;
+
+
+typedef struct NetdevDumpOptions NetdevDumpOptions;
+
+typedef struct NetdevDumpOptionsList
+{
+ union {
+ NetdevDumpOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevDumpOptionsList *next;
+} NetdevDumpOptionsList;
+
+
+typedef struct NetdevBridgeOptions NetdevBridgeOptions;
+
+typedef struct NetdevBridgeOptionsList
+{
+ union {
+ NetdevBridgeOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevBridgeOptionsList *next;
+} NetdevBridgeOptionsList;
+
+
+typedef struct NetdevHubPortOptions NetdevHubPortOptions;
+
+typedef struct NetdevHubPortOptionsList
+{
+ union {
+ NetdevHubPortOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevHubPortOptionsList *next;
+} NetdevHubPortOptionsList;
+
+
+typedef struct NetdevNetmapOptions NetdevNetmapOptions;
+
+typedef struct NetdevNetmapOptionsList
+{
+ union {
+ NetdevNetmapOptions *value;
+ uint64_t padding;
+ };
+ struct NetdevNetmapOptionsList *next;
+} NetdevNetmapOptionsList;
+
+
+typedef struct NetClientOptions NetClientOptions;
+
+typedef struct NetClientOptionsList
+{
+ union {
+ NetClientOptions *value;
+ uint64_t padding;
+ };
+ struct NetClientOptionsList *next;
+} NetClientOptionsList;
+
+extern const char *NetClientOptionsKind_lookup[];
+typedef enum NetClientOptionsKind
+{
+ NET_CLIENT_OPTIONS_KIND_NONE = 0,
+ NET_CLIENT_OPTIONS_KIND_NIC = 1,
+ NET_CLIENT_OPTIONS_KIND_USER = 2,
+ NET_CLIENT_OPTIONS_KIND_TAP = 3,
+ NET_CLIENT_OPTIONS_KIND_SOCKET = 4,
+ NET_CLIENT_OPTIONS_KIND_VDE = 5,
+ NET_CLIENT_OPTIONS_KIND_DUMP = 6,
+ NET_CLIENT_OPTIONS_KIND_BRIDGE = 7,
+ NET_CLIENT_OPTIONS_KIND_HUBPORT = 8,
+ NET_CLIENT_OPTIONS_KIND_NETMAP = 9,
+ NET_CLIENT_OPTIONS_KIND_MAX = 10,
+} NetClientOptionsKind;
+
+
+typedef struct NetLegacy NetLegacy;
+
+typedef struct NetLegacyList
+{
+ union {
+ NetLegacy *value;
+ uint64_t padding;
+ };
+ struct NetLegacyList *next;
+} NetLegacyList;
+
+
+typedef struct Netdev Netdev;
+
+typedef struct NetdevList
+{
+ union {
+ Netdev *value;
+ uint64_t padding;
+ };
+ struct NetdevList *next;
+} NetdevList;
+
+
+typedef struct InetSocketAddress InetSocketAddress;
+
+typedef struct InetSocketAddressList
+{
+ union {
+ InetSocketAddress *value;
+ uint64_t padding;
+ };
+ struct InetSocketAddressList *next;
+} InetSocketAddressList;
+
+
+typedef struct UnixSocketAddress UnixSocketAddress;
+
+typedef struct UnixSocketAddressList
+{
+ union {
+ UnixSocketAddress *value;
+ uint64_t padding;
+ };
+ struct UnixSocketAddressList *next;
+} UnixSocketAddressList;
+
+
+typedef struct SocketAddress SocketAddress;
+
+typedef struct SocketAddressList
+{
+ union {
+ SocketAddress *value;
+ uint64_t padding;
+ };
+ struct SocketAddressList *next;
+} SocketAddressList;
+
+extern const char *SocketAddressKind_lookup[];
+typedef enum SocketAddressKind
+{
+ SOCKET_ADDRESS_KIND_INET = 0,
+ SOCKET_ADDRESS_KIND_UNIX = 1,
+ SOCKET_ADDRESS_KIND_FD = 2,
+ SOCKET_ADDRESS_KIND_MAX = 3,
+} SocketAddressKind;
+
+
+typedef struct MachineInfo MachineInfo;
+
+typedef struct MachineInfoList
+{
+ union {
+ MachineInfo *value;
+ uint64_t padding;
+ };
+ struct MachineInfoList *next;
+} MachineInfoList;
+
+
+typedef struct CpuDefinitionInfo CpuDefinitionInfo;
+
+typedef struct CpuDefinitionInfoList
+{
+ union {
+ CpuDefinitionInfo *value;
+ uint64_t padding;
+ };
+ struct CpuDefinitionInfoList *next;
+} CpuDefinitionInfoList;
+
+
+typedef struct AddfdInfo AddfdInfo;
+
+typedef struct AddfdInfoList
+{
+ union {
+ AddfdInfo *value;
+ uint64_t padding;
+ };
+ struct AddfdInfoList *next;
+} AddfdInfoList;
+
+
+typedef struct FdsetFdInfo FdsetFdInfo;
+
+typedef struct FdsetFdInfoList
+{
+ union {
+ FdsetFdInfo *value;
+ uint64_t padding;
+ };
+ struct FdsetFdInfoList *next;
+} FdsetFdInfoList;
+
+
+typedef struct FdsetInfo FdsetInfo;
+
+typedef struct FdsetInfoList
+{
+ union {
+ FdsetInfo *value;
+ uint64_t padding;
+ };
+ struct FdsetInfoList *next;
+} FdsetInfoList;
+
+
+typedef struct TargetInfo TargetInfo;
+
+typedef struct TargetInfoList
+{
+ union {
+ TargetInfo *value;
+ uint64_t padding;
+ };
+ struct TargetInfoList *next;
+} TargetInfoList;
+
+extern const char *QKeyCode_lookup[];
+typedef enum QKeyCode
+{
+ Q_KEY_CODE_SHIFT = 0,
+ Q_KEY_CODE_SHIFT_R = 1,
+ Q_KEY_CODE_ALT = 2,
+ Q_KEY_CODE_ALT_R = 3,
+ Q_KEY_CODE_ALTGR = 4,
+ Q_KEY_CODE_ALTGR_R = 5,
+ Q_KEY_CODE_CTRL = 6,
+ Q_KEY_CODE_CTRL_R = 7,
+ Q_KEY_CODE_MENU = 8,
+ Q_KEY_CODE_ESC = 9,
+ Q_KEY_CODE_1 = 10,
+ Q_KEY_CODE_2 = 11,
+ Q_KEY_CODE_3 = 12,
+ Q_KEY_CODE_4 = 13,
+ Q_KEY_CODE_5 = 14,
+ Q_KEY_CODE_6 = 15,
+ Q_KEY_CODE_7 = 16,
+ Q_KEY_CODE_8 = 17,
+ Q_KEY_CODE_9 = 18,
+ Q_KEY_CODE_0 = 19,
+ Q_KEY_CODE_MINUS = 20,
+ Q_KEY_CODE_EQUAL = 21,
+ Q_KEY_CODE_BACKSPACE = 22,
+ Q_KEY_CODE_TAB = 23,
+ Q_KEY_CODE_Q = 24,
+ Q_KEY_CODE_W = 25,
+ Q_KEY_CODE_E = 26,
+ Q_KEY_CODE_R = 27,
+ Q_KEY_CODE_T = 28,
+ Q_KEY_CODE_Y = 29,
+ Q_KEY_CODE_U = 30,
+ Q_KEY_CODE_I = 31,
+ Q_KEY_CODE_O = 32,
+ Q_KEY_CODE_P = 33,
+ Q_KEY_CODE_BRACKET_LEFT = 34,
+ Q_KEY_CODE_BRACKET_RIGHT = 35,
+ Q_KEY_CODE_RET = 36,
+ Q_KEY_CODE_A = 37,
+ Q_KEY_CODE_S = 38,
+ Q_KEY_CODE_D = 39,
+ Q_KEY_CODE_F = 40,
+ Q_KEY_CODE_G = 41,
+ Q_KEY_CODE_H = 42,
+ Q_KEY_CODE_J = 43,
+ Q_KEY_CODE_K = 44,
+ Q_KEY_CODE_L = 45,
+ Q_KEY_CODE_SEMICOLON = 46,
+ Q_KEY_CODE_APOSTROPHE = 47,
+ Q_KEY_CODE_GRAVE_ACCENT = 48,
+ Q_KEY_CODE_BACKSLASH = 49,
+ Q_KEY_CODE_Z = 50,
+ Q_KEY_CODE_X = 51,
+ Q_KEY_CODE_C = 52,
+ Q_KEY_CODE_V = 53,
+ Q_KEY_CODE_B = 54,
+ Q_KEY_CODE_N = 55,
+ Q_KEY_CODE_M = 56,
+ Q_KEY_CODE_COMMA = 57,
+ Q_KEY_CODE_DOT = 58,
+ Q_KEY_CODE_SLASH = 59,
+ Q_KEY_CODE_ASTERISK = 60,
+ Q_KEY_CODE_SPC = 61,
+ Q_KEY_CODE_CAPS_LOCK = 62,
+ Q_KEY_CODE_F1 = 63,
+ Q_KEY_CODE_F2 = 64,
+ Q_KEY_CODE_F3 = 65,
+ Q_KEY_CODE_F4 = 66,
+ Q_KEY_CODE_F5 = 67,
+ Q_KEY_CODE_F6 = 68,
+ Q_KEY_CODE_F7 = 69,
+ Q_KEY_CODE_F8 = 70,
+ Q_KEY_CODE_F9 = 71,
+ Q_KEY_CODE_F10 = 72,
+ Q_KEY_CODE_NUM_LOCK = 73,
+ Q_KEY_CODE_SCROLL_LOCK = 74,
+ Q_KEY_CODE_KP_DIVIDE = 75,
+ Q_KEY_CODE_KP_MULTIPLY = 76,
+ Q_KEY_CODE_KP_SUBTRACT = 77,
+ Q_KEY_CODE_KP_ADD = 78,
+ Q_KEY_CODE_KP_ENTER = 79,
+ Q_KEY_CODE_KP_DECIMAL = 80,
+ Q_KEY_CODE_SYSRQ = 81,
+ Q_KEY_CODE_KP_0 = 82,
+ Q_KEY_CODE_KP_1 = 83,
+ Q_KEY_CODE_KP_2 = 84,
+ Q_KEY_CODE_KP_3 = 85,
+ Q_KEY_CODE_KP_4 = 86,
+ Q_KEY_CODE_KP_5 = 87,
+ Q_KEY_CODE_KP_6 = 88,
+ Q_KEY_CODE_KP_7 = 89,
+ Q_KEY_CODE_KP_8 = 90,
+ Q_KEY_CODE_KP_9 = 91,
+ Q_KEY_CODE_LESS = 92,
+ Q_KEY_CODE_F11 = 93,
+ Q_KEY_CODE_F12 = 94,
+ Q_KEY_CODE_PRINT = 95,
+ Q_KEY_CODE_HOME = 96,
+ Q_KEY_CODE_PGUP = 97,
+ Q_KEY_CODE_PGDN = 98,
+ Q_KEY_CODE_END = 99,
+ Q_KEY_CODE_LEFT = 100,
+ Q_KEY_CODE_UP = 101,
+ Q_KEY_CODE_DOWN = 102,
+ Q_KEY_CODE_RIGHT = 103,
+ Q_KEY_CODE_INSERT = 104,
+ Q_KEY_CODE_DELETE = 105,
+ Q_KEY_CODE_STOP = 106,
+ Q_KEY_CODE_AGAIN = 107,
+ Q_KEY_CODE_PROPS = 108,
+ Q_KEY_CODE_UNDO = 109,
+ Q_KEY_CODE_FRONT = 110,
+ Q_KEY_CODE_COPY = 111,
+ Q_KEY_CODE_OPEN = 112,
+ Q_KEY_CODE_PASTE = 113,
+ Q_KEY_CODE_FIND = 114,
+ Q_KEY_CODE_CUT = 115,
+ Q_KEY_CODE_LF = 116,
+ Q_KEY_CODE_HELP = 117,
+ Q_KEY_CODE_META_L = 118,
+ Q_KEY_CODE_META_R = 119,
+ Q_KEY_CODE_COMPOSE = 120,
+ Q_KEY_CODE_MAX = 121,
+} QKeyCode;
+
+typedef struct QKeyCodeList
+{
+ union {
+ QKeyCode value;
+ uint64_t padding;
+ };
+ struct QKeyCodeList *next;
+} QKeyCodeList;
+
+
+typedef struct KeyValue KeyValue;
+
+typedef struct KeyValueList
+{
+ union {
+ KeyValue *value;
+ uint64_t padding;
+ };
+ struct KeyValueList *next;
+} KeyValueList;
+
+extern const char *KeyValueKind_lookup[];
+typedef enum KeyValueKind
+{
+ KEY_VALUE_KIND_NUMBER = 0,
+ KEY_VALUE_KIND_QCODE = 1,
+ KEY_VALUE_KIND_MAX = 2,
+} KeyValueKind;
+
+
+typedef struct ChardevFile ChardevFile;
+
+typedef struct ChardevFileList
+{
+ union {
+ ChardevFile *value;
+ uint64_t padding;
+ };
+ struct ChardevFileList *next;
+} ChardevFileList;
+
+
+typedef struct ChardevHostdev ChardevHostdev;
+
+typedef struct ChardevHostdevList
+{
+ union {
+ ChardevHostdev *value;
+ uint64_t padding;
+ };
+ struct ChardevHostdevList *next;
+} ChardevHostdevList;
+
+
+typedef struct ChardevSocket ChardevSocket;
+
+typedef struct ChardevSocketList
+{
+ union {
+ ChardevSocket *value;
+ uint64_t padding;
+ };
+ struct ChardevSocketList *next;
+} ChardevSocketList;
+
+
+typedef struct ChardevUdp ChardevUdp;
+
+typedef struct ChardevUdpList
+{
+ union {
+ ChardevUdp *value;
+ uint64_t padding;
+ };
+ struct ChardevUdpList *next;
+} ChardevUdpList;
+
+
+typedef struct ChardevMux ChardevMux;
+
+typedef struct ChardevMuxList
+{
+ union {
+ ChardevMux *value;
+ uint64_t padding;
+ };
+ struct ChardevMuxList *next;
+} ChardevMuxList;
+
+
+typedef struct ChardevStdio ChardevStdio;
+
+typedef struct ChardevStdioList
+{
+ union {
+ ChardevStdio *value;
+ uint64_t padding;
+ };
+ struct ChardevStdioList *next;
+} ChardevStdioList;
+
+
+typedef struct ChardevSpiceChannel ChardevSpiceChannel;
+
+typedef struct ChardevSpiceChannelList
+{
+ union {
+ ChardevSpiceChannel *value;
+ uint64_t padding;
+ };
+ struct ChardevSpiceChannelList *next;
+} ChardevSpiceChannelList;
+
+
+typedef struct ChardevSpicePort ChardevSpicePort;
+
+typedef struct ChardevSpicePortList
+{
+ union {
+ ChardevSpicePort *value;
+ uint64_t padding;
+ };
+ struct ChardevSpicePortList *next;
+} ChardevSpicePortList;
+
+
+typedef struct ChardevVC ChardevVC;
+
+typedef struct ChardevVCList
+{
+ union {
+ ChardevVC *value;
+ uint64_t padding;
+ };
+ struct ChardevVCList *next;
+} ChardevVCList;
+
+
+typedef struct ChardevRingbuf ChardevRingbuf;
+
+typedef struct ChardevRingbufList
+{
+ union {
+ ChardevRingbuf *value;
+ uint64_t padding;
+ };
+ struct ChardevRingbufList *next;
+} ChardevRingbufList;
+
+
+typedef struct ChardevDummy ChardevDummy;
+
+typedef struct ChardevDummyList
+{
+ union {
+ ChardevDummy *value;
+ uint64_t padding;
+ };
+ struct ChardevDummyList *next;
+} ChardevDummyList;
+
+
+typedef struct ChardevBackend ChardevBackend;
+
+typedef struct ChardevBackendList
+{
+ union {
+ ChardevBackend *value;
+ uint64_t padding;
+ };
+ struct ChardevBackendList *next;
+} ChardevBackendList;
+
+extern const char *ChardevBackendKind_lookup[];
+typedef enum ChardevBackendKind
+{
+ CHARDEV_BACKEND_KIND_FILE = 0,
+ CHARDEV_BACKEND_KIND_SERIAL = 1,
+ CHARDEV_BACKEND_KIND_PARALLEL = 2,
+ CHARDEV_BACKEND_KIND_PIPE = 3,
+ CHARDEV_BACKEND_KIND_SOCKET = 4,
+ CHARDEV_BACKEND_KIND_UDP = 5,
+ CHARDEV_BACKEND_KIND_PTY = 6,
+ CHARDEV_BACKEND_KIND_NULL = 7,
+ CHARDEV_BACKEND_KIND_MUX = 8,
+ CHARDEV_BACKEND_KIND_MSMOUSE = 9,
+ CHARDEV_BACKEND_KIND_BRAILLE = 10,
+ CHARDEV_BACKEND_KIND_STDIO = 11,
+ CHARDEV_BACKEND_KIND_CONSOLE = 12,
+ CHARDEV_BACKEND_KIND_SPICEVMC = 13,
+ CHARDEV_BACKEND_KIND_SPICEPORT = 14,
+ CHARDEV_BACKEND_KIND_VC = 15,
+ CHARDEV_BACKEND_KIND_RINGBUF = 16,
+ CHARDEV_BACKEND_KIND_MEMORY = 17,
+ CHARDEV_BACKEND_KIND_MAX = 18,
+} ChardevBackendKind;
+
+
+typedef struct ChardevReturn ChardevReturn;
+
+typedef struct ChardevReturnList
+{
+ union {
+ ChardevReturn *value;
+ uint64_t padding;
+ };
+ struct ChardevReturnList *next;
+} ChardevReturnList;
+
+extern const char *TpmModel_lookup[];
+typedef enum TpmModel
+{
+ TPM_MODEL_TPM_TIS = 0,
+ TPM_MODEL_MAX = 1,
+} TpmModel;
+
+typedef struct TpmModelList
+{
+ union {
+ TpmModel value;
+ uint64_t padding;
+ };
+ struct TpmModelList *next;
+} TpmModelList;
+
+extern const char *TpmType_lookup[];
+typedef enum TpmType
+{
+ TPM_TYPE_PASSTHROUGH = 0,
+ TPM_TYPE_MAX = 1,
+} TpmType;
+
+typedef struct TpmTypeList
+{
+ union {
+ TpmType value;
+ uint64_t padding;
+ };
+ struct TpmTypeList *next;
+} TpmTypeList;
+
+
+typedef struct TPMPassthroughOptions TPMPassthroughOptions;
+
+typedef struct TPMPassthroughOptionsList
+{
+ union {
+ TPMPassthroughOptions *value;
+ uint64_t padding;
+ };
+ struct TPMPassthroughOptionsList *next;
+} TPMPassthroughOptionsList;
+
+
+typedef struct TpmTypeOptions TpmTypeOptions;
+
+typedef struct TpmTypeOptionsList
+{
+ union {
+ TpmTypeOptions *value;
+ uint64_t padding;
+ };
+ struct TpmTypeOptionsList *next;
+} TpmTypeOptionsList;
+
+extern const char *TpmTypeOptionsKind_lookup[];
+typedef enum TpmTypeOptionsKind
+{
+ TPM_TYPE_OPTIONS_KIND_PASSTHROUGH = 0,
+ TPM_TYPE_OPTIONS_KIND_MAX = 1,
+} TpmTypeOptionsKind;
+
+
+typedef struct TPMInfo TPMInfo;
+
+typedef struct TPMInfoList
+{
+ union {
+ TPMInfo *value;
+ uint64_t padding;
+ };
+ struct TPMInfoList *next;
+} TPMInfoList;
+
+
+typedef struct AcpiTableOptions AcpiTableOptions;
+
+typedef struct AcpiTableOptionsList
+{
+ union {
+ AcpiTableOptions *value;
+ uint64_t padding;
+ };
+ struct AcpiTableOptionsList *next;
+} AcpiTableOptionsList;
+
+extern const char *CommandLineParameterType_lookup[];
+typedef enum CommandLineParameterType
+{
+ COMMAND_LINE_PARAMETER_TYPE_STRING = 0,
+ COMMAND_LINE_PARAMETER_TYPE_BOOLEAN = 1,
+ COMMAND_LINE_PARAMETER_TYPE_NUMBER = 2,
+ COMMAND_LINE_PARAMETER_TYPE_SIZE = 3,
+ COMMAND_LINE_PARAMETER_TYPE_MAX = 4,
+} CommandLineParameterType;
+
+typedef struct CommandLineParameterTypeList
+{
+ union {
+ CommandLineParameterType value;
+ uint64_t padding;
+ };
+ struct CommandLineParameterTypeList *next;
+} CommandLineParameterTypeList;
+
+
+typedef struct CommandLineParameterInfo CommandLineParameterInfo;
+
+typedef struct CommandLineParameterInfoList
+{
+ union {
+ CommandLineParameterInfo *value;
+ uint64_t padding;
+ };
+ struct CommandLineParameterInfoList *next;
+} CommandLineParameterInfoList;
+
+
+typedef struct CommandLineOptionInfo CommandLineOptionInfo;
+
+typedef struct CommandLineOptionInfoList
+{
+ union {
+ CommandLineOptionInfo *value;
+ uint64_t padding;
+ };
+ struct CommandLineOptionInfoList *next;
+} CommandLineOptionInfoList;
+
+extern const char *X86CPURegister32_lookup[];
+typedef enum X86CPURegister32
+{
+ X86_C_P_U_REGISTER32_EAX = 0,
+ X86_C_P_U_REGISTER32_EBX = 1,
+ X86_C_P_U_REGISTER32_ECX = 2,
+ X86_C_P_U_REGISTER32_EDX = 3,
+ X86_C_P_U_REGISTER32_ESP = 4,
+ X86_C_P_U_REGISTER32_EBP = 5,
+ X86_C_P_U_REGISTER32_ESI = 6,
+ X86_C_P_U_REGISTER32_EDI = 7,
+ X86_C_P_U_REGISTER32_MAX = 8,
+} X86CPURegister32;
+
+typedef struct X86CPURegister32List
+{
+ union {
+ X86CPURegister32 value;
+ uint64_t padding;
+ };
+ struct X86CPURegister32List *next;
+} X86CPURegister32List;
+
+
+typedef struct X86CPUFeatureWordInfo X86CPUFeatureWordInfo;
+
+typedef struct X86CPUFeatureWordInfoList
+{
+ union {
+ X86CPUFeatureWordInfo *value;
+ uint64_t padding;
+ };
+ struct X86CPUFeatureWordInfoList *next;
+} X86CPUFeatureWordInfoList;
+
+extern const char *RxState_lookup[];
+typedef enum RxState
+{
+ RX_STATE_NORMAL = 0,
+ RX_STATE_NONE = 1,
+ RX_STATE_ALL = 2,
+ RX_STATE_MAX = 3,
+} RxState;
+
+typedef struct RxStateList
+{
+ union {
+ RxState value;
+ uint64_t padding;
+ };
+ struct RxStateList *next;
+} RxStateList;
+
+
+typedef struct RxFilterInfo RxFilterInfo;
+
+typedef struct RxFilterInfoList
+{
+ union {
+ RxFilterInfo *value;
+ uint64_t padding;
+ };
+ struct RxFilterInfoList *next;
+} RxFilterInfoList;
+
+extern const char *BlockdevDiscardOptions_lookup[];
+typedef enum BlockdevDiscardOptions
+{
+ BLOCKDEV_DISCARD_OPTIONS_IGNORE = 0,
+ BLOCKDEV_DISCARD_OPTIONS_UNMAP = 1,
+ BLOCKDEV_DISCARD_OPTIONS_MAX = 2,
+} BlockdevDiscardOptions;
+
+typedef struct BlockdevDiscardOptionsList
+{
+ union {
+ BlockdevDiscardOptions value;
+ uint64_t padding;
+ };
+ struct BlockdevDiscardOptionsList *next;
+} BlockdevDiscardOptionsList;
+
+extern const char *BlockdevAioOptions_lookup[];
+typedef enum BlockdevAioOptions
+{
+ BLOCKDEV_AIO_OPTIONS_THREADS = 0,
+ BLOCKDEV_AIO_OPTIONS_NATIVE = 1,
+ BLOCKDEV_AIO_OPTIONS_MAX = 2,
+} BlockdevAioOptions;
+
+typedef struct BlockdevAioOptionsList
+{
+ union {
+ BlockdevAioOptions value;
+ uint64_t padding;
+ };
+ struct BlockdevAioOptionsList *next;
+} BlockdevAioOptionsList;
+
+
+typedef struct BlockdevCacheOptions BlockdevCacheOptions;
+
+typedef struct BlockdevCacheOptionsList
+{
+ union {
+ BlockdevCacheOptions *value;
+ uint64_t padding;
+ };
+ struct BlockdevCacheOptionsList *next;
+} BlockdevCacheOptionsList;
+
+
+typedef struct BlockdevOptionsBase BlockdevOptionsBase;
+
+typedef struct BlockdevOptionsBaseList
+{
+ union {
+ BlockdevOptionsBase *value;
+ uint64_t padding;
+ };
+ struct BlockdevOptionsBaseList *next;
+} BlockdevOptionsBaseList;
+
+
+typedef struct BlockdevOptionsFile BlockdevOptionsFile;
+
+typedef struct BlockdevOptionsFileList
+{
+ union {
+ BlockdevOptionsFile *value;
+ uint64_t padding;
+ };
+ struct BlockdevOptionsFileList *next;
+} BlockdevOptionsFileList;
+
+
+typedef struct BlockdevOptionsVVFAT BlockdevOptionsVVFAT;
+
+typedef struct BlockdevOptionsVVFATList
+{
+ union {
+ BlockdevOptionsVVFAT *value;
+ uint64_t padding;
+ };
+ struct BlockdevOptionsVVFATList *next;
+} BlockdevOptionsVVFATList;
+
+
+typedef struct BlockdevOptionsGenericFormat BlockdevOptionsGenericFormat;
+
+typedef struct BlockdevOptionsGenericFormatList
+{
+ union {
+ BlockdevOptionsGenericFormat *value;
+ uint64_t padding;
+ };
+ struct BlockdevOptionsGenericFormatList *next;
+} BlockdevOptionsGenericFormatList;
+
+
+typedef struct BlockdevOptionsGenericCOWFormat BlockdevOptionsGenericCOWFormat;
+
+typedef struct BlockdevOptionsGenericCOWFormatList
+{
+ union {
+ BlockdevOptionsGenericCOWFormat *value;
+ uint64_t padding;
+ };
+ struct BlockdevOptionsGenericCOWFormatList *next;
+} BlockdevOptionsGenericCOWFormatList;
+
+
+typedef struct BlockdevOptionsQcow2 BlockdevOptionsQcow2;
+
+typedef struct BlockdevOptionsQcow2List
+{
+ union {
+ BlockdevOptionsQcow2 *value;
+ uint64_t padding;
+ };
+ struct BlockdevOptionsQcow2List *next;
+} BlockdevOptionsQcow2List;
+
+
+typedef struct BlockdevOptions BlockdevOptions;
+
+typedef struct BlockdevOptionsList
+{
+ union {
+ BlockdevOptions *value;
+ uint64_t padding;
+ };
+ struct BlockdevOptionsList *next;
+} BlockdevOptionsList;
+
+extern const char *BlockdevOptionsKind_lookup[];
+typedef enum BlockdevOptionsKind
+{
+ BLOCKDEV_OPTIONS_KIND_FILE = 0,
+ BLOCKDEV_OPTIONS_KIND_HTTP = 1,
+ BLOCKDEV_OPTIONS_KIND_HTTPS = 2,
+ BLOCKDEV_OPTIONS_KIND_FTP = 3,
+ BLOCKDEV_OPTIONS_KIND_FTPS = 4,
+ BLOCKDEV_OPTIONS_KIND_TFTP = 5,
+ BLOCKDEV_OPTIONS_KIND_VVFAT = 6,
+ BLOCKDEV_OPTIONS_KIND_BOCHS = 7,
+ BLOCKDEV_OPTIONS_KIND_CLOOP = 8,
+ BLOCKDEV_OPTIONS_KIND_COW = 9,
+ BLOCKDEV_OPTIONS_KIND_DMG = 10,
+ BLOCKDEV_OPTIONS_KIND_PARALLELS = 11,
+ BLOCKDEV_OPTIONS_KIND_QCOW = 12,
+ BLOCKDEV_OPTIONS_KIND_QCOW2 = 13,
+ BLOCKDEV_OPTIONS_KIND_QED = 14,
+ BLOCKDEV_OPTIONS_KIND_RAW = 15,
+ BLOCKDEV_OPTIONS_KIND_VDI = 16,
+ BLOCKDEV_OPTIONS_KIND_VHDX = 17,
+ BLOCKDEV_OPTIONS_KIND_VMDK = 18,
+ BLOCKDEV_OPTIONS_KIND_VPC = 19,
+ BLOCKDEV_OPTIONS_KIND_MAX = 20,
+} BlockdevOptionsKind;
+
+
+typedef struct BlockdevRef BlockdevRef;
+
+typedef struct BlockdevRefList
+{
+ union {
+ BlockdevRef *value;
+ uint64_t padding;
+ };
+ struct BlockdevRefList *next;
+} BlockdevRefList;
+
+extern const char *BlockdevRefKind_lookup[];
+typedef enum BlockdevRefKind
+{
+ BLOCKDEV_REF_KIND_DEFINITION = 0,
+ BLOCKDEV_REF_KIND_REFERENCE = 1,
+ BLOCKDEV_REF_KIND_MAX = 2,
+} BlockdevRefKind;
+
+#ifndef QAPI_TYPES_BUILTIN_CLEANUP_DECL_H
+#define QAPI_TYPES_BUILTIN_CLEANUP_DECL_H
+
+void qapi_free_strList(strList * obj);
+void qapi_free_intList(intList * obj);
+void qapi_free_numberList(numberList * obj);
+void qapi_free_boolList(boolList * obj);
+void qapi_free_int8List(int8List * obj);
+void qapi_free_int16List(int16List * obj);
+void qapi_free_int32List(int32List * obj);
+void qapi_free_int64List(int64List * obj);
+void qapi_free_uint8List(uint8List * obj);
+void qapi_free_uint16List(uint16List * obj);
+void qapi_free_uint32List(uint32List * obj);
+void qapi_free_uint64List(uint64List * obj);
+
+#endif /* QAPI_TYPES_BUILTIN_CLEANUP_DECL_H */
+
+
+void qapi_free_ErrorClassList(ErrorClassList * obj);
+
+struct NameInfo
+{
+ bool has_name;
+ char * name;
+};
+
+void qapi_free_NameInfoList(NameInfoList * obj);
+void qapi_free_NameInfo(NameInfo * obj);
+
+struct VersionInfo
+{
+ struct
+ {
+ int64_t major;
+ int64_t minor;
+ int64_t micro;
+ } qemu;
+ char * package;
+};
+
+void qapi_free_VersionInfoList(VersionInfoList * obj);
+void qapi_free_VersionInfo(VersionInfo * obj);
+
+struct KvmInfo
+{
+ bool enabled;
+ bool present;
+};
+
+void qapi_free_KvmInfoList(KvmInfoList * obj);
+void qapi_free_KvmInfo(KvmInfo * obj);
+
+void qapi_free_RunStateList(RunStateList * obj);
+
+struct SnapshotInfo
+{
+ char * id;
+ char * name;
+ int64_t vm_state_size;
+ int64_t date_sec;
+ int64_t date_nsec;
+ int64_t vm_clock_sec;
+ int64_t vm_clock_nsec;
+};
+
+void qapi_free_SnapshotInfoList(SnapshotInfoList * obj);
+void qapi_free_SnapshotInfo(SnapshotInfo * obj);
+
+struct ImageInfoSpecificQCow2
+{
+ char * compat;
+ bool has_lazy_refcounts;
+ bool lazy_refcounts;
+};
+
+void qapi_free_ImageInfoSpecificQCow2List(ImageInfoSpecificQCow2List * obj);
+void qapi_free_ImageInfoSpecificQCow2(ImageInfoSpecificQCow2 * obj);
+
+struct ImageInfoSpecificVmdk
+{
+ char * create_type;
+ int64_t cid;
+ int64_t parent_cid;
+ ImageInfoList * extents;
+};
+
+void qapi_free_ImageInfoSpecificVmdkList(ImageInfoSpecificVmdkList * obj);
+void qapi_free_ImageInfoSpecificVmdk(ImageInfoSpecificVmdk * obj);
+
+struct ImageInfoSpecific
+{
+ ImageInfoSpecificKind kind;
+ union {
+ void *data;
+ ImageInfoSpecificQCow2 * qcow2;
+ ImageInfoSpecificVmdk * vmdk;
+ };
+};
+void qapi_free_ImageInfoSpecificList(ImageInfoSpecificList * obj);
+void qapi_free_ImageInfoSpecific(ImageInfoSpecific * obj);
+
+struct ImageInfo
+{
+ char * filename;
+ char * format;
+ bool has_dirty_flag;
+ bool dirty_flag;
+ bool has_actual_size;
+ int64_t actual_size;
+ int64_t virtual_size;
+ bool has_cluster_size;
+ int64_t cluster_size;
+ bool has_encrypted;
+ bool encrypted;
+ bool has_compressed;
+ bool compressed;
+ bool has_backing_filename;
+ char * backing_filename;
+ bool has_full_backing_filename;
+ char * full_backing_filename;
+ bool has_backing_filename_format;
+ char * backing_filename_format;
+ bool has_snapshots;
+ SnapshotInfoList * snapshots;
+ bool has_backing_image;
+ ImageInfo * backing_image;
+ bool has_format_specific;
+ ImageInfoSpecific * format_specific;
+};
+
+void qapi_free_ImageInfoList(ImageInfoList * obj);
+void qapi_free_ImageInfo(ImageInfo * obj);
+
+struct ImageCheck
+{
+ char * filename;
+ char * format;
+ int64_t check_errors;
+ bool has_image_end_offset;
+ int64_t image_end_offset;
+ bool has_corruptions;
+ int64_t corruptions;
+ bool has_leaks;
+ int64_t leaks;
+ bool has_corruptions_fixed;
+ int64_t corruptions_fixed;
+ bool has_leaks_fixed;
+ int64_t leaks_fixed;
+ bool has_total_clusters;
+ int64_t total_clusters;
+ bool has_allocated_clusters;
+ int64_t allocated_clusters;
+ bool has_fragmented_clusters;
+ int64_t fragmented_clusters;
+ bool has_compressed_clusters;
+ int64_t compressed_clusters;
+};
+
+void qapi_free_ImageCheckList(ImageCheckList * obj);
+void qapi_free_ImageCheck(ImageCheck * obj);
+
+struct StatusInfo
+{
+ bool running;
+ bool singlestep;
+ RunState status;
+};
+
+void qapi_free_StatusInfoList(StatusInfoList * obj);
+void qapi_free_StatusInfo(StatusInfo * obj);
+
+struct UuidInfo
+{
+ char * UUID;
+};
+
+void qapi_free_UuidInfoList(UuidInfoList * obj);
+void qapi_free_UuidInfo(UuidInfo * obj);
+
+struct ChardevInfo
+{
+ char * label;
+ char * filename;
+};
+
+void qapi_free_ChardevInfoList(ChardevInfoList * obj);
+void qapi_free_ChardevInfo(ChardevInfo * obj);
+
+void qapi_free_DataFormatList(DataFormatList * obj);
+
+struct CommandInfo
+{
+ char * name;
+};
+
+void qapi_free_CommandInfoList(CommandInfoList * obj);
+void qapi_free_CommandInfo(CommandInfo * obj);
+
+struct EventInfo
+{
+ char * name;
+};
+
+void qapi_free_EventInfoList(EventInfoList * obj);
+void qapi_free_EventInfo(EventInfo * obj);
+
+struct MigrationStats
+{
+ int64_t transferred;
+ int64_t remaining;
+ int64_t total;
+ int64_t duplicate;
+ int64_t skipped;
+ int64_t normal;
+ int64_t normal_bytes;
+ int64_t dirty_pages_rate;
+ double mbps;
+};
+
+void qapi_free_MigrationStatsList(MigrationStatsList * obj);
+void qapi_free_MigrationStats(MigrationStats * obj);
+
+struct XBZRLECacheStats
+{
+ int64_t cache_size;
+ int64_t bytes;
+ int64_t pages;
+ int64_t cache_miss;
+ int64_t overflow;
+};
+
+void qapi_free_XBZRLECacheStatsList(XBZRLECacheStatsList * obj);
+void qapi_free_XBZRLECacheStats(XBZRLECacheStats * obj);
+
+struct MigrationInfo
+{
+ bool has_status;
+ char * status;
+ bool has_ram;
+ MigrationStats * ram;
+ bool has_disk;
+ MigrationStats * disk;
+ bool has_xbzrle_cache;
+ XBZRLECacheStats * xbzrle_cache;
+ bool has_total_time;
+ int64_t total_time;
+ bool has_expected_downtime;
+ int64_t expected_downtime;
+ bool has_downtime;
+ int64_t downtime;
+ bool has_setup_time;
+ int64_t setup_time;
+};
+
+void qapi_free_MigrationInfoList(MigrationInfoList * obj);
+void qapi_free_MigrationInfo(MigrationInfo * obj);
+
+void qapi_free_MigrationCapabilityList(MigrationCapabilityList * obj);
+
+struct MigrationCapabilityStatus
+{
+ MigrationCapability capability;
+ bool state;
+};
+
+void qapi_free_MigrationCapabilityStatusList(MigrationCapabilityStatusList * obj);
+void qapi_free_MigrationCapabilityStatus(MigrationCapabilityStatus * obj);
+
+struct MouseInfo
+{
+ char * name;
+ int64_t index;
+ bool current;
+ bool absolute;
+};
+
+void qapi_free_MouseInfoList(MouseInfoList * obj);
+void qapi_free_MouseInfo(MouseInfo * obj);
+
+struct CpuInfo
+{
+ int64_t CPU;
+ bool current;
+ bool halted;
+ bool has_pc;
+ int64_t pc;
+ bool has_nip;
+ int64_t nip;
+ bool has_npc;
+ int64_t npc;
+ bool has_PC;
+ int64_t PC;
+ int64_t thread_id;
+};
+
+void qapi_free_CpuInfoList(CpuInfoList * obj);
+void qapi_free_CpuInfo(CpuInfo * obj);
+
+struct BlockDeviceInfo
+{
+ char * file;
+ bool ro;
+ char * drv;
+ bool has_backing_file;
+ char * backing_file;
+ int64_t backing_file_depth;
+ bool encrypted;
+ bool encryption_key_missing;
+ int64_t bps;
+ int64_t bps_rd;
+ int64_t bps_wr;
+ int64_t iops;
+ int64_t iops_rd;
+ int64_t iops_wr;
+ ImageInfo * image;
+ bool has_bps_max;
+ int64_t bps_max;
+ bool has_bps_rd_max;
+ int64_t bps_rd_max;
+ bool has_bps_wr_max;
+ int64_t bps_wr_max;
+ bool has_iops_max;
+ int64_t iops_max;
+ bool has_iops_rd_max;
+ int64_t iops_rd_max;
+ bool has_iops_wr_max;
+ int64_t iops_wr_max;
+ bool has_iops_size;
+ int64_t iops_size;
+};
+
+void qapi_free_BlockDeviceInfoList(BlockDeviceInfoList * obj);
+void qapi_free_BlockDeviceInfo(BlockDeviceInfo * obj);
+
+void qapi_free_BlockDeviceIoStatusList(BlockDeviceIoStatusList * obj);
+
+struct BlockDeviceMapEntry
+{
+ int64_t start;
+ int64_t length;
+ int64_t depth;
+ bool zero;
+ bool data;
+ bool has_offset;
+ int64_t offset;
+};
+
+void qapi_free_BlockDeviceMapEntryList(BlockDeviceMapEntryList * obj);
+void qapi_free_BlockDeviceMapEntry(BlockDeviceMapEntry * obj);
+
+struct BlockDirtyInfo
+{
+ int64_t count;
+ int64_t granularity;
+};
+
+void qapi_free_BlockDirtyInfoList(BlockDirtyInfoList * obj);
+void qapi_free_BlockDirtyInfo(BlockDirtyInfo * obj);
+
+struct BlockInfo
+{
+ char * device;
+ char * type;
+ bool removable;
+ bool locked;
+ bool has_inserted;
+ BlockDeviceInfo * inserted;
+ bool has_tray_open;
+ bool tray_open;
+ bool has_io_status;
+ BlockDeviceIoStatus io_status;
+ bool has_dirty_bitmaps;
+ BlockDirtyInfoList * dirty_bitmaps;
+};
+
+void qapi_free_BlockInfoList(BlockInfoList * obj);
+void qapi_free_BlockInfo(BlockInfo * obj);
+
+struct BlockDeviceStats
+{
+ int64_t rd_bytes;
+ int64_t wr_bytes;
+ int64_t rd_operations;
+ int64_t wr_operations;
+ int64_t flush_operations;
+ int64_t flush_total_time_ns;
+ int64_t wr_total_time_ns;
+ int64_t rd_total_time_ns;
+ int64_t wr_highest_offset;
+};
+
+void qapi_free_BlockDeviceStatsList(BlockDeviceStatsList * obj);
+void qapi_free_BlockDeviceStats(BlockDeviceStats * obj);
+
+struct BlockStats
+{
+ bool has_device;
+ char * device;
+ BlockDeviceStats * stats;
+ bool has_parent;
+ BlockStats * parent;
+};
+
+void qapi_free_BlockStatsList(BlockStatsList * obj);
+void qapi_free_BlockStats(BlockStats * obj);
+
+struct VncClientInfo
+{
+ char * host;
+ char * family;
+ char * service;
+ bool has_x509_dname;
+ char * x509_dname;
+ bool has_sasl_username;
+ char * sasl_username;
+};
+
+void qapi_free_VncClientInfoList(VncClientInfoList * obj);
+void qapi_free_VncClientInfo(VncClientInfo * obj);
+
+struct VncInfo
+{
+ bool enabled;
+ bool has_host;
+ char * host;
+ bool has_family;
+ char * family;
+ bool has_service;
+ char * service;
+ bool has_auth;
+ char * auth;
+ bool has_clients;
+ VncClientInfoList * clients;
+};
+
+void qapi_free_VncInfoList(VncInfoList * obj);
+void qapi_free_VncInfo(VncInfo * obj);
+
+struct SpiceChannel
+{
+ char * host;
+ char * family;
+ char * port;
+ int64_t connection_id;
+ int64_t channel_type;
+ int64_t channel_id;
+ bool tls;
+};
+
+void qapi_free_SpiceChannelList(SpiceChannelList * obj);
+void qapi_free_SpiceChannel(SpiceChannel * obj);
+
+void qapi_free_SpiceQueryMouseModeList(SpiceQueryMouseModeList * obj);
+
+struct SpiceInfo
+{
+ bool enabled;
+ bool migrated;
+ bool has_host;
+ char * host;
+ bool has_port;
+ int64_t port;
+ bool has_tls_port;
+ int64_t tls_port;
+ bool has_auth;
+ char * auth;
+ bool has_compiled_version;
+ char * compiled_version;
+ SpiceQueryMouseMode mouse_mode;
+ bool has_channels;
+ SpiceChannelList * channels;
+};
+
+void qapi_free_SpiceInfoList(SpiceInfoList * obj);
+void qapi_free_SpiceInfo(SpiceInfo * obj);
+
+struct BalloonInfo
+{
+ int64_t actual;
+};
+
+void qapi_free_BalloonInfoList(BalloonInfoList * obj);
+void qapi_free_BalloonInfo(BalloonInfo * obj);
+
+struct PciMemoryRange
+{
+ int64_t base;
+ int64_t limit;
+};
+
+void qapi_free_PciMemoryRangeList(PciMemoryRangeList * obj);
+void qapi_free_PciMemoryRange(PciMemoryRange * obj);
+
+struct PciMemoryRegion
+{
+ int64_t bar;
+ char * type;
+ int64_t address;
+ int64_t size;
+ bool has_prefetch;
+ bool prefetch;
+ bool has_mem_type_64;
+ bool mem_type_64;
+};
+
+void qapi_free_PciMemoryRegionList(PciMemoryRegionList * obj);
+void qapi_free_PciMemoryRegion(PciMemoryRegion * obj);
+
+struct PciBridgeInfo
+{
+ struct
+ {
+ int64_t number;
+ int64_t secondary;
+ int64_t subordinate;
+ PciMemoryRange * io_range;
+ PciMemoryRange * memory_range;
+ PciMemoryRange * prefetchable_range;
+ } bus;
+ bool has_devices;
+ PciDeviceInfoList * devices;
+};
+
+void qapi_free_PciBridgeInfoList(PciBridgeInfoList * obj);
+void qapi_free_PciBridgeInfo(PciBridgeInfo * obj);
+
+struct PciDeviceInfo
+{
+ int64_t bus;
+ int64_t slot;
+ int64_t function;
+ struct
+ {
+ bool has_desc;
+ char * desc;
+ int64_t q_class;
+ } class_info;
+ struct
+ {
+ int64_t device;
+ int64_t vendor;
+ } id;
+ bool has_irq;
+ int64_t irq;
+ char * qdev_id;
+ bool has_pci_bridge;
+ PciBridgeInfo * pci_bridge;
+ PciMemoryRegionList * regions;
+};
+
+void qapi_free_PciDeviceInfoList(PciDeviceInfoList * obj);
+void qapi_free_PciDeviceInfo(PciDeviceInfo * obj);
+
+struct PciInfo
+{
+ int64_t bus;
+ PciDeviceInfoList * devices;
+};
+
+void qapi_free_PciInfoList(PciInfoList * obj);
+void qapi_free_PciInfo(PciInfo * obj);
+
+void qapi_free_BlockdevOnErrorList(BlockdevOnErrorList * obj);
+
+void qapi_free_MirrorSyncModeList(MirrorSyncModeList * obj);
+
+void qapi_free_BlockJobTypeList(BlockJobTypeList * obj);
+
+struct BlockJobInfo
+{
+ char * type;
+ char * device;
+ int64_t len;
+ int64_t offset;
+ bool busy;
+ bool paused;
+ int64_t speed;
+ BlockDeviceIoStatus io_status;
+};
+
+void qapi_free_BlockJobInfoList(BlockJobInfoList * obj);
+void qapi_free_BlockJobInfo(BlockJobInfo * obj);
+
+void qapi_free_NewImageModeList(NewImageModeList * obj);
+
+struct BlockdevSnapshot
+{
+ char * device;
+ char * snapshot_file;
+ bool has_format;
+ char * format;
+ bool has_mode;
+ NewImageMode mode;
+};
+
+void qapi_free_BlockdevSnapshotList(BlockdevSnapshotList * obj);
+void qapi_free_BlockdevSnapshot(BlockdevSnapshot * obj);
+
+struct BlockdevSnapshotInternal
+{
+ char * device;
+ char * name;
+};
+
+void qapi_free_BlockdevSnapshotInternalList(BlockdevSnapshotInternalList * obj);
+void qapi_free_BlockdevSnapshotInternal(BlockdevSnapshotInternal * obj);
+
+struct DriveBackup
+{
+ char * device;
+ char * target;
+ bool has_format;
+ char * format;
+ MirrorSyncMode sync;
+ bool has_mode;
+ NewImageMode mode;
+ bool has_speed;
+ int64_t speed;
+ bool has_on_source_error;
+ BlockdevOnError on_source_error;
+ bool has_on_target_error;
+ BlockdevOnError on_target_error;
+};
+
+void qapi_free_DriveBackupList(DriveBackupList * obj);
+void qapi_free_DriveBackup(DriveBackup * obj);
+
+struct Abort
+{
+};
+
+void qapi_free_AbortList(AbortList * obj);
+void qapi_free_Abort(Abort * obj);
+
+struct TransactionAction
+{
+ TransactionActionKind kind;
+ union {
+ void *data;
+ BlockdevSnapshot * blockdev_snapshot_sync;
+ DriveBackup * drive_backup;
+ Abort * abort;
+ BlockdevSnapshotInternal * blockdev_snapshot_internal_sync;
+ };
+};
+void qapi_free_TransactionActionList(TransactionActionList * obj);
+void qapi_free_TransactionAction(TransactionAction * obj);
+
+struct ObjectPropertyInfo
+{
+ char * name;
+ char * type;
+};
+
+void qapi_free_ObjectPropertyInfoList(ObjectPropertyInfoList * obj);
+void qapi_free_ObjectPropertyInfo(ObjectPropertyInfo * obj);
+
+struct ObjectTypeInfo
+{
+ char * name;
+};
+
+void qapi_free_ObjectTypeInfoList(ObjectTypeInfoList * obj);
+void qapi_free_ObjectTypeInfo(ObjectTypeInfo * obj);
+
+struct DevicePropertyInfo
+{
+ char * name;
+ char * type;
+};
+
+void qapi_free_DevicePropertyInfoList(DevicePropertyInfoList * obj);
+void qapi_free_DevicePropertyInfo(DevicePropertyInfo * obj);
+
+struct NetdevNoneOptions
+{
+};
+
+void qapi_free_NetdevNoneOptionsList(NetdevNoneOptionsList * obj);
+void qapi_free_NetdevNoneOptions(NetdevNoneOptions * obj);
+
+struct NetLegacyNicOptions
+{
+ bool has_netdev;
+ char * netdev;
+ bool has_macaddr;
+ char * macaddr;
+ bool has_model;
+ char * model;
+ bool has_addr;
+ char * addr;
+ bool has_vectors;
+ uint32_t vectors;
+};
+
+void qapi_free_NetLegacyNicOptionsList(NetLegacyNicOptionsList * obj);
+void qapi_free_NetLegacyNicOptions(NetLegacyNicOptions * obj);
+
+struct String
+{
+ char * str;
+};
+
+void qapi_free_StringList(StringList * obj);
+void qapi_free_String(String * obj);
+
+struct NetdevUserOptions
+{
+ bool has_hostname;
+ char * hostname;
+ bool has_q_restrict;
+ bool q_restrict;
+ bool has_ip;
+ char * ip;
+ bool has_net;
+ char * net;
+ bool has_host;
+ char * host;
+ bool has_tftp;
+ char * tftp;
+ bool has_bootfile;
+ char * bootfile;
+ bool has_dhcpstart;
+ char * dhcpstart;
+ bool has_dns;
+ char * dns;
+ bool has_dnssearch;
+ StringList * dnssearch;
+ bool has_smb;
+ char * smb;
+ bool has_smbserver;
+ char * smbserver;
+ bool has_hostfwd;
+ StringList * hostfwd;
+ bool has_guestfwd;
+ StringList * guestfwd;
+};
+
+void qapi_free_NetdevUserOptionsList(NetdevUserOptionsList * obj);
+void qapi_free_NetdevUserOptions(NetdevUserOptions * obj);
+
+struct NetdevTapOptions
+{
+ bool has_ifname;
+ char * ifname;
+ bool has_fd;
+ char * fd;
+ bool has_fds;
+ char * fds;
+ bool has_script;
+ char * script;
+ bool has_downscript;
+ char * downscript;
+ bool has_helper;
+ char * helper;
+ bool has_sndbuf;
+ uint64_t sndbuf;
+ bool has_vnet_hdr;
+ bool vnet_hdr;
+ bool has_vhost;
+ bool vhost;
+ bool has_vhostfd;
+ char * vhostfd;
+ bool has_vhostfds;
+ char * vhostfds;
+ bool has_vhostforce;
+ bool vhostforce;
+ bool has_queues;
+ uint32_t queues;
+};
+
+void qapi_free_NetdevTapOptionsList(NetdevTapOptionsList * obj);
+void qapi_free_NetdevTapOptions(NetdevTapOptions * obj);
+
+struct NetdevSocketOptions
+{
+ bool has_fd;
+ char * fd;
+ bool has_listen;
+ char * listen;
+ bool has_connect;
+ char * connect;
+ bool has_mcast;
+ char * mcast;
+ bool has_localaddr;
+ char * localaddr;
+ bool has_udp;
+ char * udp;
+};
+
+void qapi_free_NetdevSocketOptionsList(NetdevSocketOptionsList * obj);
+void qapi_free_NetdevSocketOptions(NetdevSocketOptions * obj);
+
+struct NetdevVdeOptions
+{
+ bool has_sock;
+ char * sock;
+ bool has_port;
+ uint16_t port;
+ bool has_group;
+ char * group;
+ bool has_mode;
+ uint16_t mode;
+};
+
+void qapi_free_NetdevVdeOptionsList(NetdevVdeOptionsList * obj);
+void qapi_free_NetdevVdeOptions(NetdevVdeOptions * obj);
+
+struct NetdevDumpOptions
+{
+ bool has_len;
+ uint64_t len;
+ bool has_file;
+ char * file;
+};
+
+void qapi_free_NetdevDumpOptionsList(NetdevDumpOptionsList * obj);
+void qapi_free_NetdevDumpOptions(NetdevDumpOptions * obj);
+
+struct NetdevBridgeOptions
+{
+ bool has_br;
+ char * br;
+ bool has_helper;
+ char * helper;
+};
+
+void qapi_free_NetdevBridgeOptionsList(NetdevBridgeOptionsList * obj);
+void qapi_free_NetdevBridgeOptions(NetdevBridgeOptions * obj);
+
+struct NetdevHubPortOptions
+{
+ int32_t hubid;
+};
+
+void qapi_free_NetdevHubPortOptionsList(NetdevHubPortOptionsList * obj);
+void qapi_free_NetdevHubPortOptions(NetdevHubPortOptions * obj);
+
+struct NetdevNetmapOptions
+{
+ char * ifname;
+ bool has_devname;
+ char * devname;
+};
+
+void qapi_free_NetdevNetmapOptionsList(NetdevNetmapOptionsList * obj);
+void qapi_free_NetdevNetmapOptions(NetdevNetmapOptions * obj);
+
+struct NetClientOptions
+{
+ NetClientOptionsKind kind;
+ union {
+ void *data;
+ NetdevNoneOptions * none;
+ NetLegacyNicOptions * nic;
+ NetdevUserOptions * user;
+ NetdevTapOptions * tap;
+ NetdevSocketOptions * socket;
+ NetdevVdeOptions * vde;
+ NetdevDumpOptions * dump;
+ NetdevBridgeOptions * bridge;
+ NetdevHubPortOptions * hubport;
+ NetdevNetmapOptions * netmap;
+ };
+};
+void qapi_free_NetClientOptionsList(NetClientOptionsList * obj);
+void qapi_free_NetClientOptions(NetClientOptions * obj);
+
+struct NetLegacy
+{
+ bool has_vlan;
+ int32_t vlan;
+ bool has_id;
+ char * id;
+ bool has_name;
+ char * name;
+ NetClientOptions * opts;
+};
+
+void qapi_free_NetLegacyList(NetLegacyList * obj);
+void qapi_free_NetLegacy(NetLegacy * obj);
+
+struct Netdev
+{
+ char * id;
+ NetClientOptions * opts;
+};
+
+void qapi_free_NetdevList(NetdevList * obj);
+void qapi_free_Netdev(Netdev * obj);
+
+struct InetSocketAddress
+{
+ char * host;
+ char * port;
+ bool has_to;
+ uint16_t to;
+ bool has_ipv4;
+ bool ipv4;
+ bool has_ipv6;
+ bool ipv6;
+};
+
+void qapi_free_InetSocketAddressList(InetSocketAddressList * obj);
+void qapi_free_InetSocketAddress(InetSocketAddress * obj);
+
+struct UnixSocketAddress
+{
+ char * path;
+};
+
+void qapi_free_UnixSocketAddressList(UnixSocketAddressList * obj);
+void qapi_free_UnixSocketAddress(UnixSocketAddress * obj);
+
+struct SocketAddress
+{
+ SocketAddressKind kind;
+ union {
+ void *data;
+ InetSocketAddress * inet;
+ UnixSocketAddress * q_unix;
+ String * fd;
+ };
+};
+void qapi_free_SocketAddressList(SocketAddressList * obj);
+void qapi_free_SocketAddress(SocketAddress * obj);
+
+struct MachineInfo
+{
+ char * name;
+ bool has_alias;
+ char * alias;
+ bool has_is_default;
+ bool is_default;
+ int64_t cpu_max;
+};
+
+void qapi_free_MachineInfoList(MachineInfoList * obj);
+void qapi_free_MachineInfo(MachineInfo * obj);
+
+struct CpuDefinitionInfo
+{
+ char * name;
+};
+
+void qapi_free_CpuDefinitionInfoList(CpuDefinitionInfoList * obj);
+void qapi_free_CpuDefinitionInfo(CpuDefinitionInfo * obj);
+
+struct AddfdInfo
+{
+ int64_t fdset_id;
+ int64_t fd;
+};
+
+void qapi_free_AddfdInfoList(AddfdInfoList * obj);
+void qapi_free_AddfdInfo(AddfdInfo * obj);
+
+struct FdsetFdInfo
+{
+ int64_t fd;
+ bool has_opaque;
+ char * opaque;
+};
+
+void qapi_free_FdsetFdInfoList(FdsetFdInfoList * obj);
+void qapi_free_FdsetFdInfo(FdsetFdInfo * obj);
+
+struct FdsetInfo
+{
+ int64_t fdset_id;
+ FdsetFdInfoList * fds;
+};
+
+void qapi_free_FdsetInfoList(FdsetInfoList * obj);
+void qapi_free_FdsetInfo(FdsetInfo * obj);
+
+struct TargetInfo
+{
+ char * arch;
+};
+
+void qapi_free_TargetInfoList(TargetInfoList * obj);
+void qapi_free_TargetInfo(TargetInfo * obj);
+
+void qapi_free_QKeyCodeList(QKeyCodeList * obj);
+
+struct KeyValue
+{
+ KeyValueKind kind;
+ union {
+ void *data;
+ int64_t number;
+ QKeyCode qcode;
+ };
+};
+void qapi_free_KeyValueList(KeyValueList * obj);
+void qapi_free_KeyValue(KeyValue * obj);
+
+struct ChardevFile
+{
+ bool has_in;
+ char * in;
+ char * out;
+};
+
+void qapi_free_ChardevFileList(ChardevFileList * obj);
+void qapi_free_ChardevFile(ChardevFile * obj);
+
+struct ChardevHostdev
+{
+ char * device;
+};
+
+void qapi_free_ChardevHostdevList(ChardevHostdevList * obj);
+void qapi_free_ChardevHostdev(ChardevHostdev * obj);
+
+struct ChardevSocket
+{
+ SocketAddress * addr;
+ bool has_server;
+ bool server;
+ bool has_wait;
+ bool wait;
+ bool has_nodelay;
+ bool nodelay;
+ bool has_telnet;
+ bool telnet;
+};
+
+void qapi_free_ChardevSocketList(ChardevSocketList * obj);
+void qapi_free_ChardevSocket(ChardevSocket * obj);
+
+struct ChardevUdp
+{
+ SocketAddress * remote;
+ bool has_local;
+ SocketAddress * local;
+};
+
+void qapi_free_ChardevUdpList(ChardevUdpList * obj);
+void qapi_free_ChardevUdp(ChardevUdp * obj);
+
+struct ChardevMux
+{
+ char * chardev;
+};
+
+void qapi_free_ChardevMuxList(ChardevMuxList * obj);
+void qapi_free_ChardevMux(ChardevMux * obj);
+
+struct ChardevStdio
+{
+ bool has_signal;
+ bool signal;
+};
+
+void qapi_free_ChardevStdioList(ChardevStdioList * obj);
+void qapi_free_ChardevStdio(ChardevStdio * obj);
+
+struct ChardevSpiceChannel
+{
+ char * type;
+};
+
+void qapi_free_ChardevSpiceChannelList(ChardevSpiceChannelList * obj);
+void qapi_free_ChardevSpiceChannel(ChardevSpiceChannel * obj);
+
+struct ChardevSpicePort
+{
+ char * fqdn;
+};
+
+void qapi_free_ChardevSpicePortList(ChardevSpicePortList * obj);
+void qapi_free_ChardevSpicePort(ChardevSpicePort * obj);
+
+struct ChardevVC
+{
+ bool has_width;
+ int64_t width;
+ bool has_height;
+ int64_t height;
+ bool has_cols;
+ int64_t cols;
+ bool has_rows;
+ int64_t rows;
+};
+
+void qapi_free_ChardevVCList(ChardevVCList * obj);
+void qapi_free_ChardevVC(ChardevVC * obj);
+
+struct ChardevRingbuf
+{
+ bool has_size;
+ int64_t size;
+};
+
+void qapi_free_ChardevRingbufList(ChardevRingbufList * obj);
+void qapi_free_ChardevRingbuf(ChardevRingbuf * obj);
+
+struct ChardevDummy
+{
+};
+
+void qapi_free_ChardevDummyList(ChardevDummyList * obj);
+void qapi_free_ChardevDummy(ChardevDummy * obj);
+
+struct ChardevBackend
+{
+ ChardevBackendKind kind;
+ union {
+ void *data;
+ ChardevFile * file;
+ ChardevHostdev * serial;
+ ChardevHostdev * parallel;
+ ChardevHostdev * pipe;
+ ChardevSocket * socket;
+ ChardevUdp * udp;
+ ChardevDummy * pty;
+ ChardevDummy * null;
+ ChardevMux * mux;
+ ChardevDummy * msmouse;
+ ChardevDummy * braille;
+ ChardevStdio * stdio;
+ ChardevDummy * console;
+ ChardevSpiceChannel * spicevmc;
+ ChardevSpicePort * spiceport;
+ ChardevVC * vc;
+ ChardevRingbuf * ringbuf;
+ ChardevRingbuf * memory;
+ };
+};
+void qapi_free_ChardevBackendList(ChardevBackendList * obj);
+void qapi_free_ChardevBackend(ChardevBackend * obj);
+
+struct ChardevReturn
+{
+ bool has_pty;
+ char * pty;
+};
+
+void qapi_free_ChardevReturnList(ChardevReturnList * obj);
+void qapi_free_ChardevReturn(ChardevReturn * obj);
+
+void qapi_free_TpmModelList(TpmModelList * obj);
+
+void qapi_free_TpmTypeList(TpmTypeList * obj);
+
+struct TPMPassthroughOptions
+{
+ bool has_path;
+ char * path;
+ bool has_cancel_path;
+ char * cancel_path;
+};
+
+void qapi_free_TPMPassthroughOptionsList(TPMPassthroughOptionsList * obj);
+void qapi_free_TPMPassthroughOptions(TPMPassthroughOptions * obj);
+
+struct TpmTypeOptions
+{
+ TpmTypeOptionsKind kind;
+ union {
+ void *data;
+ TPMPassthroughOptions * passthrough;
+ };
+};
+void qapi_free_TpmTypeOptionsList(TpmTypeOptionsList * obj);
+void qapi_free_TpmTypeOptions(TpmTypeOptions * obj);
+
+struct TPMInfo
+{
+ char * id;
+ TpmModel model;
+ TpmTypeOptions * options;
+};
+
+void qapi_free_TPMInfoList(TPMInfoList * obj);
+void qapi_free_TPMInfo(TPMInfo * obj);
+
+struct AcpiTableOptions
+{
+ bool has_sig;
+ char * sig;
+ bool has_rev;
+ uint8_t rev;
+ bool has_oem_id;
+ char * oem_id;
+ bool has_oem_table_id;
+ char * oem_table_id;
+ bool has_oem_rev;
+ uint32_t oem_rev;
+ bool has_asl_compiler_id;
+ char * asl_compiler_id;
+ bool has_asl_compiler_rev;
+ uint32_t asl_compiler_rev;
+ bool has_file;
+ char * file;
+ bool has_data;
+ char * data;
+};
+
+void qapi_free_AcpiTableOptionsList(AcpiTableOptionsList * obj);
+void qapi_free_AcpiTableOptions(AcpiTableOptions * obj);
+
+void qapi_free_CommandLineParameterTypeList(CommandLineParameterTypeList * obj);
+
+struct CommandLineParameterInfo
+{
+ char * name;
+ CommandLineParameterType type;
+ bool has_help;
+ char * help;
+};
+
+void qapi_free_CommandLineParameterInfoList(CommandLineParameterInfoList * obj);
+void qapi_free_CommandLineParameterInfo(CommandLineParameterInfo * obj);
+
+struct CommandLineOptionInfo
+{
+ char * option;
+ CommandLineParameterInfoList * parameters;
+};
+
+void qapi_free_CommandLineOptionInfoList(CommandLineOptionInfoList * obj);
+void qapi_free_CommandLineOptionInfo(CommandLineOptionInfo * obj);
+
+void qapi_free_X86CPURegister32List(X86CPURegister32List * obj);
+
+struct X86CPUFeatureWordInfo
+{
+ int64_t cpuid_input_eax;
+ bool has_cpuid_input_ecx;
+ int64_t cpuid_input_ecx;
+ X86CPURegister32 cpuid_register;
+ int64_t features;
+};
+
+void qapi_free_X86CPUFeatureWordInfoList(X86CPUFeatureWordInfoList * obj);
+void qapi_free_X86CPUFeatureWordInfo(X86CPUFeatureWordInfo * obj);
+
+void qapi_free_RxStateList(RxStateList * obj);
+
+struct RxFilterInfo
+{
+ char * name;
+ bool promiscuous;
+ RxState multicast;
+ RxState unicast;
+ bool broadcast_allowed;
+ bool multicast_overflow;
+ bool unicast_overflow;
+ char * main_mac;
+ intList * vlan_table;
+ strList * unicast_table;
+ strList * multicast_table;
+};
+
+void qapi_free_RxFilterInfoList(RxFilterInfoList * obj);
+void qapi_free_RxFilterInfo(RxFilterInfo * obj);
+
+void qapi_free_BlockdevDiscardOptionsList(BlockdevDiscardOptionsList * obj);
+
+void qapi_free_BlockdevAioOptionsList(BlockdevAioOptionsList * obj);
+
+struct BlockdevCacheOptions
+{
+ bool has_writeback;
+ bool writeback;
+ bool has_direct;
+ bool direct;
+ bool has_no_flush;
+ bool no_flush;
+};
+
+void qapi_free_BlockdevCacheOptionsList(BlockdevCacheOptionsList * obj);
+void qapi_free_BlockdevCacheOptions(BlockdevCacheOptions * obj);
+
+struct BlockdevOptionsBase
+{
+ char * driver;
+ bool has_id;
+ char * id;
+ bool has_discard;
+ BlockdevDiscardOptions discard;
+ bool has_cache;
+ BlockdevCacheOptions * cache;
+ bool has_aio;
+ BlockdevAioOptions aio;
+ bool has_rerror;
+ BlockdevOnError rerror;
+ bool has_werror;
+ BlockdevOnError werror;
+ bool has_read_only;
+ bool read_only;
+};
+
+void qapi_free_BlockdevOptionsBaseList(BlockdevOptionsBaseList * obj);
+void qapi_free_BlockdevOptionsBase(BlockdevOptionsBase * obj);
+
+struct BlockdevOptionsFile
+{
+ char * filename;
+};
+
+void qapi_free_BlockdevOptionsFileList(BlockdevOptionsFileList * obj);
+void qapi_free_BlockdevOptionsFile(BlockdevOptionsFile * obj);
+
+struct BlockdevOptionsVVFAT
+{
+ char * dir;
+ bool has_fat_type;
+ int64_t fat_type;
+ bool has_floppy;
+ bool floppy;
+ bool has_rw;
+ bool rw;
+};
+
+void qapi_free_BlockdevOptionsVVFATList(BlockdevOptionsVVFATList * obj);
+void qapi_free_BlockdevOptionsVVFAT(BlockdevOptionsVVFAT * obj);
+
+struct BlockdevOptionsGenericFormat
+{
+ BlockdevRef * file;
+};
+
+void qapi_free_BlockdevOptionsGenericFormatList(BlockdevOptionsGenericFormatList * obj);
+void qapi_free_BlockdevOptionsGenericFormat(BlockdevOptionsGenericFormat * obj);
+
+struct BlockdevOptionsGenericCOWFormat
+{
+ BlockdevOptionsGenericFormat * base;
+ bool has_backing;
+ BlockdevRef * backing;
+};
+
+void qapi_free_BlockdevOptionsGenericCOWFormatList(BlockdevOptionsGenericCOWFormatList * obj);
+void qapi_free_BlockdevOptionsGenericCOWFormat(BlockdevOptionsGenericCOWFormat * obj);
+
+struct BlockdevOptionsQcow2
+{
+ BlockdevOptionsGenericCOWFormat * base;
+ bool has_lazy_refcounts;
+ bool lazy_refcounts;
+ bool has_pass_discard_request;
+ bool pass_discard_request;
+ bool has_pass_discard_snapshot;
+ bool pass_discard_snapshot;
+ bool has_pass_discard_other;
+ bool pass_discard_other;
+};
+
+void qapi_free_BlockdevOptionsQcow2List(BlockdevOptionsQcow2List * obj);
+void qapi_free_BlockdevOptionsQcow2(BlockdevOptionsQcow2 * obj);
+
+struct BlockdevOptions
+{
+ BlockdevOptionsKind kind;
+ union {
+ void *data;
+ BlockdevOptionsFile * file;
+ BlockdevOptionsFile * http;
+ BlockdevOptionsFile * https;
+ BlockdevOptionsFile * ftp;
+ BlockdevOptionsFile * ftps;
+ BlockdevOptionsFile * tftp;
+ BlockdevOptionsVVFAT * vvfat;
+ BlockdevOptionsGenericFormat * bochs;
+ BlockdevOptionsGenericFormat * cloop;
+ BlockdevOptionsGenericCOWFormat * cow;
+ BlockdevOptionsGenericFormat * dmg;
+ BlockdevOptionsGenericFormat * parallels;
+ BlockdevOptionsGenericCOWFormat * qcow;
+ BlockdevOptionsQcow2 * qcow2;
+ BlockdevOptionsGenericCOWFormat * qed;
+ BlockdevOptionsGenericFormat * raw;
+ BlockdevOptionsGenericFormat * vdi;
+ BlockdevOptionsGenericFormat * vhdx;
+ BlockdevOptionsGenericCOWFormat * vmdk;
+ BlockdevOptionsGenericFormat * vpc;
+ };
+ bool has_id;
+ char * id;
+ bool has_discard;
+ BlockdevDiscardOptions discard;
+ bool has_cache;
+ BlockdevCacheOptions * cache;
+ bool has_aio;
+ BlockdevAioOptions aio;
+ bool has_rerror;
+ BlockdevOnError rerror;
+ bool has_werror;
+ BlockdevOnError werror;
+ bool has_read_only;
+ bool read_only;
+};
+void qapi_free_BlockdevOptionsList(BlockdevOptionsList * obj);
+void qapi_free_BlockdevOptions(BlockdevOptions * obj);
+
+struct BlockdevRef
+{
+ BlockdevRefKind kind;
+ union {
+ void *data;
+ BlockdevOptions * definition;
+ char * reference;
+ };
+};
+extern const int BlockdevRef_qtypes[];
+void qapi_free_BlockdevRefList(BlockdevRefList * obj);
+void qapi_free_BlockdevRef(BlockdevRef * obj);
+
+#endif
diff --git a/qapi-auto-generated/qapi-visit.c b/qapi-auto-generated/qapi-visit.c
new file mode 100644
index 0000000..af20d3e
--- /dev/null
+++ b/qapi-auto-generated/qapi-visit.c
@@ -0,0 +1,6982 @@
+/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QAPI visitor functions
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include "qemu-common.h"
+#include "qapi-visit.h"
+
+#ifndef QAPI_VISIT_BUILTIN_VISITOR_DEF_H
+#define QAPI_VISIT_BUILTIN_VISITOR_DEF_H
+
+
+void visit_type_strList(Visitor *m, strList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ strList *native_i = (strList *)i;
+ visit_type_str(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_intList(Visitor *m, intList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ intList *native_i = (intList *)i;
+ visit_type_int(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_numberList(Visitor *m, numberList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ numberList *native_i = (numberList *)i;
+ visit_type_number(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_boolList(Visitor *m, boolList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ boolList *native_i = (boolList *)i;
+ visit_type_bool(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_int8List(Visitor *m, int8List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ int8List *native_i = (int8List *)i;
+ visit_type_int8(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_int16List(Visitor *m, int16List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ int16List *native_i = (int16List *)i;
+ visit_type_int16(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_int32List(Visitor *m, int32List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ int32List *native_i = (int32List *)i;
+ visit_type_int32(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_int64List(Visitor *m, int64List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ int64List *native_i = (int64List *)i;
+ visit_type_int64(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_uint8List(Visitor *m, uint8List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ uint8List *native_i = (uint8List *)i;
+ visit_type_uint8(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_uint16List(Visitor *m, uint16List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ uint16List *native_i = (uint16List *)i;
+ visit_type_uint16(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_uint32List(Visitor *m, uint32List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ uint32List *native_i = (uint32List *)i;
+ visit_type_uint32(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_uint64List(Visitor *m, uint64List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ uint64List *native_i = (uint64List *)i;
+ visit_type_uint64(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+#endif /* QAPI_VISIT_BUILTIN_VISITOR_DEF_H */
+
+
+void visit_type_ErrorClassList(Visitor *m, ErrorClassList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ErrorClassList *native_i = (ErrorClassList *)i;
+ visit_type_ErrorClass(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ErrorClass(Visitor *m, ErrorClass * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, ErrorClass_lookup, "ErrorClass", name, errp);
+}
+
+static void visit_type_NameInfo_fields(Visitor *m, NameInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_name : NULL, "name", &err);
+ if (obj && (*obj)->has_name) {
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NameInfo(Visitor *m, NameInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NameInfo", name, sizeof(NameInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NameInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NameInfoList(Visitor *m, NameInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NameInfoList *native_i = (NameInfoList *)i;
+ visit_type_NameInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_VersionInfo_qemu_fields(Visitor *m, VersionInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->qemu.major : NULL, "major", &err);
+ visit_type_int(m, obj ? &(*obj)->qemu.minor : NULL, "minor", &err);
+ visit_type_int(m, obj ? &(*obj)->qemu.micro : NULL, "micro", &err);
+
+ error_propagate(errp, err);
+}
+
+static void visit_type_VersionInfo_fields(Visitor *m, VersionInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ if (!error_is_set(errp)) {
+ Error **errp = &err; /* from outer scope */
+ Error *err = NULL;
+ visit_start_struct(m, NULL, "", "qemu", 0, &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_VersionInfo_qemu_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+ visit_type_str(m, obj ? &(*obj)->package : NULL, "package", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_VersionInfo(Visitor *m, VersionInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "VersionInfo", name, sizeof(VersionInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_VersionInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_VersionInfoList(Visitor *m, VersionInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ VersionInfoList *native_i = (VersionInfoList *)i;
+ visit_type_VersionInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_KvmInfo_fields(Visitor *m, KvmInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_bool(m, obj ? &(*obj)->enabled : NULL, "enabled", &err);
+ visit_type_bool(m, obj ? &(*obj)->present : NULL, "present", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_KvmInfo(Visitor *m, KvmInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "KvmInfo", name, sizeof(KvmInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_KvmInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_KvmInfoList(Visitor *m, KvmInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ KvmInfoList *native_i = (KvmInfoList *)i;
+ visit_type_KvmInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_RunStateList(Visitor *m, RunStateList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ RunStateList *native_i = (RunStateList *)i;
+ visit_type_RunState(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_RunState(Visitor *m, RunState * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, RunState_lookup, "RunState", name, errp);
+}
+
+static void visit_type_SnapshotInfo_fields(Visitor *m, SnapshotInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->id : NULL, "id", &err);
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ visit_type_int(m, obj ? &(*obj)->vm_state_size : NULL, "vm-state-size", &err);
+ visit_type_int(m, obj ? &(*obj)->date_sec : NULL, "date-sec", &err);
+ visit_type_int(m, obj ? &(*obj)->date_nsec : NULL, "date-nsec", &err);
+ visit_type_int(m, obj ? &(*obj)->vm_clock_sec : NULL, "vm-clock-sec", &err);
+ visit_type_int(m, obj ? &(*obj)->vm_clock_nsec : NULL, "vm-clock-nsec", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_SnapshotInfo(Visitor *m, SnapshotInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "SnapshotInfo", name, sizeof(SnapshotInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_SnapshotInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_SnapshotInfoList(Visitor *m, SnapshotInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ SnapshotInfoList *native_i = (SnapshotInfoList *)i;
+ visit_type_SnapshotInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ImageInfoSpecificQCow2_fields(Visitor *m, ImageInfoSpecificQCow2 ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->compat : NULL, "compat", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_lazy_refcounts : NULL, "lazy-refcounts", &err);
+ if (obj && (*obj)->has_lazy_refcounts) {
+ visit_type_bool(m, obj ? &(*obj)->lazy_refcounts : NULL, "lazy-refcounts", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ImageInfoSpecificQCow2(Visitor *m, ImageInfoSpecificQCow2 ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ImageInfoSpecificQCow2", name, sizeof(ImageInfoSpecificQCow2), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ImageInfoSpecificQCow2_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ImageInfoSpecificQCow2List(Visitor *m, ImageInfoSpecificQCow2List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ImageInfoSpecificQCow2List *native_i = (ImageInfoSpecificQCow2List *)i;
+ visit_type_ImageInfoSpecificQCow2(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ImageInfoSpecificVmdk_fields(Visitor *m, ImageInfoSpecificVmdk ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->create_type : NULL, "create-type", &err);
+ visit_type_int(m, obj ? &(*obj)->cid : NULL, "cid", &err);
+ visit_type_int(m, obj ? &(*obj)->parent_cid : NULL, "parent-cid", &err);
+ visit_type_ImageInfoList(m, obj ? &(*obj)->extents : NULL, "extents", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ImageInfoSpecificVmdk(Visitor *m, ImageInfoSpecificVmdk ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ImageInfoSpecificVmdk", name, sizeof(ImageInfoSpecificVmdk), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ImageInfoSpecificVmdk_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ImageInfoSpecificVmdkList(Visitor *m, ImageInfoSpecificVmdkList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ImageInfoSpecificVmdkList *native_i = (ImageInfoSpecificVmdkList *)i;
+ visit_type_ImageInfoSpecificVmdk(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ImageInfoSpecificKind(Visitor *m, ImageInfoSpecificKind * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, ImageInfoSpecificKind_lookup, "ImageInfoSpecificKind", name, errp);
+}
+
+void visit_type_ImageInfoSpecific(Visitor *m, ImageInfoSpecific ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "ImageInfoSpecific", name, sizeof(ImageInfoSpecific), &err);
+ if (!err) {
+ if (obj && *obj) {
+ visit_type_ImageInfoSpecificKind(m, &(*obj)->kind, "type", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+ case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
+ visit_type_ImageInfoSpecificQCow2(m, &(*obj)->qcow2, "data", &err);
+ break;
+ case IMAGE_INFO_SPECIFIC_KIND_VMDK:
+ visit_type_ImageInfoSpecificVmdk(m, &(*obj)->vmdk, "data", &err);
+ break;
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ImageInfoSpecificList(Visitor *m, ImageInfoSpecificList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ImageInfoSpecificList *native_i = (ImageInfoSpecificList *)i;
+ visit_type_ImageInfoSpecific(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ImageInfo_fields(Visitor *m, ImageInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->filename : NULL, "filename", &err);
+ visit_type_str(m, obj ? &(*obj)->format : NULL, "format", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_dirty_flag : NULL, "dirty-flag", &err);
+ if (obj && (*obj)->has_dirty_flag) {
+ visit_type_bool(m, obj ? &(*obj)->dirty_flag : NULL, "dirty-flag", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_actual_size : NULL, "actual-size", &err);
+ if (obj && (*obj)->has_actual_size) {
+ visit_type_int(m, obj ? &(*obj)->actual_size : NULL, "actual-size", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_int(m, obj ? &(*obj)->virtual_size : NULL, "virtual-size", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_cluster_size : NULL, "cluster-size", &err);
+ if (obj && (*obj)->has_cluster_size) {
+ visit_type_int(m, obj ? &(*obj)->cluster_size : NULL, "cluster-size", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_encrypted : NULL, "encrypted", &err);
+ if (obj && (*obj)->has_encrypted) {
+ visit_type_bool(m, obj ? &(*obj)->encrypted : NULL, "encrypted", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_compressed : NULL, "compressed", &err);
+ if (obj && (*obj)->has_compressed) {
+ visit_type_bool(m, obj ? &(*obj)->compressed : NULL, "compressed", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_backing_filename : NULL, "backing-filename", &err);
+ if (obj && (*obj)->has_backing_filename) {
+ visit_type_str(m, obj ? &(*obj)->backing_filename : NULL, "backing-filename", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_full_backing_filename : NULL, "full-backing-filename", &err);
+ if (obj && (*obj)->has_full_backing_filename) {
+ visit_type_str(m, obj ? &(*obj)->full_backing_filename : NULL, "full-backing-filename", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_backing_filename_format : NULL, "backing-filename-format", &err);
+ if (obj && (*obj)->has_backing_filename_format) {
+ visit_type_str(m, obj ? &(*obj)->backing_filename_format : NULL, "backing-filename-format", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_snapshots : NULL, "snapshots", &err);
+ if (obj && (*obj)->has_snapshots) {
+ visit_type_SnapshotInfoList(m, obj ? &(*obj)->snapshots : NULL, "snapshots", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_backing_image : NULL, "backing-image", &err);
+ if (obj && (*obj)->has_backing_image) {
+ visit_type_ImageInfo(m, obj ? &(*obj)->backing_image : NULL, "backing-image", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_format_specific : NULL, "format-specific", &err);
+ if (obj && (*obj)->has_format_specific) {
+ visit_type_ImageInfoSpecific(m, obj ? &(*obj)->format_specific : NULL, "format-specific", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ImageInfo(Visitor *m, ImageInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ImageInfo", name, sizeof(ImageInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ImageInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ImageInfoList(Visitor *m, ImageInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ImageInfoList *native_i = (ImageInfoList *)i;
+ visit_type_ImageInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ImageCheck_fields(Visitor *m, ImageCheck ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->filename : NULL, "filename", &err);
+ visit_type_str(m, obj ? &(*obj)->format : NULL, "format", &err);
+ visit_type_int(m, obj ? &(*obj)->check_errors : NULL, "check-errors", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_image_end_offset : NULL, "image-end-offset", &err);
+ if (obj && (*obj)->has_image_end_offset) {
+ visit_type_int(m, obj ? &(*obj)->image_end_offset : NULL, "image-end-offset", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_corruptions : NULL, "corruptions", &err);
+ if (obj && (*obj)->has_corruptions) {
+ visit_type_int(m, obj ? &(*obj)->corruptions : NULL, "corruptions", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_leaks : NULL, "leaks", &err);
+ if (obj && (*obj)->has_leaks) {
+ visit_type_int(m, obj ? &(*obj)->leaks : NULL, "leaks", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_corruptions_fixed : NULL, "corruptions-fixed", &err);
+ if (obj && (*obj)->has_corruptions_fixed) {
+ visit_type_int(m, obj ? &(*obj)->corruptions_fixed : NULL, "corruptions-fixed", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_leaks_fixed : NULL, "leaks-fixed", &err);
+ if (obj && (*obj)->has_leaks_fixed) {
+ visit_type_int(m, obj ? &(*obj)->leaks_fixed : NULL, "leaks-fixed", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_total_clusters : NULL, "total-clusters", &err);
+ if (obj && (*obj)->has_total_clusters) {
+ visit_type_int(m, obj ? &(*obj)->total_clusters : NULL, "total-clusters", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_allocated_clusters : NULL, "allocated-clusters", &err);
+ if (obj && (*obj)->has_allocated_clusters) {
+ visit_type_int(m, obj ? &(*obj)->allocated_clusters : NULL, "allocated-clusters", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_fragmented_clusters : NULL, "fragmented-clusters", &err);
+ if (obj && (*obj)->has_fragmented_clusters) {
+ visit_type_int(m, obj ? &(*obj)->fragmented_clusters : NULL, "fragmented-clusters", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_compressed_clusters : NULL, "compressed-clusters", &err);
+ if (obj && (*obj)->has_compressed_clusters) {
+ visit_type_int(m, obj ? &(*obj)->compressed_clusters : NULL, "compressed-clusters", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ImageCheck(Visitor *m, ImageCheck ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ImageCheck", name, sizeof(ImageCheck), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ImageCheck_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ImageCheckList(Visitor *m, ImageCheckList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ImageCheckList *native_i = (ImageCheckList *)i;
+ visit_type_ImageCheck(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_StatusInfo_fields(Visitor *m, StatusInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_bool(m, obj ? &(*obj)->running : NULL, "running", &err);
+ visit_type_bool(m, obj ? &(*obj)->singlestep : NULL, "singlestep", &err);
+ visit_type_RunState(m, obj ? &(*obj)->status : NULL, "status", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_StatusInfo(Visitor *m, StatusInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "StatusInfo", name, sizeof(StatusInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_StatusInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_StatusInfoList(Visitor *m, StatusInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ StatusInfoList *native_i = (StatusInfoList *)i;
+ visit_type_StatusInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_UuidInfo_fields(Visitor *m, UuidInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->UUID : NULL, "UUID", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_UuidInfo(Visitor *m, UuidInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "UuidInfo", name, sizeof(UuidInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_UuidInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_UuidInfoList(Visitor *m, UuidInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ UuidInfoList *native_i = (UuidInfoList *)i;
+ visit_type_UuidInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevInfo_fields(Visitor *m, ChardevInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->label : NULL, "label", &err);
+ visit_type_str(m, obj ? &(*obj)->filename : NULL, "filename", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevInfo(Visitor *m, ChardevInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevInfo", name, sizeof(ChardevInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevInfoList(Visitor *m, ChardevInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevInfoList *native_i = (ChardevInfoList *)i;
+ visit_type_ChardevInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_DataFormatList(Visitor *m, DataFormatList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ DataFormatList *native_i = (DataFormatList *)i;
+ visit_type_DataFormat(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_DataFormat(Visitor *m, DataFormat * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, DataFormat_lookup, "DataFormat", name, errp);
+}
+
+static void visit_type_CommandInfo_fields(Visitor *m, CommandInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_CommandInfo(Visitor *m, CommandInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "CommandInfo", name, sizeof(CommandInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_CommandInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_CommandInfoList(Visitor *m, CommandInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ CommandInfoList *native_i = (CommandInfoList *)i;
+ visit_type_CommandInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_EventInfo_fields(Visitor *m, EventInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_EventInfo(Visitor *m, EventInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "EventInfo", name, sizeof(EventInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_EventInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_EventInfoList(Visitor *m, EventInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ EventInfoList *native_i = (EventInfoList *)i;
+ visit_type_EventInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_MigrationStats_fields(Visitor *m, MigrationStats ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->transferred : NULL, "transferred", &err);
+ visit_type_int(m, obj ? &(*obj)->remaining : NULL, "remaining", &err);
+ visit_type_int(m, obj ? &(*obj)->total : NULL, "total", &err);
+ visit_type_int(m, obj ? &(*obj)->duplicate : NULL, "duplicate", &err);
+ visit_type_int(m, obj ? &(*obj)->skipped : NULL, "skipped", &err);
+ visit_type_int(m, obj ? &(*obj)->normal : NULL, "normal", &err);
+ visit_type_int(m, obj ? &(*obj)->normal_bytes : NULL, "normal-bytes", &err);
+ visit_type_int(m, obj ? &(*obj)->dirty_pages_rate : NULL, "dirty-pages-rate", &err);
+ visit_type_number(m, obj ? &(*obj)->mbps : NULL, "mbps", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_MigrationStats(Visitor *m, MigrationStats ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "MigrationStats", name, sizeof(MigrationStats), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_MigrationStats_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_MigrationStatsList(Visitor *m, MigrationStatsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ MigrationStatsList *native_i = (MigrationStatsList *)i;
+ visit_type_MigrationStats(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_XBZRLECacheStats_fields(Visitor *m, XBZRLECacheStats ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->cache_size : NULL, "cache-size", &err);
+ visit_type_int(m, obj ? &(*obj)->bytes : NULL, "bytes", &err);
+ visit_type_int(m, obj ? &(*obj)->pages : NULL, "pages", &err);
+ visit_type_int(m, obj ? &(*obj)->cache_miss : NULL, "cache-miss", &err);
+ visit_type_int(m, obj ? &(*obj)->overflow : NULL, "overflow", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_XBZRLECacheStats(Visitor *m, XBZRLECacheStats ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "XBZRLECacheStats", name, sizeof(XBZRLECacheStats), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_XBZRLECacheStats_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_XBZRLECacheStatsList(Visitor *m, XBZRLECacheStatsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ XBZRLECacheStatsList *native_i = (XBZRLECacheStatsList *)i;
+ visit_type_XBZRLECacheStats(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_MigrationInfo_fields(Visitor *m, MigrationInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_status : NULL, "status", &err);
+ if (obj && (*obj)->has_status) {
+ visit_type_str(m, obj ? &(*obj)->status : NULL, "status", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_ram : NULL, "ram", &err);
+ if (obj && (*obj)->has_ram) {
+ visit_type_MigrationStats(m, obj ? &(*obj)->ram : NULL, "ram", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_disk : NULL, "disk", &err);
+ if (obj && (*obj)->has_disk) {
+ visit_type_MigrationStats(m, obj ? &(*obj)->disk : NULL, "disk", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_xbzrle_cache : NULL, "xbzrle-cache", &err);
+ if (obj && (*obj)->has_xbzrle_cache) {
+ visit_type_XBZRLECacheStats(m, obj ? &(*obj)->xbzrle_cache : NULL, "xbzrle-cache", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_total_time : NULL, "total-time", &err);
+ if (obj && (*obj)->has_total_time) {
+ visit_type_int(m, obj ? &(*obj)->total_time : NULL, "total-time", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_expected_downtime : NULL, "expected-downtime", &err);
+ if (obj && (*obj)->has_expected_downtime) {
+ visit_type_int(m, obj ? &(*obj)->expected_downtime : NULL, "expected-downtime", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_downtime : NULL, "downtime", &err);
+ if (obj && (*obj)->has_downtime) {
+ visit_type_int(m, obj ? &(*obj)->downtime : NULL, "downtime", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_setup_time : NULL, "setup-time", &err);
+ if (obj && (*obj)->has_setup_time) {
+ visit_type_int(m, obj ? &(*obj)->setup_time : NULL, "setup-time", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_MigrationInfo(Visitor *m, MigrationInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "MigrationInfo", name, sizeof(MigrationInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_MigrationInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_MigrationInfoList(Visitor *m, MigrationInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ MigrationInfoList *native_i = (MigrationInfoList *)i;
+ visit_type_MigrationInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_MigrationCapabilityList(Visitor *m, MigrationCapabilityList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ MigrationCapabilityList *native_i = (MigrationCapabilityList *)i;
+ visit_type_MigrationCapability(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_MigrationCapability(Visitor *m, MigrationCapability * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, MigrationCapability_lookup, "MigrationCapability", name, errp);
+}
+
+static void visit_type_MigrationCapabilityStatus_fields(Visitor *m, MigrationCapabilityStatus ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_MigrationCapability(m, obj ? &(*obj)->capability : NULL, "capability", &err);
+ visit_type_bool(m, obj ? &(*obj)->state : NULL, "state", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_MigrationCapabilityStatus(Visitor *m, MigrationCapabilityStatus ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "MigrationCapabilityStatus", name, sizeof(MigrationCapabilityStatus), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_MigrationCapabilityStatus_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_MigrationCapabilityStatusList(Visitor *m, MigrationCapabilityStatusList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ MigrationCapabilityStatusList *native_i = (MigrationCapabilityStatusList *)i;
+ visit_type_MigrationCapabilityStatus(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_MouseInfo_fields(Visitor *m, MouseInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ visit_type_int(m, obj ? &(*obj)->index : NULL, "index", &err);
+ visit_type_bool(m, obj ? &(*obj)->current : NULL, "current", &err);
+ visit_type_bool(m, obj ? &(*obj)->absolute : NULL, "absolute", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_MouseInfo(Visitor *m, MouseInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "MouseInfo", name, sizeof(MouseInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_MouseInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_MouseInfoList(Visitor *m, MouseInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ MouseInfoList *native_i = (MouseInfoList *)i;
+ visit_type_MouseInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_CpuInfo_fields(Visitor *m, CpuInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->CPU : NULL, "CPU", &err);
+ visit_type_bool(m, obj ? &(*obj)->current : NULL, "current", &err);
+ visit_type_bool(m, obj ? &(*obj)->halted : NULL, "halted", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_pc : NULL, "pc", &err);
+ if (obj && (*obj)->has_pc) {
+ visit_type_int(m, obj ? &(*obj)->pc : NULL, "pc", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_nip : NULL, "nip", &err);
+ if (obj && (*obj)->has_nip) {
+ visit_type_int(m, obj ? &(*obj)->nip : NULL, "nip", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_npc : NULL, "npc", &err);
+ if (obj && (*obj)->has_npc) {
+ visit_type_int(m, obj ? &(*obj)->npc : NULL, "npc", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_PC : NULL, "PC", &err);
+ if (obj && (*obj)->has_PC) {
+ visit_type_int(m, obj ? &(*obj)->PC : NULL, "PC", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_int(m, obj ? &(*obj)->thread_id : NULL, "thread_id", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_CpuInfo(Visitor *m, CpuInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "CpuInfo", name, sizeof(CpuInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_CpuInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_CpuInfoList(Visitor *m, CpuInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ CpuInfoList *native_i = (CpuInfoList *)i;
+ visit_type_CpuInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockDeviceInfo_fields(Visitor *m, BlockDeviceInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->file : NULL, "file", &err);
+ visit_type_bool(m, obj ? &(*obj)->ro : NULL, "ro", &err);
+ visit_type_str(m, obj ? &(*obj)->drv : NULL, "drv", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_backing_file : NULL, "backing_file", &err);
+ if (obj && (*obj)->has_backing_file) {
+ visit_type_str(m, obj ? &(*obj)->backing_file : NULL, "backing_file", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_int(m, obj ? &(*obj)->backing_file_depth : NULL, "backing_file_depth", &err);
+ visit_type_bool(m, obj ? &(*obj)->encrypted : NULL, "encrypted", &err);
+ visit_type_bool(m, obj ? &(*obj)->encryption_key_missing : NULL, "encryption_key_missing", &err);
+ visit_type_int(m, obj ? &(*obj)->bps : NULL, "bps", &err);
+ visit_type_int(m, obj ? &(*obj)->bps_rd : NULL, "bps_rd", &err);
+ visit_type_int(m, obj ? &(*obj)->bps_wr : NULL, "bps_wr", &err);
+ visit_type_int(m, obj ? &(*obj)->iops : NULL, "iops", &err);
+ visit_type_int(m, obj ? &(*obj)->iops_rd : NULL, "iops_rd", &err);
+ visit_type_int(m, obj ? &(*obj)->iops_wr : NULL, "iops_wr", &err);
+ visit_type_ImageInfo(m, obj ? &(*obj)->image : NULL, "image", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_bps_max : NULL, "bps_max", &err);
+ if (obj && (*obj)->has_bps_max) {
+ visit_type_int(m, obj ? &(*obj)->bps_max : NULL, "bps_max", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_bps_rd_max : NULL, "bps_rd_max", &err);
+ if (obj && (*obj)->has_bps_rd_max) {
+ visit_type_int(m, obj ? &(*obj)->bps_rd_max : NULL, "bps_rd_max", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_bps_wr_max : NULL, "bps_wr_max", &err);
+ if (obj && (*obj)->has_bps_wr_max) {
+ visit_type_int(m, obj ? &(*obj)->bps_wr_max : NULL, "bps_wr_max", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_iops_max : NULL, "iops_max", &err);
+ if (obj && (*obj)->has_iops_max) {
+ visit_type_int(m, obj ? &(*obj)->iops_max : NULL, "iops_max", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_iops_rd_max : NULL, "iops_rd_max", &err);
+ if (obj && (*obj)->has_iops_rd_max) {
+ visit_type_int(m, obj ? &(*obj)->iops_rd_max : NULL, "iops_rd_max", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_iops_wr_max : NULL, "iops_wr_max", &err);
+ if (obj && (*obj)->has_iops_wr_max) {
+ visit_type_int(m, obj ? &(*obj)->iops_wr_max : NULL, "iops_wr_max", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_iops_size : NULL, "iops_size", &err);
+ if (obj && (*obj)->has_iops_size) {
+ visit_type_int(m, obj ? &(*obj)->iops_size : NULL, "iops_size", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockDeviceInfo(Visitor *m, BlockDeviceInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockDeviceInfo", name, sizeof(BlockDeviceInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockDeviceInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockDeviceInfoList(Visitor *m, BlockDeviceInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockDeviceInfoList *native_i = (BlockDeviceInfoList *)i;
+ visit_type_BlockDeviceInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockDeviceIoStatusList(Visitor *m, BlockDeviceIoStatusList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockDeviceIoStatusList *native_i = (BlockDeviceIoStatusList *)i;
+ visit_type_BlockDeviceIoStatus(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockDeviceIoStatus(Visitor *m, BlockDeviceIoStatus * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, BlockDeviceIoStatus_lookup, "BlockDeviceIoStatus", name, errp);
+}
+
+static void visit_type_BlockDeviceMapEntry_fields(Visitor *m, BlockDeviceMapEntry ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->start : NULL, "start", &err);
+ visit_type_int(m, obj ? &(*obj)->length : NULL, "length", &err);
+ visit_type_int(m, obj ? &(*obj)->depth : NULL, "depth", &err);
+ visit_type_bool(m, obj ? &(*obj)->zero : NULL, "zero", &err);
+ visit_type_bool(m, obj ? &(*obj)->data : NULL, "data", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_offset : NULL, "offset", &err);
+ if (obj && (*obj)->has_offset) {
+ visit_type_int(m, obj ? &(*obj)->offset : NULL, "offset", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockDeviceMapEntry(Visitor *m, BlockDeviceMapEntry ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockDeviceMapEntry", name, sizeof(BlockDeviceMapEntry), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockDeviceMapEntry_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockDeviceMapEntryList(Visitor *m, BlockDeviceMapEntryList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockDeviceMapEntryList *native_i = (BlockDeviceMapEntryList *)i;
+ visit_type_BlockDeviceMapEntry(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockDirtyInfo_fields(Visitor *m, BlockDirtyInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->count : NULL, "count", &err);
+ visit_type_int(m, obj ? &(*obj)->granularity : NULL, "granularity", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockDirtyInfo(Visitor *m, BlockDirtyInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockDirtyInfo", name, sizeof(BlockDirtyInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockDirtyInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockDirtyInfoList(Visitor *m, BlockDirtyInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockDirtyInfoList *native_i = (BlockDirtyInfoList *)i;
+ visit_type_BlockDirtyInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockInfo_fields(Visitor *m, BlockInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->device : NULL, "device", &err);
+ visit_type_str(m, obj ? &(*obj)->type : NULL, "type", &err);
+ visit_type_bool(m, obj ? &(*obj)->removable : NULL, "removable", &err);
+ visit_type_bool(m, obj ? &(*obj)->locked : NULL, "locked", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_inserted : NULL, "inserted", &err);
+ if (obj && (*obj)->has_inserted) {
+ visit_type_BlockDeviceInfo(m, obj ? &(*obj)->inserted : NULL, "inserted", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_tray_open : NULL, "tray_open", &err);
+ if (obj && (*obj)->has_tray_open) {
+ visit_type_bool(m, obj ? &(*obj)->tray_open : NULL, "tray_open", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_io_status : NULL, "io-status", &err);
+ if (obj && (*obj)->has_io_status) {
+ visit_type_BlockDeviceIoStatus(m, obj ? &(*obj)->io_status : NULL, "io-status", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_dirty_bitmaps : NULL, "dirty-bitmaps", &err);
+ if (obj && (*obj)->has_dirty_bitmaps) {
+ visit_type_BlockDirtyInfoList(m, obj ? &(*obj)->dirty_bitmaps : NULL, "dirty-bitmaps", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockInfo(Visitor *m, BlockInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockInfo", name, sizeof(BlockInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockInfoList(Visitor *m, BlockInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockInfoList *native_i = (BlockInfoList *)i;
+ visit_type_BlockInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockDeviceStats_fields(Visitor *m, BlockDeviceStats ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->rd_bytes : NULL, "rd_bytes", &err);
+ visit_type_int(m, obj ? &(*obj)->wr_bytes : NULL, "wr_bytes", &err);
+ visit_type_int(m, obj ? &(*obj)->rd_operations : NULL, "rd_operations", &err);
+ visit_type_int(m, obj ? &(*obj)->wr_operations : NULL, "wr_operations", &err);
+ visit_type_int(m, obj ? &(*obj)->flush_operations : NULL, "flush_operations", &err);
+ visit_type_int(m, obj ? &(*obj)->flush_total_time_ns : NULL, "flush_total_time_ns", &err);
+ visit_type_int(m, obj ? &(*obj)->wr_total_time_ns : NULL, "wr_total_time_ns", &err);
+ visit_type_int(m, obj ? &(*obj)->rd_total_time_ns : NULL, "rd_total_time_ns", &err);
+ visit_type_int(m, obj ? &(*obj)->wr_highest_offset : NULL, "wr_highest_offset", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockDeviceStats(Visitor *m, BlockDeviceStats ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockDeviceStats", name, sizeof(BlockDeviceStats), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockDeviceStats_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockDeviceStatsList(Visitor *m, BlockDeviceStatsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockDeviceStatsList *native_i = (BlockDeviceStatsList *)i;
+ visit_type_BlockDeviceStats(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockStats_fields(Visitor *m, BlockStats ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_device : NULL, "device", &err);
+ if (obj && (*obj)->has_device) {
+ visit_type_str(m, obj ? &(*obj)->device : NULL, "device", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_BlockDeviceStats(m, obj ? &(*obj)->stats : NULL, "stats", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_parent : NULL, "parent", &err);
+ if (obj && (*obj)->has_parent) {
+ visit_type_BlockStats(m, obj ? &(*obj)->parent : NULL, "parent", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockStats(Visitor *m, BlockStats ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockStats", name, sizeof(BlockStats), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockStats_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockStatsList(Visitor *m, BlockStatsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockStatsList *native_i = (BlockStatsList *)i;
+ visit_type_BlockStats(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_VncClientInfo_fields(Visitor *m, VncClientInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->host : NULL, "host", &err);
+ visit_type_str(m, obj ? &(*obj)->family : NULL, "family", &err);
+ visit_type_str(m, obj ? &(*obj)->service : NULL, "service", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_x509_dname : NULL, "x509_dname", &err);
+ if (obj && (*obj)->has_x509_dname) {
+ visit_type_str(m, obj ? &(*obj)->x509_dname : NULL, "x509_dname", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_sasl_username : NULL, "sasl_username", &err);
+ if (obj && (*obj)->has_sasl_username) {
+ visit_type_str(m, obj ? &(*obj)->sasl_username : NULL, "sasl_username", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_VncClientInfo(Visitor *m, VncClientInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "VncClientInfo", name, sizeof(VncClientInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_VncClientInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_VncClientInfoList(Visitor *m, VncClientInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ VncClientInfoList *native_i = (VncClientInfoList *)i;
+ visit_type_VncClientInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_VncInfo_fields(Visitor *m, VncInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_bool(m, obj ? &(*obj)->enabled : NULL, "enabled", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_host : NULL, "host", &err);
+ if (obj && (*obj)->has_host) {
+ visit_type_str(m, obj ? &(*obj)->host : NULL, "host", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_family : NULL, "family", &err);
+ if (obj && (*obj)->has_family) {
+ visit_type_str(m, obj ? &(*obj)->family : NULL, "family", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_service : NULL, "service", &err);
+ if (obj && (*obj)->has_service) {
+ visit_type_str(m, obj ? &(*obj)->service : NULL, "service", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_auth : NULL, "auth", &err);
+ if (obj && (*obj)->has_auth) {
+ visit_type_str(m, obj ? &(*obj)->auth : NULL, "auth", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_clients : NULL, "clients", &err);
+ if (obj && (*obj)->has_clients) {
+ visit_type_VncClientInfoList(m, obj ? &(*obj)->clients : NULL, "clients", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_VncInfo(Visitor *m, VncInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "VncInfo", name, sizeof(VncInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_VncInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_VncInfoList(Visitor *m, VncInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ VncInfoList *native_i = (VncInfoList *)i;
+ visit_type_VncInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_SpiceChannel_fields(Visitor *m, SpiceChannel ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->host : NULL, "host", &err);
+ visit_type_str(m, obj ? &(*obj)->family : NULL, "family", &err);
+ visit_type_str(m, obj ? &(*obj)->port : NULL, "port", &err);
+ visit_type_int(m, obj ? &(*obj)->connection_id : NULL, "connection-id", &err);
+ visit_type_int(m, obj ? &(*obj)->channel_type : NULL, "channel-type", &err);
+ visit_type_int(m, obj ? &(*obj)->channel_id : NULL, "channel-id", &err);
+ visit_type_bool(m, obj ? &(*obj)->tls : NULL, "tls", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_SpiceChannel(Visitor *m, SpiceChannel ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "SpiceChannel", name, sizeof(SpiceChannel), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_SpiceChannel_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_SpiceChannelList(Visitor *m, SpiceChannelList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ SpiceChannelList *native_i = (SpiceChannelList *)i;
+ visit_type_SpiceChannel(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_SpiceQueryMouseModeList(Visitor *m, SpiceQueryMouseModeList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ SpiceQueryMouseModeList *native_i = (SpiceQueryMouseModeList *)i;
+ visit_type_SpiceQueryMouseMode(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_SpiceQueryMouseMode(Visitor *m, SpiceQueryMouseMode * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, SpiceQueryMouseMode_lookup, "SpiceQueryMouseMode", name, errp);
+}
+
+static void visit_type_SpiceInfo_fields(Visitor *m, SpiceInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_bool(m, obj ? &(*obj)->enabled : NULL, "enabled", &err);
+ visit_type_bool(m, obj ? &(*obj)->migrated : NULL, "migrated", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_host : NULL, "host", &err);
+ if (obj && (*obj)->has_host) {
+ visit_type_str(m, obj ? &(*obj)->host : NULL, "host", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_port : NULL, "port", &err);
+ if (obj && (*obj)->has_port) {
+ visit_type_int(m, obj ? &(*obj)->port : NULL, "port", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_tls_port : NULL, "tls-port", &err);
+ if (obj && (*obj)->has_tls_port) {
+ visit_type_int(m, obj ? &(*obj)->tls_port : NULL, "tls-port", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_auth : NULL, "auth", &err);
+ if (obj && (*obj)->has_auth) {
+ visit_type_str(m, obj ? &(*obj)->auth : NULL, "auth", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_compiled_version : NULL, "compiled-version", &err);
+ if (obj && (*obj)->has_compiled_version) {
+ visit_type_str(m, obj ? &(*obj)->compiled_version : NULL, "compiled-version", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_SpiceQueryMouseMode(m, obj ? &(*obj)->mouse_mode : NULL, "mouse-mode", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_channels : NULL, "channels", &err);
+ if (obj && (*obj)->has_channels) {
+ visit_type_SpiceChannelList(m, obj ? &(*obj)->channels : NULL, "channels", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_SpiceInfo(Visitor *m, SpiceInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "SpiceInfo", name, sizeof(SpiceInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_SpiceInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_SpiceInfoList(Visitor *m, SpiceInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ SpiceInfoList *native_i = (SpiceInfoList *)i;
+ visit_type_SpiceInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BalloonInfo_fields(Visitor *m, BalloonInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->actual : NULL, "actual", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BalloonInfo(Visitor *m, BalloonInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BalloonInfo", name, sizeof(BalloonInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BalloonInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BalloonInfoList(Visitor *m, BalloonInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BalloonInfoList *native_i = (BalloonInfoList *)i;
+ visit_type_BalloonInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_PciMemoryRange_fields(Visitor *m, PciMemoryRange ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->base : NULL, "base", &err);
+ visit_type_int(m, obj ? &(*obj)->limit : NULL, "limit", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_PciMemoryRange(Visitor *m, PciMemoryRange ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "PciMemoryRange", name, sizeof(PciMemoryRange), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_PciMemoryRange_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_PciMemoryRangeList(Visitor *m, PciMemoryRangeList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ PciMemoryRangeList *native_i = (PciMemoryRangeList *)i;
+ visit_type_PciMemoryRange(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_PciMemoryRegion_fields(Visitor *m, PciMemoryRegion ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->bar : NULL, "bar", &err);
+ visit_type_str(m, obj ? &(*obj)->type : NULL, "type", &err);
+ visit_type_int(m, obj ? &(*obj)->address : NULL, "address", &err);
+ visit_type_int(m, obj ? &(*obj)->size : NULL, "size", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_prefetch : NULL, "prefetch", &err);
+ if (obj && (*obj)->has_prefetch) {
+ visit_type_bool(m, obj ? &(*obj)->prefetch : NULL, "prefetch", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_mem_type_64 : NULL, "mem_type_64", &err);
+ if (obj && (*obj)->has_mem_type_64) {
+ visit_type_bool(m, obj ? &(*obj)->mem_type_64 : NULL, "mem_type_64", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_PciMemoryRegion(Visitor *m, PciMemoryRegion ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "PciMemoryRegion", name, sizeof(PciMemoryRegion), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_PciMemoryRegion_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_PciMemoryRegionList(Visitor *m, PciMemoryRegionList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ PciMemoryRegionList *native_i = (PciMemoryRegionList *)i;
+ visit_type_PciMemoryRegion(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_PciBridgeInfo_bus_fields(Visitor *m, PciBridgeInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->bus.number : NULL, "number", &err);
+ visit_type_int(m, obj ? &(*obj)->bus.secondary : NULL, "secondary", &err);
+ visit_type_int(m, obj ? &(*obj)->bus.subordinate : NULL, "subordinate", &err);
+ visit_type_PciMemoryRange(m, obj ? &(*obj)->bus.io_range : NULL, "io_range", &err);
+ visit_type_PciMemoryRange(m, obj ? &(*obj)->bus.memory_range : NULL, "memory_range", &err);
+ visit_type_PciMemoryRange(m, obj ? &(*obj)->bus.prefetchable_range : NULL, "prefetchable_range", &err);
+
+ error_propagate(errp, err);
+}
+
+static void visit_type_PciBridgeInfo_fields(Visitor *m, PciBridgeInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ if (!error_is_set(errp)) {
+ Error **errp = &err; /* from outer scope */
+ Error *err = NULL;
+ visit_start_struct(m, NULL, "", "bus", 0, &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_PciBridgeInfo_bus_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+ visit_start_optional(m, obj ? &(*obj)->has_devices : NULL, "devices", &err);
+ if (obj && (*obj)->has_devices) {
+ visit_type_PciDeviceInfoList(m, obj ? &(*obj)->devices : NULL, "devices", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_PciBridgeInfo(Visitor *m, PciBridgeInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "PciBridgeInfo", name, sizeof(PciBridgeInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_PciBridgeInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_PciBridgeInfoList(Visitor *m, PciBridgeInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ PciBridgeInfoList *native_i = (PciBridgeInfoList *)i;
+ visit_type_PciBridgeInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_PciDeviceInfo_class_info_fields(Visitor *m, PciDeviceInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->class_info.has_desc : NULL, "desc", &err);
+ if (obj && (*obj)->class_info.has_desc) {
+ visit_type_str(m, obj ? &(*obj)->class_info.desc : NULL, "desc", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_int(m, obj ? &(*obj)->class_info.q_class : NULL, "class", &err);
+
+ error_propagate(errp, err);
+}
+
+static void visit_type_PciDeviceInfo_id_fields(Visitor *m, PciDeviceInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->id.device : NULL, "device", &err);
+ visit_type_int(m, obj ? &(*obj)->id.vendor : NULL, "vendor", &err);
+
+ error_propagate(errp, err);
+}
+
+static void visit_type_PciDeviceInfo_fields(Visitor *m, PciDeviceInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->bus : NULL, "bus", &err);
+ visit_type_int(m, obj ? &(*obj)->slot : NULL, "slot", &err);
+ visit_type_int(m, obj ? &(*obj)->function : NULL, "function", &err);
+ if (!error_is_set(errp)) {
+ Error **errp = &err; /* from outer scope */
+ Error *err = NULL;
+ visit_start_struct(m, NULL, "", "class_info", 0, &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_PciDeviceInfo_class_info_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+ if (!error_is_set(errp)) {
+ Error **errp = &err; /* from outer scope */
+ Error *err = NULL;
+ visit_start_struct(m, NULL, "", "id", 0, &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_PciDeviceInfo_id_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+ visit_start_optional(m, obj ? &(*obj)->has_irq : NULL, "irq", &err);
+ if (obj && (*obj)->has_irq) {
+ visit_type_int(m, obj ? &(*obj)->irq : NULL, "irq", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_str(m, obj ? &(*obj)->qdev_id : NULL, "qdev_id", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_pci_bridge : NULL, "pci_bridge", &err);
+ if (obj && (*obj)->has_pci_bridge) {
+ visit_type_PciBridgeInfo(m, obj ? &(*obj)->pci_bridge : NULL, "pci_bridge", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_PciMemoryRegionList(m, obj ? &(*obj)->regions : NULL, "regions", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_PciDeviceInfo(Visitor *m, PciDeviceInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "PciDeviceInfo", name, sizeof(PciDeviceInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_PciDeviceInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_PciDeviceInfoList(Visitor *m, PciDeviceInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ PciDeviceInfoList *native_i = (PciDeviceInfoList *)i;
+ visit_type_PciDeviceInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_PciInfo_fields(Visitor *m, PciInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->bus : NULL, "bus", &err);
+ visit_type_PciDeviceInfoList(m, obj ? &(*obj)->devices : NULL, "devices", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_PciInfo(Visitor *m, PciInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "PciInfo", name, sizeof(PciInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_PciInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_PciInfoList(Visitor *m, PciInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ PciInfoList *native_i = (PciInfoList *)i;
+ visit_type_PciInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOnErrorList(Visitor *m, BlockdevOnErrorList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevOnErrorList *native_i = (BlockdevOnErrorList *)i;
+ visit_type_BlockdevOnError(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOnError(Visitor *m, BlockdevOnError * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, BlockdevOnError_lookup, "BlockdevOnError", name, errp);
+}
+
+void visit_type_MirrorSyncModeList(Visitor *m, MirrorSyncModeList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ MirrorSyncModeList *native_i = (MirrorSyncModeList *)i;
+ visit_type_MirrorSyncMode(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_MirrorSyncMode(Visitor *m, MirrorSyncMode * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, MirrorSyncMode_lookup, "MirrorSyncMode", name, errp);
+}
+
+void visit_type_BlockJobTypeList(Visitor *m, BlockJobTypeList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockJobTypeList *native_i = (BlockJobTypeList *)i;
+ visit_type_BlockJobType(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockJobType(Visitor *m, BlockJobType * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, BlockJobType_lookup, "BlockJobType", name, errp);
+}
+
+static void visit_type_BlockJobInfo_fields(Visitor *m, BlockJobInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->type : NULL, "type", &err);
+ visit_type_str(m, obj ? &(*obj)->device : NULL, "device", &err);
+ visit_type_int(m, obj ? &(*obj)->len : NULL, "len", &err);
+ visit_type_int(m, obj ? &(*obj)->offset : NULL, "offset", &err);
+ visit_type_bool(m, obj ? &(*obj)->busy : NULL, "busy", &err);
+ visit_type_bool(m, obj ? &(*obj)->paused : NULL, "paused", &err);
+ visit_type_int(m, obj ? &(*obj)->speed : NULL, "speed", &err);
+ visit_type_BlockDeviceIoStatus(m, obj ? &(*obj)->io_status : NULL, "io-status", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockJobInfo(Visitor *m, BlockJobInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockJobInfo", name, sizeof(BlockJobInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockJobInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockJobInfoList(Visitor *m, BlockJobInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockJobInfoList *native_i = (BlockJobInfoList *)i;
+ visit_type_BlockJobInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NewImageModeList(Visitor *m, NewImageModeList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NewImageModeList *native_i = (NewImageModeList *)i;
+ visit_type_NewImageMode(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NewImageMode(Visitor *m, NewImageMode * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, NewImageMode_lookup, "NewImageMode", name, errp);
+}
+
+static void visit_type_BlockdevSnapshot_fields(Visitor *m, BlockdevSnapshot ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->device : NULL, "device", &err);
+ visit_type_str(m, obj ? &(*obj)->snapshot_file : NULL, "snapshot-file", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_format : NULL, "format", &err);
+ if (obj && (*obj)->has_format) {
+ visit_type_str(m, obj ? &(*obj)->format : NULL, "format", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_mode : NULL, "mode", &err);
+ if (obj && (*obj)->has_mode) {
+ visit_type_NewImageMode(m, obj ? &(*obj)->mode : NULL, "mode", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevSnapshot(Visitor *m, BlockdevSnapshot ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevSnapshot", name, sizeof(BlockdevSnapshot), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevSnapshot_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevSnapshotList(Visitor *m, BlockdevSnapshotList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevSnapshotList *native_i = (BlockdevSnapshotList *)i;
+ visit_type_BlockdevSnapshot(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockdevSnapshotInternal_fields(Visitor *m, BlockdevSnapshotInternal ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->device : NULL, "device", &err);
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevSnapshotInternal(Visitor *m, BlockdevSnapshotInternal ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevSnapshotInternal", name, sizeof(BlockdevSnapshotInternal), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevSnapshotInternal_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevSnapshotInternalList(Visitor *m, BlockdevSnapshotInternalList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevSnapshotInternalList *native_i = (BlockdevSnapshotInternalList *)i;
+ visit_type_BlockdevSnapshotInternal(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_DriveBackup_fields(Visitor *m, DriveBackup ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->device : NULL, "device", &err);
+ visit_type_str(m, obj ? &(*obj)->target : NULL, "target", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_format : NULL, "format", &err);
+ if (obj && (*obj)->has_format) {
+ visit_type_str(m, obj ? &(*obj)->format : NULL, "format", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_MirrorSyncMode(m, obj ? &(*obj)->sync : NULL, "sync", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_mode : NULL, "mode", &err);
+ if (obj && (*obj)->has_mode) {
+ visit_type_NewImageMode(m, obj ? &(*obj)->mode : NULL, "mode", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_speed : NULL, "speed", &err);
+ if (obj && (*obj)->has_speed) {
+ visit_type_int(m, obj ? &(*obj)->speed : NULL, "speed", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_on_source_error : NULL, "on-source-error", &err);
+ if (obj && (*obj)->has_on_source_error) {
+ visit_type_BlockdevOnError(m, obj ? &(*obj)->on_source_error : NULL, "on-source-error", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_on_target_error : NULL, "on-target-error", &err);
+ if (obj && (*obj)->has_on_target_error) {
+ visit_type_BlockdevOnError(m, obj ? &(*obj)->on_target_error : NULL, "on-target-error", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_DriveBackup(Visitor *m, DriveBackup ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "DriveBackup", name, sizeof(DriveBackup), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_DriveBackup_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_DriveBackupList(Visitor *m, DriveBackupList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ DriveBackupList *native_i = (DriveBackupList *)i;
+ visit_type_DriveBackup(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_Abort_fields(Visitor *m, Abort ** obj, Error **errp)
+{
+ Error *err = NULL;
+
+ error_propagate(errp, err);
+}
+
+void visit_type_Abort(Visitor *m, Abort ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "Abort", name, sizeof(Abort), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_Abort_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_AbortList(Visitor *m, AbortList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ AbortList *native_i = (AbortList *)i;
+ visit_type_Abort(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TransactionActionKind(Visitor *m, TransactionActionKind * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, TransactionActionKind_lookup, "TransactionActionKind", name, errp);
+}
+
+void visit_type_TransactionAction(Visitor *m, TransactionAction ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "TransactionAction", name, sizeof(TransactionAction), &err);
+ if (!err) {
+ if (obj && *obj) {
+ visit_type_TransactionActionKind(m, &(*obj)->kind, "type", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+ case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC:
+ visit_type_BlockdevSnapshot(m, &(*obj)->blockdev_snapshot_sync, "data", &err);
+ break;
+ case TRANSACTION_ACTION_KIND_DRIVE_BACKUP:
+ visit_type_DriveBackup(m, &(*obj)->drive_backup, "data", &err);
+ break;
+ case TRANSACTION_ACTION_KIND_ABORT:
+ visit_type_Abort(m, &(*obj)->abort, "data", &err);
+ break;
+ case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC:
+ visit_type_BlockdevSnapshotInternal(m, &(*obj)->blockdev_snapshot_internal_sync, "data", &err);
+ break;
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TransactionActionList(Visitor *m, TransactionActionList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ TransactionActionList *native_i = (TransactionActionList *)i;
+ visit_type_TransactionAction(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ObjectPropertyInfo_fields(Visitor *m, ObjectPropertyInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ visit_type_str(m, obj ? &(*obj)->type : NULL, "type", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ObjectPropertyInfo(Visitor *m, ObjectPropertyInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ObjectPropertyInfo", name, sizeof(ObjectPropertyInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ObjectPropertyInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ObjectPropertyInfoList(Visitor *m, ObjectPropertyInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ObjectPropertyInfoList *native_i = (ObjectPropertyInfoList *)i;
+ visit_type_ObjectPropertyInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ObjectTypeInfo_fields(Visitor *m, ObjectTypeInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ObjectTypeInfo(Visitor *m, ObjectTypeInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ObjectTypeInfo", name, sizeof(ObjectTypeInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ObjectTypeInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ObjectTypeInfoList(Visitor *m, ObjectTypeInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ObjectTypeInfoList *native_i = (ObjectTypeInfoList *)i;
+ visit_type_ObjectTypeInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_DevicePropertyInfo_fields(Visitor *m, DevicePropertyInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ visit_type_str(m, obj ? &(*obj)->type : NULL, "type", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_DevicePropertyInfo(Visitor *m, DevicePropertyInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "DevicePropertyInfo", name, sizeof(DevicePropertyInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_DevicePropertyInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_DevicePropertyInfoList(Visitor *m, DevicePropertyInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ DevicePropertyInfoList *native_i = (DevicePropertyInfoList *)i;
+ visit_type_DevicePropertyInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevNoneOptions_fields(Visitor *m, NetdevNoneOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevNoneOptions(Visitor *m, NetdevNoneOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevNoneOptions", name, sizeof(NetdevNoneOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevNoneOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevNoneOptionsList(Visitor *m, NetdevNoneOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevNoneOptionsList *native_i = (NetdevNoneOptionsList *)i;
+ visit_type_NetdevNoneOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetLegacyNicOptions_fields(Visitor *m, NetLegacyNicOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_netdev : NULL, "netdev", &err);
+ if (obj && (*obj)->has_netdev) {
+ visit_type_str(m, obj ? &(*obj)->netdev : NULL, "netdev", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_macaddr : NULL, "macaddr", &err);
+ if (obj && (*obj)->has_macaddr) {
+ visit_type_str(m, obj ? &(*obj)->macaddr : NULL, "macaddr", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_model : NULL, "model", &err);
+ if (obj && (*obj)->has_model) {
+ visit_type_str(m, obj ? &(*obj)->model : NULL, "model", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_addr : NULL, "addr", &err);
+ if (obj && (*obj)->has_addr) {
+ visit_type_str(m, obj ? &(*obj)->addr : NULL, "addr", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_vectors : NULL, "vectors", &err);
+ if (obj && (*obj)->has_vectors) {
+ visit_type_uint32(m, obj ? &(*obj)->vectors : NULL, "vectors", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetLegacyNicOptions(Visitor *m, NetLegacyNicOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetLegacyNicOptions", name, sizeof(NetLegacyNicOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetLegacyNicOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetLegacyNicOptionsList(Visitor *m, NetLegacyNicOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetLegacyNicOptionsList *native_i = (NetLegacyNicOptionsList *)i;
+ visit_type_NetLegacyNicOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_String_fields(Visitor *m, String ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->str : NULL, "str", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_String(Visitor *m, String ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "String", name, sizeof(String), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_String_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_StringList(Visitor *m, StringList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ StringList *native_i = (StringList *)i;
+ visit_type_String(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevUserOptions_fields(Visitor *m, NetdevUserOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_hostname : NULL, "hostname", &err);
+ if (obj && (*obj)->has_hostname) {
+ visit_type_str(m, obj ? &(*obj)->hostname : NULL, "hostname", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_q_restrict : NULL, "restrict", &err);
+ if (obj && (*obj)->has_q_restrict) {
+ visit_type_bool(m, obj ? &(*obj)->q_restrict : NULL, "restrict", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_ip : NULL, "ip", &err);
+ if (obj && (*obj)->has_ip) {
+ visit_type_str(m, obj ? &(*obj)->ip : NULL, "ip", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_net : NULL, "net", &err);
+ if (obj && (*obj)->has_net) {
+ visit_type_str(m, obj ? &(*obj)->net : NULL, "net", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_host : NULL, "host", &err);
+ if (obj && (*obj)->has_host) {
+ visit_type_str(m, obj ? &(*obj)->host : NULL, "host", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_tftp : NULL, "tftp", &err);
+ if (obj && (*obj)->has_tftp) {
+ visit_type_str(m, obj ? &(*obj)->tftp : NULL, "tftp", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_bootfile : NULL, "bootfile", &err);
+ if (obj && (*obj)->has_bootfile) {
+ visit_type_str(m, obj ? &(*obj)->bootfile : NULL, "bootfile", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_dhcpstart : NULL, "dhcpstart", &err);
+ if (obj && (*obj)->has_dhcpstart) {
+ visit_type_str(m, obj ? &(*obj)->dhcpstart : NULL, "dhcpstart", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_dns : NULL, "dns", &err);
+ if (obj && (*obj)->has_dns) {
+ visit_type_str(m, obj ? &(*obj)->dns : NULL, "dns", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_dnssearch : NULL, "dnssearch", &err);
+ if (obj && (*obj)->has_dnssearch) {
+ visit_type_StringList(m, obj ? &(*obj)->dnssearch : NULL, "dnssearch", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_smb : NULL, "smb", &err);
+ if (obj && (*obj)->has_smb) {
+ visit_type_str(m, obj ? &(*obj)->smb : NULL, "smb", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_smbserver : NULL, "smbserver", &err);
+ if (obj && (*obj)->has_smbserver) {
+ visit_type_str(m, obj ? &(*obj)->smbserver : NULL, "smbserver", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_hostfwd : NULL, "hostfwd", &err);
+ if (obj && (*obj)->has_hostfwd) {
+ visit_type_StringList(m, obj ? &(*obj)->hostfwd : NULL, "hostfwd", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_guestfwd : NULL, "guestfwd", &err);
+ if (obj && (*obj)->has_guestfwd) {
+ visit_type_StringList(m, obj ? &(*obj)->guestfwd : NULL, "guestfwd", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevUserOptions(Visitor *m, NetdevUserOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevUserOptions", name, sizeof(NetdevUserOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevUserOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevUserOptionsList(Visitor *m, NetdevUserOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevUserOptionsList *native_i = (NetdevUserOptionsList *)i;
+ visit_type_NetdevUserOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevTapOptions_fields(Visitor *m, NetdevTapOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_ifname : NULL, "ifname", &err);
+ if (obj && (*obj)->has_ifname) {
+ visit_type_str(m, obj ? &(*obj)->ifname : NULL, "ifname", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_fd : NULL, "fd", &err);
+ if (obj && (*obj)->has_fd) {
+ visit_type_str(m, obj ? &(*obj)->fd : NULL, "fd", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_fds : NULL, "fds", &err);
+ if (obj && (*obj)->has_fds) {
+ visit_type_str(m, obj ? &(*obj)->fds : NULL, "fds", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_script : NULL, "script", &err);
+ if (obj && (*obj)->has_script) {
+ visit_type_str(m, obj ? &(*obj)->script : NULL, "script", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_downscript : NULL, "downscript", &err);
+ if (obj && (*obj)->has_downscript) {
+ visit_type_str(m, obj ? &(*obj)->downscript : NULL, "downscript", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_helper : NULL, "helper", &err);
+ if (obj && (*obj)->has_helper) {
+ visit_type_str(m, obj ? &(*obj)->helper : NULL, "helper", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_sndbuf : NULL, "sndbuf", &err);
+ if (obj && (*obj)->has_sndbuf) {
+ visit_type_size(m, obj ? &(*obj)->sndbuf : NULL, "sndbuf", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_vnet_hdr : NULL, "vnet_hdr", &err);
+ if (obj && (*obj)->has_vnet_hdr) {
+ visit_type_bool(m, obj ? &(*obj)->vnet_hdr : NULL, "vnet_hdr", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_vhost : NULL, "vhost", &err);
+ if (obj && (*obj)->has_vhost) {
+ visit_type_bool(m, obj ? &(*obj)->vhost : NULL, "vhost", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_vhostfd : NULL, "vhostfd", &err);
+ if (obj && (*obj)->has_vhostfd) {
+ visit_type_str(m, obj ? &(*obj)->vhostfd : NULL, "vhostfd", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_vhostfds : NULL, "vhostfds", &err);
+ if (obj && (*obj)->has_vhostfds) {
+ visit_type_str(m, obj ? &(*obj)->vhostfds : NULL, "vhostfds", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_vhostforce : NULL, "vhostforce", &err);
+ if (obj && (*obj)->has_vhostforce) {
+ visit_type_bool(m, obj ? &(*obj)->vhostforce : NULL, "vhostforce", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_queues : NULL, "queues", &err);
+ if (obj && (*obj)->has_queues) {
+ visit_type_uint32(m, obj ? &(*obj)->queues : NULL, "queues", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevTapOptions(Visitor *m, NetdevTapOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevTapOptions", name, sizeof(NetdevTapOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevTapOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevTapOptionsList(Visitor *m, NetdevTapOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevTapOptionsList *native_i = (NetdevTapOptionsList *)i;
+ visit_type_NetdevTapOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevSocketOptions_fields(Visitor *m, NetdevSocketOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_fd : NULL, "fd", &err);
+ if (obj && (*obj)->has_fd) {
+ visit_type_str(m, obj ? &(*obj)->fd : NULL, "fd", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_listen : NULL, "listen", &err);
+ if (obj && (*obj)->has_listen) {
+ visit_type_str(m, obj ? &(*obj)->listen : NULL, "listen", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_connect : NULL, "connect", &err);
+ if (obj && (*obj)->has_connect) {
+ visit_type_str(m, obj ? &(*obj)->connect : NULL, "connect", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_mcast : NULL, "mcast", &err);
+ if (obj && (*obj)->has_mcast) {
+ visit_type_str(m, obj ? &(*obj)->mcast : NULL, "mcast", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_localaddr : NULL, "localaddr", &err);
+ if (obj && (*obj)->has_localaddr) {
+ visit_type_str(m, obj ? &(*obj)->localaddr : NULL, "localaddr", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_udp : NULL, "udp", &err);
+ if (obj && (*obj)->has_udp) {
+ visit_type_str(m, obj ? &(*obj)->udp : NULL, "udp", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevSocketOptions(Visitor *m, NetdevSocketOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevSocketOptions", name, sizeof(NetdevSocketOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevSocketOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevSocketOptionsList(Visitor *m, NetdevSocketOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevSocketOptionsList *native_i = (NetdevSocketOptionsList *)i;
+ visit_type_NetdevSocketOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevVdeOptions_fields(Visitor *m, NetdevVdeOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_sock : NULL, "sock", &err);
+ if (obj && (*obj)->has_sock) {
+ visit_type_str(m, obj ? &(*obj)->sock : NULL, "sock", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_port : NULL, "port", &err);
+ if (obj && (*obj)->has_port) {
+ visit_type_uint16(m, obj ? &(*obj)->port : NULL, "port", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_group : NULL, "group", &err);
+ if (obj && (*obj)->has_group) {
+ visit_type_str(m, obj ? &(*obj)->group : NULL, "group", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_mode : NULL, "mode", &err);
+ if (obj && (*obj)->has_mode) {
+ visit_type_uint16(m, obj ? &(*obj)->mode : NULL, "mode", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevVdeOptions(Visitor *m, NetdevVdeOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevVdeOptions", name, sizeof(NetdevVdeOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevVdeOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevVdeOptionsList(Visitor *m, NetdevVdeOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevVdeOptionsList *native_i = (NetdevVdeOptionsList *)i;
+ visit_type_NetdevVdeOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevDumpOptions_fields(Visitor *m, NetdevDumpOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_len : NULL, "len", &err);
+ if (obj && (*obj)->has_len) {
+ visit_type_size(m, obj ? &(*obj)->len : NULL, "len", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_file : NULL, "file", &err);
+ if (obj && (*obj)->has_file) {
+ visit_type_str(m, obj ? &(*obj)->file : NULL, "file", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevDumpOptions(Visitor *m, NetdevDumpOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevDumpOptions", name, sizeof(NetdevDumpOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevDumpOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevDumpOptionsList(Visitor *m, NetdevDumpOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevDumpOptionsList *native_i = (NetdevDumpOptionsList *)i;
+ visit_type_NetdevDumpOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevBridgeOptions_fields(Visitor *m, NetdevBridgeOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_br : NULL, "br", &err);
+ if (obj && (*obj)->has_br) {
+ visit_type_str(m, obj ? &(*obj)->br : NULL, "br", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_helper : NULL, "helper", &err);
+ if (obj && (*obj)->has_helper) {
+ visit_type_str(m, obj ? &(*obj)->helper : NULL, "helper", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevBridgeOptions(Visitor *m, NetdevBridgeOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevBridgeOptions", name, sizeof(NetdevBridgeOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevBridgeOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevBridgeOptionsList(Visitor *m, NetdevBridgeOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevBridgeOptionsList *native_i = (NetdevBridgeOptionsList *)i;
+ visit_type_NetdevBridgeOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevHubPortOptions_fields(Visitor *m, NetdevHubPortOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int32(m, obj ? &(*obj)->hubid : NULL, "hubid", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevHubPortOptions(Visitor *m, NetdevHubPortOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevHubPortOptions", name, sizeof(NetdevHubPortOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevHubPortOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevHubPortOptionsList(Visitor *m, NetdevHubPortOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevHubPortOptionsList *native_i = (NetdevHubPortOptionsList *)i;
+ visit_type_NetdevHubPortOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetdevNetmapOptions_fields(Visitor *m, NetdevNetmapOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->ifname : NULL, "ifname", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_devname : NULL, "devname", &err);
+ if (obj && (*obj)->has_devname) {
+ visit_type_str(m, obj ? &(*obj)->devname : NULL, "devname", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetdevNetmapOptions(Visitor *m, NetdevNetmapOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetdevNetmapOptions", name, sizeof(NetdevNetmapOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetdevNetmapOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevNetmapOptionsList(Visitor *m, NetdevNetmapOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevNetmapOptionsList *native_i = (NetdevNetmapOptionsList *)i;
+ visit_type_NetdevNetmapOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetClientOptionsKind(Visitor *m, NetClientOptionsKind * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, NetClientOptionsKind_lookup, "NetClientOptionsKind", name, errp);
+}
+
+void visit_type_NetClientOptions(Visitor *m, NetClientOptions ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "NetClientOptions", name, sizeof(NetClientOptions), &err);
+ if (!err) {
+ if (obj && *obj) {
+ visit_type_NetClientOptionsKind(m, &(*obj)->kind, "type", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+ case NET_CLIENT_OPTIONS_KIND_NONE:
+ visit_type_NetdevNoneOptions(m, &(*obj)->none, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_NIC:
+ visit_type_NetLegacyNicOptions(m, &(*obj)->nic, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_USER:
+ visit_type_NetdevUserOptions(m, &(*obj)->user, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_TAP:
+ visit_type_NetdevTapOptions(m, &(*obj)->tap, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_SOCKET:
+ visit_type_NetdevSocketOptions(m, &(*obj)->socket, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_VDE:
+ visit_type_NetdevVdeOptions(m, &(*obj)->vde, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_DUMP:
+ visit_type_NetdevDumpOptions(m, &(*obj)->dump, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_BRIDGE:
+ visit_type_NetdevBridgeOptions(m, &(*obj)->bridge, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_HUBPORT:
+ visit_type_NetdevHubPortOptions(m, &(*obj)->hubport, "data", &err);
+ break;
+ case NET_CLIENT_OPTIONS_KIND_NETMAP:
+ visit_type_NetdevNetmapOptions(m, &(*obj)->netmap, "data", &err);
+ break;
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetClientOptionsList(Visitor *m, NetClientOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetClientOptionsList *native_i = (NetClientOptionsList *)i;
+ visit_type_NetClientOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_NetLegacy_fields(Visitor *m, NetLegacy ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_vlan : NULL, "vlan", &err);
+ if (obj && (*obj)->has_vlan) {
+ visit_type_int32(m, obj ? &(*obj)->vlan : NULL, "vlan", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_id : NULL, "id", &err);
+ if (obj && (*obj)->has_id) {
+ visit_type_str(m, obj ? &(*obj)->id : NULL, "id", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_name : NULL, "name", &err);
+ if (obj && (*obj)->has_name) {
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_NetClientOptions(m, obj ? &(*obj)->opts : NULL, "opts", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_NetLegacy(Visitor *m, NetLegacy ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "NetLegacy", name, sizeof(NetLegacy), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_NetLegacy_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetLegacyList(Visitor *m, NetLegacyList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetLegacyList *native_i = (NetLegacyList *)i;
+ visit_type_NetLegacy(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_Netdev_fields(Visitor *m, Netdev ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->id : NULL, "id", &err);
+ visit_type_NetClientOptions(m, obj ? &(*obj)->opts : NULL, "opts", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_Netdev(Visitor *m, Netdev ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "Netdev", name, sizeof(Netdev), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_Netdev_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_NetdevList(Visitor *m, NetdevList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ NetdevList *native_i = (NetdevList *)i;
+ visit_type_Netdev(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_InetSocketAddress_fields(Visitor *m, InetSocketAddress ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->host : NULL, "host", &err);
+ visit_type_str(m, obj ? &(*obj)->port : NULL, "port", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_to : NULL, "to", &err);
+ if (obj && (*obj)->has_to) {
+ visit_type_uint16(m, obj ? &(*obj)->to : NULL, "to", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_ipv4 : NULL, "ipv4", &err);
+ if (obj && (*obj)->has_ipv4) {
+ visit_type_bool(m, obj ? &(*obj)->ipv4 : NULL, "ipv4", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_ipv6 : NULL, "ipv6", &err);
+ if (obj && (*obj)->has_ipv6) {
+ visit_type_bool(m, obj ? &(*obj)->ipv6 : NULL, "ipv6", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_InetSocketAddress(Visitor *m, InetSocketAddress ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "InetSocketAddress", name, sizeof(InetSocketAddress), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_InetSocketAddress_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_InetSocketAddressList(Visitor *m, InetSocketAddressList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ InetSocketAddressList *native_i = (InetSocketAddressList *)i;
+ visit_type_InetSocketAddress(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_UnixSocketAddress_fields(Visitor *m, UnixSocketAddress ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->path : NULL, "path", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_UnixSocketAddress(Visitor *m, UnixSocketAddress ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "UnixSocketAddress", name, sizeof(UnixSocketAddress), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_UnixSocketAddress_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_UnixSocketAddressList(Visitor *m, UnixSocketAddressList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ UnixSocketAddressList *native_i = (UnixSocketAddressList *)i;
+ visit_type_UnixSocketAddress(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_SocketAddressKind(Visitor *m, SocketAddressKind * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, SocketAddressKind_lookup, "SocketAddressKind", name, errp);
+}
+
+void visit_type_SocketAddress(Visitor *m, SocketAddress ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "SocketAddress", name, sizeof(SocketAddress), &err);
+ if (!err) {
+ if (obj && *obj) {
+ visit_type_SocketAddressKind(m, &(*obj)->kind, "type", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+ case SOCKET_ADDRESS_KIND_INET:
+ visit_type_InetSocketAddress(m, &(*obj)->inet, "data", &err);
+ break;
+ case SOCKET_ADDRESS_KIND_UNIX:
+ visit_type_UnixSocketAddress(m, &(*obj)->q_unix, "data", &err);
+ break;
+ case SOCKET_ADDRESS_KIND_FD:
+ visit_type_String(m, &(*obj)->fd, "data", &err);
+ break;
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_SocketAddressList(Visitor *m, SocketAddressList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ SocketAddressList *native_i = (SocketAddressList *)i;
+ visit_type_SocketAddress(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_MachineInfo_fields(Visitor *m, MachineInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_alias : NULL, "alias", &err);
+ if (obj && (*obj)->has_alias) {
+ visit_type_str(m, obj ? &(*obj)->alias : NULL, "alias", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_is_default : NULL, "is-default", &err);
+ if (obj && (*obj)->has_is_default) {
+ visit_type_bool(m, obj ? &(*obj)->is_default : NULL, "is-default", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_int(m, obj ? &(*obj)->cpu_max : NULL, "cpu-max", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_MachineInfo(Visitor *m, MachineInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "MachineInfo", name, sizeof(MachineInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_MachineInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_MachineInfoList(Visitor *m, MachineInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ MachineInfoList *native_i = (MachineInfoList *)i;
+ visit_type_MachineInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_CpuDefinitionInfo_fields(Visitor *m, CpuDefinitionInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_CpuDefinitionInfo(Visitor *m, CpuDefinitionInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "CpuDefinitionInfo", name, sizeof(CpuDefinitionInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_CpuDefinitionInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_CpuDefinitionInfoList(Visitor *m, CpuDefinitionInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ CpuDefinitionInfoList *native_i = (CpuDefinitionInfoList *)i;
+ visit_type_CpuDefinitionInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_AddfdInfo_fields(Visitor *m, AddfdInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->fdset_id : NULL, "fdset-id", &err);
+ visit_type_int(m, obj ? &(*obj)->fd : NULL, "fd", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_AddfdInfo(Visitor *m, AddfdInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "AddfdInfo", name, sizeof(AddfdInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_AddfdInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_AddfdInfoList(Visitor *m, AddfdInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ AddfdInfoList *native_i = (AddfdInfoList *)i;
+ visit_type_AddfdInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_FdsetFdInfo_fields(Visitor *m, FdsetFdInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->fd : NULL, "fd", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_opaque : NULL, "opaque", &err);
+ if (obj && (*obj)->has_opaque) {
+ visit_type_str(m, obj ? &(*obj)->opaque : NULL, "opaque", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_FdsetFdInfo(Visitor *m, FdsetFdInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "FdsetFdInfo", name, sizeof(FdsetFdInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_FdsetFdInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_FdsetFdInfoList(Visitor *m, FdsetFdInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ FdsetFdInfoList *native_i = (FdsetFdInfoList *)i;
+ visit_type_FdsetFdInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_FdsetInfo_fields(Visitor *m, FdsetInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->fdset_id : NULL, "fdset-id", &err);
+ visit_type_FdsetFdInfoList(m, obj ? &(*obj)->fds : NULL, "fds", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_FdsetInfo(Visitor *m, FdsetInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "FdsetInfo", name, sizeof(FdsetInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_FdsetInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_FdsetInfoList(Visitor *m, FdsetInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ FdsetInfoList *native_i = (FdsetInfoList *)i;
+ visit_type_FdsetInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_TargetInfo_fields(Visitor *m, TargetInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->arch : NULL, "arch", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_TargetInfo(Visitor *m, TargetInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "TargetInfo", name, sizeof(TargetInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_TargetInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TargetInfoList(Visitor *m, TargetInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ TargetInfoList *native_i = (TargetInfoList *)i;
+ visit_type_TargetInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_QKeyCodeList(Visitor *m, QKeyCodeList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ QKeyCodeList *native_i = (QKeyCodeList *)i;
+ visit_type_QKeyCode(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_QKeyCode(Visitor *m, QKeyCode * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, QKeyCode_lookup, "QKeyCode", name, errp);
+}
+
+void visit_type_KeyValueKind(Visitor *m, KeyValueKind * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, KeyValueKind_lookup, "KeyValueKind", name, errp);
+}
+
+void visit_type_KeyValue(Visitor *m, KeyValue ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "KeyValue", name, sizeof(KeyValue), &err);
+ if (!err) {
+ if (obj && *obj) {
+ visit_type_KeyValueKind(m, &(*obj)->kind, "type", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+ case KEY_VALUE_KIND_NUMBER:
+ visit_type_int(m, &(*obj)->number, "data", &err);
+ break;
+ case KEY_VALUE_KIND_QCODE:
+ visit_type_QKeyCode(m, &(*obj)->qcode, "data", &err);
+ break;
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_KeyValueList(Visitor *m, KeyValueList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ KeyValueList *native_i = (KeyValueList *)i;
+ visit_type_KeyValue(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevFile_fields(Visitor *m, ChardevFile ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_in : NULL, "in", &err);
+ if (obj && (*obj)->has_in) {
+ visit_type_str(m, obj ? &(*obj)->in : NULL, "in", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_str(m, obj ? &(*obj)->out : NULL, "out", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevFile(Visitor *m, ChardevFile ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevFile", name, sizeof(ChardevFile), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevFile_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevFileList(Visitor *m, ChardevFileList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevFileList *native_i = (ChardevFileList *)i;
+ visit_type_ChardevFile(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevHostdev_fields(Visitor *m, ChardevHostdev ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->device : NULL, "device", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevHostdev(Visitor *m, ChardevHostdev ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevHostdev", name, sizeof(ChardevHostdev), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevHostdev_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevHostdevList(Visitor *m, ChardevHostdevList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevHostdevList *native_i = (ChardevHostdevList *)i;
+ visit_type_ChardevHostdev(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevSocket_fields(Visitor *m, ChardevSocket ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_SocketAddress(m, obj ? &(*obj)->addr : NULL, "addr", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_server : NULL, "server", &err);
+ if (obj && (*obj)->has_server) {
+ visit_type_bool(m, obj ? &(*obj)->server : NULL, "server", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_wait : NULL, "wait", &err);
+ if (obj && (*obj)->has_wait) {
+ visit_type_bool(m, obj ? &(*obj)->wait : NULL, "wait", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_nodelay : NULL, "nodelay", &err);
+ if (obj && (*obj)->has_nodelay) {
+ visit_type_bool(m, obj ? &(*obj)->nodelay : NULL, "nodelay", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_telnet : NULL, "telnet", &err);
+ if (obj && (*obj)->has_telnet) {
+ visit_type_bool(m, obj ? &(*obj)->telnet : NULL, "telnet", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevSocket(Visitor *m, ChardevSocket ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevSocket", name, sizeof(ChardevSocket), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevSocket_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevSocketList(Visitor *m, ChardevSocketList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevSocketList *native_i = (ChardevSocketList *)i;
+ visit_type_ChardevSocket(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevUdp_fields(Visitor *m, ChardevUdp ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_SocketAddress(m, obj ? &(*obj)->remote : NULL, "remote", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_local : NULL, "local", &err);
+ if (obj && (*obj)->has_local) {
+ visit_type_SocketAddress(m, obj ? &(*obj)->local : NULL, "local", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevUdp(Visitor *m, ChardevUdp ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevUdp", name, sizeof(ChardevUdp), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevUdp_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevUdpList(Visitor *m, ChardevUdpList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevUdpList *native_i = (ChardevUdpList *)i;
+ visit_type_ChardevUdp(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevMux_fields(Visitor *m, ChardevMux ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->chardev : NULL, "chardev", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevMux(Visitor *m, ChardevMux ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevMux", name, sizeof(ChardevMux), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevMux_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevMuxList(Visitor *m, ChardevMuxList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevMuxList *native_i = (ChardevMuxList *)i;
+ visit_type_ChardevMux(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevStdio_fields(Visitor *m, ChardevStdio ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_signal : NULL, "signal", &err);
+ if (obj && (*obj)->has_signal) {
+ visit_type_bool(m, obj ? &(*obj)->signal : NULL, "signal", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevStdio(Visitor *m, ChardevStdio ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevStdio", name, sizeof(ChardevStdio), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevStdio_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevStdioList(Visitor *m, ChardevStdioList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevStdioList *native_i = (ChardevStdioList *)i;
+ visit_type_ChardevStdio(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevSpiceChannel_fields(Visitor *m, ChardevSpiceChannel ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->type : NULL, "type", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevSpiceChannel(Visitor *m, ChardevSpiceChannel ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevSpiceChannel", name, sizeof(ChardevSpiceChannel), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevSpiceChannel_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevSpiceChannelList(Visitor *m, ChardevSpiceChannelList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevSpiceChannelList *native_i = (ChardevSpiceChannelList *)i;
+ visit_type_ChardevSpiceChannel(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevSpicePort_fields(Visitor *m, ChardevSpicePort ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->fqdn : NULL, "fqdn", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevSpicePort(Visitor *m, ChardevSpicePort ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevSpicePort", name, sizeof(ChardevSpicePort), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevSpicePort_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevSpicePortList(Visitor *m, ChardevSpicePortList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevSpicePortList *native_i = (ChardevSpicePortList *)i;
+ visit_type_ChardevSpicePort(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevVC_fields(Visitor *m, ChardevVC ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_width : NULL, "width", &err);
+ if (obj && (*obj)->has_width) {
+ visit_type_int(m, obj ? &(*obj)->width : NULL, "width", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_height : NULL, "height", &err);
+ if (obj && (*obj)->has_height) {
+ visit_type_int(m, obj ? &(*obj)->height : NULL, "height", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_cols : NULL, "cols", &err);
+ if (obj && (*obj)->has_cols) {
+ visit_type_int(m, obj ? &(*obj)->cols : NULL, "cols", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_rows : NULL, "rows", &err);
+ if (obj && (*obj)->has_rows) {
+ visit_type_int(m, obj ? &(*obj)->rows : NULL, "rows", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevVC(Visitor *m, ChardevVC ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevVC", name, sizeof(ChardevVC), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevVC_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevVCList(Visitor *m, ChardevVCList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevVCList *native_i = (ChardevVCList *)i;
+ visit_type_ChardevVC(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevRingbuf_fields(Visitor *m, ChardevRingbuf ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_size : NULL, "size", &err);
+ if (obj && (*obj)->has_size) {
+ visit_type_int(m, obj ? &(*obj)->size : NULL, "size", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevRingbuf(Visitor *m, ChardevRingbuf ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevRingbuf", name, sizeof(ChardevRingbuf), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevRingbuf_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevRingbufList(Visitor *m, ChardevRingbufList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevRingbufList *native_i = (ChardevRingbufList *)i;
+ visit_type_ChardevRingbuf(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevDummy_fields(Visitor *m, ChardevDummy ** obj, Error **errp)
+{
+ Error *err = NULL;
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevDummy(Visitor *m, ChardevDummy ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevDummy", name, sizeof(ChardevDummy), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevDummy_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevDummyList(Visitor *m, ChardevDummyList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevDummyList *native_i = (ChardevDummyList *)i;
+ visit_type_ChardevDummy(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevBackendKind(Visitor *m, ChardevBackendKind * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, ChardevBackendKind_lookup, "ChardevBackendKind", name, errp);
+}
+
+void visit_type_ChardevBackend(Visitor *m, ChardevBackend ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "ChardevBackend", name, sizeof(ChardevBackend), &err);
+ if (!err) {
+ if (obj && *obj) {
+ visit_type_ChardevBackendKind(m, &(*obj)->kind, "type", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+ case CHARDEV_BACKEND_KIND_FILE:
+ visit_type_ChardevFile(m, &(*obj)->file, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_SERIAL:
+ visit_type_ChardevHostdev(m, &(*obj)->serial, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_PARALLEL:
+ visit_type_ChardevHostdev(m, &(*obj)->parallel, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_PIPE:
+ visit_type_ChardevHostdev(m, &(*obj)->pipe, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_SOCKET:
+ visit_type_ChardevSocket(m, &(*obj)->socket, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_UDP:
+ visit_type_ChardevUdp(m, &(*obj)->udp, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_PTY:
+ visit_type_ChardevDummy(m, &(*obj)->pty, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_NULL:
+ visit_type_ChardevDummy(m, &(*obj)->null, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_MUX:
+ visit_type_ChardevMux(m, &(*obj)->mux, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_MSMOUSE:
+ visit_type_ChardevDummy(m, &(*obj)->msmouse, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_BRAILLE:
+ visit_type_ChardevDummy(m, &(*obj)->braille, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_STDIO:
+ visit_type_ChardevStdio(m, &(*obj)->stdio, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_CONSOLE:
+ visit_type_ChardevDummy(m, &(*obj)->console, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_SPICEVMC:
+ visit_type_ChardevSpiceChannel(m, &(*obj)->spicevmc, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_SPICEPORT:
+ visit_type_ChardevSpicePort(m, &(*obj)->spiceport, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_VC:
+ visit_type_ChardevVC(m, &(*obj)->vc, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_RINGBUF:
+ visit_type_ChardevRingbuf(m, &(*obj)->ringbuf, "data", &err);
+ break;
+ case CHARDEV_BACKEND_KIND_MEMORY:
+ visit_type_ChardevRingbuf(m, &(*obj)->memory, "data", &err);
+ break;
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevBackendList(Visitor *m, ChardevBackendList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevBackendList *native_i = (ChardevBackendList *)i;
+ visit_type_ChardevBackend(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_ChardevReturn_fields(Visitor *m, ChardevReturn ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_pty : NULL, "pty", &err);
+ if (obj && (*obj)->has_pty) {
+ visit_type_str(m, obj ? &(*obj)->pty : NULL, "pty", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_ChardevReturn(Visitor *m, ChardevReturn ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "ChardevReturn", name, sizeof(ChardevReturn), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_ChardevReturn_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_ChardevReturnList(Visitor *m, ChardevReturnList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ ChardevReturnList *native_i = (ChardevReturnList *)i;
+ visit_type_ChardevReturn(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TpmModelList(Visitor *m, TpmModelList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ TpmModelList *native_i = (TpmModelList *)i;
+ visit_type_TpmModel(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TpmModel(Visitor *m, TpmModel * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, TpmModel_lookup, "TpmModel", name, errp);
+}
+
+void visit_type_TpmTypeList(Visitor *m, TpmTypeList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ TpmTypeList *native_i = (TpmTypeList *)i;
+ visit_type_TpmType(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TpmType(Visitor *m, TpmType * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, TpmType_lookup, "TpmType", name, errp);
+}
+
+static void visit_type_TPMPassthroughOptions_fields(Visitor *m, TPMPassthroughOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_path : NULL, "path", &err);
+ if (obj && (*obj)->has_path) {
+ visit_type_str(m, obj ? &(*obj)->path : NULL, "path", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_cancel_path : NULL, "cancel-path", &err);
+ if (obj && (*obj)->has_cancel_path) {
+ visit_type_str(m, obj ? &(*obj)->cancel_path : NULL, "cancel-path", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_TPMPassthroughOptions(Visitor *m, TPMPassthroughOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "TPMPassthroughOptions", name, sizeof(TPMPassthroughOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_TPMPassthroughOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TPMPassthroughOptionsList(Visitor *m, TPMPassthroughOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ TPMPassthroughOptionsList *native_i = (TPMPassthroughOptionsList *)i;
+ visit_type_TPMPassthroughOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TpmTypeOptionsKind(Visitor *m, TpmTypeOptionsKind * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, TpmTypeOptionsKind_lookup, "TpmTypeOptionsKind", name, errp);
+}
+
+void visit_type_TpmTypeOptions(Visitor *m, TpmTypeOptions ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "TpmTypeOptions", name, sizeof(TpmTypeOptions), &err);
+ if (!err) {
+ if (obj && *obj) {
+ visit_type_TpmTypeOptionsKind(m, &(*obj)->kind, "type", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+ case TPM_TYPE_OPTIONS_KIND_PASSTHROUGH:
+ visit_type_TPMPassthroughOptions(m, &(*obj)->passthrough, "data", &err);
+ break;
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TpmTypeOptionsList(Visitor *m, TpmTypeOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ TpmTypeOptionsList *native_i = (TpmTypeOptionsList *)i;
+ visit_type_TpmTypeOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_TPMInfo_fields(Visitor *m, TPMInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->id : NULL, "id", &err);
+ visit_type_TpmModel(m, obj ? &(*obj)->model : NULL, "model", &err);
+ visit_type_TpmTypeOptions(m, obj ? &(*obj)->options : NULL, "options", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_TPMInfo(Visitor *m, TPMInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "TPMInfo", name, sizeof(TPMInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_TPMInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_TPMInfoList(Visitor *m, TPMInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ TPMInfoList *native_i = (TPMInfoList *)i;
+ visit_type_TPMInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_AcpiTableOptions_fields(Visitor *m, AcpiTableOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_sig : NULL, "sig", &err);
+ if (obj && (*obj)->has_sig) {
+ visit_type_str(m, obj ? &(*obj)->sig : NULL, "sig", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_rev : NULL, "rev", &err);
+ if (obj && (*obj)->has_rev) {
+ visit_type_uint8(m, obj ? &(*obj)->rev : NULL, "rev", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_oem_id : NULL, "oem_id", &err);
+ if (obj && (*obj)->has_oem_id) {
+ visit_type_str(m, obj ? &(*obj)->oem_id : NULL, "oem_id", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_oem_table_id : NULL, "oem_table_id", &err);
+ if (obj && (*obj)->has_oem_table_id) {
+ visit_type_str(m, obj ? &(*obj)->oem_table_id : NULL, "oem_table_id", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_oem_rev : NULL, "oem_rev", &err);
+ if (obj && (*obj)->has_oem_rev) {
+ visit_type_uint32(m, obj ? &(*obj)->oem_rev : NULL, "oem_rev", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_asl_compiler_id : NULL, "asl_compiler_id", &err);
+ if (obj && (*obj)->has_asl_compiler_id) {
+ visit_type_str(m, obj ? &(*obj)->asl_compiler_id : NULL, "asl_compiler_id", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_asl_compiler_rev : NULL, "asl_compiler_rev", &err);
+ if (obj && (*obj)->has_asl_compiler_rev) {
+ visit_type_uint32(m, obj ? &(*obj)->asl_compiler_rev : NULL, "asl_compiler_rev", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_file : NULL, "file", &err);
+ if (obj && (*obj)->has_file) {
+ visit_type_str(m, obj ? &(*obj)->file : NULL, "file", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_data : NULL, "data", &err);
+ if (obj && (*obj)->has_data) {
+ visit_type_str(m, obj ? &(*obj)->data : NULL, "data", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_AcpiTableOptions(Visitor *m, AcpiTableOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "AcpiTableOptions", name, sizeof(AcpiTableOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_AcpiTableOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_AcpiTableOptionsList(Visitor *m, AcpiTableOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ AcpiTableOptionsList *native_i = (AcpiTableOptionsList *)i;
+ visit_type_AcpiTableOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_CommandLineParameterTypeList(Visitor *m, CommandLineParameterTypeList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ CommandLineParameterTypeList *native_i = (CommandLineParameterTypeList *)i;
+ visit_type_CommandLineParameterType(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_CommandLineParameterType(Visitor *m, CommandLineParameterType * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, CommandLineParameterType_lookup, "CommandLineParameterType", name, errp);
+}
+
+static void visit_type_CommandLineParameterInfo_fields(Visitor *m, CommandLineParameterInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ visit_type_CommandLineParameterType(m, obj ? &(*obj)->type : NULL, "type", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_help : NULL, "help", &err);
+ if (obj && (*obj)->has_help) {
+ visit_type_str(m, obj ? &(*obj)->help : NULL, "help", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_CommandLineParameterInfo(Visitor *m, CommandLineParameterInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "CommandLineParameterInfo", name, sizeof(CommandLineParameterInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_CommandLineParameterInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_CommandLineParameterInfoList(Visitor *m, CommandLineParameterInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ CommandLineParameterInfoList *native_i = (CommandLineParameterInfoList *)i;
+ visit_type_CommandLineParameterInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_CommandLineOptionInfo_fields(Visitor *m, CommandLineOptionInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->option : NULL, "option", &err);
+ visit_type_CommandLineParameterInfoList(m, obj ? &(*obj)->parameters : NULL, "parameters", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_CommandLineOptionInfo(Visitor *m, CommandLineOptionInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "CommandLineOptionInfo", name, sizeof(CommandLineOptionInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_CommandLineOptionInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_CommandLineOptionInfoList(Visitor *m, CommandLineOptionInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ CommandLineOptionInfoList *native_i = (CommandLineOptionInfoList *)i;
+ visit_type_CommandLineOptionInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_X86CPURegister32List(Visitor *m, X86CPURegister32List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ X86CPURegister32List *native_i = (X86CPURegister32List *)i;
+ visit_type_X86CPURegister32(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_X86CPURegister32(Visitor *m, X86CPURegister32 * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, X86CPURegister32_lookup, "X86CPURegister32", name, errp);
+}
+
+static void visit_type_X86CPUFeatureWordInfo_fields(Visitor *m, X86CPUFeatureWordInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_int(m, obj ? &(*obj)->cpuid_input_eax : NULL, "cpuid-input-eax", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_cpuid_input_ecx : NULL, "cpuid-input-ecx", &err);
+ if (obj && (*obj)->has_cpuid_input_ecx) {
+ visit_type_int(m, obj ? &(*obj)->cpuid_input_ecx : NULL, "cpuid-input-ecx", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_type_X86CPURegister32(m, obj ? &(*obj)->cpuid_register : NULL, "cpuid-register", &err);
+ visit_type_int(m, obj ? &(*obj)->features : NULL, "features", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_X86CPUFeatureWordInfo(Visitor *m, X86CPUFeatureWordInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "X86CPUFeatureWordInfo", name, sizeof(X86CPUFeatureWordInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_X86CPUFeatureWordInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_X86CPUFeatureWordInfoList(Visitor *m, X86CPUFeatureWordInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ X86CPUFeatureWordInfoList *native_i = (X86CPUFeatureWordInfoList *)i;
+ visit_type_X86CPUFeatureWordInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_RxStateList(Visitor *m, RxStateList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ RxStateList *native_i = (RxStateList *)i;
+ visit_type_RxState(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_RxState(Visitor *m, RxState * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, RxState_lookup, "RxState", name, errp);
+}
+
+static void visit_type_RxFilterInfo_fields(Visitor *m, RxFilterInfo ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->name : NULL, "name", &err);
+ visit_type_bool(m, obj ? &(*obj)->promiscuous : NULL, "promiscuous", &err);
+ visit_type_RxState(m, obj ? &(*obj)->multicast : NULL, "multicast", &err);
+ visit_type_RxState(m, obj ? &(*obj)->unicast : NULL, "unicast", &err);
+ visit_type_bool(m, obj ? &(*obj)->broadcast_allowed : NULL, "broadcast-allowed", &err);
+ visit_type_bool(m, obj ? &(*obj)->multicast_overflow : NULL, "multicast-overflow", &err);
+ visit_type_bool(m, obj ? &(*obj)->unicast_overflow : NULL, "unicast-overflow", &err);
+ visit_type_str(m, obj ? &(*obj)->main_mac : NULL, "main-mac", &err);
+ visit_type_intList(m, obj ? &(*obj)->vlan_table : NULL, "vlan-table", &err);
+ visit_type_strList(m, obj ? &(*obj)->unicast_table : NULL, "unicast-table", &err);
+ visit_type_strList(m, obj ? &(*obj)->multicast_table : NULL, "multicast-table", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_RxFilterInfo(Visitor *m, RxFilterInfo ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "RxFilterInfo", name, sizeof(RxFilterInfo), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_RxFilterInfo_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_RxFilterInfoList(Visitor *m, RxFilterInfoList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ RxFilterInfoList *native_i = (RxFilterInfoList *)i;
+ visit_type_RxFilterInfo(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevDiscardOptionsList(Visitor *m, BlockdevDiscardOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevDiscardOptionsList *native_i = (BlockdevDiscardOptionsList *)i;
+ visit_type_BlockdevDiscardOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevDiscardOptions(Visitor *m, BlockdevDiscardOptions * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, BlockdevDiscardOptions_lookup, "BlockdevDiscardOptions", name, errp);
+}
+
+void visit_type_BlockdevAioOptionsList(Visitor *m, BlockdevAioOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevAioOptionsList *native_i = (BlockdevAioOptionsList *)i;
+ visit_type_BlockdevAioOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevAioOptions(Visitor *m, BlockdevAioOptions * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, BlockdevAioOptions_lookup, "BlockdevAioOptions", name, errp);
+}
+
+static void visit_type_BlockdevCacheOptions_fields(Visitor *m, BlockdevCacheOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_writeback : NULL, "writeback", &err);
+ if (obj && (*obj)->has_writeback) {
+ visit_type_bool(m, obj ? &(*obj)->writeback : NULL, "writeback", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_direct : NULL, "direct", &err);
+ if (obj && (*obj)->has_direct) {
+ visit_type_bool(m, obj ? &(*obj)->direct : NULL, "direct", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_no_flush : NULL, "no-flush", &err);
+ if (obj && (*obj)->has_no_flush) {
+ visit_type_bool(m, obj ? &(*obj)->no_flush : NULL, "no-flush", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevCacheOptions(Visitor *m, BlockdevCacheOptions ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevCacheOptions", name, sizeof(BlockdevCacheOptions), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevCacheOptions_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevCacheOptionsList(Visitor *m, BlockdevCacheOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevCacheOptionsList *native_i = (BlockdevCacheOptionsList *)i;
+ visit_type_BlockdevCacheOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockdevOptionsBase_fields(Visitor *m, BlockdevOptionsBase ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->driver : NULL, "driver", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_id : NULL, "id", &err);
+ if (obj && (*obj)->has_id) {
+ visit_type_str(m, obj ? &(*obj)->id : NULL, "id", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_discard : NULL, "discard", &err);
+ if (obj && (*obj)->has_discard) {
+ visit_type_BlockdevDiscardOptions(m, obj ? &(*obj)->discard : NULL, "discard", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_cache : NULL, "cache", &err);
+ if (obj && (*obj)->has_cache) {
+ visit_type_BlockdevCacheOptions(m, obj ? &(*obj)->cache : NULL, "cache", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_aio : NULL, "aio", &err);
+ if (obj && (*obj)->has_aio) {
+ visit_type_BlockdevAioOptions(m, obj ? &(*obj)->aio : NULL, "aio", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_rerror : NULL, "rerror", &err);
+ if (obj && (*obj)->has_rerror) {
+ visit_type_BlockdevOnError(m, obj ? &(*obj)->rerror : NULL, "rerror", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_werror : NULL, "werror", &err);
+ if (obj && (*obj)->has_werror) {
+ visit_type_BlockdevOnError(m, obj ? &(*obj)->werror : NULL, "werror", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_read_only : NULL, "read-only", &err);
+ if (obj && (*obj)->has_read_only) {
+ visit_type_bool(m, obj ? &(*obj)->read_only : NULL, "read-only", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevOptionsBase(Visitor *m, BlockdevOptionsBase ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevOptionsBase", name, sizeof(BlockdevOptionsBase), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevOptionsBase_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOptionsBaseList(Visitor *m, BlockdevOptionsBaseList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevOptionsBaseList *native_i = (BlockdevOptionsBaseList *)i;
+ visit_type_BlockdevOptionsBase(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockdevOptionsFile_fields(Visitor *m, BlockdevOptionsFile ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->filename : NULL, "filename", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevOptionsFile(Visitor *m, BlockdevOptionsFile ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevOptionsFile", name, sizeof(BlockdevOptionsFile), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevOptionsFile_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOptionsFileList(Visitor *m, BlockdevOptionsFileList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevOptionsFileList *native_i = (BlockdevOptionsFileList *)i;
+ visit_type_BlockdevOptionsFile(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockdevOptionsVVFAT_fields(Visitor *m, BlockdevOptionsVVFAT ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_str(m, obj ? &(*obj)->dir : NULL, "dir", &err);
+ visit_start_optional(m, obj ? &(*obj)->has_fat_type : NULL, "fat-type", &err);
+ if (obj && (*obj)->has_fat_type) {
+ visit_type_int(m, obj ? &(*obj)->fat_type : NULL, "fat-type", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_floppy : NULL, "floppy", &err);
+ if (obj && (*obj)->has_floppy) {
+ visit_type_bool(m, obj ? &(*obj)->floppy : NULL, "floppy", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_rw : NULL, "rw", &err);
+ if (obj && (*obj)->has_rw) {
+ visit_type_bool(m, obj ? &(*obj)->rw : NULL, "rw", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevOptionsVVFAT(Visitor *m, BlockdevOptionsVVFAT ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevOptionsVVFAT", name, sizeof(BlockdevOptionsVVFAT), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevOptionsVVFAT_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOptionsVVFATList(Visitor *m, BlockdevOptionsVVFATList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevOptionsVVFATList *native_i = (BlockdevOptionsVVFATList *)i;
+ visit_type_BlockdevOptionsVVFAT(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockdevOptionsGenericFormat_fields(Visitor *m, BlockdevOptionsGenericFormat ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_type_BlockdevRef(m, obj ? &(*obj)->file : NULL, "file", &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevOptionsGenericFormat(Visitor *m, BlockdevOptionsGenericFormat ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevOptionsGenericFormat", name, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOptionsGenericFormatList(Visitor *m, BlockdevOptionsGenericFormatList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevOptionsGenericFormatList *native_i = (BlockdevOptionsGenericFormatList *)i;
+ visit_type_BlockdevOptionsGenericFormat(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockdevOptionsGenericCOWFormat_fields(Visitor *m, BlockdevOptionsGenericCOWFormat ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_implicit_struct(m, obj ? (void**) &(*obj)->base : NULL, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, obj ? &(*obj)->base : NULL, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ visit_start_optional(m, obj ? &(*obj)->has_backing : NULL, "backing", &err);
+ if (obj && (*obj)->has_backing) {
+ visit_type_BlockdevRef(m, obj ? &(*obj)->backing : NULL, "backing", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevOptionsGenericCOWFormat(Visitor *m, BlockdevOptionsGenericCOWFormat ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevOptionsGenericCOWFormat", name, sizeof(BlockdevOptionsGenericCOWFormat), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevOptionsGenericCOWFormat_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOptionsGenericCOWFormatList(Visitor *m, BlockdevOptionsGenericCOWFormatList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevOptionsGenericCOWFormatList *native_i = (BlockdevOptionsGenericCOWFormatList *)i;
+ visit_type_BlockdevOptionsGenericCOWFormat(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+static void visit_type_BlockdevOptionsQcow2_fields(Visitor *m, BlockdevOptionsQcow2 ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_implicit_struct(m, obj ? (void**) &(*obj)->base : NULL, sizeof(BlockdevOptionsGenericCOWFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericCOWFormat_fields(m, obj ? &(*obj)->base : NULL, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ visit_start_optional(m, obj ? &(*obj)->has_lazy_refcounts : NULL, "lazy-refcounts", &err);
+ if (obj && (*obj)->has_lazy_refcounts) {
+ visit_type_bool(m, obj ? &(*obj)->lazy_refcounts : NULL, "lazy-refcounts", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_pass_discard_request : NULL, "pass-discard-request", &err);
+ if (obj && (*obj)->has_pass_discard_request) {
+ visit_type_bool(m, obj ? &(*obj)->pass_discard_request : NULL, "pass-discard-request", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_pass_discard_snapshot : NULL, "pass-discard-snapshot", &err);
+ if (obj && (*obj)->has_pass_discard_snapshot) {
+ visit_type_bool(m, obj ? &(*obj)->pass_discard_snapshot : NULL, "pass-discard-snapshot", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_pass_discard_other : NULL, "pass-discard-other", &err);
+ if (obj && (*obj)->has_pass_discard_other) {
+ visit_type_bool(m, obj ? &(*obj)->pass_discard_other : NULL, "pass-discard-other", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevOptionsQcow2(Visitor *m, BlockdevOptionsQcow2 ** obj, const char *name, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ Error *err = NULL;
+ visit_start_struct(m, (void **)obj, "BlockdevOptionsQcow2", name, sizeof(BlockdevOptionsQcow2), &err);
+ if (!err) {
+ if (!obj || *obj) {
+ visit_type_BlockdevOptionsQcow2_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOptionsQcow2List(Visitor *m, BlockdevOptionsQcow2List ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevOptionsQcow2List *native_i = (BlockdevOptionsQcow2List *)i;
+ visit_type_BlockdevOptionsQcow2(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOptionsKind(Visitor *m, BlockdevOptionsKind * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, BlockdevOptionsKind_lookup, "BlockdevOptionsKind", name, errp);
+}
+
+static void visit_type_BlockdevOptions_fields(Visitor *m, BlockdevOptions ** obj, Error **errp)
+{
+ Error *err = NULL;
+ visit_start_optional(m, obj ? &(*obj)->has_id : NULL, "id", &err);
+ if (obj && (*obj)->has_id) {
+ visit_type_str(m, obj ? &(*obj)->id : NULL, "id", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_discard : NULL, "discard", &err);
+ if (obj && (*obj)->has_discard) {
+ visit_type_BlockdevDiscardOptions(m, obj ? &(*obj)->discard : NULL, "discard", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_cache : NULL, "cache", &err);
+ if (obj && (*obj)->has_cache) {
+ visit_type_BlockdevCacheOptions(m, obj ? &(*obj)->cache : NULL, "cache", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_aio : NULL, "aio", &err);
+ if (obj && (*obj)->has_aio) {
+ visit_type_BlockdevAioOptions(m, obj ? &(*obj)->aio : NULL, "aio", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_rerror : NULL, "rerror", &err);
+ if (obj && (*obj)->has_rerror) {
+ visit_type_BlockdevOnError(m, obj ? &(*obj)->rerror : NULL, "rerror", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_werror : NULL, "werror", &err);
+ if (obj && (*obj)->has_werror) {
+ visit_type_BlockdevOnError(m, obj ? &(*obj)->werror : NULL, "werror", &err);
+ }
+ visit_end_optional(m, &err);
+ visit_start_optional(m, obj ? &(*obj)->has_read_only : NULL, "read-only", &err);
+ if (obj && (*obj)->has_read_only) {
+ visit_type_bool(m, obj ? &(*obj)->read_only : NULL, "read-only", &err);
+ }
+ visit_end_optional(m, &err);
+
+ error_propagate(errp, err);
+}
+
+void visit_type_BlockdevOptions(Visitor *m, BlockdevOptions ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "BlockdevOptions", name, sizeof(BlockdevOptions), &err);
+ if (!err) {
+ if (obj && *obj) {
+ visit_type_BlockdevOptions_fields(m, obj, &err);
+ visit_type_BlockdevOptionsKind(m, &(*obj)->kind, "driver", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+ case BLOCKDEV_OPTIONS_KIND_FILE:
+ visit_start_implicit_struct(m, (void**) &(*obj)->file, sizeof(BlockdevOptionsFile), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsFile_fields(m, &(*obj)->file, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_HTTP:
+ visit_start_implicit_struct(m, (void**) &(*obj)->http, sizeof(BlockdevOptionsFile), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsFile_fields(m, &(*obj)->http, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_HTTPS:
+ visit_start_implicit_struct(m, (void**) &(*obj)->https, sizeof(BlockdevOptionsFile), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsFile_fields(m, &(*obj)->https, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_FTP:
+ visit_start_implicit_struct(m, (void**) &(*obj)->ftp, sizeof(BlockdevOptionsFile), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsFile_fields(m, &(*obj)->ftp, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_FTPS:
+ visit_start_implicit_struct(m, (void**) &(*obj)->ftps, sizeof(BlockdevOptionsFile), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsFile_fields(m, &(*obj)->ftps, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_TFTP:
+ visit_start_implicit_struct(m, (void**) &(*obj)->tftp, sizeof(BlockdevOptionsFile), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsFile_fields(m, &(*obj)->tftp, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_VVFAT:
+ visit_start_implicit_struct(m, (void**) &(*obj)->vvfat, sizeof(BlockdevOptionsVVFAT), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsVVFAT_fields(m, &(*obj)->vvfat, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_BOCHS:
+ visit_start_implicit_struct(m, (void**) &(*obj)->bochs, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, &(*obj)->bochs, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_CLOOP:
+ visit_start_implicit_struct(m, (void**) &(*obj)->cloop, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, &(*obj)->cloop, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_COW:
+ visit_start_implicit_struct(m, (void**) &(*obj)->cow, sizeof(BlockdevOptionsGenericCOWFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericCOWFormat_fields(m, &(*obj)->cow, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_DMG:
+ visit_start_implicit_struct(m, (void**) &(*obj)->dmg, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, &(*obj)->dmg, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_PARALLELS:
+ visit_start_implicit_struct(m, (void**) &(*obj)->parallels, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, &(*obj)->parallels, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_QCOW:
+ visit_start_implicit_struct(m, (void**) &(*obj)->qcow, sizeof(BlockdevOptionsGenericCOWFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericCOWFormat_fields(m, &(*obj)->qcow, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_QCOW2:
+ visit_start_implicit_struct(m, (void**) &(*obj)->qcow2, sizeof(BlockdevOptionsQcow2), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsQcow2_fields(m, &(*obj)->qcow2, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_QED:
+ visit_start_implicit_struct(m, (void**) &(*obj)->qed, sizeof(BlockdevOptionsGenericCOWFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericCOWFormat_fields(m, &(*obj)->qed, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_RAW:
+ visit_start_implicit_struct(m, (void**) &(*obj)->raw, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, &(*obj)->raw, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_VDI:
+ visit_start_implicit_struct(m, (void**) &(*obj)->vdi, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, &(*obj)->vdi, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_VHDX:
+ visit_start_implicit_struct(m, (void**) &(*obj)->vhdx, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, &(*obj)->vhdx, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_VMDK:
+ visit_start_implicit_struct(m, (void**) &(*obj)->vmdk, sizeof(BlockdevOptionsGenericCOWFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericCOWFormat_fields(m, &(*obj)->vmdk, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ case BLOCKDEV_OPTIONS_KIND_VPC:
+ visit_start_implicit_struct(m, (void**) &(*obj)->vpc, sizeof(BlockdevOptionsGenericFormat), &err);
+ if (!err) {
+ visit_type_BlockdevOptionsGenericFormat_fields(m, &(*obj)->vpc, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+ break;
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevOptionsList(Visitor *m, BlockdevOptionsList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevOptionsList *native_i = (BlockdevOptionsList *)i;
+ visit_type_BlockdevOptions(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+
+void visit_type_BlockdevRef(Visitor *m, BlockdevRef ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_implicit_struct(m, (void**) obj, sizeof(BlockdevRef), &err);
+ visit_get_next_type(m, (int*) &(*obj)->kind, BlockdevRef_qtypes, name, &err);
+ switch ((*obj)->kind) {
+ case BLOCKDEV_REF_KIND_DEFINITION:
+ visit_type_BlockdevOptions(m, &(*obj)->definition, name, &err);
+ break;
+ case BLOCKDEV_REF_KIND_REFERENCE:
+ visit_type_str(m, &(*obj)->reference, name, &err);
+ break;
+ default:
+ abort();
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+}
+
+void visit_type_BlockdevRefList(Visitor *m, BlockdevRefList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ BlockdevRefList *native_i = (BlockdevRefList *)i;
+ visit_type_BlockdevRef(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
diff --git a/qapi-auto-generated/qapi-visit.h b/qapi-auto-generated/qapi-visit.h
new file mode 100644
index 0000000..1bad133
--- /dev/null
+++ b/qapi-auto-generated/qapi-visit.h
@@ -0,0 +1,411 @@
+/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QAPI visitor function
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef QAPI_VISIT_H
+#define QAPI_VISIT_H
+
+#include "qapi/visitor.h"
+#include "qapi-types.h"
+
+
+#ifndef QAPI_VISIT_BUILTIN_VISITOR_DECL_H
+#define QAPI_VISIT_BUILTIN_VISITOR_DECL_H
+
+void visit_type_strList(Visitor *m, strList ** obj, const char *name, Error **errp);
+void visit_type_intList(Visitor *m, intList ** obj, const char *name, Error **errp);
+void visit_type_numberList(Visitor *m, numberList ** obj, const char *name, Error **errp);
+void visit_type_boolList(Visitor *m, boolList ** obj, const char *name, Error **errp);
+void visit_type_int8List(Visitor *m, int8List ** obj, const char *name, Error **errp);
+void visit_type_int16List(Visitor *m, int16List ** obj, const char *name, Error **errp);
+void visit_type_int32List(Visitor *m, int32List ** obj, const char *name, Error **errp);
+void visit_type_int64List(Visitor *m, int64List ** obj, const char *name, Error **errp);
+void visit_type_uint8List(Visitor *m, uint8List ** obj, const char *name, Error **errp);
+void visit_type_uint16List(Visitor *m, uint16List ** obj, const char *name, Error **errp);
+void visit_type_uint32List(Visitor *m, uint32List ** obj, const char *name, Error **errp);
+void visit_type_uint64List(Visitor *m, uint64List ** obj, const char *name, Error **errp);
+
+#endif /* QAPI_VISIT_BUILTIN_VISITOR_DECL_H */
+
+
+void visit_type_ErrorClass(Visitor *m, ErrorClass * obj, const char *name, Error **errp);
+void visit_type_ErrorClassList(Visitor *m, ErrorClassList ** obj, const char *name, Error **errp);
+
+void visit_type_NameInfo(Visitor *m, NameInfo ** obj, const char *name, Error **errp);
+void visit_type_NameInfoList(Visitor *m, NameInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_VersionInfo(Visitor *m, VersionInfo ** obj, const char *name, Error **errp);
+void visit_type_VersionInfoList(Visitor *m, VersionInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_KvmInfo(Visitor *m, KvmInfo ** obj, const char *name, Error **errp);
+void visit_type_KvmInfoList(Visitor *m, KvmInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_RunState(Visitor *m, RunState * obj, const char *name, Error **errp);
+void visit_type_RunStateList(Visitor *m, RunStateList ** obj, const char *name, Error **errp);
+
+void visit_type_SnapshotInfo(Visitor *m, SnapshotInfo ** obj, const char *name, Error **errp);
+void visit_type_SnapshotInfoList(Visitor *m, SnapshotInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_ImageInfoSpecificQCow2(Visitor *m, ImageInfoSpecificQCow2 ** obj, const char *name, Error **errp);
+void visit_type_ImageInfoSpecificQCow2List(Visitor *m, ImageInfoSpecificQCow2List ** obj, const char *name, Error **errp);
+
+void visit_type_ImageInfoSpecificVmdk(Visitor *m, ImageInfoSpecificVmdk ** obj, const char *name, Error **errp);
+void visit_type_ImageInfoSpecificVmdkList(Visitor *m, ImageInfoSpecificVmdkList ** obj, const char *name, Error **errp);
+
+void visit_type_ImageInfoSpecificKind(Visitor *m, ImageInfoSpecificKind * obj, const char *name, Error **errp);
+
+void visit_type_ImageInfoSpecific(Visitor *m, ImageInfoSpecific ** obj, const char *name, Error **errp);
+void visit_type_ImageInfoSpecificList(Visitor *m, ImageInfoSpecificList ** obj, const char *name, Error **errp);
+
+void visit_type_ImageInfo(Visitor *m, ImageInfo ** obj, const char *name, Error **errp);
+void visit_type_ImageInfoList(Visitor *m, ImageInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_ImageCheck(Visitor *m, ImageCheck ** obj, const char *name, Error **errp);
+void visit_type_ImageCheckList(Visitor *m, ImageCheckList ** obj, const char *name, Error **errp);
+
+void visit_type_StatusInfo(Visitor *m, StatusInfo ** obj, const char *name, Error **errp);
+void visit_type_StatusInfoList(Visitor *m, StatusInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_UuidInfo(Visitor *m, UuidInfo ** obj, const char *name, Error **errp);
+void visit_type_UuidInfoList(Visitor *m, UuidInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevInfo(Visitor *m, ChardevInfo ** obj, const char *name, Error **errp);
+void visit_type_ChardevInfoList(Visitor *m, ChardevInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_DataFormat(Visitor *m, DataFormat * obj, const char *name, Error **errp);
+void visit_type_DataFormatList(Visitor *m, DataFormatList ** obj, const char *name, Error **errp);
+
+void visit_type_CommandInfo(Visitor *m, CommandInfo ** obj, const char *name, Error **errp);
+void visit_type_CommandInfoList(Visitor *m, CommandInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_EventInfo(Visitor *m, EventInfo ** obj, const char *name, Error **errp);
+void visit_type_EventInfoList(Visitor *m, EventInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_MigrationStats(Visitor *m, MigrationStats ** obj, const char *name, Error **errp);
+void visit_type_MigrationStatsList(Visitor *m, MigrationStatsList ** obj, const char *name, Error **errp);
+
+void visit_type_XBZRLECacheStats(Visitor *m, XBZRLECacheStats ** obj, const char *name, Error **errp);
+void visit_type_XBZRLECacheStatsList(Visitor *m, XBZRLECacheStatsList ** obj, const char *name, Error **errp);
+
+void visit_type_MigrationInfo(Visitor *m, MigrationInfo ** obj, const char *name, Error **errp);
+void visit_type_MigrationInfoList(Visitor *m, MigrationInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_MigrationCapability(Visitor *m, MigrationCapability * obj, const char *name, Error **errp);
+void visit_type_MigrationCapabilityList(Visitor *m, MigrationCapabilityList ** obj, const char *name, Error **errp);
+
+void visit_type_MigrationCapabilityStatus(Visitor *m, MigrationCapabilityStatus ** obj, const char *name, Error **errp);
+void visit_type_MigrationCapabilityStatusList(Visitor *m, MigrationCapabilityStatusList ** obj, const char *name, Error **errp);
+
+void visit_type_MouseInfo(Visitor *m, MouseInfo ** obj, const char *name, Error **errp);
+void visit_type_MouseInfoList(Visitor *m, MouseInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_CpuInfo(Visitor *m, CpuInfo ** obj, const char *name, Error **errp);
+void visit_type_CpuInfoList(Visitor *m, CpuInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockDeviceInfo(Visitor *m, BlockDeviceInfo ** obj, const char *name, Error **errp);
+void visit_type_BlockDeviceInfoList(Visitor *m, BlockDeviceInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockDeviceIoStatus(Visitor *m, BlockDeviceIoStatus * obj, const char *name, Error **errp);
+void visit_type_BlockDeviceIoStatusList(Visitor *m, BlockDeviceIoStatusList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockDeviceMapEntry(Visitor *m, BlockDeviceMapEntry ** obj, const char *name, Error **errp);
+void visit_type_BlockDeviceMapEntryList(Visitor *m, BlockDeviceMapEntryList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockDirtyInfo(Visitor *m, BlockDirtyInfo ** obj, const char *name, Error **errp);
+void visit_type_BlockDirtyInfoList(Visitor *m, BlockDirtyInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockInfo(Visitor *m, BlockInfo ** obj, const char *name, Error **errp);
+void visit_type_BlockInfoList(Visitor *m, BlockInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockDeviceStats(Visitor *m, BlockDeviceStats ** obj, const char *name, Error **errp);
+void visit_type_BlockDeviceStatsList(Visitor *m, BlockDeviceStatsList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockStats(Visitor *m, BlockStats ** obj, const char *name, Error **errp);
+void visit_type_BlockStatsList(Visitor *m, BlockStatsList ** obj, const char *name, Error **errp);
+
+void visit_type_VncClientInfo(Visitor *m, VncClientInfo ** obj, const char *name, Error **errp);
+void visit_type_VncClientInfoList(Visitor *m, VncClientInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_VncInfo(Visitor *m, VncInfo ** obj, const char *name, Error **errp);
+void visit_type_VncInfoList(Visitor *m, VncInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_SpiceChannel(Visitor *m, SpiceChannel ** obj, const char *name, Error **errp);
+void visit_type_SpiceChannelList(Visitor *m, SpiceChannelList ** obj, const char *name, Error **errp);
+
+void visit_type_SpiceQueryMouseMode(Visitor *m, SpiceQueryMouseMode * obj, const char *name, Error **errp);
+void visit_type_SpiceQueryMouseModeList(Visitor *m, SpiceQueryMouseModeList ** obj, const char *name, Error **errp);
+
+void visit_type_SpiceInfo(Visitor *m, SpiceInfo ** obj, const char *name, Error **errp);
+void visit_type_SpiceInfoList(Visitor *m, SpiceInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_BalloonInfo(Visitor *m, BalloonInfo ** obj, const char *name, Error **errp);
+void visit_type_BalloonInfoList(Visitor *m, BalloonInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_PciMemoryRange(Visitor *m, PciMemoryRange ** obj, const char *name, Error **errp);
+void visit_type_PciMemoryRangeList(Visitor *m, PciMemoryRangeList ** obj, const char *name, Error **errp);
+
+void visit_type_PciMemoryRegion(Visitor *m, PciMemoryRegion ** obj, const char *name, Error **errp);
+void visit_type_PciMemoryRegionList(Visitor *m, PciMemoryRegionList ** obj, const char *name, Error **errp);
+
+void visit_type_PciBridgeInfo(Visitor *m, PciBridgeInfo ** obj, const char *name, Error **errp);
+void visit_type_PciBridgeInfoList(Visitor *m, PciBridgeInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_PciDeviceInfo(Visitor *m, PciDeviceInfo ** obj, const char *name, Error **errp);
+void visit_type_PciDeviceInfoList(Visitor *m, PciDeviceInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_PciInfo(Visitor *m, PciInfo ** obj, const char *name, Error **errp);
+void visit_type_PciInfoList(Visitor *m, PciInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOnError(Visitor *m, BlockdevOnError * obj, const char *name, Error **errp);
+void visit_type_BlockdevOnErrorList(Visitor *m, BlockdevOnErrorList ** obj, const char *name, Error **errp);
+
+void visit_type_MirrorSyncMode(Visitor *m, MirrorSyncMode * obj, const char *name, Error **errp);
+void visit_type_MirrorSyncModeList(Visitor *m, MirrorSyncModeList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockJobType(Visitor *m, BlockJobType * obj, const char *name, Error **errp);
+void visit_type_BlockJobTypeList(Visitor *m, BlockJobTypeList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockJobInfo(Visitor *m, BlockJobInfo ** obj, const char *name, Error **errp);
+void visit_type_BlockJobInfoList(Visitor *m, BlockJobInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_NewImageMode(Visitor *m, NewImageMode * obj, const char *name, Error **errp);
+void visit_type_NewImageModeList(Visitor *m, NewImageModeList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevSnapshot(Visitor *m, BlockdevSnapshot ** obj, const char *name, Error **errp);
+void visit_type_BlockdevSnapshotList(Visitor *m, BlockdevSnapshotList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevSnapshotInternal(Visitor *m, BlockdevSnapshotInternal ** obj, const char *name, Error **errp);
+void visit_type_BlockdevSnapshotInternalList(Visitor *m, BlockdevSnapshotInternalList ** obj, const char *name, Error **errp);
+
+void visit_type_DriveBackup(Visitor *m, DriveBackup ** obj, const char *name, Error **errp);
+void visit_type_DriveBackupList(Visitor *m, DriveBackupList ** obj, const char *name, Error **errp);
+
+void visit_type_Abort(Visitor *m, Abort ** obj, const char *name, Error **errp);
+void visit_type_AbortList(Visitor *m, AbortList ** obj, const char *name, Error **errp);
+
+void visit_type_TransactionActionKind(Visitor *m, TransactionActionKind * obj, const char *name, Error **errp);
+
+void visit_type_TransactionAction(Visitor *m, TransactionAction ** obj, const char *name, Error **errp);
+void visit_type_TransactionActionList(Visitor *m, TransactionActionList ** obj, const char *name, Error **errp);
+
+void visit_type_ObjectPropertyInfo(Visitor *m, ObjectPropertyInfo ** obj, const char *name, Error **errp);
+void visit_type_ObjectPropertyInfoList(Visitor *m, ObjectPropertyInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_ObjectTypeInfo(Visitor *m, ObjectTypeInfo ** obj, const char *name, Error **errp);
+void visit_type_ObjectTypeInfoList(Visitor *m, ObjectTypeInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_DevicePropertyInfo(Visitor *m, DevicePropertyInfo ** obj, const char *name, Error **errp);
+void visit_type_DevicePropertyInfoList(Visitor *m, DevicePropertyInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevNoneOptions(Visitor *m, NetdevNoneOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevNoneOptionsList(Visitor *m, NetdevNoneOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetLegacyNicOptions(Visitor *m, NetLegacyNicOptions ** obj, const char *name, Error **errp);
+void visit_type_NetLegacyNicOptionsList(Visitor *m, NetLegacyNicOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_String(Visitor *m, String ** obj, const char *name, Error **errp);
+void visit_type_StringList(Visitor *m, StringList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevUserOptions(Visitor *m, NetdevUserOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevUserOptionsList(Visitor *m, NetdevUserOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevTapOptions(Visitor *m, NetdevTapOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevTapOptionsList(Visitor *m, NetdevTapOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevSocketOptions(Visitor *m, NetdevSocketOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevSocketOptionsList(Visitor *m, NetdevSocketOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevVdeOptions(Visitor *m, NetdevVdeOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevVdeOptionsList(Visitor *m, NetdevVdeOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevDumpOptions(Visitor *m, NetdevDumpOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevDumpOptionsList(Visitor *m, NetdevDumpOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevBridgeOptions(Visitor *m, NetdevBridgeOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevBridgeOptionsList(Visitor *m, NetdevBridgeOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevHubPortOptions(Visitor *m, NetdevHubPortOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevHubPortOptionsList(Visitor *m, NetdevHubPortOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetdevNetmapOptions(Visitor *m, NetdevNetmapOptions ** obj, const char *name, Error **errp);
+void visit_type_NetdevNetmapOptionsList(Visitor *m, NetdevNetmapOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetClientOptionsKind(Visitor *m, NetClientOptionsKind * obj, const char *name, Error **errp);
+
+void visit_type_NetClientOptions(Visitor *m, NetClientOptions ** obj, const char *name, Error **errp);
+void visit_type_NetClientOptionsList(Visitor *m, NetClientOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_NetLegacy(Visitor *m, NetLegacy ** obj, const char *name, Error **errp);
+void visit_type_NetLegacyList(Visitor *m, NetLegacyList ** obj, const char *name, Error **errp);
+
+void visit_type_Netdev(Visitor *m, Netdev ** obj, const char *name, Error **errp);
+void visit_type_NetdevList(Visitor *m, NetdevList ** obj, const char *name, Error **errp);
+
+void visit_type_InetSocketAddress(Visitor *m, InetSocketAddress ** obj, const char *name, Error **errp);
+void visit_type_InetSocketAddressList(Visitor *m, InetSocketAddressList ** obj, const char *name, Error **errp);
+
+void visit_type_UnixSocketAddress(Visitor *m, UnixSocketAddress ** obj, const char *name, Error **errp);
+void visit_type_UnixSocketAddressList(Visitor *m, UnixSocketAddressList ** obj, const char *name, Error **errp);
+
+void visit_type_SocketAddressKind(Visitor *m, SocketAddressKind * obj, const char *name, Error **errp);
+
+void visit_type_SocketAddress(Visitor *m, SocketAddress ** obj, const char *name, Error **errp);
+void visit_type_SocketAddressList(Visitor *m, SocketAddressList ** obj, const char *name, Error **errp);
+
+void visit_type_MachineInfo(Visitor *m, MachineInfo ** obj, const char *name, Error **errp);
+void visit_type_MachineInfoList(Visitor *m, MachineInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_CpuDefinitionInfo(Visitor *m, CpuDefinitionInfo ** obj, const char *name, Error **errp);
+void visit_type_CpuDefinitionInfoList(Visitor *m, CpuDefinitionInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_AddfdInfo(Visitor *m, AddfdInfo ** obj, const char *name, Error **errp);
+void visit_type_AddfdInfoList(Visitor *m, AddfdInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_FdsetFdInfo(Visitor *m, FdsetFdInfo ** obj, const char *name, Error **errp);
+void visit_type_FdsetFdInfoList(Visitor *m, FdsetFdInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_FdsetInfo(Visitor *m, FdsetInfo ** obj, const char *name, Error **errp);
+void visit_type_FdsetInfoList(Visitor *m, FdsetInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_TargetInfo(Visitor *m, TargetInfo ** obj, const char *name, Error **errp);
+void visit_type_TargetInfoList(Visitor *m, TargetInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_QKeyCode(Visitor *m, QKeyCode * obj, const char *name, Error **errp);
+void visit_type_QKeyCodeList(Visitor *m, QKeyCodeList ** obj, const char *name, Error **errp);
+
+void visit_type_KeyValueKind(Visitor *m, KeyValueKind * obj, const char *name, Error **errp);
+
+void visit_type_KeyValue(Visitor *m, KeyValue ** obj, const char *name, Error **errp);
+void visit_type_KeyValueList(Visitor *m, KeyValueList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevFile(Visitor *m, ChardevFile ** obj, const char *name, Error **errp);
+void visit_type_ChardevFileList(Visitor *m, ChardevFileList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevHostdev(Visitor *m, ChardevHostdev ** obj, const char *name, Error **errp);
+void visit_type_ChardevHostdevList(Visitor *m, ChardevHostdevList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevSocket(Visitor *m, ChardevSocket ** obj, const char *name, Error **errp);
+void visit_type_ChardevSocketList(Visitor *m, ChardevSocketList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevUdp(Visitor *m, ChardevUdp ** obj, const char *name, Error **errp);
+void visit_type_ChardevUdpList(Visitor *m, ChardevUdpList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevMux(Visitor *m, ChardevMux ** obj, const char *name, Error **errp);
+void visit_type_ChardevMuxList(Visitor *m, ChardevMuxList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevStdio(Visitor *m, ChardevStdio ** obj, const char *name, Error **errp);
+void visit_type_ChardevStdioList(Visitor *m, ChardevStdioList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevSpiceChannel(Visitor *m, ChardevSpiceChannel ** obj, const char *name, Error **errp);
+void visit_type_ChardevSpiceChannelList(Visitor *m, ChardevSpiceChannelList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevSpicePort(Visitor *m, ChardevSpicePort ** obj, const char *name, Error **errp);
+void visit_type_ChardevSpicePortList(Visitor *m, ChardevSpicePortList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevVC(Visitor *m, ChardevVC ** obj, const char *name, Error **errp);
+void visit_type_ChardevVCList(Visitor *m, ChardevVCList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevRingbuf(Visitor *m, ChardevRingbuf ** obj, const char *name, Error **errp);
+void visit_type_ChardevRingbufList(Visitor *m, ChardevRingbufList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevDummy(Visitor *m, ChardevDummy ** obj, const char *name, Error **errp);
+void visit_type_ChardevDummyList(Visitor *m, ChardevDummyList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevBackendKind(Visitor *m, ChardevBackendKind * obj, const char *name, Error **errp);
+
+void visit_type_ChardevBackend(Visitor *m, ChardevBackend ** obj, const char *name, Error **errp);
+void visit_type_ChardevBackendList(Visitor *m, ChardevBackendList ** obj, const char *name, Error **errp);
+
+void visit_type_ChardevReturn(Visitor *m, ChardevReturn ** obj, const char *name, Error **errp);
+void visit_type_ChardevReturnList(Visitor *m, ChardevReturnList ** obj, const char *name, Error **errp);
+
+void visit_type_TpmModel(Visitor *m, TpmModel * obj, const char *name, Error **errp);
+void visit_type_TpmModelList(Visitor *m, TpmModelList ** obj, const char *name, Error **errp);
+
+void visit_type_TpmType(Visitor *m, TpmType * obj, const char *name, Error **errp);
+void visit_type_TpmTypeList(Visitor *m, TpmTypeList ** obj, const char *name, Error **errp);
+
+void visit_type_TPMPassthroughOptions(Visitor *m, TPMPassthroughOptions ** obj, const char *name, Error **errp);
+void visit_type_TPMPassthroughOptionsList(Visitor *m, TPMPassthroughOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_TpmTypeOptionsKind(Visitor *m, TpmTypeOptionsKind * obj, const char *name, Error **errp);
+
+void visit_type_TpmTypeOptions(Visitor *m, TpmTypeOptions ** obj, const char *name, Error **errp);
+void visit_type_TpmTypeOptionsList(Visitor *m, TpmTypeOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_TPMInfo(Visitor *m, TPMInfo ** obj, const char *name, Error **errp);
+void visit_type_TPMInfoList(Visitor *m, TPMInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_AcpiTableOptions(Visitor *m, AcpiTableOptions ** obj, const char *name, Error **errp);
+void visit_type_AcpiTableOptionsList(Visitor *m, AcpiTableOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_CommandLineParameterType(Visitor *m, CommandLineParameterType * obj, const char *name, Error **errp);
+void visit_type_CommandLineParameterTypeList(Visitor *m, CommandLineParameterTypeList ** obj, const char *name, Error **errp);
+
+void visit_type_CommandLineParameterInfo(Visitor *m, CommandLineParameterInfo ** obj, const char *name, Error **errp);
+void visit_type_CommandLineParameterInfoList(Visitor *m, CommandLineParameterInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_CommandLineOptionInfo(Visitor *m, CommandLineOptionInfo ** obj, const char *name, Error **errp);
+void visit_type_CommandLineOptionInfoList(Visitor *m, CommandLineOptionInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_X86CPURegister32(Visitor *m, X86CPURegister32 * obj, const char *name, Error **errp);
+void visit_type_X86CPURegister32List(Visitor *m, X86CPURegister32List ** obj, const char *name, Error **errp);
+
+void visit_type_X86CPUFeatureWordInfo(Visitor *m, X86CPUFeatureWordInfo ** obj, const char *name, Error **errp);
+void visit_type_X86CPUFeatureWordInfoList(Visitor *m, X86CPUFeatureWordInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_RxState(Visitor *m, RxState * obj, const char *name, Error **errp);
+void visit_type_RxStateList(Visitor *m, RxStateList ** obj, const char *name, Error **errp);
+
+void visit_type_RxFilterInfo(Visitor *m, RxFilterInfo ** obj, const char *name, Error **errp);
+void visit_type_RxFilterInfoList(Visitor *m, RxFilterInfoList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevDiscardOptions(Visitor *m, BlockdevDiscardOptions * obj, const char *name, Error **errp);
+void visit_type_BlockdevDiscardOptionsList(Visitor *m, BlockdevDiscardOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevAioOptions(Visitor *m, BlockdevAioOptions * obj, const char *name, Error **errp);
+void visit_type_BlockdevAioOptionsList(Visitor *m, BlockdevAioOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevCacheOptions(Visitor *m, BlockdevCacheOptions ** obj, const char *name, Error **errp);
+void visit_type_BlockdevCacheOptionsList(Visitor *m, BlockdevCacheOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOptionsBase(Visitor *m, BlockdevOptionsBase ** obj, const char *name, Error **errp);
+void visit_type_BlockdevOptionsBaseList(Visitor *m, BlockdevOptionsBaseList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOptionsFile(Visitor *m, BlockdevOptionsFile ** obj, const char *name, Error **errp);
+void visit_type_BlockdevOptionsFileList(Visitor *m, BlockdevOptionsFileList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOptionsVVFAT(Visitor *m, BlockdevOptionsVVFAT ** obj, const char *name, Error **errp);
+void visit_type_BlockdevOptionsVVFATList(Visitor *m, BlockdevOptionsVVFATList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOptionsGenericFormat(Visitor *m, BlockdevOptionsGenericFormat ** obj, const char *name, Error **errp);
+void visit_type_BlockdevOptionsGenericFormatList(Visitor *m, BlockdevOptionsGenericFormatList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOptionsGenericCOWFormat(Visitor *m, BlockdevOptionsGenericCOWFormat ** obj, const char *name, Error **errp);
+void visit_type_BlockdevOptionsGenericCOWFormatList(Visitor *m, BlockdevOptionsGenericCOWFormatList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOptionsQcow2(Visitor *m, BlockdevOptionsQcow2 ** obj, const char *name, Error **errp);
+void visit_type_BlockdevOptionsQcow2List(Visitor *m, BlockdevOptionsQcow2List ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOptionsKind(Visitor *m, BlockdevOptionsKind * obj, const char *name, Error **errp);
+
+void visit_type_BlockdevOptions(Visitor *m, BlockdevOptions ** obj, const char *name, Error **errp);
+void visit_type_BlockdevOptionsList(Visitor *m, BlockdevOptionsList ** obj, const char *name, Error **errp);
+
+void visit_type_BlockdevRefKind(Visitor *m, BlockdevRefKind * obj, const char *name, Error **errp);
+
+void visit_type_BlockdevRef(Visitor *m, BlockdevRef ** obj, const char *name, Error **errp);
+void visit_type_BlockdevRefList(Visitor *m, BlockdevRefList ** obj, const char *name, Error **errp);
+
+#endif
diff --git a/qapi-auto-generated/qmp-commands.h b/qapi-auto-generated/qmp-commands.h
new file mode 100644
index 0000000..0b2f190
--- /dev/null
+++ b/qapi-auto-generated/qmp-commands.h
@@ -0,0 +1,210 @@
+/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QAPI function prototypes
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef QMP_COMMANDS_H
+#define QMP_COMMANDS_H
+
+#include "qapi-types.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/error.h"
+
+void qmp_add_client(const char * protocol, const char * fdname, bool has_skipauth, bool skipauth, bool has_tls, bool tls, Error **errp);
+int qmp_marshal_input_add_client(Monitor *mon, const QDict *qdict, QObject **ret);
+NameInfo * qmp_query_name(Error **errp);
+int qmp_marshal_input_query_name(Monitor *mon, const QDict *qdict, QObject **ret);
+VersionInfo * qmp_query_version(Error **errp);
+int qmp_marshal_input_query_version(Monitor *mon, const QDict *qdict, QObject **ret);
+KvmInfo * qmp_query_kvm(Error **errp);
+int qmp_marshal_input_query_kvm(Monitor *mon, const QDict *qdict, QObject **ret);
+StatusInfo * qmp_query_status(Error **errp);
+int qmp_marshal_input_query_status(Monitor *mon, const QDict *qdict, QObject **ret);
+UuidInfo * qmp_query_uuid(Error **errp);
+int qmp_marshal_input_query_uuid(Monitor *mon, const QDict *qdict, QObject **ret);
+ChardevInfoList * qmp_query_chardev(Error **errp);
+int qmp_marshal_input_query_chardev(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_ringbuf_write(const char * device, const char * data, bool has_format, DataFormat format, Error **errp);
+int qmp_marshal_input_ringbuf_write(Monitor *mon, const QDict *qdict, QObject **ret);
+char * qmp_ringbuf_read(const char * device, int64_t size, bool has_format, DataFormat format, Error **errp);
+int qmp_marshal_input_ringbuf_read(Monitor *mon, const QDict *qdict, QObject **ret);
+CommandInfoList * qmp_query_commands(Error **errp);
+int qmp_marshal_input_query_commands(Monitor *mon, const QDict *qdict, QObject **ret);
+EventInfoList * qmp_query_events(Error **errp);
+int qmp_marshal_input_query_events(Monitor *mon, const QDict *qdict, QObject **ret);
+MigrationInfo * qmp_query_migrate(Error **errp);
+int qmp_marshal_input_query_migrate(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_migrate_set_capabilities(MigrationCapabilityStatusList * capabilities, Error **errp);
+int qmp_marshal_input_migrate_set_capabilities(Monitor *mon, const QDict *qdict, QObject **ret);
+MigrationCapabilityStatusList * qmp_query_migrate_capabilities(Error **errp);
+int qmp_marshal_input_query_migrate_capabilities(Monitor *mon, const QDict *qdict, QObject **ret);
+MouseInfoList * qmp_query_mice(Error **errp);
+int qmp_marshal_input_query_mice(Monitor *mon, const QDict *qdict, QObject **ret);
+CpuInfoList * qmp_query_cpus(Error **errp);
+int qmp_marshal_input_query_cpus(Monitor *mon, const QDict *qdict, QObject **ret);
+BlockInfoList * qmp_query_block(Error **errp);
+int qmp_marshal_input_query_block(Monitor *mon, const QDict *qdict, QObject **ret);
+BlockStatsList * qmp_query_blockstats(Error **errp);
+int qmp_marshal_input_query_blockstats(Monitor *mon, const QDict *qdict, QObject **ret);
+VncInfo * qmp_query_vnc(Error **errp);
+int qmp_marshal_input_query_vnc(Monitor *mon, const QDict *qdict, QObject **ret);
+SpiceInfo * qmp_query_spice(Error **errp);
+int qmp_marshal_input_query_spice(Monitor *mon, const QDict *qdict, QObject **ret);
+BalloonInfo * qmp_query_balloon(Error **errp);
+int qmp_marshal_input_query_balloon(Monitor *mon, const QDict *qdict, QObject **ret);
+PciInfoList * qmp_query_pci(Error **errp);
+int qmp_marshal_input_query_pci(Monitor *mon, const QDict *qdict, QObject **ret);
+BlockJobInfoList * qmp_query_block_jobs(Error **errp);
+int qmp_marshal_input_query_block_jobs(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_quit(Error **errp);
+int qmp_marshal_input_quit(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_stop(Error **errp);
+int qmp_marshal_input_stop(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_system_reset(Error **errp);
+int qmp_marshal_input_system_reset(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_system_powerdown(Error **errp);
+int qmp_marshal_input_system_powerdown(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_cpu(int64_t index, Error **errp);
+int qmp_marshal_input_cpu(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_cpu_add(int64_t id, Error **errp);
+int qmp_marshal_input_cpu_add(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_memsave(int64_t val, int64_t size, const char * filename, bool has_cpu_index, int64_t cpu_index, Error **errp);
+int qmp_marshal_input_memsave(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_pmemsave(int64_t val, int64_t size, const char * filename, Error **errp);
+int qmp_marshal_input_pmemsave(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_cont(Error **errp);
+int qmp_marshal_input_cont(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_system_wakeup(Error **errp);
+int qmp_marshal_input_system_wakeup(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_inject_nmi(Error **errp);
+int qmp_marshal_input_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_set_link(const char * name, bool up, Error **errp);
+int qmp_marshal_input_set_link(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_passwd(const char * device, const char * password, Error **errp);
+int qmp_marshal_input_block_passwd(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_balloon(int64_t value, Error **errp);
+int qmp_marshal_input_balloon(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_resize(const char * device, int64_t size, Error **errp);
+int qmp_marshal_input_block_resize(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_transaction(TransactionActionList * actions, Error **errp);
+int qmp_marshal_input_transaction(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_blockdev_snapshot_sync(const char * device, const char * snapshot_file, bool has_format, const char * format, bool has_mode, NewImageMode mode, Error **errp);
+int qmp_marshal_input_blockdev_snapshot_sync(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_blockdev_snapshot_internal_sync(const char * device, const char * name, Error **errp);
+int qmp_marshal_input_blockdev_snapshot_internal_sync(Monitor *mon, const QDict *qdict, QObject **ret);
+SnapshotInfo * qmp_blockdev_snapshot_delete_internal_sync(const char * device, bool has_id, const char * id, bool has_name, const char * name, Error **errp);
+int qmp_marshal_input_blockdev_snapshot_delete_internal_sync(Monitor *mon, const QDict *qdict, QObject **ret);
+char * qmp_human_monitor_command(const char * command_line, bool has_cpu_index, int64_t cpu_index, Error **errp);
+int qmp_marshal_input_human_monitor_command(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_commit(const char * device, bool has_base, const char * base, const char * top, bool has_speed, int64_t speed, Error **errp);
+int qmp_marshal_input_block_commit(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_drive_backup(const char * device, const char * target, bool has_format, const char * format, MirrorSyncMode sync, bool has_mode, NewImageMode mode, bool has_speed, int64_t speed, bool has_on_source_error, BlockdevOnError on_source_error, bool has_on_target_error, BlockdevOnError on_target_error, Error **errp);
+int qmp_marshal_input_drive_backup(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_drive_mirror(const char * device, const char * target, bool has_format, const char * format, MirrorSyncMode sync, bool has_mode, NewImageMode mode, bool has_speed, int64_t speed, bool has_granularity, uint32_t granularity, bool has_buf_size, int64_t buf_size, bool has_on_source_error, BlockdevOnError on_source_error, bool has_on_target_error, BlockdevOnError on_target_error, Error **errp);
+int qmp_marshal_input_drive_mirror(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_migrate_cancel(Error **errp);
+int qmp_marshal_input_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_migrate_set_downtime(double value, Error **errp);
+int qmp_marshal_input_migrate_set_downtime(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_migrate_set_speed(int64_t value, Error **errp);
+int qmp_marshal_input_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_migrate_set_cache_size(int64_t value, Error **errp);
+int qmp_marshal_input_migrate_set_cache_size(Monitor *mon, const QDict *qdict, QObject **ret);
+int64_t qmp_query_migrate_cache_size(Error **errp);
+int qmp_marshal_input_query_migrate_cache_size(Monitor *mon, const QDict *qdict, QObject **ret);
+ObjectPropertyInfoList * qmp_qom_list(const char * path, Error **errp);
+int qmp_marshal_input_qom_list(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_set_password(const char * protocol, const char * password, bool has_connected, const char * connected, Error **errp);
+int qmp_marshal_input_set_password(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_expire_password(const char * protocol, const char * time, Error **errp);
+int qmp_marshal_input_expire_password(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_eject(const char * device, bool has_force, bool force, Error **errp);
+int qmp_marshal_input_eject(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_change_vnc_password(const char * password, Error **errp);
+int qmp_marshal_input_change_vnc_password(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_change(const char * device, const char * target, bool has_arg, const char * arg, Error **errp);
+int qmp_marshal_input_change(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_set_io_throttle(const char * device, int64_t bps, int64_t bps_rd, int64_t bps_wr, int64_t iops, int64_t iops_rd, int64_t iops_wr, bool has_bps_max, int64_t bps_max, bool has_bps_rd_max, int64_t bps_rd_max, bool has_bps_wr_max, int64_t bps_wr_max, bool has_iops_max, int64_t iops_max, bool has_iops_rd_max, int64_t iops_rd_max, bool has_iops_wr_max, int64_t iops_wr_max, bool has_iops_size, int64_t iops_size, Error **errp);
+int qmp_marshal_input_block_set_io_throttle(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_stream(const char * device, bool has_base, const char * base, bool has_speed, int64_t speed, bool has_on_error, BlockdevOnError on_error, Error **errp);
+int qmp_marshal_input_block_stream(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_job_set_speed(const char * device, int64_t speed, Error **errp);
+int qmp_marshal_input_block_job_set_speed(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_job_cancel(const char * device, bool has_force, bool force, Error **errp);
+int qmp_marshal_input_block_job_cancel(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_job_pause(const char * device, Error **errp);
+int qmp_marshal_input_block_job_pause(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_job_resume(const char * device, Error **errp);
+int qmp_marshal_input_block_job_resume(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_block_job_complete(const char * device, Error **errp);
+int qmp_marshal_input_block_job_complete(Monitor *mon, const QDict *qdict, QObject **ret);
+ObjectTypeInfoList * qmp_qom_list_types(bool has_implements, const char * implements, bool has_abstract, bool abstract, Error **errp);
+int qmp_marshal_input_qom_list_types(Monitor *mon, const QDict *qdict, QObject **ret);
+DevicePropertyInfoList * qmp_device_list_properties(const char * q_typename, Error **errp);
+int qmp_marshal_input_device_list_properties(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_migrate(const char * uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, Error **errp);
+int qmp_marshal_input_migrate(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_xen_save_devices_state(const char * filename, Error **errp);
+int qmp_marshal_input_xen_save_devices_state(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_xen_set_global_dirty_log(bool enable, Error **errp);
+int qmp_marshal_input_xen_set_global_dirty_log(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_device_del(const char * id, Error **errp);
+int qmp_marshal_input_device_del(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_dump_guest_memory(bool paging, const char * protocol, bool has_begin, int64_t begin, bool has_length, int64_t length, Error **errp);
+int qmp_marshal_input_dump_guest_memory(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_netdev_del(const char * id, Error **errp);
+int qmp_marshal_input_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_getfd(const char * fdname, Error **errp);
+int qmp_marshal_input_getfd(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_closefd(const char * fdname, Error **errp);
+int qmp_marshal_input_closefd(Monitor *mon, const QDict *qdict, QObject **ret);
+MachineInfoList * qmp_query_machines(Error **errp);
+int qmp_marshal_input_query_machines(Monitor *mon, const QDict *qdict, QObject **ret);
+CpuDefinitionInfoList * qmp_query_cpu_definitions(Error **errp);
+int qmp_marshal_input_query_cpu_definitions(Monitor *mon, const QDict *qdict, QObject **ret);
+AddfdInfo * qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque, const char * opaque, Error **errp);
+int qmp_marshal_input_add_fd(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_remove_fd(int64_t fdset_id, bool has_fd, int64_t fd, Error **errp);
+int qmp_marshal_input_remove_fd(Monitor *mon, const QDict *qdict, QObject **ret);
+FdsetInfoList * qmp_query_fdsets(Error **errp);
+int qmp_marshal_input_query_fdsets(Monitor *mon, const QDict *qdict, QObject **ret);
+TargetInfo * qmp_query_target(Error **errp);
+int qmp_marshal_input_query_target(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_send_key(KeyValueList * keys, bool has_hold_time, int64_t hold_time, Error **errp);
+int qmp_marshal_input_send_key(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_screendump(const char * filename, Error **errp);
+int qmp_marshal_input_screendump(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_nbd_server_start(SocketAddress * addr, Error **errp);
+int qmp_marshal_input_nbd_server_start(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_nbd_server_add(const char * device, bool has_writable, bool writable, Error **errp);
+int qmp_marshal_input_nbd_server_add(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_nbd_server_stop(Error **errp);
+int qmp_marshal_input_nbd_server_stop(Monitor *mon, const QDict *qdict, QObject **ret);
+ChardevReturn * qmp_chardev_add(const char * id, ChardevBackend * backend, Error **errp);
+int qmp_marshal_input_chardev_add(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_chardev_remove(const char * id, Error **errp);
+int qmp_marshal_input_chardev_remove(Monitor *mon, const QDict *qdict, QObject **ret);
+TpmModelList * qmp_query_tpm_models(Error **errp);
+int qmp_marshal_input_query_tpm_models(Monitor *mon, const QDict *qdict, QObject **ret);
+TpmTypeList * qmp_query_tpm_types(Error **errp);
+int qmp_marshal_input_query_tpm_types(Monitor *mon, const QDict *qdict, QObject **ret);
+TPMInfoList * qmp_query_tpm(Error **errp);
+int qmp_marshal_input_query_tpm(Monitor *mon, const QDict *qdict, QObject **ret);
+CommandLineOptionInfoList * qmp_query_command_line_options(bool has_option, const char * option, Error **errp);
+int qmp_marshal_input_query_command_line_options(Monitor *mon, const QDict *qdict, QObject **ret);
+RxFilterInfoList * qmp_query_rx_filter(bool has_name, const char * name, Error **errp);
+int qmp_marshal_input_query_rx_filter(Monitor *mon, const QDict *qdict, QObject **ret);
+void qmp_blockdev_add(BlockdevOptions * options, Error **errp);
+int qmp_marshal_input_blockdev_add(Monitor *mon, const QDict *qdict, QObject **ret);
+
+#endif
diff --git a/qapi-auto-generated/qmp-marshal.c b/qapi-auto-generated/qmp-marshal.c
new file mode 100644
index 0000000..8acee1a
--- /dev/null
+++ b/qapi-auto-generated/qmp-marshal.c
@@ -0,0 +1,4235 @@
+/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QMP->QAPI command dispatch
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include "qemu-common.h"
+#include "qemu/module.h"
+#include "qapi/qmp/qerror.h"
+#include "qapi/qmp/types.h"
+#include "qapi/qmp/dispatch.h"
+#include "qapi/visitor.h"
+#include "qapi/qmp-output-visitor.h"
+#include "qapi/qmp-input-visitor.h"
+#include "qapi/dealloc-visitor.h"
+#include "qapi-types.h"
+#include "qapi-visit.h"
+
+#include "qmp-commands.h"
+
+int qmp_marshal_input_add_client(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * protocol = NULL;
+ char * fdname = NULL;
+ bool has_skipauth = false;
+ bool skipauth;
+ bool has_tls = false;
+ bool tls;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &protocol, "protocol", errp);
+ visit_type_str(v, &fdname, "fdname", errp);
+ visit_start_optional(v, &has_skipauth, "skipauth", errp);
+ if (has_skipauth) {
+ visit_type_bool(v, &skipauth, "skipauth", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_tls, "tls", errp);
+ if (has_tls) {
+ visit_type_bool(v, &tls, "tls", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_add_client(protocol, fdname, has_skipauth, skipauth, has_tls, tls, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &protocol, "protocol", NULL);
+ visit_type_str(v, &fdname, "fdname", NULL);
+ visit_start_optional(v, &has_skipauth, "skipauth", NULL);
+ if (has_skipauth) {
+ visit_type_bool(v, &skipauth, "skipauth", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_tls, "tls", NULL);
+ if (has_tls) {
+ visit_type_bool(v, &tls, "tls", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_name(NameInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_NameInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_NameInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_name(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ NameInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_name(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_name(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_version(VersionInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_VersionInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_VersionInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_version(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ VersionInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_version(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_version(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_kvm(KvmInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_KvmInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_KvmInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_kvm(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ KvmInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_kvm(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_kvm(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_status(StatusInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_StatusInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_StatusInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_status(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ StatusInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_status(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_status(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_uuid(UuidInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_UuidInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_UuidInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_uuid(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ UuidInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_uuid(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_uuid(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_chardev(ChardevInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_ChardevInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_chardev(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ ChardevInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_chardev(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_chardev(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_ringbuf_write(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ char * data = NULL;
+ bool has_format = false;
+ DataFormat format;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_str(v, &data, "data", errp);
+ visit_start_optional(v, &has_format, "format", errp);
+ if (has_format) {
+ visit_type_DataFormat(v, &format, "format", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_ringbuf_write(device, data, has_format, format, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_str(v, &data, "data", NULL);
+ visit_start_optional(v, &has_format, "format", NULL);
+ if (has_format) {
+ visit_type_DataFormat(v, &format, "format", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_ringbuf_read(char * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_str(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_ringbuf_read(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ char * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ int64_t size;
+ bool has_format = false;
+ DataFormat format;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_int(v, &size, "size", errp);
+ visit_start_optional(v, &has_format, "format", errp);
+ if (has_format) {
+ visit_type_DataFormat(v, &format, "format", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_ringbuf_read(device, size, has_format, format, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_ringbuf_read(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_int(v, &size, "size", NULL);
+ visit_start_optional(v, &has_format, "format", NULL);
+ if (has_format) {
+ visit_type_DataFormat(v, &format, "format", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_commands(CommandInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_CommandInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_commands(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ CommandInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_commands(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_commands(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_events(EventInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_EventInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_EventInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_events(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ EventInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_events(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_events(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_migrate(MigrationInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_MigrationInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_migrate(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ MigrationInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_migrate(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_migrate(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_migrate_set_capabilities(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ MigrationCapabilityStatusList * capabilities = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_MigrationCapabilityStatusList(v, &capabilities, "capabilities", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_migrate_set_capabilities(capabilities, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationCapabilityStatusList(v, &capabilities, "capabilities", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_migrate_capabilities(MigrationCapabilityStatusList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_MigrationCapabilityStatusList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MigrationCapabilityStatusList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_migrate_capabilities(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ MigrationCapabilityStatusList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_migrate_capabilities(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_migrate_capabilities(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_mice(MouseInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_MouseInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MouseInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_mice(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ MouseInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_mice(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_mice(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_cpus(CpuInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_CpuInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CpuInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_cpus(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ CpuInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_cpus(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_cpus(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_block(BlockInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_BlockInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_block(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ BlockInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_block(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_block(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_blockstats(BlockStatsList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_BlockStatsList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockStatsList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_blockstats(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ BlockStatsList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_blockstats(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_blockstats(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_vnc(VncInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_VncInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_VncInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_vnc(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ VncInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_vnc(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_vnc(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_spice(SpiceInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_SpiceInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SpiceInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_spice(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ SpiceInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_spice(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_spice(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_balloon(BalloonInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_BalloonInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BalloonInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_balloon(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ BalloonInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_balloon(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_balloon(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_pci(PciInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_PciInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_PciInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_pci(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ PciInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_pci(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_pci(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_block_jobs(BlockJobInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_BlockJobInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockJobInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_block_jobs(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ BlockJobInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_block_jobs(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_block_jobs(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_quit(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_quit(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_stop(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_stop(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_system_reset(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_system_reset(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_system_powerdown(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_system_powerdown(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_cpu(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ int64_t index;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_int(v, &index, "index", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_cpu(index, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &index, "index", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_cpu_add(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ int64_t id;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_int(v, &id, "id", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_cpu_add(id, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &id, "id", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_memsave(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ int64_t val;
+ int64_t size;
+ char * filename = NULL;
+ bool has_cpu_index = false;
+ int64_t cpu_index;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_int(v, &val, "val", errp);
+ visit_type_int(v, &size, "size", errp);
+ visit_type_str(v, &filename, "filename", errp);
+ visit_start_optional(v, &has_cpu_index, "cpu-index", errp);
+ if (has_cpu_index) {
+ visit_type_int(v, &cpu_index, "cpu-index", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_memsave(val, size, filename, has_cpu_index, cpu_index, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &val, "val", NULL);
+ visit_type_int(v, &size, "size", NULL);
+ visit_type_str(v, &filename, "filename", NULL);
+ visit_start_optional(v, &has_cpu_index, "cpu-index", NULL);
+ if (has_cpu_index) {
+ visit_type_int(v, &cpu_index, "cpu-index", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_pmemsave(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ int64_t val;
+ int64_t size;
+ char * filename = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_int(v, &val, "val", errp);
+ visit_type_int(v, &size, "size", errp);
+ visit_type_str(v, &filename, "filename", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_pmemsave(val, size, filename, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &val, "val", NULL);
+ visit_type_int(v, &size, "size", NULL);
+ visit_type_str(v, &filename, "filename", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_cont(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_cont(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_system_wakeup(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_system_wakeup(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_inject_nmi(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_set_link(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * name = NULL;
+ bool up;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &name, "name", errp);
+ visit_type_bool(v, &up, "up", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_set_link(name, up, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &name, "name", NULL);
+ visit_type_bool(v, &up, "up", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_passwd(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ char * password = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_str(v, &password, "password", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_passwd(device, password, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_str(v, &password, "password", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_balloon(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ int64_t value;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_int(v, &value, "value", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_balloon(value, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &value, "value", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_resize(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ int64_t size;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_int(v, &size, "size", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_resize(device, size, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_int(v, &size, "size", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_transaction(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ TransactionActionList * actions = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_TransactionActionList(v, &actions, "actions", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_transaction(actions, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TransactionActionList(v, &actions, "actions", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_blockdev_snapshot_sync(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ char * snapshot_file = NULL;
+ bool has_format = false;
+ char * format = NULL;
+ bool has_mode = false;
+ NewImageMode mode;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_str(v, &snapshot_file, "snapshot-file", errp);
+ visit_start_optional(v, &has_format, "format", errp);
+ if (has_format) {
+ visit_type_str(v, &format, "format", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_mode, "mode", errp);
+ if (has_mode) {
+ visit_type_NewImageMode(v, &mode, "mode", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_blockdev_snapshot_sync(device, snapshot_file, has_format, format, has_mode, mode, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_str(v, &snapshot_file, "snapshot-file", NULL);
+ visit_start_optional(v, &has_format, "format", NULL);
+ if (has_format) {
+ visit_type_str(v, &format, "format", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_mode, "mode", NULL);
+ if (has_mode) {
+ visit_type_NewImageMode(v, &mode, "mode", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_blockdev_snapshot_internal_sync(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ char * name = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_str(v, &name, "name", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_blockdev_snapshot_internal_sync(device, name, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_str(v, &name, "name", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_blockdev_snapshot_delete_internal_sync(SnapshotInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_SnapshotInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SnapshotInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_blockdev_snapshot_delete_internal_sync(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ SnapshotInfo * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ bool has_id = false;
+ char * id = NULL;
+ bool has_name = false;
+ char * name = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_start_optional(v, &has_id, "id", errp);
+ if (has_id) {
+ visit_type_str(v, &id, "id", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_name, "name", errp);
+ if (has_name) {
+ visit_type_str(v, &name, "name", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_blockdev_snapshot_delete_internal_sync(device, has_id, id, has_name, name, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_blockdev_snapshot_delete_internal_sync(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_start_optional(v, &has_id, "id", NULL);
+ if (has_id) {
+ visit_type_str(v, &id, "id", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_name, "name", NULL);
+ if (has_name) {
+ visit_type_str(v, &name, "name", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_human_monitor_command(char * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_str(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_human_monitor_command(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ char * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * command_line = NULL;
+ bool has_cpu_index = false;
+ int64_t cpu_index;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &command_line, "command-line", errp);
+ visit_start_optional(v, &has_cpu_index, "cpu-index", errp);
+ if (has_cpu_index) {
+ visit_type_int(v, &cpu_index, "cpu-index", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_human_monitor_command(command_line, has_cpu_index, cpu_index, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_human_monitor_command(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &command_line, "command-line", NULL);
+ visit_start_optional(v, &has_cpu_index, "cpu-index", NULL);
+ if (has_cpu_index) {
+ visit_type_int(v, &cpu_index, "cpu-index", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_commit(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ bool has_base = false;
+ char * base = NULL;
+ char * top = NULL;
+ bool has_speed = false;
+ int64_t speed;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_start_optional(v, &has_base, "base", errp);
+ if (has_base) {
+ visit_type_str(v, &base, "base", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_type_str(v, &top, "top", errp);
+ visit_start_optional(v, &has_speed, "speed", errp);
+ if (has_speed) {
+ visit_type_int(v, &speed, "speed", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_commit(device, has_base, base, top, has_speed, speed, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_start_optional(v, &has_base, "base", NULL);
+ if (has_base) {
+ visit_type_str(v, &base, "base", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_type_str(v, &top, "top", NULL);
+ visit_start_optional(v, &has_speed, "speed", NULL);
+ if (has_speed) {
+ visit_type_int(v, &speed, "speed", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_drive_backup(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ char * target = NULL;
+ bool has_format = false;
+ char * format = NULL;
+ MirrorSyncMode sync;
+ bool has_mode = false;
+ NewImageMode mode;
+ bool has_speed = false;
+ int64_t speed;
+ bool has_on_source_error = false;
+ BlockdevOnError on_source_error;
+ bool has_on_target_error = false;
+ BlockdevOnError on_target_error;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_str(v, &target, "target", errp);
+ visit_start_optional(v, &has_format, "format", errp);
+ if (has_format) {
+ visit_type_str(v, &format, "format", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_type_MirrorSyncMode(v, &sync, "sync", errp);
+ visit_start_optional(v, &has_mode, "mode", errp);
+ if (has_mode) {
+ visit_type_NewImageMode(v, &mode, "mode", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_speed, "speed", errp);
+ if (has_speed) {
+ visit_type_int(v, &speed, "speed", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_on_source_error, "on-source-error", errp);
+ if (has_on_source_error) {
+ visit_type_BlockdevOnError(v, &on_source_error, "on-source-error", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_on_target_error, "on-target-error", errp);
+ if (has_on_target_error) {
+ visit_type_BlockdevOnError(v, &on_target_error, "on-target-error", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_drive_backup(device, target, has_format, format, sync, has_mode, mode, has_speed, speed, has_on_source_error, on_source_error, has_on_target_error, on_target_error, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_str(v, &target, "target", NULL);
+ visit_start_optional(v, &has_format, "format", NULL);
+ if (has_format) {
+ visit_type_str(v, &format, "format", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_type_MirrorSyncMode(v, &sync, "sync", NULL);
+ visit_start_optional(v, &has_mode, "mode", NULL);
+ if (has_mode) {
+ visit_type_NewImageMode(v, &mode, "mode", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_speed, "speed", NULL);
+ if (has_speed) {
+ visit_type_int(v, &speed, "speed", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_on_source_error, "on-source-error", NULL);
+ if (has_on_source_error) {
+ visit_type_BlockdevOnError(v, &on_source_error, "on-source-error", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_on_target_error, "on-target-error", NULL);
+ if (has_on_target_error) {
+ visit_type_BlockdevOnError(v, &on_target_error, "on-target-error", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_drive_mirror(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ char * target = NULL;
+ bool has_format = false;
+ char * format = NULL;
+ MirrorSyncMode sync;
+ bool has_mode = false;
+ NewImageMode mode;
+ bool has_speed = false;
+ int64_t speed;
+ bool has_granularity = false;
+ uint32_t granularity;
+ bool has_buf_size = false;
+ int64_t buf_size;
+ bool has_on_source_error = false;
+ BlockdevOnError on_source_error;
+ bool has_on_target_error = false;
+ BlockdevOnError on_target_error;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_str(v, &target, "target", errp);
+ visit_start_optional(v, &has_format, "format", errp);
+ if (has_format) {
+ visit_type_str(v, &format, "format", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_type_MirrorSyncMode(v, &sync, "sync", errp);
+ visit_start_optional(v, &has_mode, "mode", errp);
+ if (has_mode) {
+ visit_type_NewImageMode(v, &mode, "mode", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_speed, "speed", errp);
+ if (has_speed) {
+ visit_type_int(v, &speed, "speed", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_granularity, "granularity", errp);
+ if (has_granularity) {
+ visit_type_uint32(v, &granularity, "granularity", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_buf_size, "buf-size", errp);
+ if (has_buf_size) {
+ visit_type_int(v, &buf_size, "buf-size", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_on_source_error, "on-source-error", errp);
+ if (has_on_source_error) {
+ visit_type_BlockdevOnError(v, &on_source_error, "on-source-error", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_on_target_error, "on-target-error", errp);
+ if (has_on_target_error) {
+ visit_type_BlockdevOnError(v, &on_target_error, "on-target-error", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_drive_mirror(device, target, has_format, format, sync, has_mode, mode, has_speed, speed, has_granularity, granularity, has_buf_size, buf_size, has_on_source_error, on_source_error, has_on_target_error, on_target_error, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_str(v, &target, "target", NULL);
+ visit_start_optional(v, &has_format, "format", NULL);
+ if (has_format) {
+ visit_type_str(v, &format, "format", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_type_MirrorSyncMode(v, &sync, "sync", NULL);
+ visit_start_optional(v, &has_mode, "mode", NULL);
+ if (has_mode) {
+ visit_type_NewImageMode(v, &mode, "mode", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_speed, "speed", NULL);
+ if (has_speed) {
+ visit_type_int(v, &speed, "speed", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_granularity, "granularity", NULL);
+ if (has_granularity) {
+ visit_type_uint32(v, &granularity, "granularity", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_buf_size, "buf-size", NULL);
+ if (has_buf_size) {
+ visit_type_int(v, &buf_size, "buf-size", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_on_source_error, "on-source-error", NULL);
+ if (has_on_source_error) {
+ visit_type_BlockdevOnError(v, &on_source_error, "on-source-error", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_on_target_error, "on-target-error", NULL);
+ if (has_on_target_error) {
+ visit_type_BlockdevOnError(v, &on_target_error, "on-target-error", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_migrate_cancel(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_migrate_set_downtime(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ double value;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_number(v, &value, "value", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_migrate_set_downtime(value, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_number(v, &value, "value", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ int64_t value;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_int(v, &value, "value", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_migrate_set_speed(value, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &value, "value", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_migrate_set_cache_size(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ int64_t value;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_int(v, &value, "value", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_migrate_set_cache_size(value, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &value, "value", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_migrate_cache_size(int64_t ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_int(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_migrate_cache_size(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ int64_t retval;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_migrate_cache_size(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_migrate_cache_size(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_qom_list(ObjectPropertyInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_ObjectPropertyInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ObjectPropertyInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_qom_list(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ ObjectPropertyInfoList * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * path = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &path, "path", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_qom_list(path, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_qom_list(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &path, "path", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_set_password(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * protocol = NULL;
+ char * password = NULL;
+ bool has_connected = false;
+ char * connected = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &protocol, "protocol", errp);
+ visit_type_str(v, &password, "password", errp);
+ visit_start_optional(v, &has_connected, "connected", errp);
+ if (has_connected) {
+ visit_type_str(v, &connected, "connected", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_set_password(protocol, password, has_connected, connected, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &protocol, "protocol", NULL);
+ visit_type_str(v, &password, "password", NULL);
+ visit_start_optional(v, &has_connected, "connected", NULL);
+ if (has_connected) {
+ visit_type_str(v, &connected, "connected", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_expire_password(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * protocol = NULL;
+ char * time = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &protocol, "protocol", errp);
+ visit_type_str(v, &time, "time", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_expire_password(protocol, time, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &protocol, "protocol", NULL);
+ visit_type_str(v, &time, "time", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_eject(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ bool has_force = false;
+ bool force;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_start_optional(v, &has_force, "force", errp);
+ if (has_force) {
+ visit_type_bool(v, &force, "force", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_eject(device, has_force, force, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_start_optional(v, &has_force, "force", NULL);
+ if (has_force) {
+ visit_type_bool(v, &force, "force", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_change_vnc_password(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * password = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &password, "password", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_change_vnc_password(password, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &password, "password", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_change(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ char * target = NULL;
+ bool has_arg = false;
+ char * arg = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_str(v, &target, "target", errp);
+ visit_start_optional(v, &has_arg, "arg", errp);
+ if (has_arg) {
+ visit_type_str(v, &arg, "arg", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_change(device, target, has_arg, arg, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_str(v, &target, "target", NULL);
+ visit_start_optional(v, &has_arg, "arg", NULL);
+ if (has_arg) {
+ visit_type_str(v, &arg, "arg", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_set_io_throttle(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ int64_t bps;
+ int64_t bps_rd;
+ int64_t bps_wr;
+ int64_t iops;
+ int64_t iops_rd;
+ int64_t iops_wr;
+ bool has_bps_max = false;
+ int64_t bps_max;
+ bool has_bps_rd_max = false;
+ int64_t bps_rd_max;
+ bool has_bps_wr_max = false;
+ int64_t bps_wr_max;
+ bool has_iops_max = false;
+ int64_t iops_max;
+ bool has_iops_rd_max = false;
+ int64_t iops_rd_max;
+ bool has_iops_wr_max = false;
+ int64_t iops_wr_max;
+ bool has_iops_size = false;
+ int64_t iops_size;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_int(v, &bps, "bps", errp);
+ visit_type_int(v, &bps_rd, "bps_rd", errp);
+ visit_type_int(v, &bps_wr, "bps_wr", errp);
+ visit_type_int(v, &iops, "iops", errp);
+ visit_type_int(v, &iops_rd, "iops_rd", errp);
+ visit_type_int(v, &iops_wr, "iops_wr", errp);
+ visit_start_optional(v, &has_bps_max, "bps_max", errp);
+ if (has_bps_max) {
+ visit_type_int(v, &bps_max, "bps_max", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_bps_rd_max, "bps_rd_max", errp);
+ if (has_bps_rd_max) {
+ visit_type_int(v, &bps_rd_max, "bps_rd_max", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_bps_wr_max, "bps_wr_max", errp);
+ if (has_bps_wr_max) {
+ visit_type_int(v, &bps_wr_max, "bps_wr_max", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_iops_max, "iops_max", errp);
+ if (has_iops_max) {
+ visit_type_int(v, &iops_max, "iops_max", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_iops_rd_max, "iops_rd_max", errp);
+ if (has_iops_rd_max) {
+ visit_type_int(v, &iops_rd_max, "iops_rd_max", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_iops_wr_max, "iops_wr_max", errp);
+ if (has_iops_wr_max) {
+ visit_type_int(v, &iops_wr_max, "iops_wr_max", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_iops_size, "iops_size", errp);
+ if (has_iops_size) {
+ visit_type_int(v, &iops_size, "iops_size", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_set_io_throttle(device, bps, bps_rd, bps_wr, iops, iops_rd, iops_wr, has_bps_max, bps_max, has_bps_rd_max, bps_rd_max, has_bps_wr_max, bps_wr_max, has_iops_max, iops_max, has_iops_rd_max, iops_rd_max, has_iops_wr_max, iops_wr_max, has_iops_size, iops_size, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_int(v, &bps, "bps", NULL);
+ visit_type_int(v, &bps_rd, "bps_rd", NULL);
+ visit_type_int(v, &bps_wr, "bps_wr", NULL);
+ visit_type_int(v, &iops, "iops", NULL);
+ visit_type_int(v, &iops_rd, "iops_rd", NULL);
+ visit_type_int(v, &iops_wr, "iops_wr", NULL);
+ visit_start_optional(v, &has_bps_max, "bps_max", NULL);
+ if (has_bps_max) {
+ visit_type_int(v, &bps_max, "bps_max", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_bps_rd_max, "bps_rd_max", NULL);
+ if (has_bps_rd_max) {
+ visit_type_int(v, &bps_rd_max, "bps_rd_max", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_bps_wr_max, "bps_wr_max", NULL);
+ if (has_bps_wr_max) {
+ visit_type_int(v, &bps_wr_max, "bps_wr_max", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_iops_max, "iops_max", NULL);
+ if (has_iops_max) {
+ visit_type_int(v, &iops_max, "iops_max", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_iops_rd_max, "iops_rd_max", NULL);
+ if (has_iops_rd_max) {
+ visit_type_int(v, &iops_rd_max, "iops_rd_max", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_iops_wr_max, "iops_wr_max", NULL);
+ if (has_iops_wr_max) {
+ visit_type_int(v, &iops_wr_max, "iops_wr_max", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_iops_size, "iops_size", NULL);
+ if (has_iops_size) {
+ visit_type_int(v, &iops_size, "iops_size", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_stream(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ bool has_base = false;
+ char * base = NULL;
+ bool has_speed = false;
+ int64_t speed;
+ bool has_on_error = false;
+ BlockdevOnError on_error;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_start_optional(v, &has_base, "base", errp);
+ if (has_base) {
+ visit_type_str(v, &base, "base", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_speed, "speed", errp);
+ if (has_speed) {
+ visit_type_int(v, &speed, "speed", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_on_error, "on-error", errp);
+ if (has_on_error) {
+ visit_type_BlockdevOnError(v, &on_error, "on-error", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_stream(device, has_base, base, has_speed, speed, has_on_error, on_error, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_start_optional(v, &has_base, "base", NULL);
+ if (has_base) {
+ visit_type_str(v, &base, "base", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_speed, "speed", NULL);
+ if (has_speed) {
+ visit_type_int(v, &speed, "speed", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_on_error, "on-error", NULL);
+ if (has_on_error) {
+ visit_type_BlockdevOnError(v, &on_error, "on-error", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_job_set_speed(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ int64_t speed;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_type_int(v, &speed, "speed", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_job_set_speed(device, speed, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_type_int(v, &speed, "speed", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_job_cancel(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ bool has_force = false;
+ bool force;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_start_optional(v, &has_force, "force", errp);
+ if (has_force) {
+ visit_type_bool(v, &force, "force", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_job_cancel(device, has_force, force, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_start_optional(v, &has_force, "force", NULL);
+ if (has_force) {
+ visit_type_bool(v, &force, "force", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_job_pause(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_job_pause(device, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_job_resume(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_job_resume(device, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_block_job_complete(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_block_job_complete(device, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_qom_list_types(ObjectTypeInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_ObjectTypeInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ObjectTypeInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_qom_list_types(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ ObjectTypeInfoList * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ bool has_implements = false;
+ char * implements = NULL;
+ bool has_abstract = false;
+ bool abstract;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_start_optional(v, &has_implements, "implements", errp);
+ if (has_implements) {
+ visit_type_str(v, &implements, "implements", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_abstract, "abstract", errp);
+ if (has_abstract) {
+ visit_type_bool(v, &abstract, "abstract", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_qom_list_types(has_implements, implements, has_abstract, abstract, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_qom_list_types(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_start_optional(v, &has_implements, "implements", NULL);
+ if (has_implements) {
+ visit_type_str(v, &implements, "implements", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_abstract, "abstract", NULL);
+ if (has_abstract) {
+ visit_type_bool(v, &abstract, "abstract", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_device_list_properties(DevicePropertyInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_DevicePropertyInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_DevicePropertyInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_device_list_properties(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ DevicePropertyInfoList * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * q_typename = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &q_typename, "typename", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_device_list_properties(q_typename, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_device_list_properties(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &q_typename, "typename", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_migrate(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * uri = NULL;
+ bool has_blk = false;
+ bool blk;
+ bool has_inc = false;
+ bool inc;
+ bool has_detach = false;
+ bool detach;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &uri, "uri", errp);
+ visit_start_optional(v, &has_blk, "blk", errp);
+ if (has_blk) {
+ visit_type_bool(v, &blk, "blk", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_inc, "inc", errp);
+ if (has_inc) {
+ visit_type_bool(v, &inc, "inc", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_detach, "detach", errp);
+ if (has_detach) {
+ visit_type_bool(v, &detach, "detach", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_migrate(uri, has_blk, blk, has_inc, inc, has_detach, detach, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &uri, "uri", NULL);
+ visit_start_optional(v, &has_blk, "blk", NULL);
+ if (has_blk) {
+ visit_type_bool(v, &blk, "blk", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_inc, "inc", NULL);
+ if (has_inc) {
+ visit_type_bool(v, &inc, "inc", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_detach, "detach", NULL);
+ if (has_detach) {
+ visit_type_bool(v, &detach, "detach", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_xen_save_devices_state(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * filename = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &filename, "filename", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_xen_save_devices_state(filename, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &filename, "filename", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_xen_set_global_dirty_log(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ bool enable;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_bool(v, &enable, "enable", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_xen_set_global_dirty_log(enable, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_bool(v, &enable, "enable", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_device_del(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * id = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &id, "id", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_device_del(id, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &id, "id", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_dump_guest_memory(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ bool paging;
+ char * protocol = NULL;
+ bool has_begin = false;
+ int64_t begin;
+ bool has_length = false;
+ int64_t length;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_bool(v, &paging, "paging", errp);
+ visit_type_str(v, &protocol, "protocol", errp);
+ visit_start_optional(v, &has_begin, "begin", errp);
+ if (has_begin) {
+ visit_type_int(v, &begin, "begin", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_length, "length", errp);
+ if (has_length) {
+ visit_type_int(v, &length, "length", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_dump_guest_memory(paging, protocol, has_begin, begin, has_length, length, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_bool(v, &paging, "paging", NULL);
+ visit_type_str(v, &protocol, "protocol", NULL);
+ visit_start_optional(v, &has_begin, "begin", NULL);
+ if (has_begin) {
+ visit_type_int(v, &begin, "begin", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_length, "length", NULL);
+ if (has_length) {
+ visit_type_int(v, &length, "length", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * id = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &id, "id", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_netdev_del(id, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &id, "id", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_getfd(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * fdname = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &fdname, "fdname", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_getfd(fdname, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &fdname, "fdname", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_closefd(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * fdname = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &fdname, "fdname", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_closefd(fdname, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &fdname, "fdname", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_machines(MachineInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_MachineInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_MachineInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_machines(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ MachineInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_machines(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_machines(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_cpu_definitions(CpuDefinitionInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_CpuDefinitionInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CpuDefinitionInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_cpu_definitions(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ CpuDefinitionInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_cpu_definitions(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_cpu_definitions(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_add_fd(AddfdInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_AddfdInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_AddfdInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_add_fd(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ AddfdInfo * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ bool has_fdset_id = false;
+ int64_t fdset_id;
+ bool has_opaque = false;
+ char * opaque = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_start_optional(v, &has_fdset_id, "fdset-id", errp);
+ if (has_fdset_id) {
+ visit_type_int(v, &fdset_id, "fdset-id", errp);
+ }
+ visit_end_optional(v, errp);
+ visit_start_optional(v, &has_opaque, "opaque", errp);
+ if (has_opaque) {
+ visit_type_str(v, &opaque, "opaque", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_add_fd(has_fdset_id, fdset_id, has_opaque, opaque, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_add_fd(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_start_optional(v, &has_fdset_id, "fdset-id", NULL);
+ if (has_fdset_id) {
+ visit_type_int(v, &fdset_id, "fdset-id", NULL);
+ }
+ visit_end_optional(v, NULL);
+ visit_start_optional(v, &has_opaque, "opaque", NULL);
+ if (has_opaque) {
+ visit_type_str(v, &opaque, "opaque", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_remove_fd(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ int64_t fdset_id;
+ bool has_fd = false;
+ int64_t fd;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_int(v, &fdset_id, "fdset-id", errp);
+ visit_start_optional(v, &has_fd, "fd", errp);
+ if (has_fd) {
+ visit_type_int(v, &fd, "fd", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_remove_fd(fdset_id, has_fd, fd, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_int(v, &fdset_id, "fdset-id", NULL);
+ visit_start_optional(v, &has_fd, "fd", NULL);
+ if (has_fd) {
+ visit_type_int(v, &fd, "fd", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_fdsets(FdsetInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_FdsetInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_FdsetInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_fdsets(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ FdsetInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_fdsets(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_fdsets(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_target(TargetInfo * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_TargetInfo(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TargetInfo(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_target(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ TargetInfo * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_target(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_target(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_send_key(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ KeyValueList * keys = NULL;
+ bool has_hold_time = false;
+ int64_t hold_time;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_KeyValueList(v, &keys, "keys", errp);
+ visit_start_optional(v, &has_hold_time, "hold-time", errp);
+ if (has_hold_time) {
+ visit_type_int(v, &hold_time, "hold-time", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_send_key(keys, has_hold_time, hold_time, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_KeyValueList(v, &keys, "keys", NULL);
+ visit_start_optional(v, &has_hold_time, "hold-time", NULL);
+ if (has_hold_time) {
+ visit_type_int(v, &hold_time, "hold-time", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_screendump(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * filename = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &filename, "filename", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_screendump(filename, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &filename, "filename", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_nbd_server_start(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ SocketAddress * addr = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_SocketAddress(v, &addr, "addr", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_nbd_server_start(addr, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_SocketAddress(v, &addr, "addr", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_nbd_server_add(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * device = NULL;
+ bool has_writable = false;
+ bool writable;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &device, "device", errp);
+ visit_start_optional(v, &has_writable, "writable", errp);
+ if (has_writable) {
+ visit_type_bool(v, &writable, "writable", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_nbd_server_add(device, has_writable, writable, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &device, "device", NULL);
+ visit_start_optional(v, &has_writable, "writable", NULL);
+ if (has_writable) {
+ visit_type_bool(v, &writable, "writable", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_nbd_server_stop(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_nbd_server_stop(errp);
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_chardev_add(ChardevReturn * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_ChardevReturn(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_ChardevReturn(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_chardev_add(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ ChardevReturn * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * id = NULL;
+ ChardevBackend * backend = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &id, "id", errp);
+ visit_type_ChardevBackend(v, &backend, "backend", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_chardev_add(id, backend, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_chardev_add(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &id, "id", NULL);
+ visit_type_ChardevBackend(v, &backend, "backend", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_chardev_remove(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ char * id = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_str(v, &id, "id", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_chardev_remove(id, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_str(v, &id, "id", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_tpm_models(TpmModelList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_TpmModelList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TpmModelList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_tpm_models(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ TpmModelList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_tpm_models(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_tpm_models(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_tpm_types(TpmTypeList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_TpmTypeList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TpmTypeList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_tpm_types(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ TpmTypeList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_tpm_types(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_tpm_types(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_tpm(TPMInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_TPMInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_TPMInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_tpm(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ TPMInfoList * retval = NULL;
+ (void)args;
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_tpm(errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_tpm(retval, ret, errp);
+ }
+
+out:
+
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_command_line_options(CommandLineOptionInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_CommandLineOptionInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_CommandLineOptionInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_command_line_options(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ CommandLineOptionInfoList * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ bool has_option = false;
+ char * option = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_start_optional(v, &has_option, "option", errp);
+ if (has_option) {
+ visit_type_str(v, &option, "option", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_command_line_options(has_option, option, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_command_line_options(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_start_optional(v, &has_option, "option", NULL);
+ if (has_option) {
+ visit_type_str(v, &option, "option", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+static void qmp_marshal_output_query_rx_filter(RxFilterInfoList * ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ visit_type_RxFilterInfoList(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_RxFilterInfoList(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+
+int qmp_marshal_input_query_rx_filter(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ RxFilterInfoList * retval = NULL;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ bool has_name = false;
+ char * name = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_start_optional(v, &has_name, "name", errp);
+ if (has_name) {
+ visit_type_str(v, &name, "name", errp);
+ }
+ visit_end_optional(v, errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ retval = qmp_query_rx_filter(has_name, name, errp);
+ if (!error_is_set(errp)) {
+ qmp_marshal_output_query_rx_filter(retval, ret, errp);
+ }
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_start_optional(v, &has_name, "name", NULL);
+ if (has_name) {
+ visit_type_str(v, &name, "name", NULL);
+ }
+ visit_end_optional(v, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
+int qmp_marshal_input_blockdev_add(Monitor *mon, const QDict *qdict, QObject **ret)
+{
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+ QmpInputVisitor *mi;
+ QapiDeallocVisitor *md;
+ Visitor *v;
+ BlockdevOptions * options = NULL;
+
+ mi = qmp_input_visitor_new_strict(QOBJECT(args));
+ v = qmp_input_get_visitor(mi);
+ visit_type_BlockdevOptions(v, &options, "options", errp);
+ qmp_input_visitor_cleanup(mi);
+
+ if (error_is_set(errp)) {
+ goto out;
+ }
+ qmp_blockdev_add(options, errp);
+
+out:
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_BlockdevOptions(v, &options, "options", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+}
+
diff --git a/qapi-schema.json b/qapi-schema.json
new file mode 100644
index 0000000..d6f8615
--- /dev/null
+++ b/qapi-schema.json
@@ -0,0 +1,4237 @@
+# -*- Mode: Python -*-
+#
+# QAPI Schema
+
+##
+# @ErrorClass
+#
+# QEMU error classes
+#
+# @GenericError: this is used for errors that don't require a specific error
+# class. This should be the default case for most errors
+#
+# @CommandNotFound: the requested command has not been found
+#
+# @DeviceEncrypted: the requested operation can't be fulfilled because the
+# selected device is encrypted
+#
+# @DeviceNotActive: a device has failed to be become active
+#
+# @DeviceNotFound: the requested device has not been found
+#
+# @KVMMissingCap: the requested operation can't be fulfilled because a
+# required KVM capability is missing
+#
+# Since: 1.2
+##
+{ 'enum': 'ErrorClass',
+ 'data': [ 'GenericError', 'CommandNotFound', 'DeviceEncrypted',
+ 'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
+
+##
+# @add_client
+#
+# Allow client connections for VNC, Spice and socket based
+# character devices to be passed in to QEMU via SCM_RIGHTS.
+#
+# @protocol: protocol name. Valid names are "vnc", "spice" or the
+# name of a character device (eg. from -chardev id=XXXX)
+#
+# @fdname: file descriptor name previously passed via 'getfd' command
+#
+# @skipauth: #optional whether to skip authentication. Only applies
+# to "vnc" and "spice" protocols
+#
+# @tls: #optional whether to perform TLS. Only applies to the "spice"
+# protocol
+#
+# Returns: nothing on success.
+#
+# Since: 0.14.0
+##
+{ 'command': 'add_client',
+ 'data': { 'protocol': 'str', 'fdname': 'str', '*skipauth': 'bool',
+ '*tls': 'bool' } }
+
+##
+# @NameInfo:
+#
+# Guest name information.
+#
+# @name: #optional The name of the guest
+#
+# Since 0.14.0
+##
+{ 'type': 'NameInfo', 'data': {'*name': 'str'} }
+
+##
+# @query-name:
+#
+# Return the name information of a guest.
+#
+# Returns: @NameInfo of the guest
+#
+# Since 0.14.0
+##
+{ 'command': 'query-name', 'returns': 'NameInfo' }
+
+##
+# @VersionInfo:
+#
+# A description of QEMU's version.
+#
+# @qemu.major: The major version of QEMU
+#
+# @qemu.minor: The minor version of QEMU
+#
+# @qemu.micro: The micro version of QEMU. By current convention, a micro
+# version of 50 signifies a development branch. A micro version
+# greater than or equal to 90 signifies a release candidate for
+# the next minor version. A micro version of less than 50
+# signifies a stable release.
+#
+# @package: QEMU will always set this field to an empty string. Downstream
+# versions of QEMU should set this to a non-empty string. The
+# exact format depends on the downstream however it highly
+# recommended that a unique name is used.
+#
+# Since: 0.14.0
+##
+{ 'type': 'VersionInfo',
+ 'data': {'qemu': {'major': 'int', 'minor': 'int', 'micro': 'int'},
+ 'package': 'str'} }
+
+##
+# @query-version:
+#
+# Returns the current version of QEMU.
+#
+# Returns: A @VersionInfo object describing the current version of QEMU.
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-version', 'returns': 'VersionInfo' }
+
+##
+# @KvmInfo:
+#
+# Information about support for KVM acceleration
+#
+# @enabled: true if KVM acceleration is active
+#
+# @present: true if KVM acceleration is built into this executable
+#
+# Since: 0.14.0
+##
+{ 'type': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
+
+##
+# @query-kvm:
+#
+# Returns information about KVM acceleration
+#
+# Returns: @KvmInfo
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
+
+##
+# @RunState
+#
+# An enumeration of VM run states.
+#
+# @debug: QEMU is running on a debugger
+#
+# @finish-migrate: guest is paused to finish the migration process
+#
+# @inmigrate: guest is paused waiting for an incoming migration. Note
+# that this state does not tell whether the machine will start at the
+# end of the migration. This depends on the command-line -S option and
+# any invocation of 'stop' or 'cont' that has happened since QEMU was
+# started.
+#
+# @internal-error: An internal error that prevents further guest execution
+# has occurred
+#
+# @io-error: the last IOP has failed and the device is configured to pause
+# on I/O errors
+#
+# @paused: guest has been paused via the 'stop' command
+#
+# @postmigrate: guest is paused following a successful 'migrate'
+#
+# @prelaunch: QEMU was started with -S and guest has not started
+#
+# @restore-vm: guest is paused to restore VM state
+#
+# @running: guest is actively running
+#
+# @save-vm: guest is paused to save the VM state
+#
+# @shutdown: guest is shut down (and -no-shutdown is in use)
+#
+# @suspended: guest is suspended (ACPI S3)
+#
+# @watchdog: the watchdog action is configured to pause and has been triggered
+#
+# @guest-panicked: guest has been panicked as a result of guest OS panic
+##
+{ 'enum': 'RunState',
+ 'data': [ 'debug', 'inmigrate', 'internal-error', 'io-error', 'paused',
+ 'postmigrate', 'prelaunch', 'finish-migrate', 'restore-vm',
+ 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog',
+ 'guest-panicked' ] }
+
+##
+# @SnapshotInfo
+#
+# @id: unique snapshot id
+#
+# @name: user chosen name
+#
+# @vm-state-size: size of the VM state
+#
+# @date-sec: UTC date of the snapshot in seconds
+#
+# @date-nsec: fractional part in nano seconds to be used with date-sec
+#
+# @vm-clock-sec: VM clock relative to boot in seconds
+#
+# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec
+#
+# Since: 1.3
+#
+##
+
+{ 'type': 'SnapshotInfo',
+ 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
+ 'date-sec': 'int', 'date-nsec': 'int',
+ 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } }
+
+##
+# @ImageInfoSpecificQCow2:
+#
+# @compat: compatibility level
+#
+# @lazy-refcounts: #optional on or off; only valid for compat >= 1.1
+#
+# Since: 1.7
+##
+{ 'type': 'ImageInfoSpecificQCow2',
+ 'data': {
+ 'compat': 'str',
+ '*lazy-refcounts': 'bool'
+ } }
+
+##
+# @ImageInfoSpecificVmdk:
+#
+# @create-type: The create type of VMDK image
+#
+# @cid: Content id of image
+#
+# @parent-cid: Parent VMDK image's cid
+#
+# @extents: List of extent files
+#
+# Since: 1.7
+##
+{ 'type': 'ImageInfoSpecificVmdk',
+ 'data': {
+ 'create-type': 'str',
+ 'cid': 'int',
+ 'parent-cid': 'int',
+ 'extents': ['ImageInfo']
+ } }
+
+##
+# @ImageInfoSpecific:
+#
+# A discriminated record of image format specific information structures.
+#
+# Since: 1.7
+##
+
+{ 'union': 'ImageInfoSpecific',
+ 'data': {
+ 'qcow2': 'ImageInfoSpecificQCow2',
+ 'vmdk': 'ImageInfoSpecificVmdk'
+ } }
+
+##
+# @ImageInfo:
+#
+# Information about a QEMU image file
+#
+# @filename: name of the image file
+#
+# @format: format of the image file
+#
+# @virtual-size: maximum capacity in bytes of the image
+#
+# @actual-size: #optional actual size on disk in bytes of the image
+#
+# @dirty-flag: #optional true if image is not cleanly closed
+#
+# @cluster-size: #optional size of a cluster in bytes
+#
+# @encrypted: #optional true if the image is encrypted
+#
+# @compressed: #optional true if the image is compressed (Since 1.7)
+#
+# @backing-filename: #optional name of the backing file
+#
+# @full-backing-filename: #optional full path of the backing file
+#
+# @backing-filename-format: #optional the format of the backing file
+#
+# @snapshots: #optional list of VM snapshots
+#
+# @backing-image: #optional info of the backing image (since 1.6)
+#
+# @format-specific: #optional structure supplying additional format-specific
+# information (since 1.7)
+#
+# Since: 1.3
+#
+##
+
+{ 'type': 'ImageInfo',
+ 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
+ '*actual-size': 'int', 'virtual-size': 'int',
+ '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool',
+ '*backing-filename': 'str', '*full-backing-filename': 'str',
+ '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'],
+ '*backing-image': 'ImageInfo',
+ '*format-specific': 'ImageInfoSpecific' } }
+
+##
+# @ImageCheck:
+#
+# Information about a QEMU image file check
+#
+# @filename: name of the image file checked
+#
+# @format: format of the image file checked
+#
+# @check-errors: number of unexpected errors occurred during check
+#
+# @image-end-offset: #optional offset (in bytes) where the image ends, this
+# field is present if the driver for the image format
+# supports it
+#
+# @corruptions: #optional number of corruptions found during the check if any
+#
+# @leaks: #optional number of leaks found during the check if any
+#
+# @corruptions-fixed: #optional number of corruptions fixed during the check
+# if any
+#
+# @leaks-fixed: #optional number of leaks fixed during the check if any
+#
+# @total-clusters: #optional total number of clusters, this field is present
+# if the driver for the image format supports it
+#
+# @allocated-clusters: #optional total number of allocated clusters, this
+# field is present if the driver for the image format
+# supports it
+#
+# @fragmented-clusters: #optional total number of fragmented clusters, this
+# field is present if the driver for the image format
+# supports it
+#
+# @compressed-clusters: #optional total number of compressed clusters, this
+# field is present if the driver for the image format
+# supports it
+#
+# Since: 1.4
+#
+##
+
+{ 'type': 'ImageCheck',
+ 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
+ '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
+ '*corruptions-fixed': 'int', '*leaks-fixed': 'int',
+ '*total-clusters': 'int', '*allocated-clusters': 'int',
+ '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } }
+
+##
+# @StatusInfo:
+#
+# Information about VCPU run state
+#
+# @running: true if all VCPUs are runnable, false if not runnable
+#
+# @singlestep: true if VCPUs are in single-step mode
+#
+# @status: the virtual machine @RunState
+#
+# Since: 0.14.0
+#
+# Notes: @singlestep is enabled through the GDB stub
+##
+{ 'type': 'StatusInfo',
+ 'data': {'running': 'bool', 'singlestep': 'bool', 'status': 'RunState'} }
+
+##
+# @query-status:
+#
+# Query the run status of all VCPUs
+#
+# Returns: @StatusInfo reflecting all VCPUs
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-status', 'returns': 'StatusInfo' }
+
+##
+# @UuidInfo:
+#
+# Guest UUID information.
+#
+# @UUID: the UUID of the guest
+#
+# Since: 0.14.0
+#
+# Notes: If no UUID was specified for the guest, a null UUID is returned.
+##
+{ 'type': 'UuidInfo', 'data': {'UUID': 'str'} }
+
+##
+# @query-uuid:
+#
+# Query the guest UUID information.
+#
+# Returns: The @UuidInfo for the guest
+#
+# Since 0.14.0
+##
+{ 'command': 'query-uuid', 'returns': 'UuidInfo' }
+
+##
+# @ChardevInfo:
+#
+# Information about a character device.
+#
+# @label: the label of the character device
+#
+# @filename: the filename of the character device
+#
+# Notes: @filename is encoded using the QEMU command line character device
+# encoding. See the QEMU man page for details.
+#
+# Since: 0.14.0
+##
+{ 'type': 'ChardevInfo', 'data': {'label': 'str', 'filename': 'str'} }
+
+##
+# @query-chardev:
+#
+# Returns information about current character devices.
+#
+# Returns: a list of @ChardevInfo
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-chardev', 'returns': ['ChardevInfo'] }
+
+##
+# @DataFormat:
+#
+# An enumeration of data format.
+#
+# @utf8: Data is a UTF-8 string (RFC 3629)
+#
+# @base64: Data is Base64 encoded binary (RFC 3548)
+#
+# Since: 1.4
+##
+{ 'enum': 'DataFormat',
+ 'data': [ 'utf8', 'base64' ] }
+
+##
+# @ringbuf-write:
+#
+# Write to a ring buffer character device.
+#
+# @device: the ring buffer character device name
+#
+# @data: data to write
+#
+# @format: #optional data encoding (default 'utf8').
+# - base64: data must be base64 encoded text. Its binary
+# decoding gets written.
+# Bug: invalid base64 is currently not rejected.
+# Whitespace *is* invalid.
+# - utf8: data's UTF-8 encoding is written
+# - data itself is always Unicode regardless of format, like
+# any other string.
+#
+# Returns: Nothing on success
+#
+# Since: 1.4
+##
+{ 'command': 'ringbuf-write',
+ 'data': {'device': 'str', 'data': 'str',
+ '*format': 'DataFormat'} }
+
+##
+# @ringbuf-read:
+#
+# Read from a ring buffer character device.
+#
+# @device: the ring buffer character device name
+#
+# @size: how many bytes to read at most
+#
+# @format: #optional data encoding (default 'utf8').
+# - base64: the data read is returned in base64 encoding.
+# - utf8: the data read is interpreted as UTF-8.
+# Bug: can screw up when the buffer contains invalid UTF-8
+# sequences, NUL characters, after the ring buffer lost
+# data, and when reading stops because the size limit is
+# reached.
+# - The return value is always Unicode regardless of format,
+# like any other string.
+#
+# Returns: data read from the device
+#
+# Since: 1.4
+##
+{ 'command': 'ringbuf-read',
+ 'data': {'device': 'str', 'size': 'int', '*format': 'DataFormat'},
+ 'returns': 'str' }
+
+##
+# @CommandInfo:
+#
+# Information about a QMP command
+#
+# @name: The command name
+#
+# Since: 0.14.0
+##
+{ 'type': 'CommandInfo', 'data': {'name': 'str'} }
+
+##
+# @query-commands:
+#
+# Return a list of supported QMP commands by this server
+#
+# Returns: A list of @CommandInfo for all supported commands
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-commands', 'returns': ['CommandInfo'] }
+
+##
+# @EventInfo:
+#
+# Information about a QMP event
+#
+# @name: The event name
+#
+# Since: 1.2.0
+##
+{ 'type': 'EventInfo', 'data': {'name': 'str'} }
+
+##
+# @query-events:
+#
+# Return a list of supported QMP events by this server
+#
+# Returns: A list of @EventInfo for all supported events
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-events', 'returns': ['EventInfo'] }
+
+##
+# @MigrationStats
+#
+# Detailed migration status.
+#
+# @transferred: amount of bytes already transferred to the target VM
+#
+# @remaining: amount of bytes remaining to be transferred to the target VM
+#
+# @total: total amount of bytes involved in the migration process
+#
+# @duplicate: number of duplicate (zero) pages (since 1.2)
+#
+# @skipped: number of skipped zero pages (since 1.5)
+#
+# @normal : number of normal pages (since 1.2)
+#
+# @normal-bytes: number of normal bytes sent (since 1.2)
+#
+# @dirty-pages-rate: number of pages dirtied by second by the
+# guest (since 1.3)
+#
+# @mbps: throughput in megabits/sec. (since 1.6)
+#
+# Since: 0.14.0
+##
+{ 'type': 'MigrationStats',
+ 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
+ 'duplicate': 'int', 'skipped': 'int', 'normal': 'int',
+ 'normal-bytes': 'int', 'dirty-pages-rate' : 'int',
+ 'mbps' : 'number' } }
+
+##
+# @XBZRLECacheStats
+#
+# Detailed XBZRLE migration cache statistics
+#
+# @cache-size: XBZRLE cache size
+#
+# @bytes: amount of bytes already transferred to the target VM
+#
+# @pages: amount of pages transferred to the target VM
+#
+# @cache-miss: number of cache miss
+#
+# @overflow: number of overflows
+#
+# Since: 1.2
+##
+{ 'type': 'XBZRLECacheStats',
+ 'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int',
+ 'cache-miss': 'int', 'overflow': 'int' } }
+
+##
+# @MigrationInfo
+#
+# Information about current migration process.
+#
+# @status: #optional string describing the current migration status.
+# As of 0.14.0 this can be 'active', 'completed', 'failed' or
+# 'cancelled'. If this field is not returned, no migration process
+# has been initiated
+#
+# @ram: #optional @MigrationStats containing detailed migration
+# status, only returned if status is 'active' or
+# 'completed'. 'comppleted' (since 1.2)
+#
+# @disk: #optional @MigrationStats containing detailed disk migration
+# status, only returned if status is 'active' and it is a block
+# migration
+#
+# @xbzrle-cache: #optional @XBZRLECacheStats containing detailed XBZRLE
+# migration statistics, only returned if XBZRLE feature is on and
+# status is 'active' or 'completed' (since 1.2)
+#
+# @total-time: #optional total amount of milliseconds since migration started.
+# If migration has ended, it returns the total migration
+# time. (since 1.2)
+#
+# @downtime: #optional only present when migration finishes correctly
+# total downtime in milliseconds for the guest.
+# (since 1.3)
+#
+# @expected-downtime: #optional only present while migration is active
+# expected downtime in milliseconds for the guest in last walk
+# of the dirty bitmap. (since 1.3)
+#
+# @setup-time: #optional amount of setup time in milliseconds _before_ the
+# iterations begin but _after_ the QMP command is issued. This is designed
+# to provide an accounting of any activities (such as RDMA pinning) which
+# may be expensive, but do not actually occur during the iterative
+# migration rounds themselves. (since 1.6)
+#
+# Since: 0.14.0
+##
+{ 'type': 'MigrationInfo',
+ 'data': {'*status': 'str', '*ram': 'MigrationStats',
+ '*disk': 'MigrationStats',
+ '*xbzrle-cache': 'XBZRLECacheStats',
+ '*total-time': 'int',
+ '*expected-downtime': 'int',
+ '*downtime': 'int',
+ '*setup-time': 'int'} }
+
+##
+# @query-migrate
+#
+# Returns information about current migration process.
+#
+# Returns: @MigrationInfo
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
+
+##
+# @MigrationCapability
+#
+# Migration capabilities enumeration
+#
+# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length Encoding).
+# This feature allows us to minimize migration traffic for certain work
+# loads, by sending compressed difference of the pages
+#
+# @x-rdma-pin-all: Controls whether or not the entire VM memory footprint is
+# mlock()'d on demand or all at once. Refer to docs/rdma.txt for usage.
+# Disabled by default. Experimental: may (or may not) be renamed after
+# further testing is complete. (since 1.6)
+#
+# @zero-blocks: During storage migration encode blocks of zeroes efficiently. This
+# essentially saves 1MB of zeroes per block on the wire. Enabling requires
+# source and target VM to support this feature. To enable it is sufficient
+# to enable the capability on the source VM. The feature is disabled by
+# default. (since 1.6)
+#
+# @auto-converge: If enabled, QEMU will automatically throttle down the guest
+# to speed up convergence of RAM migration. (since 1.6)
+#
+# Since: 1.2
+##
+{ 'enum': 'MigrationCapability',
+ 'data': ['xbzrle', 'x-rdma-pin-all', 'auto-converge', 'zero-blocks'] }
+
+##
+# @MigrationCapabilityStatus
+#
+# Migration capability information
+#
+# @capability: capability enum
+#
+# @state: capability state bool
+#
+# Since: 1.2
+##
+{ 'type': 'MigrationCapabilityStatus',
+ 'data': { 'capability' : 'MigrationCapability', 'state' : 'bool' } }
+
+##
+# @migrate-set-capabilities
+#
+# Enable/Disable the following migration capabilities (like xbzrle)
+#
+# @capabilities: json array of capability modifications to make
+#
+# Since: 1.2
+##
+{ 'command': 'migrate-set-capabilities',
+ 'data': { 'capabilities': ['MigrationCapabilityStatus'] } }
+
+##
+# @query-migrate-capabilities
+#
+# Returns information about the current migration capabilities status
+#
+# Returns: @MigrationCapabilitiesStatus
+#
+# Since: 1.2
+##
+{ 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']}
+
+##
+# @MouseInfo:
+#
+# Information about a mouse device.
+#
+# @name: the name of the mouse device
+#
+# @index: the index of the mouse device
+#
+# @current: true if this device is currently receiving mouse events
+#
+# @absolute: true if this device supports absolute coordinates as input
+#
+# Since: 0.14.0
+##
+{ 'type': 'MouseInfo',
+ 'data': {'name': 'str', 'index': 'int', 'current': 'bool',
+ 'absolute': 'bool'} }
+
+##
+# @query-mice:
+#
+# Returns information about each active mouse device
+#
+# Returns: a list of @MouseInfo for each device
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-mice', 'returns': ['MouseInfo'] }
+
+##
+# @CpuInfo:
+#
+# Information about a virtual CPU
+#
+# @CPU: the index of the virtual CPU
+#
+# @current: this only exists for backwards compatible and should be ignored
+#
+# @halted: true if the virtual CPU is in the halt state. Halt usually refers
+# to a processor specific low power mode.
+#
+# @pc: #optional If the target is i386 or x86_64, this is the 64-bit instruction
+# pointer.
+# If the target is Sparc, this is the PC component of the
+# instruction pointer.
+#
+# @nip: #optional If the target is PPC, the instruction pointer
+#
+# @npc: #optional If the target is Sparc, the NPC component of the instruction
+# pointer
+#
+# @PC: #optional If the target is MIPS, the instruction pointer
+#
+# @thread_id: ID of the underlying host thread
+#
+# Since: 0.14.0
+#
+# Notes: @halted is a transient state that changes frequently. By the time the
+# data is sent to the client, the guest may no longer be halted.
+##
+{ 'type': 'CpuInfo',
+ 'data': {'CPU': 'int', 'current': 'bool', 'halted': 'bool', '*pc': 'int',
+ '*nip': 'int', '*npc': 'int', '*PC': 'int', 'thread_id': 'int'} }
+
+##
+# @query-cpus:
+#
+# Returns a list of information about each virtual CPU.
+#
+# Returns: a list of @CpuInfo for each virtual CPU
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-cpus', 'returns': ['CpuInfo'] }
+
+##
+# @BlockDeviceInfo:
+#
+# Information about the backing device for a block device.
+#
+# @file: the filename of the backing device
+#
+# @ro: true if the backing device was open read-only
+#
+# @drv: the name of the block format used to open the backing device. As of
+# 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
+# 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
+# 'host_floppy', 'http', 'https', 'nbd', 'parallels', 'qcow',
+# 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
+#
+# @backing_file: #optional the name of the backing file (for copy-on-write)
+#
+# @backing_file_depth: number of files in the backing file chain (since: 1.2)
+#
+# @encrypted: true if the backing device is encrypted
+#
+# @encryption_key_missing: true if the backing device is encrypted but an
+# valid encryption key is missing
+#
+# @bps: total throughput limit in bytes per second is specified
+#
+# @bps_rd: read throughput limit in bytes per second is specified
+#
+# @bps_wr: write throughput limit in bytes per second is specified
+#
+# @iops: total I/O operations per second is specified
+#
+# @iops_rd: read I/O operations per second is specified
+#
+# @iops_wr: write I/O operations per second is specified
+#
+# @image: the info of image used (since: 1.6)
+#
+# @bps_max: #optional total max in bytes (Since 1.7)
+#
+# @bps_rd_max: #optional read max in bytes (Since 1.7)
+#
+# @bps_wr_max: #optional write max in bytes (Since 1.7)
+#
+# @iops_max: #optional total I/O operations max (Since 1.7)
+#
+# @iops_rd_max: #optional read I/O operations max (Since 1.7)
+#
+# @iops_wr_max: #optional write I/O operations max (Since 1.7)
+#
+# @iops_size: #optional an I/O size in bytes (Since 1.7)
+#
+# Since: 0.14.0
+#
+# Notes: This interface is only found in @BlockInfo.
+##
+{ 'type': 'BlockDeviceInfo',
+ 'data': { 'file': 'str', 'ro': 'bool', 'drv': 'str',
+ '*backing_file': 'str', 'backing_file_depth': 'int',
+ 'encrypted': 'bool', 'encryption_key_missing': 'bool',
+ 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
+ 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
+ 'image': 'ImageInfo',
+ '*bps_max': 'int', '*bps_rd_max': 'int',
+ '*bps_wr_max': 'int', '*iops_max': 'int',
+ '*iops_rd_max': 'int', '*iops_wr_max': 'int',
+ '*iops_size': 'int' } }
+
+##
+# @BlockDeviceIoStatus:
+#
+# An enumeration of block device I/O status.
+#
+# @ok: The last I/O operation has succeeded
+#
+# @failed: The last I/O operation has failed
+#
+# @nospace: The last I/O operation has failed due to a no-space condition
+#
+# Since: 1.0
+##
+{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
+
+##
+# @BlockDeviceMapEntry:
+#
+# Entry in the metadata map of the device (returned by "qemu-img map")
+#
+# @start: Offset in the image of the first byte described by this entry
+# (in bytes)
+#
+# @length: Length of the range described by this entry (in bytes)
+#
+# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
+# before reaching one for which the range is allocated. The value is
+# in the range 0 to the depth of the image chain - 1.
+#
+# @zero: the sectors in this range read as zeros
+#
+# @data: reading the image will actually read data from a file (in particular,
+# if @offset is present this means that the sectors are not simply
+# preallocated, but contain actual data in raw format)
+#
+# @offset: if present, the image file stores the data for this range in
+# raw format at the given offset.
+#
+# Since 1.7
+##
+{ 'type': 'BlockDeviceMapEntry',
+ 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
+ 'data': 'bool', '*offset': 'int' } }
+
+##
+# @BlockDirtyInfo:
+#
+# Block dirty bitmap information.
+#
+# @count: number of dirty bytes according to the dirty bitmap
+#
+# @granularity: granularity of the dirty bitmap in bytes (since 1.4)
+#
+# Since: 1.3
+##
+{ 'type': 'BlockDirtyInfo',
+ 'data': {'count': 'int', 'granularity': 'int'} }
+
+##
+# @BlockInfo:
+#
+# Block device information. This structure describes a virtual device and
+# the backing device associated with it.
+#
+# @device: The device name associated with the virtual device.
+#
+# @type: This field is returned only for compatibility reasons, it should
+# not be used (always returns 'unknown')
+#
+# @removable: True if the device supports removable media.
+#
+# @locked: True if the guest has locked this device from having its media
+# removed
+#
+# @tray_open: #optional True if the device has a tray and it is open
+# (only present if removable is true)
+#
+# @dirty-bitmaps: #optional dirty bitmaps information (only present if the
+# driver has one or more dirty bitmaps) (Since 1.8)
+#
+# @io-status: #optional @BlockDeviceIoStatus. Only present if the device
+# supports it and the VM is configured to stop on errors
+#
+# @inserted: #optional @BlockDeviceInfo describing the device if media is
+# present
+#
+# Since: 0.14.0
+##
+{ 'type': 'BlockInfo',
+ 'data': {'device': 'str', 'type': 'str', 'removable': 'bool',
+ 'locked': 'bool', '*inserted': 'BlockDeviceInfo',
+ '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus',
+ '*dirty-bitmaps': ['BlockDirtyInfo'] } }
+
+##
+# @query-block:
+#
+# Get a list of BlockInfo for all virtual block devices.
+#
+# Returns: a list of @BlockInfo describing each virtual block device
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-block', 'returns': ['BlockInfo'] }
+
+##
+# @BlockDeviceStats:
+#
+# Statistics of a virtual block device or a block backing device.
+#
+# @rd_bytes: The number of bytes read by the device.
+#
+# @wr_bytes: The number of bytes written by the device.
+#
+# @rd_operations: The number of read operations performed by the device.
+#
+# @wr_operations: The number of write operations performed by the device.
+#
+# @flush_operations: The number of cache flush operations performed by the
+# device (since 0.15.0)
+#
+# @flush_total_time_ns: Total time spend on cache flushes in nano-seconds
+# (since 0.15.0).
+#
+# @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0).
+#
+# @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0).
+#
+# @wr_highest_offset: The offset after the greatest byte written to the
+# device. The intended use of this information is for
+# growable sparse files (like qcow2) that are used on top
+# of a physical device.
+#
+# Since: 0.14.0
+##
+{ 'type': 'BlockDeviceStats',
+ 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int',
+ 'wr_operations': 'int', 'flush_operations': 'int',
+ 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int',
+ 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int' } }
+
+##
+# @BlockStats:
+#
+# Statistics of a virtual block device or a block backing device.
+#
+# @device: #optional If the stats are for a virtual block device, the name
+# corresponding to the virtual block device.
+#
+# @stats: A @BlockDeviceStats for the device.
+#
+# @parent: #optional This may point to the backing block device if this is a
+# a virtual block device. If it's a backing block, this will point
+# to the backing file is one is present.
+#
+# Since: 0.14.0
+##
+{ 'type': 'BlockStats',
+ 'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
+ '*parent': 'BlockStats'} }
+
+##
+# @query-blockstats:
+#
+# Query the @BlockStats for all virtual block devices.
+#
+# Returns: A list of @BlockStats for each virtual block devices.
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-blockstats', 'returns': ['BlockStats'] }
+
+##
+# @VncClientInfo:
+#
+# Information about a connected VNC client.
+#
+# @host: The host name of the client. QEMU tries to resolve this to a DNS name
+# when possible.
+#
+# @family: 'ipv6' if the client is connected via IPv6 and TCP
+# 'ipv4' if the client is connected via IPv4 and TCP
+# 'unix' if the client is connected via a unix domain socket
+# 'unknown' otherwise
+#
+# @service: The service name of the client's port. This may depends on the
+# host system's service database so symbolic names should not be
+# relied on.
+#
+# @x509_dname: #optional If x509 authentication is in use, the Distinguished
+# Name of the client.
+#
+# @sasl_username: #optional If SASL authentication is in use, the SASL username
+# used for authentication.
+#
+# Since: 0.14.0
+##
+{ 'type': 'VncClientInfo',
+ 'data': {'host': 'str', 'family': 'str', 'service': 'str',
+ '*x509_dname': 'str', '*sasl_username': 'str'} }
+
+##
+# @VncInfo:
+#
+# Information about the VNC session.
+#
+# @enabled: true if the VNC server is enabled, false otherwise
+#
+# @host: #optional The hostname the VNC server is bound to. This depends on
+# the name resolution on the host and may be an IP address.
+#
+# @family: #optional 'ipv6' if the host is listening for IPv6 connections
+# 'ipv4' if the host is listening for IPv4 connections
+# 'unix' if the host is listening on a unix domain socket
+# 'unknown' otherwise
+#
+# @service: #optional The service name of the server's port. This may depends
+# on the host system's service database so symbolic names should not
+# be relied on.
+#
+# @auth: #optional the current authentication type used by the server
+# 'none' if no authentication is being used
+# 'vnc' if VNC authentication is being used
+# 'vencrypt+plain' if VEncrypt is used with plain text authentication
+# 'vencrypt+tls+none' if VEncrypt is used with TLS and no authentication
+# 'vencrypt+tls+vnc' if VEncrypt is used with TLS and VNC authentication
+# 'vencrypt+tls+plain' if VEncrypt is used with TLS and plain text auth
+# 'vencrypt+x509+none' if VEncrypt is used with x509 and no auth
+# 'vencrypt+x509+vnc' if VEncrypt is used with x509 and VNC auth
+# 'vencrypt+x509+plain' if VEncrypt is used with x509 and plain text auth
+# 'vencrypt+tls+sasl' if VEncrypt is used with TLS and SASL auth
+# 'vencrypt+x509+sasl' if VEncrypt is used with x509 and SASL auth
+#
+# @clients: a list of @VncClientInfo of all currently connected clients
+#
+# Since: 0.14.0
+##
+{ 'type': 'VncInfo',
+ 'data': {'enabled': 'bool', '*host': 'str', '*family': 'str',
+ '*service': 'str', '*auth': 'str', '*clients': ['VncClientInfo']} }
+
+##
+# @query-vnc:
+#
+# Returns information about the current VNC server
+#
+# Returns: @VncInfo
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-vnc', 'returns': 'VncInfo' }
+
+##
+# @SpiceChannel
+#
+# Information about a SPICE client channel.
+#
+# @host: The host name of the client. QEMU tries to resolve this to a DNS name
+# when possible.
+#
+# @family: 'ipv6' if the client is connected via IPv6 and TCP
+# 'ipv4' if the client is connected via IPv4 and TCP
+# 'unix' if the client is connected via a unix domain socket
+# 'unknown' otherwise
+#
+# @port: The client's port number.
+#
+# @connection-id: SPICE connection id number. All channels with the same id
+# belong to the same SPICE session.
+#
+# @connection-type: SPICE channel type number. "1" is the main control
+# channel, filter for this one if you want to track spice
+# sessions only
+#
+# @channel-id: SPICE channel ID number. Usually "0", might be different when
+# multiple channels of the same type exist, such as multiple
+# display channels in a multihead setup
+#
+# @tls: true if the channel is encrypted, false otherwise.
+#
+# Since: 0.14.0
+##
+{ 'type': 'SpiceChannel',
+ 'data': {'host': 'str', 'family': 'str', 'port': 'str',
+ 'connection-id': 'int', 'channel-type': 'int', 'channel-id': 'int',
+ 'tls': 'bool'} }
+
+##
+# @SpiceQueryMouseMode
+#
+# An enumeration of Spice mouse states.
+#
+# @client: Mouse cursor position is determined by the client.
+#
+# @server: Mouse cursor position is determined by the server.
+#
+# @unknown: No information is available about mouse mode used by
+# the spice server.
+#
+# Note: spice/enums.h has a SpiceMouseMode already, hence the name.
+#
+# Since: 1.1
+##
+{ 'enum': 'SpiceQueryMouseMode',
+ 'data': [ 'client', 'server', 'unknown' ] }
+
+##
+# @SpiceInfo
+#
+# Information about the SPICE session.
+#
+# @enabled: true if the SPICE server is enabled, false otherwise
+#
+# @migrated: true if the last guest migration completed and spice
+# migration had completed as well. false otherwise.
+#
+# @host: #optional The hostname the SPICE server is bound to. This depends on
+# the name resolution on the host and may be an IP address.
+#
+# @port: #optional The SPICE server's port number.
+#
+# @compiled-version: #optional SPICE server version.
+#
+# @tls-port: #optional The SPICE server's TLS port number.
+#
+# @auth: #optional the current authentication type used by the server
+# 'none' if no authentication is being used
+# 'spice' uses SASL or direct TLS authentication, depending on command
+# line options
+#
+# @mouse-mode: The mode in which the mouse cursor is displayed currently. Can
+# be determined by the client or the server, or unknown if spice
+# server doesn't provide this information.
+#
+# Since: 1.1
+#
+# @channels: a list of @SpiceChannel for each active spice channel
+#
+# Since: 0.14.0
+##
+{ 'type': 'SpiceInfo',
+ 'data': {'enabled': 'bool', 'migrated': 'bool', '*host': 'str', '*port': 'int',
+ '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str',
+ 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']} }
+
+##
+# @query-spice
+#
+# Returns information about the current SPICE server
+#
+# Returns: @SpiceInfo
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-spice', 'returns': 'SpiceInfo' }
+
+##
+# @BalloonInfo:
+#
+# Information about the guest balloon device.
+#
+# @actual: the number of bytes the balloon currently contains
+#
+# Since: 0.14.0
+#
+##
+{ 'type': 'BalloonInfo', 'data': {'actual': 'int' } }
+
+##
+# @query-balloon:
+#
+# Return information about the balloon device.
+#
+# Returns: @BalloonInfo on success
+# If the balloon driver is enabled but not functional because the KVM
+# kernel module cannot support it, KvmMissingCap
+# If no balloon device is present, DeviceNotActive
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-balloon', 'returns': 'BalloonInfo' }
+
+##
+# @PciMemoryRange:
+#
+# A PCI device memory region
+#
+# @base: the starting address (guest physical)
+#
+# @limit: the ending address (guest physical)
+#
+# Since: 0.14.0
+##
+{ 'type': 'PciMemoryRange', 'data': {'base': 'int', 'limit': 'int'} }
+
+##
+# @PciMemoryRegion
+#
+# Information about a PCI device I/O region.
+#
+# @bar: the index of the Base Address Register for this region
+#
+# @type: 'io' if the region is a PIO region
+# 'memory' if the region is a MMIO region
+#
+# @prefetch: #optional if @type is 'memory', true if the memory is prefetchable
+#
+# @mem_type_64: #optional if @type is 'memory', true if the BAR is 64-bit
+#
+# Since: 0.14.0
+##
+{ 'type': 'PciMemoryRegion',
+ 'data': {'bar': 'int', 'type': 'str', 'address': 'int', 'size': 'int',
+ '*prefetch': 'bool', '*mem_type_64': 'bool' } }
+
+##
+# @PciBridgeInfo:
+#
+# Information about a PCI Bridge device
+#
+# @bus.number: primary bus interface number. This should be the number of the
+# bus the device resides on.
+#
+# @bus.secondary: secondary bus interface number. This is the number of the
+# main bus for the bridge
+#
+# @bus.subordinate: This is the highest number bus that resides below the
+# bridge.
+#
+# @bus.io_range: The PIO range for all devices on this bridge
+#
+# @bus.memory_range: The MMIO range for all devices on this bridge
+#
+# @bus.prefetchable_range: The range of prefetchable MMIO for all devices on
+# this bridge
+#
+# @devices: a list of @PciDeviceInfo for each device on this bridge
+#
+# Since: 0.14.0
+##
+{ 'type': 'PciBridgeInfo',
+ 'data': {'bus': { 'number': 'int', 'secondary': 'int', 'subordinate': 'int',
+ 'io_range': 'PciMemoryRange',
+ 'memory_range': 'PciMemoryRange',
+ 'prefetchable_range': 'PciMemoryRange' },
+ '*devices': ['PciDeviceInfo']} }
+
+##
+# @PciDeviceInfo:
+#
+# Information about a PCI device
+#
+# @bus: the bus number of the device
+#
+# @slot: the slot the device is located in
+#
+# @function: the function of the slot used by the device
+#
+# @class_info.desc: #optional a string description of the device's class
+#
+# @class_info.class: the class code of the device
+#
+# @id.device: the PCI device id
+#
+# @id.vendor: the PCI vendor id
+#
+# @irq: #optional if an IRQ is assigned to the device, the IRQ number
+#
+# @qdev_id: the device name of the PCI device
+#
+# @pci_bridge: if the device is a PCI bridge, the bridge information
+#
+# @regions: a list of the PCI I/O regions associated with the device
+#
+# Notes: the contents of @class_info.desc are not stable and should only be
+# treated as informational.
+#
+# Since: 0.14.0
+##
+{ 'type': 'PciDeviceInfo',
+ 'data': {'bus': 'int', 'slot': 'int', 'function': 'int',
+ 'class_info': {'*desc': 'str', 'class': 'int'},
+ 'id': {'device': 'int', 'vendor': 'int'},
+ '*irq': 'int', 'qdev_id': 'str', '*pci_bridge': 'PciBridgeInfo',
+ 'regions': ['PciMemoryRegion']} }
+
+##
+# @PciInfo:
+#
+# Information about a PCI bus
+#
+# @bus: the bus index
+#
+# @devices: a list of devices on this bus
+#
+# Since: 0.14.0
+##
+{ 'type': 'PciInfo', 'data': {'bus': 'int', 'devices': ['PciDeviceInfo']} }
+
+##
+# @query-pci:
+#
+# Return information about the PCI bus topology of the guest.
+#
+# Returns: a list of @PciInfo for each PCI bus
+#
+# Since: 0.14.0
+##
+{ 'command': 'query-pci', 'returns': ['PciInfo'] }
+
+##
+# @BlockdevOnError:
+#
+# An enumeration of possible behaviors for errors on I/O operations.
+# The exact meaning depends on whether the I/O was initiated by a guest
+# or by a block job
+#
+# @report: for guest operations, report the error to the guest;
+# for jobs, cancel the job
+#
+# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR
+# or BLOCK_JOB_ERROR)
+#
+# @enospc: same as @stop on ENOSPC, same as @report otherwise.
+#
+# @stop: for guest operations, stop the virtual machine;
+# for jobs, pause the job
+#
+# Since: 1.3
+##
+{ 'enum': 'BlockdevOnError',
+ 'data': ['report', 'ignore', 'enospc', 'stop'] }
+
+##
+# @MirrorSyncMode:
+#
+# An enumeration of possible behaviors for the initial synchronization
+# phase of storage mirroring.
+#
+# @top: copies data in the topmost image to the destination
+#
+# @full: copies data from all images to the destination
+#
+# @none: only copy data written from now on
+#
+# Since: 1.3
+##
+{ 'enum': 'MirrorSyncMode',
+ 'data': ['top', 'full', 'none'] }
+
+##
+# @BlockJobType:
+#
+# Type of a block job.
+#
+# @commit: block commit job type, see "block-commit"
+#
+# @stream: block stream job type, see "block-stream"
+#
+# @mirror: drive mirror job type, see "drive-mirror"
+#
+# @backup: drive backup job type, see "drive-backup"
+#
+# Since: 1.7
+##
+{ 'enum': 'BlockJobType',
+ 'data': ['commit', 'stream', 'mirror', 'backup'] }
+
+##
+# @BlockJobInfo:
+#
+# Information about a long-running block device operation.
+#
+# @type: the job type ('stream' for image streaming)
+#
+# @device: the block device name
+#
+# @len: the maximum progress value
+#
+# @busy: false if the job is known to be in a quiescent state, with
+# no pending I/O. Since 1.3.
+#
+# @paused: whether the job is paused or, if @busy is true, will
+# pause itself as soon as possible. Since 1.3.
+#
+# @offset: the current progress value
+#
+# @speed: the rate limit, bytes per second
+#
+# @io-status: the status of the job (since 1.3)
+#
+# Since: 1.1
+##
+{ 'type': 'BlockJobInfo',
+ 'data': {'type': 'str', 'device': 'str', 'len': 'int',
+ 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int',
+ 'io-status': 'BlockDeviceIoStatus'} }
+
+##
+# @query-block-jobs:
+#
+# Return information about long-running block device operations.
+#
+# Returns: a list of @BlockJobInfo for each active block job
+#
+# Since: 1.1
+##
+{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] }
+
+##
+# @quit:
+#
+# This command will cause the QEMU process to exit gracefully. While every
+# attempt is made to send the QMP response before terminating, this is not
+# guaranteed. When using this interface, a premature EOF would not be
+# unexpected.
+#
+# Since: 0.14.0
+##
+{ 'command': 'quit' }
+
+##
+# @stop:
+#
+# Stop all guest VCPU execution.
+#
+# Since: 0.14.0
+#
+# Notes: This function will succeed even if the guest is already in the stopped
+# state. In "inmigrate" state, it will ensure that the guest
+# remains paused once migration finishes, as if the -S option was
+# passed on the command line.
+##
+{ 'command': 'stop' }
+
+##
+# @system_reset:
+#
+# Performs a hard reset of a guest.
+#
+# Since: 0.14.0
+##
+{ 'command': 'system_reset' }
+
+##
+# @system_powerdown:
+#
+# Requests that a guest perform a powerdown operation.
+#
+# Since: 0.14.0
+#
+# Notes: A guest may or may not respond to this command. This command
+# returning does not indicate that a guest has accepted the request or
+# that it has shut down. Many guests will respond to this command by
+# prompting the user in some way.
+##
+{ 'command': 'system_powerdown' }
+
+##
+# @cpu:
+#
+# This command is a nop that is only provided for the purposes of compatibility.
+#
+# Since: 0.14.0
+#
+# Notes: Do not use this command.
+##
+{ 'command': 'cpu', 'data': {'index': 'int'} }
+
+##
+# @cpu-add
+#
+# Adds CPU with specified ID
+#
+# @id: ID of CPU to be created, valid values [0..max_cpus)
+#
+# Returns: Nothing on success
+#
+# Since 1.5
+##
+{ 'command': 'cpu-add', 'data': {'id': 'int'} }
+
+##
+# @memsave:
+#
+# Save a portion of guest memory to a file.
+#
+# @val: the virtual address of the guest to start from
+#
+# @size: the size of memory region to save
+#
+# @filename: the file to save the memory to as binary data
+#
+# @cpu-index: #optional the index of the virtual CPU to use for translating the
+# virtual address (defaults to CPU 0)
+#
+# Returns: Nothing on success
+#
+# Since: 0.14.0
+#
+# Notes: Errors were not reliably returned until 1.1
+##
+{ 'command': 'memsave',
+ 'data': {'val': 'int', 'size': 'int', 'filename': 'str', '*cpu-index': 'int'} }
+
+##
+# @pmemsave:
+#
+# Save a portion of guest physical memory to a file.
+#
+# @val: the physical address of the guest to start from
+#
+# @size: the size of memory region to save
+#
+# @filename: the file to save the memory to as binary data
+#
+# Returns: Nothing on success
+#
+# Since: 0.14.0
+#
+# Notes: Errors were not reliably returned until 1.1
+##
+{ 'command': 'pmemsave',
+ 'data': {'val': 'int', 'size': 'int', 'filename': 'str'} }
+
+##
+# @cont:
+#
+# Resume guest VCPU execution.
+#
+# Since: 0.14.0
+#
+# Returns: If successful, nothing
+# If QEMU was started with an encrypted block device and a key has
+# not yet been set, DeviceEncrypted.
+#
+# Notes: This command will succeed if the guest is currently running. It
+# will also succeed if the guest is in the "inmigrate" state; in
+# this case, the effect of the command is to make sure the guest
+# starts once migration finishes, removing the effect of the -S
+# command line option if it was passed.
+##
+{ 'command': 'cont' }
+
+##
+# @system_wakeup:
+#
+# Wakeup guest from suspend. Does nothing in case the guest isn't suspended.
+#
+# Since: 1.1
+#
+# Returns: nothing.
+##
+{ 'command': 'system_wakeup' }
+
+##
+# @inject-nmi:
+#
+# Injects an Non-Maskable Interrupt into all guest's VCPUs.
+#
+# Returns: If successful, nothing
+#
+# Since: 0.14.0
+#
+# Notes: Only x86 Virtual Machines support this command.
+##
+{ 'command': 'inject-nmi' }
+
+##
+# @set_link:
+#
+# Sets the link status of a virtual network adapter.
+#
+# @name: the device name of the virtual network adapter
+#
+# @up: true to set the link status to be up
+#
+# Returns: Nothing on success
+# If @name is not a valid network device, DeviceNotFound
+#
+# Since: 0.14.0
+#
+# Notes: Not all network adapters support setting link status. This command
+# will succeed even if the network adapter does not support link status
+# notification.
+##
+{ 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} }
+
+##
+# @block_passwd:
+#
+# This command sets the password of a block device that has not been open
+# with a password and requires one.
+#
+# The two cases where this can happen are a block device is created through
+# QEMU's initial command line or a block device is changed through the legacy
+# @change interface.
+#
+# In the event that the block device is created through the initial command
+# line, the VM will start in the stopped state regardless of whether '-S' is
+# used. The intention is for a management tool to query the block devices to
+# determine which ones are encrypted, set the passwords with this command, and
+# then start the guest with the @cont command.
+#
+# @device: the name of the device to set the password on
+#
+# @password: the password to use for the device
+#
+# Returns: nothing on success
+# If @device is not a valid block device, DeviceNotFound
+# If @device is not encrypted, DeviceNotEncrypted
+#
+# Notes: Not all block formats support encryption and some that do are not
+# able to validate that a password is correct. Disk corruption may
+# occur if an invalid password is specified.
+#
+# Since: 0.14.0
+##
+{ 'command': 'block_passwd', 'data': {'device': 'str', 'password': 'str'} }
+
+##
+# @balloon:
+#
+# Request the balloon driver to change its balloon size.
+#
+# @value: the target size of the balloon in bytes
+#
+# Returns: Nothing on success
+# If the balloon driver is enabled but not functional because the KVM
+# kernel module cannot support it, KvmMissingCap
+# If no balloon device is present, DeviceNotActive
+#
+# Notes: This command just issues a request to the guest. When it returns,
+# the balloon size may not have changed. A guest can change the balloon
+# size independent of this command.
+#
+# Since: 0.14.0
+##
+{ 'command': 'balloon', 'data': {'value': 'int'} }
+
+##
+# @block_resize
+#
+# Resize a block image while a guest is running.
+#
+# @device: the name of the device to get the image resized
+#
+# @size: new image size in bytes
+#
+# Returns: nothing on success
+# If @device is not a valid block device, DeviceNotFound
+#
+# Since: 0.14.0
+##
+{ 'command': 'block_resize', 'data': { 'device': 'str', 'size': 'int' }}
+
+##
+# @NewImageMode
+#
+# An enumeration that tells QEMU how to set the backing file path in
+# a new image file.
+#
+# @existing: QEMU should look for an existing image file.
+#
+# @absolute-paths: QEMU should create a new image with absolute paths
+# for the backing file. If there is no backing file available, the new
+# image will not be backed either.
+#
+# Since: 1.1
+##
+{ 'enum': 'NewImageMode',
+ 'data': [ 'existing', 'absolute-paths' ] }
+
+##
+# @BlockdevSnapshot
+#
+# @device: the name of the device to generate the snapshot from.
+#
+# @snapshot-file: the target of the new image. A new file will be created.
+#
+# @format: #optional the format of the snapshot image, default is 'qcow2'.
+#
+# @mode: #optional whether and how QEMU should create a new image, default is
+# 'absolute-paths'.
+##
+{ 'type': 'BlockdevSnapshot',
+ 'data': { 'device': 'str', 'snapshot-file': 'str', '*format': 'str',
+ '*mode': 'NewImageMode' } }
+
+##
+# @BlockdevSnapshotInternal
+#
+# @device: the name of the device to generate the snapshot from
+#
+# @name: the name of the internal snapshot to be created
+#
+# Notes: In transaction, if @name is empty, or any snapshot matching @name
+# exists, the operation will fail. Only some image formats support it,
+# for example, qcow2, rbd, and sheepdog.
+#
+# Since: 1.7
+##
+{ 'type': 'BlockdevSnapshotInternal',
+ 'data': { 'device': 'str', 'name': 'str' } }
+
+##
+# @DriveBackup
+#
+# @device: the name of the device which should be copied.
+#
+# @target: the target of the new image. If the file exists, or if it
+# is a device, the existing file/device will be used as the new
+# destination. If it does not exist, a new file will be created.
+#
+# @format: #optional the format of the new destination, default is to
+# probe if @mode is 'existing', else the format of the source
+#
+# @sync: what parts of the disk image should be copied to the destination
+# (all the disk, only the sectors allocated in the topmost image, or
+# only new I/O).
+#
+# @mode: #optional whether and how QEMU should create a new image, default is
+# 'absolute-paths'.
+#
+# @speed: #optional the maximum speed, in bytes per second
+#
+# @on-source-error: #optional the action to take on an error on the source,
+# default 'report'. 'stop' and 'enospc' can only be used
+# if the block device supports io-status (see BlockInfo).
+#
+# @on-target-error: #optional the action to take on an error on the target,
+# default 'report' (no limitations, since this applies to
+# a different block device than @device).
+#
+# Note that @on-source-error and @on-target-error only affect background I/O.
+# If an error occurs during a guest write request, the device's rerror/werror
+# actions will be used.
+#
+# Since: 1.6
+##
+{ 'type': 'DriveBackup',
+ 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
+ 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
+ '*speed': 'int',
+ '*on-source-error': 'BlockdevOnError',
+ '*on-target-error': 'BlockdevOnError' } }
+
+##
+# @Abort
+#
+# This action can be used to test transaction failure.
+#
+# Since: 1.6
+###
+{ 'type': 'Abort',
+ 'data': { } }
+
+##
+# @TransactionAction
+#
+# A discriminated record of operations that can be performed with
+# @transaction.
+##
+{ 'union': 'TransactionAction',
+ 'data': {
+ 'blockdev-snapshot-sync': 'BlockdevSnapshot',
+ 'drive-backup': 'DriveBackup',
+ 'abort': 'Abort',
+ 'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternal'
+ } }
+
+##
+# @transaction
+#
+# Executes a number of transactionable QMP commands atomically. If any
+# operation fails, then the entire set of actions will be abandoned and the
+# appropriate error returned.
+#
+# List of:
+# @TransactionAction: information needed for the respective operation
+#
+# Returns: nothing on success
+# Errors depend on the operations of the transaction
+#
+# Note: The transaction aborts on the first failure. Therefore, there will be
+# information on only one failed operation returned in an error condition, and
+# subsequent actions will not have been attempted.
+#
+# Since 1.1
+##
+{ 'command': 'transaction',
+ 'data': { 'actions': [ 'TransactionAction' ] } }
+
+##
+# @blockdev-snapshot-sync
+#
+# Generates a synchronous snapshot of a block device.
+#
+# For the arguments, see the documentation of BlockdevSnapshot.
+#
+# Returns: nothing on success
+# If @device is not a valid block device, DeviceNotFound
+#
+# Since 0.14.0
+##
+{ 'command': 'blockdev-snapshot-sync',
+ 'data': 'BlockdevSnapshot' }
+
+##
+# @blockdev-snapshot-internal-sync
+#
+# Synchronously take an internal snapshot of a block device, when the format
+# of the image used supports it.
+#
+# For the arguments, see the documentation of BlockdevSnapshotInternal.
+#
+# Returns: nothing on success
+# If @device is not a valid block device, DeviceNotFound
+# If any snapshot matching @name exists, or @name is empty,
+# GenericError
+# If the format of the image used does not support it,
+# BlockFormatFeatureNotSupported
+#
+# Since 1.7
+##
+{ 'command': 'blockdev-snapshot-internal-sync',
+ 'data': 'BlockdevSnapshotInternal' }
+
+##
+# @blockdev-snapshot-delete-internal-sync
+#
+# Synchronously delete an internal snapshot of a block device, when the format
+# of the image used support it. The snapshot is identified by name or id or
+# both. One of the name or id is required. Return SnapshotInfo for the
+# successfully deleted snapshot.
+#
+# @device: the name of the device to delete the snapshot from
+#
+# @id: optional the snapshot's ID to be deleted
+#
+# @name: optional the snapshot's name to be deleted
+#
+# Returns: SnapshotInfo on success
+# If @device is not a valid block device, DeviceNotFound
+# If snapshot not found, GenericError
+# If the format of the image used does not support it,
+# BlockFormatFeatureNotSupported
+# If @id and @name are both not specified, GenericError
+#
+# Since 1.7
+##
+{ 'command': 'blockdev-snapshot-delete-internal-sync',
+ 'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
+ 'returns': 'SnapshotInfo' }
+
+##
+# @human-monitor-command:
+#
+# Execute a command on the human monitor and return the output.
+#
+# @command-line: the command to execute in the human monitor
+#
+# @cpu-index: #optional The CPU to use for commands that require an implicit CPU
+#
+# Returns: the output of the command as a string
+#
+# Since: 0.14.0
+#
+# Notes: This command only exists as a stop-gap. Its use is highly
+# discouraged. The semantics of this command are not guaranteed.
+#
+# Known limitations:
+#
+# o This command is stateless, this means that commands that depend
+# on state information (such as getfd) might not work
+#
+# o Commands that prompt the user for data (eg. 'cont' when the block
+# device is encrypted) don't currently work
+##
+{ 'command': 'human-monitor-command',
+ 'data': {'command-line': 'str', '*cpu-index': 'int'},
+ 'returns': 'str' }
+
+##
+# @block-commit
+#
+# Live commit of data from overlay image nodes into backing nodes - i.e.,
+# writes data between 'top' and 'base' into 'base'.
+#
+# @device: the name of the device
+#
+# @base: #optional The file name of the backing image to write data into.
+# If not specified, this is the deepest backing image
+#
+# @top: The file name of the backing image within the image chain,
+# which contains the topmost data to be committed down.
+# Note, the active layer as 'top' is currently unsupported.
+#
+# If top == base, that is an error.
+#
+#
+# @speed: #optional the maximum speed, in bytes per second
+#
+# Returns: Nothing on success
+# If commit or stream is already active on this device, DeviceInUse
+# If @device does not exist, DeviceNotFound
+# If image commit is not supported by this device, NotSupported
+# If @base or @top is invalid, a generic error is returned
+# If @top is the active layer, or omitted, a generic error is returned
+# If @speed is invalid, InvalidParameter
+#
+# Since: 1.3
+#
+##
+{ 'command': 'block-commit',
+ 'data': { 'device': 'str', '*base': 'str', 'top': 'str',
+ '*speed': 'int' } }
+
+##
+# @drive-backup
+#
+# Start a point-in-time copy of a block device to a new destination. The
+# status of ongoing drive-backup operations can be checked with
+# query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
+# The operation can be stopped before it has completed using the
+# block-job-cancel command.
+#
+# For the arguments, see the documentation of DriveBackup.
+#
+# Returns: nothing on success
+# If @device is not a valid block device, DeviceNotFound
+#
+# Since 1.6
+##
+{ 'command': 'drive-backup', 'data': 'DriveBackup' }
+
+##
+# @drive-mirror
+#
+# Start mirroring a block device's writes to a new destination.
+#
+# @device: the name of the device whose writes should be mirrored.
+#
+# @target: the target of the new image. If the file exists, or if it
+# is a device, the existing file/device will be used as the new
+# destination. If it does not exist, a new file will be created.
+#
+# @format: #optional the format of the new destination, default is to
+# probe if @mode is 'existing', else the format of the source
+#
+# @mode: #optional whether and how QEMU should create a new image, default is
+# 'absolute-paths'.
+#
+# @speed: #optional the maximum speed, in bytes per second
+#
+# @sync: what parts of the disk image should be copied to the destination
+# (all the disk, only the sectors allocated in the topmost image, or
+# only new I/O).
+#
+# @granularity: #optional granularity of the dirty bitmap, default is 64K
+# if the image format doesn't have clusters, 4K if the clusters
+# are smaller than that, else the cluster size. Must be a
+# power of 2 between 512 and 64M (since 1.4).
+#
+# @buf-size: #optional maximum amount of data in flight from source to
+# target (since 1.4).
+#
+# @on-source-error: #optional the action to take on an error on the source,
+# default 'report'. 'stop' and 'enospc' can only be used
+# if the block device supports io-status (see BlockInfo).
+#
+# @on-target-error: #optional the action to take on an error on the target,
+# default 'report' (no limitations, since this applies to
+# a different block device than @device).
+#
+# Returns: nothing on success
+# If @device is not a valid block device, DeviceNotFound
+#
+# Since 1.3
+##
+{ 'command': 'drive-mirror',
+ 'data': { 'device': 'str', 'target': 'str', '*format': 'str',
+ 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
+ '*speed': 'int', '*granularity': 'uint32',
+ '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
+ '*on-target-error': 'BlockdevOnError' } }
+
+##
+# @migrate_cancel
+#
+# Cancel the current executing migration process.
+#
+# Returns: nothing on success
+#
+# Notes: This command succeeds even if there is no migration process running.
+#
+# Since: 0.14.0
+##
+{ 'command': 'migrate_cancel' }
+
+##
+# @migrate_set_downtime
+#
+# Set maximum tolerated downtime for migration.
+#
+# @value: maximum downtime in seconds
+#
+# Returns: nothing on success
+#
+# Since: 0.14.0
+##
+{ 'command': 'migrate_set_downtime', 'data': {'value': 'number'} }
+
+##
+# @migrate_set_speed
+#
+# Set maximum speed for migration.
+#
+# @value: maximum speed in bytes.
+#
+# Returns: nothing on success
+#
+# Notes: A value lesser than zero will be automatically round up to zero.
+#
+# Since: 0.14.0
+##
+{ 'command': 'migrate_set_speed', 'data': {'value': 'int'} }
+
+##
+# @migrate-set-cache-size
+#
+# Set XBZRLE cache size
+#
+# @value: cache size in bytes
+#
+# The size will be rounded down to the nearest power of 2.
+# The cache size can be modified before and during ongoing migration
+#
+# Returns: nothing on success
+#
+# Since: 1.2
+##
+{ 'command': 'migrate-set-cache-size', 'data': {'value': 'int'} }
+
+##
+# @query-migrate-cache-size
+#
+# query XBZRLE cache size
+#
+# Returns: XBZRLE cache size in bytes
+#
+# Since: 1.2
+##
+{ 'command': 'query-migrate-cache-size', 'returns': 'int' }
+
+##
+# @ObjectPropertyInfo:
+#
+# @name: the name of the property
+#
+# @type: the type of the property. This will typically come in one of four
+# forms:
+#
+# 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
+# These types are mapped to the appropriate JSON type.
+#
+# 2) A legacy type in the form 'legacy<subtype>' where subtype is the
+# legacy qdev typename. These types are always treated as strings.
+#
+# 3) A child type in the form 'child<subtype>' where subtype is a qdev
+# device type name. Child properties create the composition tree.
+#
+# 4) A link type in the form 'link<subtype>' where subtype is a qdev
+# device type name. Link properties form the device model graph.
+#
+# Since: 1.2
+##
+{ 'type': 'ObjectPropertyInfo',
+ 'data': { 'name': 'str', 'type': 'str' } }
+
+##
+# @qom-list:
+#
+# This command will list any properties of a object given a path in the object
+# model.
+#
+# @path: the path within the object model. See @qom-get for a description of
+# this parameter.
+#
+# Returns: a list of @ObjectPropertyInfo that describe the properties of the
+# object.
+#
+# Since: 1.2
+##
+{ 'command': 'qom-list',
+ 'data': { 'path': 'str' },
+ 'returns': [ 'ObjectPropertyInfo' ] }
+
+##
+# @qom-get:
+#
+# This command will get a property from a object model path and return the
+# value.
+#
+# @path: The path within the object model. There are two forms of supported
+# paths--absolute and partial paths.
+#
+# Absolute paths are derived from the root object and can follow child<>
+# or link<> properties. Since they can follow link<> properties, they
+# can be arbitrarily long. Absolute paths look like absolute filenames
+# and are prefixed with a leading slash.
+#
+# Partial paths look like relative filenames. They do not begin
+# with a prefix. The matching rules for partial paths are subtle but
+# designed to make specifying objects easy. At each level of the
+# composition tree, the partial path is matched as an absolute path.
+# The first match is not returned. At least two matches are searched
+# for. A successful result is only returned if only one match is
+# found. If more than one match is found, a flag is return to
+# indicate that the match was ambiguous.
+#
+# @property: The property name to read
+#
+# Returns: The property value. The type depends on the property type. legacy<>
+# properties are returned as #str. child<> and link<> properties are
+# returns as #str pathnames. All integer property types (u8, u16, etc)
+# are returned as #int.
+#
+# Since: 1.2
+##
+{ 'command': 'qom-get',
+ 'data': { 'path': 'str', 'property': 'str' },
+ 'returns': 'visitor',
+ 'gen': 'no' }
+
+##
+# @qom-set:
+#
+# This command will set a property from a object model path.
+#
+# @path: see @qom-get for a description of this parameter
+#
+# @property: the property name to set
+#
+# @value: a value who's type is appropriate for the property type. See @qom-get
+# for a description of type mapping.
+#
+# Since: 1.2
+##
+{ 'command': 'qom-set',
+ 'data': { 'path': 'str', 'property': 'str', 'value': 'visitor' },
+ 'gen': 'no' }
+
+##
+# @set_password:
+#
+# Sets the password of a remote display session.
+#
+# @protocol: `vnc' to modify the VNC server password
+# `spice' to modify the Spice server password
+#
+# @password: the new password
+#
+# @connected: #optional how to handle existing clients when changing the
+# password. If nothing is specified, defaults to `keep'
+# `fail' to fail the command if clients are connected
+# `disconnect' to disconnect existing clients
+# `keep' to maintain existing clients
+#
+# Returns: Nothing on success
+# If Spice is not enabled, DeviceNotFound
+#
+# Since: 0.14.0
+##
+{ 'command': 'set_password',
+ 'data': {'protocol': 'str', 'password': 'str', '*connected': 'str'} }
+
+##
+# @expire_password:
+#
+# Expire the password of a remote display server.
+#
+# @protocol: the name of the remote display protocol `vnc' or `spice'
+#
+# @time: when to expire the password.
+# `now' to expire the password immediately
+# `never' to cancel password expiration
+# `+INT' where INT is the number of seconds from now (integer)
+# `INT' where INT is the absolute time in seconds
+#
+# Returns: Nothing on success
+# If @protocol is `spice' and Spice is not active, DeviceNotFound
+#
+# Since: 0.14.0
+#
+# Notes: Time is relative to the server and currently there is no way to
+# coordinate server time with client time. It is not recommended to
+# use the absolute time version of the @time parameter unless you're
+# sure you are on the same machine as the QEMU instance.
+##
+{ 'command': 'expire_password', 'data': {'protocol': 'str', 'time': 'str'} }
+
+##
+# @eject:
+#
+# Ejects a device from a removable drive.
+#
+# @device: The name of the device
+#
+# @force: @optional If true, eject regardless of whether the drive is locked.
+# If not specified, the default value is false.
+#
+# Returns: Nothing on success
+# If @device is not a valid block device, DeviceNotFound
+#
+# Notes: Ejecting a device will no media results in success
+#
+# Since: 0.14.0
+##
+{ 'command': 'eject', 'data': {'device': 'str', '*force': 'bool'} }
+
+##
+# @change-vnc-password:
+#
+# Change the VNC server password.
+#
+# @target: the new password to use with VNC authentication
+#
+# Since: 1.1
+#
+# Notes: An empty password in this command will set the password to the empty
+# string. Existing clients are unaffected by executing this command.
+##
+{ 'command': 'change-vnc-password', 'data': {'password': 'str'} }
+
+##
+# @change:
+#
+# This command is multiple commands multiplexed together.
+#
+# @device: This is normally the name of a block device but it may also be 'vnc'.
+# when it's 'vnc', then sub command depends on @target
+#
+# @target: If @device is a block device, then this is the new filename.
+# If @device is 'vnc', then if the value 'password' selects the vnc
+# change password command. Otherwise, this specifies a new server URI
+# address to listen to for VNC connections.
+#
+# @arg: If @device is a block device, then this is an optional format to open
+# the device with.
+# If @device is 'vnc' and @target is 'password', this is the new VNC
+# password to set. If this argument is an empty string, then no future
+# logins will be allowed.
+#
+# Returns: Nothing on success.
+# If @device is not a valid block device, DeviceNotFound
+# If the new block device is encrypted, DeviceEncrypted. Note that
+# if this error is returned, the device has been opened successfully
+# and an additional call to @block_passwd is required to set the
+# device's password. The behavior of reads and writes to the block
+# device between when these calls are executed is undefined.
+#
+# Notes: It is strongly recommended that this interface is not used especially
+# for changing block devices.
+#
+# Since: 0.14.0
+##
+{ 'command': 'change',
+ 'data': {'device': 'str', 'target': 'str', '*arg': 'str'} }
+
+##
+# @block_set_io_throttle:
+#
+# Change I/O throttle limits for a block drive.
+#
+# @device: The name of the device
+#
+# @bps: total throughput limit in bytes per second
+#
+# @bps_rd: read throughput limit in bytes per second
+#
+# @bps_wr: write throughput limit in bytes per second
+#
+# @iops: total I/O operations per second
+#
+# @ops_rd: read I/O operations per second
+#
+# @iops_wr: write I/O operations per second
+#
+# @bps_max: #optional total max in bytes (Since 1.7)
+#
+# @bps_rd_max: #optional read max in bytes (Since 1.7)
+#
+# @bps_wr_max: #optional write max in bytes (Since 1.7)
+#
+# @iops_max: #optional total I/O operations max (Since 1.7)
+#
+# @iops_rd_max: #optional read I/O operations max (Since 1.7)
+#
+# @iops_wr_max: #optional write I/O operations max (Since 1.7)
+#
+# @iops_size: #optional an I/O size in bytes (Since 1.7)
+#
+# Returns: Nothing on success
+# If @device is not a valid block device, DeviceNotFound
+#
+# Since: 1.1
+##
+{ 'command': 'block_set_io_throttle',
+ 'data': { 'device': 'str', 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int',
+ 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int',
+ '*bps_max': 'int', '*bps_rd_max': 'int',
+ '*bps_wr_max': 'int', '*iops_max': 'int',
+ '*iops_rd_max': 'int', '*iops_wr_max': 'int',
+ '*iops_size': 'int' } }
+
+##
+# @block-stream:
+#
+# Copy data from a backing file into a block device.
+#
+# The block streaming operation is performed in the background until the entire
+# backing file has been copied. This command returns immediately once streaming
+# has started. The status of ongoing block streaming operations can be checked
+# with query-block-jobs. The operation can be stopped before it has completed
+# using the block-job-cancel command.
+#
+# If a base file is specified then sectors are not copied from that base file and
+# its backing chain. When streaming completes the image file will have the base
+# file as its backing file. This can be used to stream a subset of the backing
+# file chain instead of flattening the entire image.
+#
+# On successful completion the image file is updated to drop the backing file
+# and the BLOCK_JOB_COMPLETED event is emitted.
+#
+# @device: the device name
+#
+# @base: #optional the common backing file name
+#
+# @speed: #optional the maximum speed, in bytes per second
+#
+# @on-error: #optional the action to take on an error (default report).
+# 'stop' and 'enospc' can only be used if the block device
+# supports io-status (see BlockInfo). Since 1.3.
+#
+# Returns: Nothing on success
+# If @device does not exist, DeviceNotFound
+#
+# Since: 1.1
+##
+{ 'command': 'block-stream',
+ 'data': { 'device': 'str', '*base': 'str', '*speed': 'int',
+ '*on-error': 'BlockdevOnError' } }
+
+##
+# @block-job-set-speed:
+#
+# Set maximum speed for a background block operation.
+#
+# This command can only be issued when there is an active block job.
+#
+# Throttling can be disabled by setting the speed to 0.
+#
+# @device: the device name
+#
+# @speed: the maximum speed, in bytes per second, or 0 for unlimited.
+# Defaults to 0.
+#
+# Returns: Nothing on success
+# If no background operation is active on this device, DeviceNotActive
+#
+# Since: 1.1
+##
+{ 'command': 'block-job-set-speed',
+ 'data': { 'device': 'str', 'speed': 'int' } }
+
+##
+# @block-job-cancel:
+#
+# Stop an active background block operation.
+#
+# This command returns immediately after marking the active background block
+# operation for cancellation. It is an error to call this command if no
+# operation is in progress.
+#
+# The operation will cancel as soon as possible and then emit the
+# BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when
+# enumerated using query-block-jobs.
+#
+# For streaming, the image file retains its backing file unless the streaming
+# operation happens to complete just as it is being cancelled. A new streaming
+# operation can be started at a later time to finish copying all data from the
+# backing file.
+#
+# @device: the device name
+#
+# @force: #optional whether to allow cancellation of a paused job (default
+# false). Since 1.3.
+#
+# Returns: Nothing on success
+# If no background operation is active on this device, DeviceNotActive
+#
+# Since: 1.1
+##
+{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } }
+
+##
+# @block-job-pause:
+#
+# Pause an active background block operation.
+#
+# This command returns immediately after marking the active background block
+# operation for pausing. It is an error to call this command if no
+# operation is in progress. Pausing an already paused job has no cumulative
+# effect; a single block-job-resume command will resume the job.
+#
+# The operation will pause as soon as possible. No event is emitted when
+# the operation is actually paused. Cancelling a paused job automatically
+# resumes it.
+#
+# @device: the device name
+#
+# Returns: Nothing on success
+# If no background operation is active on this device, DeviceNotActive
+#
+# Since: 1.3
+##
+{ 'command': 'block-job-pause', 'data': { 'device': 'str' } }
+
+##
+# @block-job-resume:
+#
+# Resume an active background block operation.
+#
+# This command returns immediately after resuming a paused background block
+# operation. It is an error to call this command if no operation is in
+# progress. Resuming an already running job is not an error.
+#
+# This command also clears the error status of the job.
+#
+# @device: the device name
+#
+# Returns: Nothing on success
+# If no background operation is active on this device, DeviceNotActive
+#
+# Since: 1.3
+##
+{ 'command': 'block-job-resume', 'data': { 'device': 'str' } }
+
+##
+# @block-job-complete:
+#
+# Manually trigger completion of an active background block operation. This
+# is supported for drive mirroring, where it also switches the device to
+# write to the target path only. The ability to complete is signaled with
+# a BLOCK_JOB_READY event.
+#
+# This command completes an active background block operation synchronously.
+# The ordering of this command's return with the BLOCK_JOB_COMPLETED event
+# is not defined. Note that if an I/O error occurs during the processing of
+# this command: 1) the command itself will fail; 2) the error will be processed
+# according to the rerror/werror arguments that were specified when starting
+# the operation.
+#
+# A cancelled or paused job cannot be completed.
+#
+# @device: the device name
+#
+# Returns: Nothing on success
+# If no background operation is active on this device, DeviceNotActive
+#
+# Since: 1.3
+##
+{ 'command': 'block-job-complete', 'data': { 'device': 'str' } }
+
+##
+# @ObjectTypeInfo:
+#
+# This structure describes a search result from @qom-list-types
+#
+# @name: the type name found in the search
+#
+# Since: 1.1
+#
+# Notes: This command is experimental and may change syntax in future releases.
+##
+{ 'type': 'ObjectTypeInfo',
+ 'data': { 'name': 'str' } }
+
+##
+# @qom-list-types:
+#
+# This command will return a list of types given search parameters
+#
+# @implements: if specified, only return types that implement this type name
+#
+# @abstract: if true, include abstract types in the results
+#
+# Returns: a list of @ObjectTypeInfo or an empty list if no results are found
+#
+# Since: 1.1
+##
+{ 'command': 'qom-list-types',
+ 'data': { '*implements': 'str', '*abstract': 'bool' },
+ 'returns': [ 'ObjectTypeInfo' ] }
+
+##
+# @DevicePropertyInfo:
+#
+# Information about device properties.
+#
+# @name: the name of the property
+# @type: the typename of the property
+#
+# Since: 1.2
+##
+{ 'type': 'DevicePropertyInfo',
+ 'data': { 'name': 'str', 'type': 'str' } }
+
+##
+# @device-list-properties:
+#
+# List properties associated with a device.
+#
+# @typename: the type name of a device
+#
+# Returns: a list of DevicePropertyInfo describing a devices properties
+#
+# Since: 1.2
+##
+{ 'command': 'device-list-properties',
+ 'data': { 'typename': 'str'},
+ 'returns': [ 'DevicePropertyInfo' ] }
+
+##
+# @migrate
+#
+# Migrates the current running guest to another Virtual Machine.
+#
+# @uri: the Uniform Resource Identifier of the destination VM
+#
+# @blk: #optional do block migration (full disk copy)
+#
+# @inc: #optional incremental disk copy migration
+#
+# @detach: this argument exists only for compatibility reasons and
+# is ignored by QEMU
+#
+# Returns: nothing on success
+#
+# Since: 0.14.0
+##
+{ 'command': 'migrate',
+ 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' } }
+
+# @xen-save-devices-state:
+#
+# Save the state of all devices to file. The RAM and the block devices
+# of the VM are not saved by this command.
+#
+# @filename: the file to save the state of the devices to as binary
+# data. See xen-save-devices-state.txt for a description of the binary
+# format.
+#
+# Returns: Nothing on success
+#
+# Since: 1.1
+##
+{ 'command': 'xen-save-devices-state', 'data': {'filename': 'str'} }
+
+##
+# @xen-set-global-dirty-log
+#
+# Enable or disable the global dirty log mode.
+#
+# @enable: true to enable, false to disable.
+#
+# Returns: nothing
+#
+# Since: 1.3
+##
+{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
+
+##
+# @device_del:
+#
+# Remove a device from a guest
+#
+# @id: the name of the device
+#
+# Returns: Nothing on success
+# If @id is not a valid device, DeviceNotFound
+#
+# Notes: When this command completes, the device may not be removed from the
+# guest. Hot removal is an operation that requires guest cooperation.
+# This command merely requests that the guest begin the hot removal
+# process. Completion of the device removal process is signaled with a
+# DEVICE_DELETED event. Guest reset will automatically complete removal
+# for all devices.
+#
+# Since: 0.14.0
+##
+{ 'command': 'device_del', 'data': {'id': 'str'} }
+
+##
+# @dump-guest-memory
+#
+# Dump guest's memory to vmcore. It is a synchronous operation that can take
+# very long depending on the amount of guest memory. This command is only
+# supported on i386 and x86_64.
+#
+# @paging: if true, do paging to get guest's memory mapping. This allows
+# using gdb to process the core file.
+#
+# IMPORTANT: this option can make QEMU allocate several gigabytes
+# of RAM. This can happen for a large guest, or a
+# malicious guest pretending to be large.
+#
+# Also, paging=true has the following limitations:
+#
+# 1. The guest may be in a catastrophic state or can have corrupted
+# memory, which cannot be trusted
+# 2. The guest can be in real-mode even if paging is enabled. For
+# example, the guest uses ACPI to sleep, and ACPI sleep state
+# goes in real-mode
+#
+# @protocol: the filename or file descriptor of the vmcore. The supported
+# protocols are:
+#
+# 1. file: the protocol starts with "file:", and the following
+# string is the file's path.
+# 2. fd: the protocol starts with "fd:", and the following string
+# is the fd's name.
+#
+# @begin: #optional if specified, the starting physical address.
+#
+# @length: #optional if specified, the memory size, in bytes. If you don't
+# want to dump all guest's memory, please specify the start @begin
+# and @length
+#
+# Returns: nothing on success
+#
+# Since: 1.2
+##
+{ 'command': 'dump-guest-memory',
+ 'data': { 'paging': 'bool', 'protocol': 'str', '*begin': 'int',
+ '*length': 'int' } }
+
+##
+# @netdev_add:
+#
+# Add a network backend.
+#
+# @type: the type of network backend. Current valid values are 'user', 'tap',
+# 'vde', 'socket', 'dump' and 'bridge'
+#
+# @id: the name of the new network backend
+#
+# @props: #optional a list of properties to be passed to the backend in
+# the format 'name=value', like 'ifname=tap0,script=no'
+#
+# Notes: The semantics of @props is not well defined. Future commands will be
+# introduced that provide stronger typing for backend creation.
+#
+# Since: 0.14.0
+#
+# Returns: Nothing on success
+# If @type is not a valid network backend, DeviceNotFound
+##
+{ 'command': 'netdev_add',
+ 'data': {'type': 'str', 'id': 'str', '*props': '**'},
+ 'gen': 'no' }
+
+##
+# @netdev_del:
+#
+# Remove a network backend.
+#
+# @id: the name of the network backend to remove
+#
+# Returns: Nothing on success
+# If @id is not a valid network backend, DeviceNotFound
+#
+# Since: 0.14.0
+##
+{ 'command': 'netdev_del', 'data': {'id': 'str'} }
+
+##
+# @NetdevNoneOptions
+#
+# Use it alone to have zero network devices.
+#
+# Since 1.2
+##
+{ 'type': 'NetdevNoneOptions',
+ 'data': { } }
+
+##
+# @NetLegacyNicOptions
+#
+# Create a new Network Interface Card.
+#
+# @netdev: #optional id of -netdev to connect to
+#
+# @macaddr: #optional MAC address
+#
+# @model: #optional device model (e1000, rtl8139, virtio etc.)
+#
+# @addr: #optional PCI device address
+#
+# @vectors: #optional number of MSI-x vectors, 0 to disable MSI-X
+#
+# Since 1.2
+##
+{ 'type': 'NetLegacyNicOptions',
+ 'data': {
+ '*netdev': 'str',
+ '*macaddr': 'str',
+ '*model': 'str',
+ '*addr': 'str',
+ '*vectors': 'uint32' } }
+
+##
+# @String
+#
+# A fat type wrapping 'str', to be embedded in lists.
+#
+# Since 1.2
+##
+{ 'type': 'String',
+ 'data': {
+ 'str': 'str' } }
+
+##
+# @NetdevUserOptions
+#
+# Use the user mode network stack which requires no administrator privilege to
+# run.
+#
+# @hostname: #optional client hostname reported by the builtin DHCP server
+#
+# @restrict: #optional isolate the guest from the host
+#
+# @ip: #optional legacy parameter, use net= instead
+#
+# @net: #optional IP address and optional netmask
+#
+# @host: #optional guest-visible address of the host
+#
+# @tftp: #optional root directory of the built-in TFTP server
+#
+# @bootfile: #optional BOOTP filename, for use with tftp=
+#
+# @dhcpstart: #optional the first of the 16 IPs the built-in DHCP server can
+# assign
+#
+# @dns: #optional guest-visible address of the virtual nameserver
+#
+# @dnssearch: #optional list of DNS suffixes to search, passed as DHCP option
+# to the guest
+#
+# @smb: #optional root directory of the built-in SMB server
+#
+# @smbserver: #optional IP address of the built-in SMB server
+#
+# @hostfwd: #optional redirect incoming TCP or UDP host connections to guest
+# endpoints
+#
+# @guestfwd: #optional forward guest TCP connections
+#
+# Since 1.2
+##
+{ 'type': 'NetdevUserOptions',
+ 'data': {
+ '*hostname': 'str',
+ '*restrict': 'bool',
+ '*ip': 'str',
+ '*net': 'str',
+ '*host': 'str',
+ '*tftp': 'str',
+ '*bootfile': 'str',
+ '*dhcpstart': 'str',
+ '*dns': 'str',
+ '*dnssearch': ['String'],
+ '*smb': 'str',
+ '*smbserver': 'str',
+ '*hostfwd': ['String'],
+ '*guestfwd': ['String'] } }
+
+##
+# @NetdevTapOptions
+#
+# Connect the host TAP network interface name to the VLAN.
+#
+# @ifname: #optional interface name
+#
+# @fd: #optional file descriptor of an already opened tap
+#
+# @fds: #optional multiple file descriptors of already opened multiqueue capable
+# tap
+#
+# @script: #optional script to initialize the interface
+#
+# @downscript: #optional script to shut down the interface
+#
+# @helper: #optional command to execute to configure bridge
+#
+# @sndbuf: #optional send buffer limit. Understands [TGMKkb] suffixes.
+#
+# @vnet_hdr: #optional enable the IFF_VNET_HDR flag on the tap interface
+#
+# @vhost: #optional enable vhost-net network accelerator
+#
+# @vhostfd: #optional file descriptor of an already opened vhost net device
+#
+# @vhostfds: #optional file descriptors of multiple already opened vhost net
+# devices
+#
+# @vhostforce: #optional vhost on for non-MSIX virtio guests
+#
+# @queues: #optional number of queues to be created for multiqueue capable tap
+#
+# Since 1.2
+##
+{ 'type': 'NetdevTapOptions',
+ 'data': {
+ '*ifname': 'str',
+ '*fd': 'str',
+ '*fds': 'str',
+ '*script': 'str',
+ '*downscript': 'str',
+ '*helper': 'str',
+ '*sndbuf': 'size',
+ '*vnet_hdr': 'bool',
+ '*vhost': 'bool',
+ '*vhostfd': 'str',
+ '*vhostfds': 'str',
+ '*vhostforce': 'bool',
+ '*queues': 'uint32'} }
+
+##
+# @NetdevSocketOptions
+#
+# Connect the VLAN to a remote VLAN in another QEMU virtual machine using a TCP
+# socket connection.
+#
+# @fd: #optional file descriptor of an already opened socket
+#
+# @listen: #optional port number, and optional hostname, to listen on
+#
+# @connect: #optional port number, and optional hostname, to connect to
+#
+# @mcast: #optional UDP multicast address and port number
+#
+# @localaddr: #optional source address and port for multicast and udp packets
+#
+# @udp: #optional UDP unicast address and port number
+#
+# Since 1.2
+##
+{ 'type': 'NetdevSocketOptions',
+ 'data': {
+ '*fd': 'str',
+ '*listen': 'str',
+ '*connect': 'str',
+ '*mcast': 'str',
+ '*localaddr': 'str',
+ '*udp': 'str' } }
+
+##
+# @NetdevVdeOptions
+#
+# Connect the VLAN to a vde switch running on the host.
+#
+# @sock: #optional socket path
+#
+# @port: #optional port number
+#
+# @group: #optional group owner of socket
+#
+# @mode: #optional permissions for socket
+#
+# Since 1.2
+##
+{ 'type': 'NetdevVdeOptions',
+ 'data': {
+ '*sock': 'str',
+ '*port': 'uint16',
+ '*group': 'str',
+ '*mode': 'uint16' } }
+
+##
+# @NetdevDumpOptions
+#
+# Dump VLAN network traffic to a file.
+#
+# @len: #optional per-packet size limit (64k default). Understands [TGMKkb]
+# suffixes.
+#
+# @file: #optional dump file path (default is qemu-vlan0.pcap)
+#
+# Since 1.2
+##
+{ 'type': 'NetdevDumpOptions',
+ 'data': {
+ '*len': 'size',
+ '*file': 'str' } }
+
+##
+# @NetdevBridgeOptions
+#
+# Connect a host TAP network interface to a host bridge device.
+#
+# @br: #optional bridge name
+#
+# @helper: #optional command to execute to configure bridge
+#
+# Since 1.2
+##
+{ 'type': 'NetdevBridgeOptions',
+ 'data': {
+ '*br': 'str',
+ '*helper': 'str' } }
+
+##
+# @NetdevHubPortOptions
+#
+# Connect two or more net clients through a software hub.
+#
+# @hubid: hub identifier number
+#
+# Since 1.2
+##
+{ 'type': 'NetdevHubPortOptions',
+ 'data': {
+ 'hubid': 'int32' } }
+
+##
+# @NetdevNetmapOptions
+#
+# Connect a client to a netmap-enabled NIC or to a VALE switch port
+#
+# @ifname: Either the name of an existing network interface supported by
+# netmap, or the name of a VALE port (created on the fly).
+# A VALE port name is in the form 'valeXXX:YYY', where XXX and
+# YYY are non-negative integers. XXX identifies a switch and
+# YYY identifies a port of the switch. VALE ports having the
+# same XXX are therefore connected to the same switch.
+#
+# @devname: #optional path of the netmap device (default: '/dev/netmap').
+#
+# Since 1.8
+##
+{ 'type': 'NetdevNetmapOptions',
+ 'data': {
+ 'ifname': 'str',
+ '*devname': 'str' } }
+
+##
+# @NetClientOptions
+#
+# A discriminated record of network device traits.
+#
+# Since 1.2
+##
+{ 'union': 'NetClientOptions',
+ 'data': {
+ 'none': 'NetdevNoneOptions',
+ 'nic': 'NetLegacyNicOptions',
+ 'user': 'NetdevUserOptions',
+ 'tap': 'NetdevTapOptions',
+ 'socket': 'NetdevSocketOptions',
+ 'vde': 'NetdevVdeOptions',
+ 'dump': 'NetdevDumpOptions',
+ 'bridge': 'NetdevBridgeOptions',
+ 'hubport': 'NetdevHubPortOptions',
+ 'netmap': 'NetdevNetmapOptions' } }
+
+##
+# @NetLegacy
+#
+# Captures the configuration of a network device; legacy.
+#
+# @vlan: #optional vlan number
+#
+# @id: #optional identifier for monitor commands
+#
+# @name: #optional identifier for monitor commands, ignored if @id is present
+#
+# @opts: device type specific properties (legacy)
+#
+# Since 1.2
+##
+{ 'type': 'NetLegacy',
+ 'data': {
+ '*vlan': 'int32',
+ '*id': 'str',
+ '*name': 'str',
+ 'opts': 'NetClientOptions' } }
+
+##
+# @Netdev
+#
+# Captures the configuration of a network device.
+#
+# @id: identifier for monitor commands.
+#
+# @opts: device type specific properties
+#
+# Since 1.2
+##
+{ 'type': 'Netdev',
+ 'data': {
+ 'id': 'str',
+ 'opts': 'NetClientOptions' } }
+
+##
+# @InetSocketAddress
+#
+# Captures a socket address or address range in the Internet namespace.
+#
+# @host: host part of the address
+#
+# @port: port part of the address, or lowest port if @to is present
+#
+# @to: highest port to try
+#
+# @ipv4: whether to accept IPv4 addresses, default try both IPv4 and IPv6
+# #optional
+#
+# @ipv6: whether to accept IPv6 addresses, default try both IPv4 and IPv6
+# #optional
+#
+# Since 1.3
+##
+{ 'type': 'InetSocketAddress',
+ 'data': {
+ 'host': 'str',
+ 'port': 'str',
+ '*to': 'uint16',
+ '*ipv4': 'bool',
+ '*ipv6': 'bool' } }
+
+##
+# @UnixSocketAddress
+#
+# Captures a socket address in the local ("Unix socket") namespace.
+#
+# @path: filesystem path to use
+#
+# Since 1.3
+##
+{ 'type': 'UnixSocketAddress',
+ 'data': {
+ 'path': 'str' } }
+
+##
+# @SocketAddress
+#
+# Captures the address of a socket, which could also be a named file descriptor
+#
+# Since 1.3
+##
+{ 'union': 'SocketAddress',
+ 'data': {
+ 'inet': 'InetSocketAddress',
+ 'unix': 'UnixSocketAddress',
+ 'fd': 'String' } }
+
+##
+# @getfd:
+#
+# Receive a file descriptor via SCM rights and assign it a name
+#
+# @fdname: file descriptor name
+#
+# Returns: Nothing on success
+#
+# Since: 0.14.0
+#
+# Notes: If @fdname already exists, the file descriptor assigned to
+# it will be closed and replaced by the received file
+# descriptor.
+# The 'closefd' command can be used to explicitly close the
+# file descriptor when it is no longer needed.
+##
+{ 'command': 'getfd', 'data': {'fdname': 'str'} }
+
+##
+# @closefd:
+#
+# Close a file descriptor previously passed via SCM rights
+#
+# @fdname: file descriptor name
+#
+# Returns: Nothing on success
+#
+# Since: 0.14.0
+##
+{ 'command': 'closefd', 'data': {'fdname': 'str'} }
+
+##
+# @MachineInfo:
+#
+# Information describing a machine.
+#
+# @name: the name of the machine
+#
+# @alias: #optional an alias for the machine name
+#
+# @default: #optional whether the machine is default
+#
+# @cpu-max: maximum number of CPUs supported by the machine type
+# (since 1.5.0)
+#
+# Since: 1.2.0
+##
+{ 'type': 'MachineInfo',
+ 'data': { 'name': 'str', '*alias': 'str',
+ '*is-default': 'bool', 'cpu-max': 'int' } }
+
+##
+# @query-machines:
+#
+# Return a list of supported machines
+#
+# Returns: a list of MachineInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
+
+##
+# @CpuDefinitionInfo:
+#
+# Virtual CPU definition.
+#
+# @name: the name of the CPU definition
+#
+# Since: 1.2.0
+##
+{ 'type': 'CpuDefinitionInfo',
+ 'data': { 'name': 'str' } }
+
+##
+# @query-cpu-definitions:
+#
+# Return a list of supported virtual CPU definitions
+#
+# Returns: a list of CpuDefInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }
+
+# @AddfdInfo:
+#
+# Information about a file descriptor that was added to an fd set.
+#
+# @fdset-id: The ID of the fd set that @fd was added to.
+#
+# @fd: The file descriptor that was received via SCM rights and
+# added to the fd set.
+#
+# Since: 1.2.0
+##
+{ 'type': 'AddfdInfo', 'data': {'fdset-id': 'int', 'fd': 'int'} }
+
+##
+# @add-fd:
+#
+# Add a file descriptor, that was passed via SCM rights, to an fd set.
+#
+# @fdset-id: #optional The ID of the fd set to add the file descriptor to.
+#
+# @opaque: #optional A free-form string that can be used to describe the fd.
+#
+# Returns: @AddfdInfo on success
+# If file descriptor was not received, FdNotSupplied
+# If @fdset-id is a negative value, InvalidParameterValue
+#
+# Notes: The list of fd sets is shared by all monitor connections.
+#
+# If @fdset-id is not specified, a new fd set will be created.
+#
+# Since: 1.2.0
+##
+{ 'command': 'add-fd', 'data': {'*fdset-id': 'int', '*opaque': 'str'},
+ 'returns': 'AddfdInfo' }
+
+##
+# @remove-fd:
+#
+# Remove a file descriptor from an fd set.
+#
+# @fdset-id: The ID of the fd set that the file descriptor belongs to.
+#
+# @fd: #optional The file descriptor that is to be removed.
+#
+# Returns: Nothing on success
+# If @fdset-id or @fd is not found, FdNotFound
+#
+# Since: 1.2.0
+#
+# Notes: The list of fd sets is shared by all monitor connections.
+#
+# If @fd is not specified, all file descriptors in @fdset-id
+# will be removed.
+##
+{ 'command': 'remove-fd', 'data': {'fdset-id': 'int', '*fd': 'int'} }
+
+##
+# @FdsetFdInfo:
+#
+# Information about a file descriptor that belongs to an fd set.
+#
+# @fd: The file descriptor value.
+#
+# @opaque: #optional A free-form string that can be used to describe the fd.
+#
+# Since: 1.2.0
+##
+{ 'type': 'FdsetFdInfo',
+ 'data': {'fd': 'int', '*opaque': 'str'} }
+
+##
+# @FdsetInfo:
+#
+# Information about an fd set.
+#
+# @fdset-id: The ID of the fd set.
+#
+# @fds: A list of file descriptors that belong to this fd set.
+#
+# Since: 1.2.0
+##
+{ 'type': 'FdsetInfo',
+ 'data': {'fdset-id': 'int', 'fds': ['FdsetFdInfo']} }
+
+##
+# @query-fdsets:
+#
+# Return information describing all fd sets.
+#
+# Returns: A list of @FdsetInfo
+#
+# Since: 1.2.0
+#
+# Note: The list of fd sets is shared by all monitor connections.
+#
+##
+{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
+
+##
+# @TargetInfo:
+#
+# Information describing the QEMU target.
+#
+# @arch: the target architecture (eg "x86_64", "i386", etc)
+#
+# Since: 1.2.0
+##
+{ 'type': 'TargetInfo',
+ 'data': { 'arch': 'str' } }
+
+##
+# @query-target:
+#
+# Return information about the target for this QEMU
+#
+# Returns: TargetInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-target', 'returns': 'TargetInfo' }
+
+##
+# @QKeyCode:
+#
+# An enumeration of key name.
+#
+# This is used by the send-key command.
+#
+# Since: 1.3.0
+##
+{ 'enum': 'QKeyCode',
+ 'data': [ 'shift', 'shift_r', 'alt', 'alt_r', 'altgr', 'altgr_r', 'ctrl',
+ 'ctrl_r', 'menu', 'esc', '1', '2', '3', '4', '5', '6', '7', '8',
+ '9', '0', 'minus', 'equal', 'backspace', 'tab', 'q', 'w', 'e',
+ 'r', 't', 'y', 'u', 'i', 'o', 'p', 'bracket_left', 'bracket_right',
+ 'ret', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'semicolon',
+ 'apostrophe', 'grave_accent', 'backslash', 'z', 'x', 'c', 'v', 'b',
+ 'n', 'm', 'comma', 'dot', 'slash', 'asterisk', 'spc', 'caps_lock',
+ 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10',
+ 'num_lock', 'scroll_lock', 'kp_divide', 'kp_multiply',
+ 'kp_subtract', 'kp_add', 'kp_enter', 'kp_decimal', 'sysrq', 'kp_0',
+ 'kp_1', 'kp_2', 'kp_3', 'kp_4', 'kp_5', 'kp_6', 'kp_7', 'kp_8',
+ 'kp_9', 'less', 'f11', 'f12', 'print', 'home', 'pgup', 'pgdn', 'end',
+ 'left', 'up', 'down', 'right', 'insert', 'delete', 'stop', 'again',
+ 'props', 'undo', 'front', 'copy', 'open', 'paste', 'find', 'cut',
+ 'lf', 'help', 'meta_l', 'meta_r', 'compose' ] }
+
+##
+# @KeyValue
+#
+# Represents a keyboard key.
+#
+# Since: 1.3.0
+##
+{ 'union': 'KeyValue',
+ 'data': {
+ 'number': 'int',
+ 'qcode': 'QKeyCode' } }
+
+##
+# @send-key:
+#
+# Send keys to guest.
+#
+# @keys: An array of @KeyValue elements. All @KeyValues in this array are
+# simultaneously sent to the guest. A @KeyValue.number value is sent
+# directly to the guest, while @KeyValue.qcode must be a valid
+# @QKeyCode value
+#
+# @hold-time: #optional time to delay key up events, milliseconds. Defaults
+# to 100
+#
+# Returns: Nothing on success
+# If key is unknown or redundant, InvalidParameter
+#
+# Since: 1.3.0
+#
+##
+{ 'command': 'send-key',
+ 'data': { 'keys': ['KeyValue'], '*hold-time': 'int' } }
+
+##
+# @screendump:
+#
+# Write a PPM of the VGA screen to a file.
+#
+# @filename: the path of a new PPM file to store the image
+#
+# Returns: Nothing on success
+#
+# Since: 0.14.0
+##
+{ 'command': 'screendump', 'data': {'filename': 'str'} }
+
+##
+# @nbd-server-start:
+#
+# Start an NBD server listening on the given host and port. Block
+# devices can then be exported using @nbd-server-add. The NBD
+# server will present them as named exports; for example, another
+# QEMU instance could refer to them as "nbd:HOST:PORT:exportname=NAME".
+#
+# @addr: Address on which to listen.
+#
+# Returns: error if the server is already running.
+#
+# Since: 1.3.0
+##
+{ 'command': 'nbd-server-start',
+ 'data': { 'addr': 'SocketAddress' } }
+
+##
+# @nbd-server-add:
+#
+# Export a device to QEMU's embedded NBD server.
+#
+# @device: Block device to be exported
+#
+# @writable: Whether clients should be able to write to the device via the
+# NBD connection (default false). #optional
+#
+# Returns: error if the device is already marked for export.
+#
+# Since: 1.3.0
+##
+{ 'command': 'nbd-server-add', 'data': {'device': 'str', '*writable': 'bool'} }
+
+##
+# @nbd-server-stop:
+#
+# Stop QEMU's embedded NBD server, and unregister all devices previously
+# added via @nbd-server-add.
+#
+# Since: 1.3.0
+##
+{ 'command': 'nbd-server-stop' }
+
+##
+# @ChardevFile:
+#
+# Configuration info for file chardevs.
+#
+# @in: #optional The name of the input file
+# @out: The name of the output file
+#
+# Since: 1.4
+##
+{ 'type': 'ChardevFile', 'data': { '*in' : 'str',
+ 'out' : 'str' } }
+
+##
+# @ChardevHostdev:
+#
+# Configuration info for device and pipe chardevs.
+#
+# @device: The name of the special file for the device,
+# i.e. /dev/ttyS0 on Unix or COM1: on Windows
+# @type: What kind of device this is.
+#
+# Since: 1.4
+##
+{ 'type': 'ChardevHostdev', 'data': { 'device' : 'str' } }
+
+##
+# @ChardevSocket:
+#
+# Configuration info for (stream) socket chardevs.
+#
+# @addr: socket address to listen on (server=true)
+# or connect to (server=false)
+# @server: #optional create server socket (default: true)
+# @wait: #optional wait for incoming connection on server
+# sockets (default: false).
+# @nodelay: #optional set TCP_NODELAY socket option (default: false)
+# @telnet: #optional enable telnet protocol on server
+# sockets (default: false)
+#
+# Since: 1.4
+##
+{ 'type': 'ChardevSocket', 'data': { 'addr' : 'SocketAddress',
+ '*server' : 'bool',
+ '*wait' : 'bool',
+ '*nodelay' : 'bool',
+ '*telnet' : 'bool' } }
+
+##
+# @ChardevUdp:
+#
+# Configuration info for datagram socket chardevs.
+#
+# @remote: remote address
+# @local: #optional local address
+#
+# Since: 1.5
+##
+{ 'type': 'ChardevUdp', 'data': { 'remote' : 'SocketAddress',
+ '*local' : 'SocketAddress' } }
+
+##
+# @ChardevMux:
+#
+# Configuration info for mux chardevs.
+#
+# @chardev: name of the base chardev.
+#
+# Since: 1.5
+##
+{ 'type': 'ChardevMux', 'data': { 'chardev' : 'str' } }
+
+##
+# @ChardevStdio:
+#
+# Configuration info for stdio chardevs.
+#
+# @signal: #optional Allow signals (such as SIGINT triggered by ^C)
+# be delivered to qemu. Default: true in -nographic mode,
+# false otherwise.
+#
+# Since: 1.5
+##
+{ 'type': 'ChardevStdio', 'data': { '*signal' : 'bool' } }
+
+##
+# @ChardevSpiceChannel:
+#
+# Configuration info for spice vm channel chardevs.
+#
+# @type: kind of channel (for example vdagent).
+#
+# Since: 1.5
+##
+{ 'type': 'ChardevSpiceChannel', 'data': { 'type' : 'str' } }
+
+##
+# @ChardevSpicePort:
+#
+# Configuration info for spice port chardevs.
+#
+# @fqdn: name of the channel (see docs/spice-port-fqdn.txt)
+#
+# Since: 1.5
+##
+{ 'type': 'ChardevSpicePort', 'data': { 'fqdn' : 'str' } }
+
+##
+# @ChardevVC:
+#
+# Configuration info for virtual console chardevs.
+#
+# @width: console width, in pixels
+# @height: console height, in pixels
+# @cols: console width, in chars
+# @rows: console height, in chars
+#
+# Since: 1.5
+##
+{ 'type': 'ChardevVC', 'data': { '*width' : 'int',
+ '*height' : 'int',
+ '*cols' : 'int',
+ '*rows' : 'int' } }
+
+##
+# @ChardevRingbuf:
+#
+# Configuration info for ring buffer chardevs.
+#
+# @size: #optional ring buffer size, must be power of two, default is 65536
+#
+# Since: 1.5
+##
+{ 'type': 'ChardevRingbuf', 'data': { '*size' : 'int' } }
+
+##
+# @ChardevBackend:
+#
+# Configuration info for the new chardev backend.
+#
+# Since: 1.4
+##
+{ 'type': 'ChardevDummy', 'data': { } }
+
+{ 'union': 'ChardevBackend', 'data': { 'file' : 'ChardevFile',
+ 'serial' : 'ChardevHostdev',
+ 'parallel': 'ChardevHostdev',
+ 'pipe' : 'ChardevHostdev',
+ 'socket' : 'ChardevSocket',
+ 'udp' : 'ChardevUdp',
+ 'pty' : 'ChardevDummy',
+ 'null' : 'ChardevDummy',
+ 'mux' : 'ChardevMux',
+ 'msmouse': 'ChardevDummy',
+ 'braille': 'ChardevDummy',
+ 'stdio' : 'ChardevStdio',
+ 'console': 'ChardevDummy',
+ 'spicevmc' : 'ChardevSpiceChannel',
+ 'spiceport' : 'ChardevSpicePort',
+ 'vc' : 'ChardevVC',
+ 'ringbuf': 'ChardevRingbuf',
+ # next one is just for compatibility
+ 'memory' : 'ChardevRingbuf' } }
+
+##
+# @ChardevReturn:
+#
+# Return info about the chardev backend just created.
+#
+# @pty: #optional name of the slave pseudoterminal device, present if
+# and only if a chardev of type 'pty' was created
+#
+# Since: 1.4
+##
+{ 'type' : 'ChardevReturn', 'data': { '*pty' : 'str' } }
+
+##
+# @chardev-add:
+#
+# Add a character device backend
+#
+# @id: the chardev's ID, must be unique
+# @backend: backend type and parameters
+#
+# Returns: ChardevReturn.
+#
+# Since: 1.4
+##
+{ 'command': 'chardev-add', 'data': {'id' : 'str',
+ 'backend' : 'ChardevBackend' },
+ 'returns': 'ChardevReturn' }
+
+##
+# @chardev-remove:
+#
+# Remove a character device backend
+#
+# @id: the chardev's ID, must exist and not be in use
+#
+# Returns: Nothing on success
+#
+# Since: 1.4
+##
+{ 'command': 'chardev-remove', 'data': {'id': 'str'} }
+
+##
+# @TpmModel:
+#
+# An enumeration of TPM models
+#
+# @tpm-tis: TPM TIS model
+#
+# Since: 1.5
+##
+{ 'enum': 'TpmModel', 'data': [ 'tpm-tis' ] }
+
+##
+# @query-tpm-models:
+#
+# Return a list of supported TPM models
+#
+# Returns: a list of TpmModel
+#
+# Since: 1.5
+##
+{ 'command': 'query-tpm-models', 'returns': ['TpmModel'] }
+
+##
+# @TpmType:
+#
+# An enumeration of TPM types
+#
+# @passthrough: TPM passthrough type
+#
+# Since: 1.5
+##
+{ 'enum': 'TpmType', 'data': [ 'passthrough' ] }
+
+##
+# @query-tpm-types:
+#
+# Return a list of supported TPM types
+#
+# Returns: a list of TpmType
+#
+# Since: 1.5
+##
+{ 'command': 'query-tpm-types', 'returns': ['TpmType'] }
+
+##
+# @TPMPassthroughOptions:
+#
+# Information about the TPM passthrough type
+#
+# @path: #optional string describing the path used for accessing the TPM device
+#
+# @cancel-path: #optional string showing the TPM's sysfs cancel file
+# for cancellation of TPM commands while they are executing
+#
+# Since: 1.5
+##
+{ 'type': 'TPMPassthroughOptions', 'data': { '*path' : 'str',
+ '*cancel-path' : 'str'} }
+
+##
+# @TpmTypeOptions:
+#
+# A union referencing different TPM backend types' configuration options
+#
+# @passthrough: The configuration options for the TPM passthrough type
+#
+# Since: 1.5
+##
+{ 'union': 'TpmTypeOptions',
+ 'data': { 'passthrough' : 'TPMPassthroughOptions' } }
+
+##
+# @TpmInfo:
+#
+# Information about the TPM
+#
+# @id: The Id of the TPM
+#
+# @model: The TPM frontend model
+#
+# @options: The TPM (backend) type configuration options
+#
+# Since: 1.5
+##
+{ 'type': 'TPMInfo',
+ 'data': {'id': 'str',
+ 'model': 'TpmModel',
+ 'options': 'TpmTypeOptions' } }
+
+##
+# @query-tpm:
+#
+# Return information about the TPM device
+#
+# Returns: @TPMInfo on success
+#
+# Since: 1.5
+##
+{ 'command': 'query-tpm', 'returns': ['TPMInfo'] }
+
+##
+# @AcpiTableOptions
+#
+# Specify an ACPI table on the command line to load.
+#
+# At most one of @file and @data can be specified. The list of files specified
+# by any one of them is loaded and concatenated in order. If both are omitted,
+# @data is implied.
+#
+# Other fields / optargs can be used to override fields of the generic ACPI
+# table header; refer to the ACPI specification 5.0, section 5.2.6 System
+# Description Table Header. If a header field is not overridden, then the
+# corresponding value from the concatenated blob is used (in case of @file), or
+# it is filled in with a hard-coded value (in case of @data).
+#
+# String fields are copied into the matching ACPI member from lowest address
+# upwards, and silently truncated / NUL-padded to length.
+#
+# @sig: #optional table signature / identifier (4 bytes)
+#
+# @rev: #optional table revision number (dependent on signature, 1 byte)
+#
+# @oem_id: #optional OEM identifier (6 bytes)
+#
+# @oem_table_id: #optional OEM table identifier (8 bytes)
+#
+# @oem_rev: #optional OEM-supplied revision number (4 bytes)
+#
+# @asl_compiler_id: #optional identifier of the utility that created the table
+# (4 bytes)
+#
+# @asl_compiler_rev: #optional revision number of the utility that created the
+# table (4 bytes)
+#
+# @file: #optional colon (:) separated list of pathnames to load and
+# concatenate as table data. The resultant binary blob is expected to
+# have an ACPI table header. At least one file is required. This field
+# excludes @data.
+#
+# @data: #optional colon (:) separated list of pathnames to load and
+# concatenate as table data. The resultant binary blob must not have an
+# ACPI table header. At least one file is required. This field excludes
+# @file.
+#
+# Since 1.5
+##
+{ 'type': 'AcpiTableOptions',
+ 'data': {
+ '*sig': 'str',
+ '*rev': 'uint8',
+ '*oem_id': 'str',
+ '*oem_table_id': 'str',
+ '*oem_rev': 'uint32',
+ '*asl_compiler_id': 'str',
+ '*asl_compiler_rev': 'uint32',
+ '*file': 'str',
+ '*data': 'str' }}
+
+##
+# @CommandLineParameterType:
+#
+# Possible types for an option parameter.
+#
+# @string: accepts a character string
+#
+# @boolean: accepts "on" or "off"
+#
+# @number: accepts a number
+#
+# @size: accepts a number followed by an optional suffix (K)ilo,
+# (M)ega, (G)iga, (T)era
+#
+# Since 1.5
+##
+{ 'enum': 'CommandLineParameterType',
+ 'data': ['string', 'boolean', 'number', 'size'] }
+
+##
+# @CommandLineParameterInfo:
+#
+# Details about a single parameter of a command line option.
+#
+# @name: parameter name
+#
+# @type: parameter @CommandLineParameterType
+#
+# @help: #optional human readable text string, not suitable for parsing.
+#
+# Since 1.5
+##
+{ 'type': 'CommandLineParameterInfo',
+ 'data': { 'name': 'str',
+ 'type': 'CommandLineParameterType',
+ '*help': 'str' } }
+
+##
+# @CommandLineOptionInfo:
+#
+# Details about a command line option, including its list of parameter details
+#
+# @option: option name
+#
+# @parameters: an array of @CommandLineParameterInfo
+#
+# Since 1.5
+##
+{ 'type': 'CommandLineOptionInfo',
+ 'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'] } }
+
+##
+# @query-command-line-options:
+#
+# Query command line option schema.
+#
+# @option: #optional option name
+#
+# Returns: list of @CommandLineOptionInfo for all options (or for the given
+# @option). Returns an error if the given @option doesn't exist.
+#
+# Since 1.5
+##
+{'command': 'query-command-line-options', 'data': { '*option': 'str' },
+ 'returns': ['CommandLineOptionInfo'] }
+
+##
+# @X86CPURegister32
+#
+# A X86 32-bit register
+#
+# Since: 1.5
+##
+{ 'enum': 'X86CPURegister32',
+ 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
+
+##
+# @X86CPUFeatureWordInfo
+#
+# Information about a X86 CPU feature word
+#
+# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
+#
+# @cpuid-input-ecx: #optional Input ECX value for CPUID instruction for that
+# feature word
+#
+# @cpuid-register: Output register containing the feature bits
+#
+# @features: value of output register, containing the feature bits
+#
+# Since: 1.5
+##
+{ 'type': 'X86CPUFeatureWordInfo',
+ 'data': { 'cpuid-input-eax': 'int',
+ '*cpuid-input-ecx': 'int',
+ 'cpuid-register': 'X86CPURegister32',
+ 'features': 'int' } }
+
+##
+# @RxState:
+#
+# Packets receiving state
+#
+# @normal: filter assigned packets according to the mac-table
+#
+# @none: don't receive any assigned packet
+#
+# @all: receive all assigned packets
+#
+# Since: 1.6
+##
+{ 'enum': 'RxState', 'data': [ 'normal', 'none', 'all' ] }
+
+##
+# @RxFilterInfo:
+#
+# Rx-filter information for a NIC.
+#
+# @name: net client name
+#
+# @promiscuous: whether promiscuous mode is enabled
+#
+# @multicast: multicast receive state
+#
+# @unicast: unicast receive state
+#
+# @broadcast-allowed: whether to receive broadcast
+#
+# @multicast-overflow: multicast table is overflowed or not
+#
+# @unicast-overflow: unicast table is overflowed or not
+#
+# @main-mac: the main macaddr string
+#
+# @vlan-table: a list of active vlan id
+#
+# @unicast-table: a list of unicast macaddr string
+#
+# @multicast-table: a list of multicast macaddr string
+#
+# Since 1.6
+##
+
+{ 'type': 'RxFilterInfo',
+ 'data': {
+ 'name': 'str',
+ 'promiscuous': 'bool',
+ 'multicast': 'RxState',
+ 'unicast': 'RxState',
+ 'broadcast-allowed': 'bool',
+ 'multicast-overflow': 'bool',
+ 'unicast-overflow': 'bool',
+ 'main-mac': 'str',
+ 'vlan-table': ['int'],
+ 'unicast-table': ['str'],
+ 'multicast-table': ['str'] }}
+
+##
+# @query-rx-filter:
+#
+# Return rx-filter information for all NICs (or for the given NIC).
+#
+# @name: #optional net client name
+#
+# Returns: list of @RxFilterInfo for all NICs (or for the given NIC).
+# Returns an error if the given @name doesn't exist, or given
+# NIC doesn't support rx-filter querying, or given net client
+# isn't a NIC.
+#
+# Since: 1.6
+##
+{ 'command': 'query-rx-filter', 'data': { '*name': 'str' },
+ 'returns': ['RxFilterInfo'] }
+
+
+##
+# @BlockdevDiscardOptions
+#
+# Determines how to handle discard requests.
+#
+# @ignore: Ignore the request
+# @unmap: Forward as an unmap request
+#
+# Since: 1.7
+##
+{ 'enum': 'BlockdevDiscardOptions',
+ 'data': [ 'ignore', 'unmap' ] }
+
+##
+# @BlockdevAioOptions
+#
+# Selects the AIO backend to handle I/O requests
+#
+# @threads: Use qemu's thread pool
+# @native: Use native AIO backend (only Linux and Windows)
+#
+# Since: 1.7
+##
+{ 'enum': 'BlockdevAioOptions',
+ 'data': [ 'threads', 'native' ] }
+
+##
+# @BlockdevCacheOptions
+#
+# Includes cache-related options for block devices
+#
+# @writeback: #optional enables writeback mode for any caches (default: true)
+# @direct: #optional enables use of O_DIRECT (bypass the host page cache;
+# default: false)
+# @no-flush: #optional ignore any flush requests for the device (default:
+# false)
+#
+# Since: 1.7
+##
+{ 'type': 'BlockdevCacheOptions',
+ 'data': { '*writeback': 'bool',
+ '*direct': 'bool',
+ '*no-flush': 'bool' } }
+
+##
+# @BlockdevOptionsBase
+#
+# Options that are available for all block devices, independent of the block
+# driver.
+#
+# @driver: block driver name
+# @id: #optional id by which the new block device can be referred to.
+# This is a required option on the top level of blockdev-add, and
+# currently not allowed on any other level.
+# @discard: #optional discard-related options (default: ignore)
+# @cache: #optional cache-related options
+# @aio: #optional AIO backend (default: threads)
+# @rerror: #optional how to handle read errors on the device
+# (default: report)
+# @werror: #optional how to handle write errors on the device
+# (default: enospc)
+# @read-only: #optional whether the block device should be read-only
+# (default: false)
+#
+# Since: 1.7
+##
+{ 'type': 'BlockdevOptionsBase',
+ 'data': { 'driver': 'str',
+ '*id': 'str',
+ '*discard': 'BlockdevDiscardOptions',
+ '*cache': 'BlockdevCacheOptions',
+ '*aio': 'BlockdevAioOptions',
+ '*rerror': 'BlockdevOnError',
+ '*werror': 'BlockdevOnError',
+ '*read-only': 'bool' } }
+
+##
+# @BlockdevOptionsFile
+#
+# Driver specific block device options for the file backend and similar
+# protocols.
+#
+# @filename: path to the image file
+#
+# Since: 1.7
+##
+{ 'type': 'BlockdevOptionsFile',
+ 'data': { 'filename': 'str' } }
+
+##
+# @BlockdevOptionsVVFAT
+#
+# Driver specific block device options for the vvfat protocol.
+#
+# @dir: directory to be exported as FAT image
+# @fat-type: #optional FAT type: 12, 16 or 32
+# @floppy: #optional whether to export a floppy image (true) or
+# partitioned hard disk (false; default)
+# @rw: #optional whether to allow write operations (default: false)
+#
+# Since: 1.7
+##
+{ 'type': 'BlockdevOptionsVVFAT',
+ 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool',
+ '*rw': 'bool' } }
+
+##
+# @BlockdevOptionsGenericFormat
+#
+# Driver specific block device options for image format that have no option
+# besides their data source.
+#
+# @file: reference to or definition of the data source block device
+#
+# Since: 1.7
+##
+{ 'type': 'BlockdevOptionsGenericFormat',
+ 'data': { 'file': 'BlockdevRef' } }
+
+##
+# @BlockdevOptionsGenericCOWFormat
+#
+# Driver specific block device options for image format that have no option
+# besides their data source and an optional backing file.
+#
+# @backing: #optional 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.
+#
+# Since: 1.7
+##
+{ 'type': 'BlockdevOptionsGenericCOWFormat',
+ 'base': 'BlockdevOptionsGenericFormat',
+ 'data': { '*backing': 'BlockdevRef' } }
+
+##
+# @BlockdevOptionsQcow2
+#
+# Driver specific block device options for qcow2.
+#
+# @lazy-refcounts: #optional whether to enable the lazy refcounts
+# feature (default is taken from the image file)
+#
+# @pass-discard-request: #optional whether discard requests to the qcow2
+# device should be forwarded to the data source
+#
+# @pass-discard-snapshot: #optional whether discard requests for the data source
+# should be issued when a snapshot operation (e.g.
+# deleting a snapshot) frees clusters in the qcow2 file
+#
+# @pass-discard-other: #optional whether discard requests for the data source
+# should be issued on other occasions where a cluster
+# gets freed
+#
+# Since: 1.7
+##
+{ 'type': 'BlockdevOptionsQcow2',
+ 'base': 'BlockdevOptionsGenericCOWFormat',
+ 'data': { '*lazy-refcounts': 'bool',
+ '*pass-discard-request': 'bool',
+ '*pass-discard-snapshot': 'bool',
+ '*pass-discard-other': 'bool' } }
+
+##
+# @BlockdevOptions
+#
+# Options for creating a block device.
+#
+# Since: 1.7
+##
+{ 'union': 'BlockdevOptions',
+ 'base': 'BlockdevOptionsBase',
+ 'discriminator': 'driver',
+ 'data': {
+ 'file': 'BlockdevOptionsFile',
+ 'http': 'BlockdevOptionsFile',
+ 'https': 'BlockdevOptionsFile',
+ 'ftp': 'BlockdevOptionsFile',
+ 'ftps': 'BlockdevOptionsFile',
+ 'tftp': 'BlockdevOptionsFile',
+# TODO gluster: Wait for structured options
+# TODO iscsi: Wait for structured options
+# TODO nbd: Should take InetSocketAddress for 'host'?
+# TODO rbd: Wait for structured options
+# TODO sheepdog: Wait for structured options
+# TODO ssh: Should take InetSocketAddress for 'host'?
+ 'vvfat': 'BlockdevOptionsVVFAT',
+
+# TODO blkdebug: Wait for structured options
+# TODO blkverify: Wait for structured options
+
+ 'bochs': 'BlockdevOptionsGenericFormat',
+ 'cloop': 'BlockdevOptionsGenericFormat',
+ 'cow': 'BlockdevOptionsGenericCOWFormat',
+ 'dmg': 'BlockdevOptionsGenericFormat',
+ 'parallels': 'BlockdevOptionsGenericFormat',
+ 'qcow': 'BlockdevOptionsGenericCOWFormat',
+ 'qcow2': 'BlockdevOptionsQcow2',
+ 'qed': 'BlockdevOptionsGenericCOWFormat',
+ 'raw': 'BlockdevOptionsGenericFormat',
+ 'vdi': 'BlockdevOptionsGenericFormat',
+ 'vhdx': 'BlockdevOptionsGenericFormat',
+ 'vmdk': 'BlockdevOptionsGenericCOWFormat',
+ 'vpc': 'BlockdevOptionsGenericFormat'
+ } }
+
+##
+# @BlockdevRef
+#
+# 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.
+#
+# Since: 1.7
+##
+{ 'union': 'BlockdevRef',
+ 'discriminator': {},
+ 'data': { 'definition': 'BlockdevOptions',
+ 'reference': 'str' } }
+
+##
+# @blockdev-add:
+#
+# Creates a new block device.
+#
+# @options: block device options for the new device
+#
+# Since: 1.7
+##
+{ 'command': 'blockdev-add', 'data': { 'options': 'BlockdevOptions' } }
diff --git a/qobject/json-lexer.c b/qobject/json-lexer.c
index dd04142..440df60 100644
--- a/qobject/json-lexer.c
+++ b/qobject/json-lexer.c
@@ -18,6 +18,8 @@
#include "qemu-common.h"
#include "qapi/qmp/json-lexer.h"
+#define MAX_TOKEN_SIZE (64ULL << 20)
+
/*
* \"([^\\\"]|(\\\"\\'\\\\\\/\\b\\f\\n\\r\\t\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))*\"
* '([^\\']|(\\\"\\'\\\\\\/\\b\\f\\n\\r\\t\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))*'
@@ -274,7 +276,7 @@
lexer->x = lexer->y = 0;
}
-static int json_lexer_feed_char(JSONLexer *lexer, char ch)
+static int json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
{
int char_consumed, new_state;
@@ -299,18 +301,48 @@
case JSON_KEYWORD:
case JSON_STRING:
lexer->emit(lexer, lexer->token, new_state, lexer->x, lexer->y);
+ /* fall through */
case JSON_SKIP:
QDECREF(lexer->token);
lexer->token = qstring_new();
new_state = IN_START;
break;
case IN_ERROR:
- return -EINVAL;
+ /* XXX: To avoid having previous bad input leaving the parser in an
+ * unresponsive state where we consume unpredictable amounts of
+ * subsequent "good" input, percolate this error state up to the
+ * tokenizer/parser by forcing a NULL object to be emitted, then
+ * reset state.
+ *
+ * Also note that this handling is required for reliable channel
+ * negotiation between QMP and the guest agent, since chr(0xFF)
+ * is placed at the beginning of certain events to ensure proper
+ * delivery when the channel is in an unknown state. chr(0xFF) is
+ * never a valid ASCII/UTF-8 sequence, so this should reliably
+ * induce an error/flush state.
+ */
+ lexer->emit(lexer, lexer->token, JSON_ERROR, lexer->x, lexer->y);
+ QDECREF(lexer->token);
+ lexer->token = qstring_new();
+ new_state = IN_START;
+ lexer->state = new_state;
+ return 0;
default:
break;
}
lexer->state = new_state;
- } while (!char_consumed);
+ } while (!char_consumed && !flush);
+
+ /* Do not let a single token grow to an arbitrarily large size,
+ * this is a security consideration.
+ */
+ if (lexer->token->length > MAX_TOKEN_SIZE) {
+ lexer->emit(lexer, lexer->token, lexer->state, lexer->x, lexer->y);
+ QDECREF(lexer->token);
+ lexer->token = qstring_new();
+ lexer->state = IN_START;
+ }
+
return 0;
}
@@ -321,7 +353,7 @@
for (i = 0; i < size; i++) {
int err;
- err = json_lexer_feed_char(lexer, buffer[i]);
+ err = json_lexer_feed_char(lexer, buffer[i], false);
if (err < 0) {
return err;
}
@@ -332,7 +364,7 @@
int json_lexer_flush(JSONLexer *lexer)
{
- return lexer->state == IN_START ? 0 : json_lexer_feed_char(lexer, 0);
+ return lexer->state == IN_START ? 0 : json_lexer_feed_char(lexer, 0, true);
}
void json_lexer_destroy(JSONLexer *lexer)
diff --git a/qobject/json-parser.c b/qobject/json-parser.c
index c3d5a3a..e7947b3 100644
--- a/qobject/json-parser.c
+++ b/qobject/json-parser.c
@@ -22,9 +22,16 @@
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/json-parser.h"
#include "qapi/qmp/json-lexer.h"
+#include "qapi/qmp/qerror.h"
typedef struct JSONParserContext
{
+ Error *err;
+ struct {
+ QObject **buf;
+ size_t pos;
+ size_t count;
+ } tokens;
} JSONParserContext;
#define BUG_ON(cond) assert(!(cond))
@@ -38,7 +45,7 @@
* 4) deal with premature EOI
*/
-static QObject *parse_value(JSONParserContext *ctxt, QList **tokens, va_list *ap);
+static QObject *parse_value(JSONParserContext *ctxt, va_list *ap);
/**
* Token manipulators
@@ -95,11 +102,15 @@
QObject *token, const char *msg, ...)
{
va_list ap;
+ char message[1024];
va_start(ap, msg);
- fprintf(stderr, "parse error: ");
- vfprintf(stderr, msg, ap);
- fprintf(stderr, "\n");
+ vsnprintf(message, sizeof(message), msg, ap);
va_end(ap);
+ if (ctxt->err) {
+ error_free(ctxt->err);
+ ctxt->err = NULL;
+ }
+ error_set(&ctxt->err, QERR_JSON_PARSE_ERROR, message);
}
/**
@@ -264,28 +275,122 @@
return NULL;
}
+static QObject *parser_context_pop_token(JSONParserContext *ctxt)
+{
+ QObject *token;
+ g_assert(ctxt->tokens.pos < ctxt->tokens.count);
+ token = ctxt->tokens.buf[ctxt->tokens.pos];
+ ctxt->tokens.pos++;
+ return token;
+}
+
+/* Note: parser_context_{peek|pop}_token do not increment the
+ * token object's refcount. In both cases the references will continue
+ * to be tracked and cleaned up in parser_context_free(), so do not
+ * attempt to free the token object.
+ */
+static QObject *parser_context_peek_token(JSONParserContext *ctxt)
+{
+ QObject *token;
+ g_assert(ctxt->tokens.pos < ctxt->tokens.count);
+ token = ctxt->tokens.buf[ctxt->tokens.pos];
+ return token;
+}
+
+static JSONParserContext parser_context_save(JSONParserContext *ctxt)
+{
+ JSONParserContext saved_ctxt = {0};
+ saved_ctxt.tokens.pos = ctxt->tokens.pos;
+ saved_ctxt.tokens.count = ctxt->tokens.count;
+ saved_ctxt.tokens.buf = ctxt->tokens.buf;
+ return saved_ctxt;
+}
+
+static void parser_context_restore(JSONParserContext *ctxt,
+ JSONParserContext saved_ctxt)
+{
+ ctxt->tokens.pos = saved_ctxt.tokens.pos;
+ ctxt->tokens.count = saved_ctxt.tokens.count;
+ ctxt->tokens.buf = saved_ctxt.tokens.buf;
+}
+
+static void tokens_append_from_iter(QObject *obj, void *opaque)
+{
+ JSONParserContext *ctxt = opaque;
+ g_assert(ctxt->tokens.pos < ctxt->tokens.count);
+ ctxt->tokens.buf[ctxt->tokens.pos++] = obj;
+ qobject_incref(obj);
+}
+
+static JSONParserContext *parser_context_new(QList *tokens)
+{
+ JSONParserContext *ctxt;
+ size_t count;
+
+ if (!tokens) {
+ return NULL;
+ }
+
+ count = qlist_size(tokens);
+ if (count == 0) {
+ return NULL;
+ }
+
+ ctxt = g_malloc0(sizeof(JSONParserContext));
+ ctxt->tokens.pos = 0;
+ ctxt->tokens.count = count;
+ ctxt->tokens.buf = g_malloc(count * sizeof(QObject *));
+ qlist_iter(tokens, tokens_append_from_iter, ctxt);
+ ctxt->tokens.pos = 0;
+
+ return ctxt;
+}
+
+/* to support error propagation, ctxt->err must be freed separately */
+static void parser_context_free(JSONParserContext *ctxt)
+{
+ int i;
+ if (ctxt) {
+ for (i = 0; i < ctxt->tokens.count; i++) {
+ qobject_decref(ctxt->tokens.buf[i]);
+ }
+ g_free(ctxt->tokens.buf);
+ g_free(ctxt);
+ }
+}
+
/**
* Parsing rules
*/
-static int parse_pair(JSONParserContext *ctxt, QDict *dict, QList **tokens, va_list *ap)
+static int parse_pair(JSONParserContext *ctxt, QDict *dict, va_list *ap)
{
- QObject *key, *token = NULL, *value, *peek;
- QList *working = qlist_copy(*tokens);
+ QObject *key = NULL, *token = NULL, *value, *peek;
+ JSONParserContext saved_ctxt = parser_context_save(ctxt);
- peek = qlist_peek(working);
- key = parse_value(ctxt, &working, ap);
+ peek = parser_context_peek_token(ctxt);
+ if (peek == NULL) {
+ parse_error(ctxt, NULL, "premature EOI");
+ goto out;
+ }
+
+ key = parse_value(ctxt, ap);
if (!key || qobject_type(key) != QTYPE_QSTRING) {
parse_error(ctxt, peek, "key is not a string in object");
goto out;
}
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ parse_error(ctxt, NULL, "premature EOI");
+ goto out;
+ }
+
if (!token_is_operator(token, ':')) {
parse_error(ctxt, token, "missing : in object pair");
goto out;
}
- value = parse_value(ctxt, &working, ap);
+ value = parse_value(ctxt, ap);
if (value == NULL) {
parse_error(ctxt, token, "Missing value in dict");
goto out;
@@ -293,97 +398,112 @@
qdict_put_obj(dict, qstring_get_str(qobject_to_qstring(key)), value);
- qobject_decref(token);
qobject_decref(key);
- QDECREF(*tokens);
- *tokens = working;
return 0;
out:
- qobject_decref(token);
+ parser_context_restore(ctxt, saved_ctxt);
qobject_decref(key);
- QDECREF(working);
return -1;
}
-static QObject *parse_object(JSONParserContext *ctxt, QList **tokens, va_list *ap)
+static QObject *parse_object(JSONParserContext *ctxt, va_list *ap)
{
QDict *dict = NULL;
QObject *token, *peek;
- QList *working = qlist_copy(*tokens);
+ JSONParserContext saved_ctxt = parser_context_save(ctxt);
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ goto out;
+ }
+
if (!token_is_operator(token, '{')) {
goto out;
}
- qobject_decref(token);
token = NULL;
dict = qdict_new();
- peek = qlist_peek(working);
+ peek = parser_context_peek_token(ctxt);
+ if (peek == NULL) {
+ parse_error(ctxt, NULL, "premature EOI");
+ goto out;
+ }
+
if (!token_is_operator(peek, '}')) {
- if (parse_pair(ctxt, dict, &working, ap) == -1) {
+ if (parse_pair(ctxt, dict, ap) == -1) {
goto out;
}
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ parse_error(ctxt, NULL, "premature EOI");
+ goto out;
+ }
+
while (!token_is_operator(token, '}')) {
if (!token_is_operator(token, ',')) {
parse_error(ctxt, token, "expected separator in dict");
goto out;
}
- qobject_decref(token);
token = NULL;
- if (parse_pair(ctxt, dict, &working, ap) == -1) {
+ if (parse_pair(ctxt, dict, ap) == -1) {
goto out;
}
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ parse_error(ctxt, NULL, "premature EOI");
+ goto out;
+ }
}
- qobject_decref(token);
token = NULL;
} else {
- token = qlist_pop(working);
- qobject_decref(token);
+ token = parser_context_pop_token(ctxt);
token = NULL;
}
- QDECREF(*tokens);
- *tokens = working;
-
return QOBJECT(dict);
out:
- qobject_decref(token);
- QDECREF(working);
+ parser_context_restore(ctxt, saved_ctxt);
QDECREF(dict);
return NULL;
}
-static QObject *parse_array(JSONParserContext *ctxt, QList **tokens, va_list *ap)
+static QObject *parse_array(JSONParserContext *ctxt, va_list *ap)
{
QList *list = NULL;
QObject *token, *peek;
- QList *working = qlist_copy(*tokens);
+ JSONParserContext saved_ctxt = parser_context_save(ctxt);
- token = qlist_pop(working);
- if (!token_is_operator(token, '[')) {
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
goto out;
}
- qobject_decref(token);
+
+ if (!token_is_operator(token, '[')) {
+ token = NULL;
+ goto out;
+ }
token = NULL;
list = qlist_new();
- peek = qlist_peek(working);
+ peek = parser_context_peek_token(ctxt);
+ if (peek == NULL) {
+ parse_error(ctxt, NULL, "premature EOI");
+ goto out;
+ }
+
if (!token_is_operator(peek, ']')) {
QObject *obj;
- obj = parse_value(ctxt, &working, ap);
+ obj = parse_value(ctxt, ap);
if (obj == NULL) {
parse_error(ctxt, token, "expecting value");
goto out;
@@ -391,17 +511,21 @@
qlist_append_obj(list, obj);
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ parse_error(ctxt, NULL, "premature EOI");
+ goto out;
+ }
+
while (!token_is_operator(token, ']')) {
if (!token_is_operator(token, ',')) {
parse_error(ctxt, token, "expected separator in list");
goto out;
}
- qobject_decref(token);
token = NULL;
- obj = parse_value(ctxt, &working, ap);
+ obj = parse_value(ctxt, ap);
if (obj == NULL) {
parse_error(ctxt, token, "expecting value");
goto out;
@@ -409,35 +533,36 @@
qlist_append_obj(list, obj);
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ parse_error(ctxt, NULL, "premature EOI");
+ goto out;
+ }
}
- qobject_decref(token);
token = NULL;
} else {
- token = qlist_pop(working);
- qobject_decref(token);
+ token = parser_context_pop_token(ctxt);
token = NULL;
}
- QDECREF(*tokens);
- *tokens = working;
-
return QOBJECT(list);
out:
- qobject_decref(token);
- QDECREF(working);
+ parser_context_restore(ctxt, saved_ctxt);
QDECREF(list);
return NULL;
}
-static QObject *parse_keyword(JSONParserContext *ctxt, QList **tokens)
+static QObject *parse_keyword(JSONParserContext *ctxt)
{
QObject *token, *ret;
- QList *working = qlist_copy(*tokens);
+ JSONParserContext saved_ctxt = parser_context_save(ctxt);
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ goto out;
+ }
if (token_get_type(token) != JSON_KEYWORD) {
goto out;
@@ -452,29 +577,27 @@
goto out;
}
- qobject_decref(token);
- QDECREF(*tokens);
- *tokens = working;
-
return ret;
out:
- qobject_decref(token);
- QDECREF(working);
+ parser_context_restore(ctxt, saved_ctxt);
return NULL;
}
-static QObject *parse_escape(JSONParserContext *ctxt, QList **tokens, va_list *ap)
+static QObject *parse_escape(JSONParserContext *ctxt, va_list *ap)
{
QObject *token = NULL, *obj;
- QList *working = qlist_copy(*tokens);
+ JSONParserContext saved_ctxt = parser_context_save(ctxt);
if (ap == NULL) {
goto out;
}
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ goto out;
+ }
if (token_is_escape(token, "%p")) {
obj = va_arg(*ap, QObject *);
@@ -495,32 +618,51 @@
goto out;
}
- qobject_decref(token);
- QDECREF(*tokens);
- *tokens = working;
-
return obj;
out:
- qobject_decref(token);
- QDECREF(working);
+ parser_context_restore(ctxt, saved_ctxt);
return NULL;
}
-static QObject *parse_literal(JSONParserContext *ctxt, QList **tokens)
+static QObject *parse_literal(JSONParserContext *ctxt)
{
QObject *token, *obj;
- QList *working = qlist_copy(*tokens);
+ JSONParserContext saved_ctxt = parser_context_save(ctxt);
- token = qlist_pop(working);
+ token = parser_context_pop_token(ctxt);
+ if (token == NULL) {
+ goto out;
+ }
+
switch (token_get_type(token)) {
case JSON_STRING:
obj = QOBJECT(qstring_from_escaped_str(ctxt, token));
break;
- case JSON_INTEGER:
- obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10)));
- break;
+ case JSON_INTEGER: {
+ /* A possibility exists that this is a whole-valued float where the
+ * fractional part was left out due to being 0 (.0). It's not a big
+ * deal to treat these as ints in the parser, so long as users of the
+ * resulting QObject know to expect a QInt in place of a QFloat in
+ * cases like these.
+ *
+ * However, in some cases these values will overflow/underflow a
+ * QInt/int64 container, thus we should assume these are to be handled
+ * as QFloats/doubles rather than silently changing their values.
+ *
+ * strtoll() indicates these instances by setting errno to ERANGE
+ */
+ int64_t value;
+
+ errno = 0; /* strtoll doesn't set errno on success */
+ value = strtoll(token_get_value(token), NULL, 10);
+ if (errno != ERANGE) {
+ obj = QOBJECT(qint_from_int(value));
+ break;
+ }
+ /* fall through to JSON_FLOAT */
+ }
case JSON_FLOAT:
/* FIXME dependent on locale */
obj = QOBJECT(qfloat_from_double(strtod(token_get_value(token), NULL)));
@@ -529,35 +671,30 @@
goto out;
}
- qobject_decref(token);
- QDECREF(*tokens);
- *tokens = working;
-
return obj;
out:
- qobject_decref(token);
- QDECREF(working);
+ parser_context_restore(ctxt, saved_ctxt);
return NULL;
}
-static QObject *parse_value(JSONParserContext *ctxt, QList **tokens, va_list *ap)
+static QObject *parse_value(JSONParserContext *ctxt, va_list *ap)
{
QObject *obj;
- obj = parse_object(ctxt, tokens, ap);
+ obj = parse_object(ctxt, ap);
if (obj == NULL) {
- obj = parse_array(ctxt, tokens, ap);
+ obj = parse_array(ctxt, ap);
}
if (obj == NULL) {
- obj = parse_escape(ctxt, tokens, ap);
+ obj = parse_escape(ctxt, ap);
}
if (obj == NULL) {
- obj = parse_keyword(ctxt, tokens);
+ obj = parse_keyword(ctxt);
}
if (obj == NULL) {
- obj = parse_literal(ctxt, tokens);
+ obj = parse_literal(ctxt);
}
return obj;
@@ -565,13 +702,23 @@
QObject *json_parser_parse(QList *tokens, va_list *ap)
{
- JSONParserContext ctxt = {};
- QList *working = qlist_copy(tokens);
+ return json_parser_parse_err(tokens, ap, NULL);
+}
+
+QObject *json_parser_parse_err(QList *tokens, va_list *ap, Error **errp)
+{
+ JSONParserContext *ctxt = parser_context_new(tokens);
QObject *result;
- result = parse_value(&ctxt, &working, ap);
+ if (!ctxt) {
+ return NULL;
+ }
- QDECREF(working);
+ result = parse_value(ctxt, ap);
+
+ error_propagate(errp, ctxt->err);
+
+ parser_context_free(ctxt);
return result;
}
diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c
index 8241125..1b2f9b1 100644
--- a/qobject/json-streamer.c
+++ b/qobject/json-streamer.c
@@ -18,6 +18,9 @@
#include "qapi/qmp/json-lexer.h"
#include "qapi/qmp/json-streamer.h"
+#define MAX_TOKEN_SIZE (64ULL << 20)
+#define MAX_NESTING (1ULL << 10)
+
static void json_message_process_token(JSONLexer *lexer, QString *token, JSONTokenType type, int x, int y)
{
JSONMessageParser *parser = container_of(lexer, JSONMessageParser, lexer);
@@ -49,14 +52,44 @@
qdict_put(dict, "x", qint_from_int(x));
qdict_put(dict, "y", qint_from_int(y));
+ parser->token_size += token->length;
+
qlist_append(parser->tokens, dict);
- if (parser->brace_count == 0 &&
- parser->bracket_count == 0) {
- parser->emit(parser, parser->tokens);
- QDECREF(parser->tokens);
- parser->tokens = qlist_new();
+ if (type == JSON_ERROR) {
+ goto out_emit_bad;
+ } else if (parser->brace_count < 0 ||
+ parser->bracket_count < 0 ||
+ (parser->brace_count == 0 &&
+ parser->bracket_count == 0)) {
+ goto out_emit;
+ } else if (parser->token_size > MAX_TOKEN_SIZE ||
+ parser->bracket_count > MAX_NESTING ||
+ parser->brace_count > MAX_NESTING) {
+ /* Security consideration, we limit total memory allocated per object
+ * and the maximum recursion depth that a message can force.
+ */
+ goto out_emit;
}
+
+ return;
+
+out_emit_bad:
+ /* clear out token list and tell the parser to emit and error
+ * indication by passing it a NULL list
+ */
+ QDECREF(parser->tokens);
+ parser->tokens = NULL;
+out_emit:
+ /* send current list of tokens to parser and reset tokenizer */
+ parser->brace_count = 0;
+ parser->bracket_count = 0;
+ parser->emit(parser, parser->tokens);
+ if (parser->tokens) {
+ QDECREF(parser->tokens);
+ }
+ parser->tokens = qlist_new();
+ parser->token_size = 0;
}
void json_message_parser_init(JSONMessageParser *parser,
@@ -66,6 +99,7 @@
parser->brace_count = 0;
parser->bracket_count = 0;
parser->tokens = qlist_new();
+ parser->token_size = 0;
json_lexer_init(&parser->lexer, json_message_process_token);
}
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 7543ccc..17e14f0 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -401,6 +401,28 @@
}
/**
+ * qdict_clone_shallow(): Clones a given QDict. Its entries are not copied, but
+ * another reference is added.
+ */
+QDict *qdict_clone_shallow(const QDict *src)
+{
+ QDict *dest;
+ QDictEntry *entry;
+ int i;
+
+ dest = qdict_new();
+
+ for (i = 0; i < QDICT_BUCKET_MAX; i++) {
+ QLIST_FOREACH(entry, &src->table[i], next) {
+ qobject_incref(entry->value);
+ qdict_put_obj(dest, entry->key, entry->value);
+ }
+ }
+
+ return dest;
+}
+
+/**
* qentry_destroy(): Free all the memory allocated by a QDictEntry
*/
static void qentry_destroy(QDictEntry *e)
@@ -454,3 +476,81 @@
g_free(qdict);
}
+
+static void qdict_do_flatten(QDict *qdict, QDict *target, const char *prefix)
+{
+ QObject *value;
+ const QDictEntry *entry, *next;
+ char *new_key;
+ bool delete;
+
+ entry = qdict_first(qdict);
+
+ while (entry != NULL) {
+
+ next = qdict_next(qdict, entry);
+ value = qdict_entry_value(entry);
+ new_key = NULL;
+ delete = false;
+
+ if (prefix) {
+ new_key = g_strdup_printf("%s.%s", prefix, entry->key);
+ }
+
+ if (qobject_type(value) == QTYPE_QDICT) {
+ /* Entries of QDicts are processed recursively, the QDict object
+ * itself disappears. */
+ qdict_do_flatten(qobject_to_qdict(value), target,
+ new_key ? new_key : entry->key);
+ delete = true;
+ } else if (prefix) {
+ /* All other objects are moved to the target unchanged. */
+ qobject_incref(value);
+ qdict_put_obj(target, new_key, value);
+ delete = true;
+ }
+
+ g_free(new_key);
+
+ if (delete) {
+ qdict_del(qdict, entry->key);
+
+ /* Restart loop after modifying the iterated QDict */
+ entry = qdict_first(qdict);
+ continue;
+ }
+
+ entry = next;
+ }
+}
+
+/**
+ * qdict_flatten(): For each nested QDict with key x, all fields with key y
+ * are moved to this QDict and their key is renamed to "x.y". This operation
+ * is applied recursively for nested QDicts.
+ */
+void qdict_flatten(QDict *qdict)
+{
+ qdict_do_flatten(qdict, qdict, NULL);
+}
+
+/* extract all the src QDict entries starting by start into dst */
+void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start)
+
+{
+ const QDictEntry *entry, *next;
+ const char *p;
+
+ *dst = qdict_new();
+ entry = qdict_first(src);
+
+ while (entry != NULL) {
+ next = qdict_next(src, entry);
+ if (strstart(entry->key, start, &p)) {
+ qobject_incref(entry->value);
+ qdict_put_obj(*dst, p, entry->value);
+ qdict_del(src, entry->key);
+ }
+ entry = next;
+ }
+}
diff --git a/qobject/qerror.c b/qobject/qerror.c
index 40d0cbb..fc8331a 100644
--- a/qobject/qerror.c
+++ b/qobject/qerror.c
@@ -23,201 +23,11 @@
};
/**
- * The 'desc' parameter is a printf-like string, the format of the format
- * string is:
- *
- * %(KEY)
- *
- * Where KEY is a QDict key, which has to be passed to qerror_from_info().
- *
- * Example:
- *
- * "foo error on device: %(device) slot: %(slot_nr)"
- *
- * A single percent sign can be printed if followed by a second one,
- * for example:
- *
- * "running out of foo: %(foo)%%"
- *
- * Please keep the entries in alphabetical order.
- * Use "sed -n '/^static.*qerror_table\[\]/,/^};/s/QERR_/&/gp' qerror.c | sort -c"
- * to check.
- */
-static const QErrorStringTable qerror_table[] = {
- {
- .error_fmt = QERR_BAD_BUS_FOR_DEVICE,
- .desc = "Device '%(device)' can't go on a %(bad_bus_type) bus",
- },
- {
- .error_fmt = QERR_BUS_NOT_FOUND,
- .desc = "Bus '%(bus)' not found",
- },
- {
- .error_fmt = QERR_BUS_NO_HOTPLUG,
- .desc = "Bus '%(bus)' does not support hotplugging",
- },
- {
- .error_fmt = QERR_COMMAND_NOT_FOUND,
- .desc = "The command %(name) has not been found",
- },
- {
- .error_fmt = QERR_DEVICE_ENCRYPTED,
- .desc = "Device '%(device)' is encrypted",
- },
- {
- .error_fmt = QERR_DEVICE_INIT_FAILED,
- .desc = "Device '%(device)' could not be initialized",
- },
- {
- .error_fmt = QERR_DEVICE_IN_USE,
- .desc = "Device '%(device)' is in use",
- },
- {
- .error_fmt = QERR_DEVICE_LOCKED,
- .desc = "Device '%(device)' is locked",
- },
- {
- .error_fmt = QERR_DEVICE_MULTIPLE_BUSSES,
- .desc = "Device '%(device)' has multiple child busses",
- },
- {
- .error_fmt = QERR_DEVICE_NOT_ACTIVE,
- .desc = "Device '%(device)' has not been activated",
- },
- {
- .error_fmt = QERR_DEVICE_NOT_ENCRYPTED,
- .desc = "Device '%(device)' is not encrypted",
- },
- {
- .error_fmt = QERR_DEVICE_NOT_FOUND,
- .desc = "Device '%(device)' not found",
- },
- {
- .error_fmt = QERR_DEVICE_NOT_REMOVABLE,
- .desc = "Device '%(device)' is not removable",
- },
- {
- .error_fmt = QERR_DEVICE_NO_BUS,
- .desc = "Device '%(device)' has no child bus",
- },
- {
- .error_fmt = QERR_DEVICE_NO_HOTPLUG,
- .desc = "Device '%(device)' does not support hotplugging",
- },
- {
- .error_fmt = QERR_DUPLICATE_ID,
- .desc = "Duplicate ID '%(id)' for %(object)",
- },
- {
- .error_fmt = QERR_FD_NOT_FOUND,
- .desc = "File descriptor named '%(name)' not found",
- },
- {
- .error_fmt = QERR_FD_NOT_SUPPLIED,
- .desc = "No file descriptor supplied via SCM_RIGHTS",
- },
- {
- .error_fmt = QERR_INVALID_BLOCK_FORMAT,
- .desc = "Invalid block format '%(name)'",
- },
- {
- .error_fmt = QERR_INVALID_PARAMETER,
- .desc = "Invalid parameter '%(name)'",
- },
- {
- .error_fmt = QERR_INVALID_PARAMETER_TYPE,
- .desc = "Invalid parameter type, expected: %(expected)",
- },
- {
- .error_fmt = QERR_INVALID_PARAMETER_VALUE,
- .desc = "Parameter '%(name)' expects %(expected)",
- },
- {
- .error_fmt = QERR_INVALID_PASSWORD,
- .desc = "Password incorrect",
- },
- {
- .error_fmt = QERR_JSON_PARSING,
- .desc = "Invalid JSON syntax",
- },
- {
- .error_fmt = QERR_KVM_MISSING_CAP,
- .desc = "Using KVM without %(capability), %(feature) unavailable",
- },
- {
- .error_fmt = QERR_MIGRATION_EXPECTED,
- .desc = "An incoming migration is expected before this command can be executed",
- },
- {
- .error_fmt = QERR_MISSING_PARAMETER,
- .desc = "Parameter '%(name)' is missing",
- },
- {
- .error_fmt = QERR_NO_BUS_FOR_DEVICE,
- .desc = "No '%(bus)' bus found for device '%(device)'",
- },
- {
- .error_fmt = QERR_OPEN_FILE_FAILED,
- .desc = "Could not open '%(filename)'",
- },
- {
- .error_fmt = QERR_PROPERTY_NOT_FOUND,
- .desc = "Property '%(device).%(property)' not found",
- },
- {
- .error_fmt = QERR_PROPERTY_VALUE_BAD,
- .desc = "Property '%(device).%(property)' doesn't take value '%(value)'",
- },
- {
- .error_fmt = QERR_PROPERTY_VALUE_IN_USE,
- .desc = "Property '%(device).%(property)' can't take value '%(value)', it's in use",
- },
- {
- .error_fmt = QERR_PROPERTY_VALUE_NOT_FOUND,
- .desc = "Property '%(device).%(property)' can't find value '%(value)'",
- },
- {
- .error_fmt = QERR_QMP_BAD_INPUT_OBJECT,
- .desc = "Expected '%(expected)' in QMP input",
- },
- {
- .error_fmt = QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
- .desc = "QMP input object member '%(member)' expects '%(expected)'",
- },
- {
- .error_fmt = QERR_QMP_EXTRA_MEMBER,
- .desc = "QMP input object member '%(member)' is unexpected",
- },
- {
- .error_fmt = QERR_SET_PASSWD_FAILED,
- .desc = "Could not set password",
- },
- {
- .error_fmt = QERR_TOO_MANY_FILES,
- .desc = "Too many open files",
- },
- {
- .error_fmt = QERR_UNDEFINED_ERROR,
- .desc = "An undefined error has ocurred",
- },
- {
- .error_fmt = QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
- .desc = "'%(device)' uses a %(format) feature which is not "
- "supported by this qemu version: %(feature)",
- },
- {
- .error_fmt = QERR_VNC_SERVER_FAILED,
- .desc = "Could not start VNC server on %(target)",
- },
- {}
-};
-
-/**
* qerror_new(): Create a new QError
*
* Return strong reference.
*/
-QError *qerror_new(void)
+static QError *qerror_new(void)
{
QError *qerr;
@@ -227,179 +37,31 @@
return qerr;
}
-static void GCC_FMT_ATTR(2, 3) qerror_abort(const QError *qerr,
- const char *fmt, ...)
-{
- va_list ap;
-
- fprintf(stderr, "qerror: bad call in function '%s':\n", qerr->func);
- fprintf(stderr, "qerror: -> ");
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-
- fprintf(stderr, "\nqerror: call at %s:%d\n", qerr->file, qerr->linenr);
- abort();
-}
-
-static void GCC_FMT_ATTR(2, 0) qerror_set_data(QError *qerr,
- const char *fmt, va_list *va)
-{
- QObject *obj;
-
- obj = qobject_from_jsonv(fmt, va);
- if (!obj) {
- qerror_abort(qerr, "invalid format '%s'", fmt);
- }
- if (qobject_type(obj) != QTYPE_QDICT) {
- qerror_abort(qerr, "error format is not a QDict '%s'", fmt);
- }
-
- qerr->error = qobject_to_qdict(obj);
-
- obj = qdict_get(qerr->error, "class");
- if (!obj) {
- qerror_abort(qerr, "missing 'class' key in '%s'", fmt);
- }
- if (qobject_type(obj) != QTYPE_QSTRING) {
- qerror_abort(qerr, "'class' key value should be a QString");
- }
-
- obj = qdict_get(qerr->error, "data");
- if (!obj) {
- qerror_abort(qerr, "missing 'data' key in '%s'", fmt);
- }
- if (qobject_type(obj) != QTYPE_QDICT) {
- qerror_abort(qerr, "'data' key value should be a QDICT");
- }
-}
-
-static void qerror_set_desc(QError *qerr, const char *fmt)
-{
- int i;
-
- // FIXME: inefficient loop
-
- for (i = 0; qerror_table[i].error_fmt; i++) {
- if (strcmp(qerror_table[i].error_fmt, fmt) == 0) {
- qerr->entry = &qerror_table[i];
- return;
- }
- }
-
- qerror_abort(qerr, "error format '%s' not found", fmt);
-}
-
/**
* qerror_from_info(): Create a new QError from error information
*
- * The information consists of:
- *
- * - file the file name of where the error occurred
- * - linenr the line number of where the error occurred
- * - func the function name of where the error occurred
- * - fmt JSON printf-like dictionary, there must exist keys 'class' and
- * 'data'
- * - va va_list of all arguments specified by fmt
- *
* Return strong reference.
*/
-QError *qerror_from_info(const char *file, int linenr, const char *func,
- const char *fmt, va_list *va)
+static QError * GCC_FMT_ATTR(2, 0)
+qerror_from_info(ErrorClass err_class, const char *fmt, va_list *va)
{
QError *qerr;
qerr = qerror_new();
loc_save(&qerr->loc);
- qerr->linenr = linenr;
- qerr->file = file;
- qerr->func = func;
- if (!fmt) {
- qerror_abort(qerr, "QDict not specified");
- }
-
- qerror_set_data(qerr, fmt, va);
- qerror_set_desc(qerr, fmt);
+ qerr->err_msg = g_strdup_vprintf(fmt, *va);
+ qerr->err_class = err_class;
return qerr;
}
-static void parse_error(const QError *qerror, int c)
-{
- qerror_abort(qerror, "expected '%c' in '%s'", c, qerror->entry->desc);
-}
-
-static const char *append_field(QString *outstr, const QError *qerror,
- const char *start)
-{
- QObject *obj;
- QDict *qdict;
- QString *key_qs;
- const char *end, *key;
-
- if (*start != '%')
- parse_error(qerror, '%');
- start++;
- if (*start != '(')
- parse_error(qerror, '(');
- start++;
-
- end = strchr(start, ')');
- if (!end)
- parse_error(qerror, ')');
-
- key_qs = qstring_from_substr(start, 0, end - start - 1);
- key = qstring_get_str(key_qs);
-
- qdict = qobject_to_qdict(qdict_get(qerror->error, "data"));
- obj = qdict_get(qdict, key);
- if (!obj) {
- qerror_abort(qerror, "key '%s' not found in QDict", key);
- }
-
- switch (qobject_type(obj)) {
- case QTYPE_QSTRING:
- qstring_append(outstr, qdict_get_str(qdict, key));
- break;
- case QTYPE_QINT:
- qstring_append_int(outstr, qdict_get_int(qdict, key));
- break;
- default:
- qerror_abort(qerror, "invalid type '%c'", qobject_type(obj));
- }
-
- QDECREF(key_qs);
- return ++end;
-}
-
/**
* qerror_human(): Format QError data into human-readable string.
- *
- * Formats according to member 'desc' of the specified QError object.
*/
QString *qerror_human(const QError *qerror)
{
- const char *p;
- QString *qstring;
-
- assert(qerror->entry != NULL);
-
- qstring = qstring_new();
-
- for (p = qerror->entry->desc; *p != '\0';) {
- if (*p != '%') {
- qstring_append_chr(qstring, *p++);
- } else if (*(p + 1) == '%') {
- qstring_append_chr(qstring, '%');
- p += 2;
- } else {
- p = append_field(qstring, qerror, p);
- }
- }
-
- return qstring;
+ return qstring_from_str(qerror->err_msg);
}
/**
@@ -409,7 +71,7 @@
* it uses error_report() for this, so that the output is routed to the right
* place (ie. stderr or Monitor's device).
*/
-void qerror_print(QError *qerror)
+static void qerror_print(QError *qerror)
{
QString *qstring = qerror_human(qerror);
loc_push_restore(&qerror->loc);
@@ -418,14 +80,13 @@
QDECREF(qstring);
}
-void qerror_report_internal(const char *file, int linenr, const char *func,
- const char *fmt, ...)
+void qerror_report(ErrorClass eclass, const char *fmt, ...)
{
va_list va;
QError *qerror;
va_start(va, fmt);
- qerror = qerror_from_info(file, linenr, func, fmt, &va);
+ qerror = qerror_from_info(eclass, fmt, &va);
va_end(va);
if (monitor_cur_is_qmp()) {
@@ -436,10 +97,42 @@
}
}
+/* Evil... */
+struct Error
+{
+ char *msg;
+ ErrorClass err_class;
+};
+
+void qerror_report_err(Error *err)
+{
+ QError *qerr;
+
+ qerr = qerror_new();
+ loc_save(&qerr->loc);
+ qerr->err_msg = g_strdup(err->msg);
+ qerr->err_class = err->err_class;
+
+ if (monitor_cur_is_qmp()) {
+ monitor_set_error(cur_mon, qerr);
+ } else {
+ qerror_print(qerr);
+ QDECREF(qerr);
+ }
+}
+
+void assert_no_error(Error *err)
+{
+ if (err) {
+ qerror_report_err(err);
+ abort();
+ }
+}
+
/**
* qobject_to_qerror(): Convert a QObject into a QError
*/
-QError *qobject_to_qerror(const QObject *obj)
+static QError *qobject_to_qerror(const QObject *obj)
{
if (qobject_type(obj) != QTYPE_QERROR) {
return NULL;
@@ -458,6 +151,6 @@
assert(obj != NULL);
qerr = qobject_to_qerror(obj);
- QDECREF(qerr->error);
+ g_free(qerr->err_msg);
g_free(qerr);
}
diff --git a/qobject/qjson.c b/qobject/qjson.c
index 83a6b4f..6cf2511 100644
--- a/qobject/qjson.c
+++ b/qobject/qjson.c
@@ -136,68 +136,56 @@
case QTYPE_QSTRING: {
QString *val = qobject_to_qstring(obj);
const char *ptr;
+ int cp;
+ char buf[16];
+ char *end;
ptr = qstring_get_str(val);
qstring_append(str, "\"");
- while (*ptr) {
- if ((ptr[0] & 0xE0) == 0xE0 &&
- (ptr[1] & 0x80) && (ptr[2] & 0x80)) {
- uint16_t wchar;
- char escape[7];
- wchar = (ptr[0] & 0x0F) << 12;
- wchar |= (ptr[1] & 0x3F) << 6;
- wchar |= (ptr[2] & 0x3F);
- ptr += 2;
-
- snprintf(escape, sizeof(escape), "\\u%04X", wchar);
- qstring_append(str, escape);
- } else if ((ptr[0] & 0xE0) == 0xC0 && (ptr[1] & 0x80)) {
- uint16_t wchar;
- char escape[7];
-
- wchar = (ptr[0] & 0x1F) << 6;
- wchar |= (ptr[1] & 0x3F);
- ptr++;
-
- snprintf(escape, sizeof(escape), "\\u%04X", wchar);
- qstring_append(str, escape);
- } else switch (ptr[0]) {
- case '\"':
- qstring_append(str, "\\\"");
- break;
- case '\\':
- qstring_append(str, "\\\\");
- break;
- case '\b':
- qstring_append(str, "\\b");
- break;
- case '\f':
- qstring_append(str, "\\f");
- break;
- case '\n':
- qstring_append(str, "\\n");
- break;
- case '\r':
- qstring_append(str, "\\r");
- break;
- case '\t':
- qstring_append(str, "\\t");
- break;
- default: {
- if (ptr[0] <= 0x1F) {
- char escape[7];
- snprintf(escape, sizeof(escape), "\\u%04X", ptr[0]);
- qstring_append(str, escape);
- } else {
- char buf[2] = { ptr[0], 0 };
- qstring_append(str, buf);
- }
- break;
+ for (; *ptr; ptr = end) {
+ cp = mod_utf8_codepoint(ptr, 6, &end);
+ switch (cp) {
+ case '\"':
+ qstring_append(str, "\\\"");
+ break;
+ case '\\':
+ qstring_append(str, "\\\\");
+ break;
+ case '\b':
+ qstring_append(str, "\\b");
+ break;
+ case '\f':
+ qstring_append(str, "\\f");
+ break;
+ case '\n':
+ qstring_append(str, "\\n");
+ break;
+ case '\r':
+ qstring_append(str, "\\r");
+ break;
+ case '\t':
+ qstring_append(str, "\\t");
+ break;
+ default:
+ if (cp < 0) {
+ cp = 0xFFFD; /* replacement character */
}
+ if (cp > 0xFFFF) {
+ /* beyond BMP; need a surrogate pair */
+ snprintf(buf, sizeof(buf), "\\u%04X\\u%04X",
+ 0xD800 + ((cp - 0x10000) >> 10),
+ 0xDC00 + ((cp - 0x10000) & 0x3FF));
+ } else if (cp < 0x20 || cp >= 0x7F) {
+ snprintf(buf, sizeof(buf), "\\u%04X", cp);
+ } else {
+ buf[0] = cp;
+ buf[1] = 0;
}
- ptr++;
- }
+ qstring_append(str, buf);
+ }
+ };
+
qstring_append(str, "\"");
break;
}
@@ -272,6 +260,8 @@
/* XXX: should QError be emitted? */
case QTYPE_NONE:
break;
+ case QTYPE_MAX:
+ abort();
}
}
diff --git a/qobject/qlist.c b/qobject/qlist.c
index 815b6aa..1ced0de 100644
--- a/qobject/qlist.c
+++ b/qobject/qlist.c
@@ -124,6 +124,19 @@
return QTAILQ_EMPTY(&qlist->head);
}
+static void qlist_size_iter(QObject *obj, void *opaque)
+{
+ size_t *count = opaque;
+ (*count)++;
+}
+
+size_t qlist_size(const QList *qlist)
+{
+ size_t count = 0;
+ qlist_iter(qlist, qlist_size_iter, &count);
+ return count;
+}
+
/**
* qobject_to_qlist(): Convert a QObject into a QList
*/
diff --git a/qobject/qstring.c b/qobject/qstring.c
index 5f7376c..607b7a1 100644
--- a/qobject/qstring.c
+++ b/qobject/qstring.c
@@ -32,6 +32,14 @@
}
/**
+ * qstring_get_length(): Get the length of a QString
+ */
+size_t qstring_get_length(const QString *qstring)
+{
+ return qstring->length;
+}
+
+/**
* qstring_from_substr(): Create a new QString from a C string substring
*
* Return string reference
diff --git a/qom/container.c b/qom/container.c
new file mode 100644
index 0000000..62b1648
--- /dev/null
+++ b/qom/container.c
@@ -0,0 +1,52 @@
+/*
+ * Device Container
+ *
+ * Copyright IBM, Corp. 2012
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qom/object.h"
+#include "qemu/module.h"
+#include <assert.h>
+
+static const TypeInfo container_info = {
+ .name = "container",
+ .instance_size = sizeof(Object),
+ .parent = TYPE_OBJECT,
+};
+
+static void container_register_types(void)
+{
+ type_register_static(&container_info);
+}
+
+Object *container_get(Object *root, const char *path)
+{
+ Object *obj, *child;
+ gchar **parts;
+ int i;
+
+ parts = g_strsplit(path, "/", 0);
+ assert(parts != NULL && parts[0] != NULL && !parts[0][0]);
+ obj = root;
+
+ for (i = 1; parts[i] != NULL; i++, obj = child) {
+ child = object_resolve_path_component(obj, parts[i]);
+ if (!child) {
+ child = object_new("container");
+ object_property_add_child(obj, parts[i], child, NULL);
+ }
+ }
+
+ g_strfreev(parts);
+
+ return obj;
+}
+
+
+type_init(container_register_types)
diff --git a/qom/object.c b/qom/object.c
new file mode 100644
index 0000000..fc19cf6
--- /dev/null
+++ b/qom/object.c
@@ -0,0 +1,1432 @@
+/*
+ * QEMU Object Model
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qom/object.h"
+#include "qemu-common.h"
+#include "qapi/visitor.h"
+#include "qapi/string-input-visitor.h"
+#include "qapi/string-output-visitor.h"
+#include "qapi/qmp/qerror.h"
+#include "trace.h"
+
+/* TODO: replace QObject with a simpler visitor to avoid a dependency
+ * of the QOM core on QObject? */
+#include "qom/qom-qobject.h"
+#include "qapi/qmp/qobject.h"
+#include "qapi/qmp/qbool.h"
+#include "qapi/qmp/qint.h"
+#include "qapi/qmp/qstring.h"
+
+#define MAX_INTERFACES 32
+
+typedef struct InterfaceImpl InterfaceImpl;
+typedef struct TypeImpl TypeImpl;
+
+struct InterfaceImpl
+{
+ const char *typename;
+};
+
+struct TypeImpl
+{
+ const char *name;
+
+ size_t class_size;
+
+ size_t instance_size;
+
+ void (*class_init)(ObjectClass *klass, void *data);
+ void (*class_base_init)(ObjectClass *klass, void *data);
+ void (*class_finalize)(ObjectClass *klass, void *data);
+
+ void *class_data;
+
+ void (*instance_init)(Object *obj);
+ void (*instance_post_init)(Object *obj);
+ void (*instance_finalize)(Object *obj);
+
+ bool abstract;
+
+ const char *parent;
+ TypeImpl *parent_type;
+
+ ObjectClass *class;
+
+ int num_interfaces;
+ InterfaceImpl interfaces[MAX_INTERFACES];
+};
+
+static Type type_interface;
+
+static GHashTable *type_table_get(void)
+{
+ static GHashTable *type_table;
+
+ if (type_table == NULL) {
+ type_table = g_hash_table_new(g_str_hash, g_str_equal);
+ }
+
+ return type_table;
+}
+
+static void type_table_add(TypeImpl *ti)
+{
+ g_hash_table_insert(type_table_get(), (void *)ti->name, ti);
+}
+
+static TypeImpl *type_table_lookup(const char *name)
+{
+ return g_hash_table_lookup(type_table_get(), name);
+}
+
+static TypeImpl *type_register_internal(const TypeInfo *info)
+{
+ TypeImpl *ti = g_malloc0(sizeof(*ti));
+ int i;
+
+ g_assert(info->name != NULL);
+
+ if (type_table_lookup(info->name) != NULL) {
+ fprintf(stderr, "Registering `%s' which already exists\n", info->name);
+ abort();
+ }
+
+ ti->name = g_strdup(info->name);
+ ti->parent = g_strdup(info->parent);
+
+ ti->class_size = info->class_size;
+ ti->instance_size = info->instance_size;
+
+ ti->class_init = info->class_init;
+ ti->class_base_init = info->class_base_init;
+ ti->class_finalize = info->class_finalize;
+ ti->class_data = info->class_data;
+
+ ti->instance_init = info->instance_init;
+ ti->instance_post_init = info->instance_post_init;
+ ti->instance_finalize = info->instance_finalize;
+
+ ti->abstract = info->abstract;
+
+ for (i = 0; info->interfaces && info->interfaces[i].type; i++) {
+ ti->interfaces[i].typename = g_strdup(info->interfaces[i].type);
+ }
+ ti->num_interfaces = i;
+
+ type_table_add(ti);
+
+ return ti;
+}
+
+TypeImpl *type_register(const TypeInfo *info)
+{
+ assert(info->parent);
+ return type_register_internal(info);
+}
+
+TypeImpl *type_register_static(const TypeInfo *info)
+{
+ return type_register(info);
+}
+
+static TypeImpl *type_get_by_name(const char *name)
+{
+ if (name == NULL) {
+ return NULL;
+ }
+
+ return type_table_lookup(name);
+}
+
+static TypeImpl *type_get_parent(TypeImpl *type)
+{
+ if (!type->parent_type && type->parent) {
+ type->parent_type = type_get_by_name(type->parent);
+ g_assert(type->parent_type != NULL);
+ }
+
+ return type->parent_type;
+}
+
+static bool type_has_parent(TypeImpl *type)
+{
+ return (type->parent != NULL);
+}
+
+static size_t type_class_get_size(TypeImpl *ti)
+{
+ if (ti->class_size) {
+ return ti->class_size;
+ }
+
+ if (type_has_parent(ti)) {
+ return type_class_get_size(type_get_parent(ti));
+ }
+
+ return sizeof(ObjectClass);
+}
+
+static size_t type_object_get_size(TypeImpl *ti)
+{
+ if (ti->instance_size) {
+ return ti->instance_size;
+ }
+
+ if (type_has_parent(ti)) {
+ return type_object_get_size(type_get_parent(ti));
+ }
+
+ return 0;
+}
+
+static bool type_is_ancestor(TypeImpl *type, TypeImpl *target_type)
+{
+ assert(target_type);
+
+ /* Check if typename is a direct ancestor of type */
+ while (type) {
+ if (type == target_type) {
+ return true;
+ }
+
+ type = type_get_parent(type);
+ }
+
+ return false;
+}
+
+static void type_initialize(TypeImpl *ti);
+
+static void type_initialize_interface(TypeImpl *ti, const char *parent)
+{
+ InterfaceClass *new_iface;
+ TypeInfo info = { };
+ TypeImpl *iface_impl;
+
+ info.parent = parent;
+ info.name = g_strdup_printf("%s::%s", ti->name, info.parent);
+ info.abstract = true;
+
+ iface_impl = type_register(&info);
+ type_initialize(iface_impl);
+ g_free((char *)info.name);
+
+ new_iface = (InterfaceClass *)iface_impl->class;
+ new_iface->concrete_class = ti->class;
+
+ ti->class->interfaces = g_slist_append(ti->class->interfaces,
+ iface_impl->class);
+}
+
+static void type_initialize(TypeImpl *ti)
+{
+ TypeImpl *parent;
+
+ if (ti->class) {
+ return;
+ }
+
+ ti->class_size = type_class_get_size(ti);
+ ti->instance_size = type_object_get_size(ti);
+
+ ti->class = g_malloc0(ti->class_size);
+
+ parent = type_get_parent(ti);
+ if (parent) {
+ type_initialize(parent);
+ GSList *e;
+ int i;
+
+ g_assert(parent->class_size <= ti->class_size);
+ memcpy(ti->class, parent->class, parent->class_size);
+ ti->class->interfaces = NULL;
+
+ for (e = parent->class->interfaces; e; e = e->next) {
+ ObjectClass *iface = e->data;
+ type_initialize_interface(ti, object_class_get_name(iface));
+ }
+
+ for (i = 0; i < ti->num_interfaces; i++) {
+ TypeImpl *t = type_get_by_name(ti->interfaces[i].typename);
+ for (e = ti->class->interfaces; e; e = e->next) {
+ TypeImpl *target_type = OBJECT_CLASS(e->data)->type;
+
+ if (type_is_ancestor(target_type, t)) {
+ break;
+ }
+ }
+
+ if (e) {
+ continue;
+ }
+
+ type_initialize_interface(ti, ti->interfaces[i].typename);
+ }
+ }
+
+ ti->class->type = ti;
+
+ while (parent) {
+ if (parent->class_base_init) {
+ parent->class_base_init(ti->class, ti->class_data);
+ }
+ parent = type_get_parent(parent);
+ }
+
+ if (ti->class_init) {
+ ti->class_init(ti->class, ti->class_data);
+ }
+
+
+}
+
+static void object_init_with_type(Object *obj, TypeImpl *ti)
+{
+ if (type_has_parent(ti)) {
+ object_init_with_type(obj, type_get_parent(ti));
+ }
+
+ if (ti->instance_init) {
+ ti->instance_init(obj);
+ }
+}
+
+static void object_post_init_with_type(Object *obj, TypeImpl *ti)
+{
+ if (ti->instance_post_init) {
+ ti->instance_post_init(obj);
+ }
+
+ if (type_has_parent(ti)) {
+ object_post_init_with_type(obj, type_get_parent(ti));
+ }
+}
+
+void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
+{
+ Object *obj = data;
+
+ g_assert(type != NULL);
+ type_initialize(type);
+
+ g_assert(type->instance_size >= sizeof(Object));
+ g_assert(type->abstract == false);
+ g_assert(size >= type->instance_size);
+
+ memset(obj, 0, type->instance_size);
+ obj->class = type->class;
+ object_ref(obj);
+ QTAILQ_INIT(&obj->properties);
+ object_init_with_type(obj, type);
+ object_post_init_with_type(obj, type);
+}
+
+void object_initialize(void *data, size_t size, const char *typename)
+{
+ TypeImpl *type = type_get_by_name(typename);
+
+ object_initialize_with_type(data, size, type);
+}
+
+static inline bool object_property_is_child(ObjectProperty *prop)
+{
+ return strstart(prop->type, "child<", NULL);
+}
+
+static inline bool object_property_is_link(ObjectProperty *prop)
+{
+ return strstart(prop->type, "link<", NULL);
+}
+
+static void object_property_del_all(Object *obj)
+{
+ while (!QTAILQ_EMPTY(&obj->properties)) {
+ ObjectProperty *prop = QTAILQ_FIRST(&obj->properties);
+
+ QTAILQ_REMOVE(&obj->properties, prop, node);
+
+ if (prop->release) {
+ prop->release(obj, prop->name, prop->opaque);
+ }
+
+ g_free(prop->name);
+ g_free(prop->type);
+ g_free(prop);
+ }
+}
+
+static void object_property_del_child(Object *obj, Object *child, Error **errp)
+{
+ ObjectProperty *prop;
+
+ QTAILQ_FOREACH(prop, &obj->properties, node) {
+ if (object_property_is_child(prop) && prop->opaque == child) {
+ object_property_del(obj, prop->name, errp);
+ break;
+ }
+ }
+}
+
+void object_unparent(Object *obj)
+{
+ if (!obj->parent) {
+ return;
+ }
+
+ object_ref(obj);
+ if (obj->class->unparent) {
+ (obj->class->unparent)(obj);
+ }
+ if (obj->parent) {
+ object_property_del_child(obj->parent, obj, NULL);
+ }
+ object_unref(obj);
+}
+
+static void object_deinit(Object *obj, TypeImpl *type)
+{
+ if (type->instance_finalize) {
+ type->instance_finalize(obj);
+ }
+
+ if (type_has_parent(type)) {
+ object_deinit(obj, type_get_parent(type));
+ }
+}
+
+static void object_finalize(void *data)
+{
+ Object *obj = data;
+ TypeImpl *ti = obj->class->type;
+
+ object_deinit(obj, ti);
+ object_property_del_all(obj);
+
+ g_assert(obj->ref == 0);
+ if (obj->free) {
+ obj->free(obj);
+ }
+}
+
+Object *object_new_with_type(Type type)
+{
+ Object *obj;
+
+ g_assert(type != NULL);
+ type_initialize(type);
+
+ obj = g_malloc(type->instance_size);
+ object_initialize_with_type(obj, type->instance_size, type);
+ obj->free = g_free;
+
+ return obj;
+}
+
+Object *object_new(const char *typename)
+{
+ TypeImpl *ti = type_get_by_name(typename);
+
+ return object_new_with_type(ti);
+}
+
+Object *object_dynamic_cast(Object *obj, const char *typename)
+{
+ if (obj && object_class_dynamic_cast(object_get_class(obj), typename)) {
+ return obj;
+ }
+
+ return NULL;
+}
+
+Object *object_dynamic_cast_assert(Object *obj, const char *typename,
+ const char *file, int line, const char *func)
+{
+ trace_object_dynamic_cast_assert(obj ? obj->class->type->name : "(null)",
+ typename, file, line, func);
+
+#ifdef CONFIG_QOM_CAST_DEBUG
+ int i;
+ Object *inst;
+
+ for (i = 0; obj && i < OBJECT_CLASS_CAST_CACHE; i++) {
+ if (obj->class->cast_cache[i] == typename) {
+ goto out;
+ }
+ }
+
+ inst = object_dynamic_cast(obj, typename);
+
+ if (!inst && obj) {
+ fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n",
+ file, line, func, obj, typename);
+ abort();
+ }
+
+ assert(obj == inst);
+
+ if (obj && obj == inst) {
+ for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
+ obj->class->cast_cache[i - 1] = obj->class->cast_cache[i];
+ }
+ obj->class->cast_cache[i - 1] = typename;
+ }
+
+out:
+#endif
+ return obj;
+}
+
+ObjectClass *object_class_dynamic_cast(ObjectClass *class,
+ const char *typename)
+{
+ ObjectClass *ret = NULL;
+ TypeImpl *target_type;
+ TypeImpl *type;
+
+ if (!class) {
+ return NULL;
+ }
+
+ /* A simple fast path that can trigger a lot for leaf classes. */
+ type = class->type;
+ if (type->name == typename) {
+ return class;
+ }
+
+ target_type = type_get_by_name(typename);
+ if (!target_type) {
+ /* target class type unknown, so fail the cast */
+ return NULL;
+ }
+
+ if (type->class->interfaces &&
+ type_is_ancestor(target_type, type_interface)) {
+ int found = 0;
+ GSList *i;
+
+ for (i = class->interfaces; i; i = i->next) {
+ ObjectClass *target_class = i->data;
+
+ if (type_is_ancestor(target_class->type, target_type)) {
+ ret = target_class;
+ found++;
+ }
+ }
+
+ /* The match was ambiguous, don't allow a cast */
+ if (found > 1) {
+ ret = NULL;
+ }
+ } else if (type_is_ancestor(type, target_type)) {
+ ret = class;
+ }
+
+ return ret;
+}
+
+ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class,
+ const char *typename,
+ const char *file, int line,
+ const char *func)
+{
+ ObjectClass *ret;
+
+ trace_object_class_dynamic_cast_assert(class ? class->type->name : "(null)",
+ typename, file, line, func);
+
+#ifdef CONFIG_QOM_CAST_DEBUG
+ int i;
+
+ for (i = 0; class && i < OBJECT_CLASS_CAST_CACHE; i++) {
+ if (class->cast_cache[i] == typename) {
+ ret = class;
+ goto out;
+ }
+ }
+#else
+ if (!class || !class->interfaces) {
+ return class;
+ }
+#endif
+
+ ret = object_class_dynamic_cast(class, typename);
+ if (!ret && class) {
+ fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n",
+ file, line, func, class, typename);
+ abort();
+ }
+
+#ifdef CONFIG_QOM_CAST_DEBUG
+ if (class && ret == class) {
+ for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
+ class->cast_cache[i - 1] = class->cast_cache[i];
+ }
+ class->cast_cache[i - 1] = typename;
+ }
+out:
+#endif
+ return ret;
+}
+
+const char *object_get_typename(Object *obj)
+{
+ return obj->class->type->name;
+}
+
+ObjectClass *object_get_class(Object *obj)
+{
+ return obj->class;
+}
+
+bool object_class_is_abstract(ObjectClass *klass)
+{
+ return klass->type->abstract;
+}
+
+const char *object_class_get_name(ObjectClass *klass)
+{
+ return klass->type->name;
+}
+
+ObjectClass *object_class_by_name(const char *typename)
+{
+ TypeImpl *type = type_get_by_name(typename);
+
+ if (!type) {
+ return NULL;
+ }
+
+ type_initialize(type);
+
+ return type->class;
+}
+
+ObjectClass *object_class_get_parent(ObjectClass *class)
+{
+ TypeImpl *type = type_get_parent(class->type);
+
+ if (!type) {
+ return NULL;
+ }
+
+ type_initialize(type);
+
+ return type->class;
+}
+
+typedef struct OCFData
+{
+ void (*fn)(ObjectClass *klass, void *opaque);
+ const char *implements_type;
+ bool include_abstract;
+ void *opaque;
+} OCFData;
+
+static void object_class_foreach_tramp(gpointer key, gpointer value,
+ gpointer opaque)
+{
+ OCFData *data = opaque;
+ TypeImpl *type = value;
+ ObjectClass *k;
+
+ type_initialize(type);
+ k = type->class;
+
+ if (!data->include_abstract && type->abstract) {
+ return;
+ }
+
+ if (data->implements_type &&
+ !object_class_dynamic_cast(k, data->implements_type)) {
+ return;
+ }
+
+ data->fn(k, data->opaque);
+}
+
+void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),
+ const char *implements_type, bool include_abstract,
+ void *opaque)
+{
+ OCFData data = { fn, implements_type, include_abstract, opaque };
+
+ g_hash_table_foreach(type_table_get(), object_class_foreach_tramp, &data);
+}
+
+int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
+ void *opaque)
+{
+ ObjectProperty *prop;
+ int ret = 0;
+
+ QTAILQ_FOREACH(prop, &obj->properties, node) {
+ if (object_property_is_child(prop)) {
+ ret = fn(prop->opaque, opaque);
+ if (ret != 0) {
+ break;
+ }
+ }
+ }
+ return ret;
+}
+
+static void object_class_get_list_tramp(ObjectClass *klass, void *opaque)
+{
+ GSList **list = opaque;
+
+ *list = g_slist_prepend(*list, klass);
+}
+
+GSList *object_class_get_list(const char *implements_type,
+ bool include_abstract)
+{
+ GSList *list = NULL;
+
+ object_class_foreach(object_class_get_list_tramp,
+ implements_type, include_abstract, &list);
+ return list;
+}
+
+void object_ref(Object *obj)
+{
+ atomic_inc(&obj->ref);
+}
+
+void object_unref(Object *obj)
+{
+ g_assert(obj->ref > 0);
+
+ /* parent always holds a reference to its children */
+ if (atomic_fetch_dec(&obj->ref) == 1) {
+ object_finalize(obj);
+ }
+}
+
+void object_property_add(Object *obj, const char *name, const char *type,
+ ObjectPropertyAccessor *get,
+ ObjectPropertyAccessor *set,
+ ObjectPropertyRelease *release,
+ void *opaque, Error **errp)
+{
+ ObjectProperty *prop;
+
+ QTAILQ_FOREACH(prop, &obj->properties, node) {
+ if (strcmp(prop->name, name) == 0) {
+ error_setg(errp, "attempt to add duplicate property '%s'"
+ " to object (type '%s')", name,
+ object_get_typename(obj));
+ return;
+ }
+ }
+
+ prop = g_malloc0(sizeof(*prop));
+
+ prop->name = g_strdup(name);
+ prop->type = g_strdup(type);
+
+ prop->get = get;
+ prop->set = set;
+ prop->release = release;
+ prop->opaque = opaque;
+
+ QTAILQ_INSERT_TAIL(&obj->properties, prop, node);
+}
+
+ObjectProperty *object_property_find(Object *obj, const char *name,
+ Error **errp)
+{
+ ObjectProperty *prop;
+
+ QTAILQ_FOREACH(prop, &obj->properties, node) {
+ if (strcmp(prop->name, name) == 0) {
+ return prop;
+ }
+ }
+
+ error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name);
+ return NULL;
+}
+
+void object_property_del(Object *obj, const char *name, Error **errp)
+{
+ ObjectProperty *prop = object_property_find(obj, name, errp);
+ if (prop == NULL) {
+ return;
+ }
+
+ if (prop->release) {
+ prop->release(obj, name, prop->opaque);
+ }
+
+ QTAILQ_REMOVE(&obj->properties, prop, node);
+
+ g_free(prop->name);
+ g_free(prop->type);
+ g_free(prop);
+}
+
+void object_property_get(Object *obj, Visitor *v, const char *name,
+ Error **errp)
+{
+ ObjectProperty *prop = object_property_find(obj, name, errp);
+ if (prop == NULL) {
+ return;
+ }
+
+ if (!prop->get) {
+ error_set(errp, QERR_PERMISSION_DENIED);
+ } else {
+ prop->get(obj, v, prop->opaque, name, errp);
+ }
+}
+
+void object_property_set(Object *obj, Visitor *v, const char *name,
+ Error **errp)
+{
+ ObjectProperty *prop = object_property_find(obj, name, errp);
+ if (prop == NULL) {
+ return;
+ }
+
+ if (!prop->set) {
+ error_set(errp, QERR_PERMISSION_DENIED);
+ } else {
+ prop->set(obj, v, prop->opaque, name, errp);
+ }
+}
+
+void object_property_set_str(Object *obj, const char *value,
+ const char *name, Error **errp)
+{
+ QString *qstr = qstring_from_str(value);
+ object_property_set_qobject(obj, QOBJECT(qstr), name, errp);
+
+ QDECREF(qstr);
+}
+
+char *object_property_get_str(Object *obj, const char *name,
+ Error **errp)
+{
+ QObject *ret = object_property_get_qobject(obj, name, errp);
+ QString *qstring;
+ char *retval;
+
+ if (!ret) {
+ return NULL;
+ }
+ qstring = qobject_to_qstring(ret);
+ if (!qstring) {
+ error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
+ retval = NULL;
+ } else {
+ retval = g_strdup(qstring_get_str(qstring));
+ }
+
+ QDECREF(qstring);
+ return retval;
+}
+
+void object_property_set_link(Object *obj, Object *value,
+ const char *name, Error **errp)
+{
+ gchar *path = object_get_canonical_path(value);
+ object_property_set_str(obj, path, name, errp);
+ g_free(path);
+}
+
+Object *object_property_get_link(Object *obj, const char *name,
+ Error **errp)
+{
+ char *str = object_property_get_str(obj, name, errp);
+ Object *target = NULL;
+
+ if (str && *str) {
+ target = object_resolve_path(str, NULL);
+ if (!target) {
+ error_set(errp, QERR_DEVICE_NOT_FOUND, str);
+ }
+ }
+
+ g_free(str);
+ return target;
+}
+
+void object_property_set_bool(Object *obj, bool value,
+ const char *name, Error **errp)
+{
+ QBool *qbool = qbool_from_int(value);
+ object_property_set_qobject(obj, QOBJECT(qbool), name, errp);
+
+ QDECREF(qbool);
+}
+
+bool object_property_get_bool(Object *obj, const char *name,
+ Error **errp)
+{
+ QObject *ret = object_property_get_qobject(obj, name, errp);
+ QBool *qbool;
+ bool retval;
+
+ if (!ret) {
+ return false;
+ }
+ qbool = qobject_to_qbool(ret);
+ if (!qbool) {
+ error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "boolean");
+ retval = false;
+ } else {
+ retval = qbool_get_int(qbool);
+ }
+
+ QDECREF(qbool);
+ return retval;
+}
+
+void object_property_set_int(Object *obj, int64_t value,
+ const char *name, Error **errp)
+{
+ QInt *qint = qint_from_int(value);
+ object_property_set_qobject(obj, QOBJECT(qint), name, errp);
+
+ QDECREF(qint);
+}
+
+int64_t object_property_get_int(Object *obj, const char *name,
+ Error **errp)
+{
+ QObject *ret = object_property_get_qobject(obj, name, errp);
+ QInt *qint;
+ int64_t retval;
+
+ if (!ret) {
+ return -1;
+ }
+ qint = qobject_to_qint(ret);
+ if (!qint) {
+ error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "int");
+ retval = -1;
+ } else {
+ retval = qint_get_int(qint);
+ }
+
+ QDECREF(qint);
+ return retval;
+}
+
+void object_property_parse(Object *obj, const char *string,
+ const char *name, Error **errp)
+{
+ StringInputVisitor *mi;
+ mi = string_input_visitor_new(string);
+ object_property_set(obj, string_input_get_visitor(mi), name, errp);
+
+ string_input_visitor_cleanup(mi);
+}
+
+char *object_property_print(Object *obj, const char *name,
+ Error **errp)
+{
+ StringOutputVisitor *mo;
+ char *string;
+
+ mo = string_output_visitor_new();
+ object_property_get(obj, string_output_get_visitor(mo), name, errp);
+ string = string_output_get_string(mo);
+ string_output_visitor_cleanup(mo);
+ return string;
+}
+
+const char *object_property_get_type(Object *obj, const char *name, Error **errp)
+{
+ ObjectProperty *prop = object_property_find(obj, name, errp);
+ if (prop == NULL) {
+ return NULL;
+ }
+
+ return prop->type;
+}
+
+Object *object_get_root(void)
+{
+ static Object *root;
+
+ if (!root) {
+ root = object_new("container");
+ }
+
+ return root;
+}
+
+static void object_get_child_property(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ Object *child = opaque;
+ gchar *path;
+
+ path = object_get_canonical_path(child);
+ visit_type_str(v, &path, name, errp);
+ g_free(path);
+}
+
+static void object_finalize_child_property(Object *obj, const char *name,
+ void *opaque)
+{
+ Object *child = opaque;
+
+ object_unref(child);
+}
+
+void object_property_add_child(Object *obj, const char *name,
+ Object *child, Error **errp)
+{
+ gchar *type;
+
+ type = g_strdup_printf("child<%s>", object_get_typename(OBJECT(child)));
+
+ object_property_add(obj, name, type, object_get_child_property,
+ NULL, object_finalize_child_property, child, errp);
+
+ object_ref(child);
+ g_assert(child->parent == NULL);
+ child->parent = obj;
+
+ g_free(type);
+}
+
+static void object_get_link_property(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ Object **child = opaque;
+ gchar *path;
+
+ if (*child) {
+ path = object_get_canonical_path(*child);
+ visit_type_str(v, &path, name, errp);
+ g_free(path);
+ } else {
+ path = (gchar *)"";
+ visit_type_str(v, &path, name, errp);
+ }
+}
+
+static void object_set_link_property(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ Object **child = opaque;
+ Object *old_target;
+ bool ambiguous = false;
+ const char *type;
+ char *path;
+ gchar *target_type;
+
+ type = object_property_get_type(obj, name, NULL);
+
+ visit_type_str(v, &path, name, errp);
+
+ old_target = *child;
+ *child = NULL;
+
+ if (strcmp(path, "") != 0) {
+ Object *target;
+
+ /* Go from link<FOO> to FOO. */
+ target_type = g_strndup(&type[5], strlen(type) - 6);
+ target = object_resolve_path_type(path, target_type, &ambiguous);
+
+ if (ambiguous) {
+ error_set(errp, QERR_AMBIGUOUS_PATH, path);
+ } else if (target) {
+ object_ref(target);
+ *child = target;
+ } else {
+ target = object_resolve_path(path, &ambiguous);
+ if (target || ambiguous) {
+ error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type);
+ } else {
+ error_set(errp, QERR_DEVICE_NOT_FOUND, path);
+ }
+ }
+ g_free(target_type);
+ }
+
+ g_free(path);
+
+ if (old_target != NULL) {
+ object_unref(old_target);
+ }
+}
+
+void object_property_add_link(Object *obj, const char *name,
+ const char *type, Object **child,
+ Error **errp)
+{
+ gchar *full_type;
+
+ full_type = g_strdup_printf("link<%s>", type);
+
+ object_property_add(obj, name, full_type,
+ object_get_link_property,
+ object_set_link_property,
+ NULL, child, errp);
+
+ g_free(full_type);
+}
+
+gchar *object_get_canonical_path(Object *obj)
+{
+ Object *root = object_get_root();
+ char *newpath = NULL, *path = NULL;
+
+ while (obj != root) {
+ ObjectProperty *prop = NULL;
+
+ g_assert(obj->parent != NULL);
+
+ QTAILQ_FOREACH(prop, &obj->parent->properties, node) {
+ if (!object_property_is_child(prop)) {
+ continue;
+ }
+
+ if (prop->opaque == obj) {
+ if (path) {
+ newpath = g_strdup_printf("%s/%s", prop->name, path);
+ g_free(path);
+ path = newpath;
+ } else {
+ path = g_strdup(prop->name);
+ }
+ break;
+ }
+ }
+
+ g_assert(prop != NULL);
+
+ obj = obj->parent;
+ }
+
+ newpath = g_strdup_printf("/%s", path);
+ g_free(path);
+
+ return newpath;
+}
+
+Object *object_resolve_path_component(Object *parent, const gchar *part)
+{
+ ObjectProperty *prop = object_property_find(parent, part, NULL);
+ if (prop == NULL) {
+ return NULL;
+ }
+
+ if (object_property_is_link(prop)) {
+ return *(Object **)prop->opaque;
+ } else if (object_property_is_child(prop)) {
+ return prop->opaque;
+ } else {
+ return NULL;
+ }
+}
+
+static Object *object_resolve_abs_path(Object *parent,
+ gchar **parts,
+ const char *typename,
+ int index)
+{
+ Object *child;
+
+ if (parts[index] == NULL) {
+ return object_dynamic_cast(parent, typename);
+ }
+
+ if (strcmp(parts[index], "") == 0) {
+ return object_resolve_abs_path(parent, parts, typename, index + 1);
+ }
+
+ child = object_resolve_path_component(parent, parts[index]);
+ if (!child) {
+ return NULL;
+ }
+
+ return object_resolve_abs_path(child, parts, typename, index + 1);
+}
+
+static Object *object_resolve_partial_path(Object *parent,
+ gchar **parts,
+ const char *typename,
+ bool *ambiguous)
+{
+ Object *obj;
+ ObjectProperty *prop;
+
+ obj = object_resolve_abs_path(parent, parts, typename, 0);
+
+ QTAILQ_FOREACH(prop, &parent->properties, node) {
+ Object *found;
+
+ if (!object_property_is_child(prop)) {
+ continue;
+ }
+
+ found = object_resolve_partial_path(prop->opaque, parts,
+ typename, ambiguous);
+ if (found) {
+ if (obj) {
+ if (ambiguous) {
+ *ambiguous = true;
+ }
+ return NULL;
+ }
+ obj = found;
+ }
+
+ if (ambiguous && *ambiguous) {
+ return NULL;
+ }
+ }
+
+ return obj;
+}
+
+Object *object_resolve_path_type(const char *path, const char *typename,
+ bool *ambiguous)
+{
+ Object *obj;
+ gchar **parts;
+
+ parts = g_strsplit(path, "/", 0);
+ assert(parts);
+
+ if (parts[0] == NULL || strcmp(parts[0], "") != 0) {
+ if (ambiguous) {
+ *ambiguous = false;
+ }
+ obj = object_resolve_partial_path(object_get_root(), parts,
+ typename, ambiguous);
+ } else {
+ obj = object_resolve_abs_path(object_get_root(), parts, typename, 1);
+ }
+
+ g_strfreev(parts);
+
+ return obj;
+}
+
+Object *object_resolve_path(const char *path, bool *ambiguous)
+{
+ return object_resolve_path_type(path, TYPE_OBJECT, ambiguous);
+}
+
+typedef struct StringProperty
+{
+ char *(*get)(Object *, Error **);
+ void (*set)(Object *, const char *, Error **);
+} StringProperty;
+
+static void property_get_str(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ StringProperty *prop = opaque;
+ char *value;
+
+ value = prop->get(obj, errp);
+ if (value) {
+ visit_type_str(v, &value, name, errp);
+ g_free(value);
+ }
+}
+
+static void property_set_str(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ StringProperty *prop = opaque;
+ char *value;
+ Error *local_err = NULL;
+
+ visit_type_str(v, &value, name, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
+ prop->set(obj, value, errp);
+ g_free(value);
+}
+
+static void property_release_str(Object *obj, const char *name,
+ void *opaque)
+{
+ StringProperty *prop = opaque;
+ g_free(prop);
+}
+
+void object_property_add_str(Object *obj, const char *name,
+ char *(*get)(Object *, Error **),
+ void (*set)(Object *, const char *, Error **),
+ Error **errp)
+{
+ StringProperty *prop = g_malloc0(sizeof(*prop));
+
+ prop->get = get;
+ prop->set = set;
+
+ object_property_add(obj, name, "string",
+ get ? property_get_str : NULL,
+ set ? property_set_str : NULL,
+ property_release_str,
+ prop, errp);
+}
+
+typedef struct BoolProperty
+{
+ bool (*get)(Object *, Error **);
+ void (*set)(Object *, bool, Error **);
+} BoolProperty;
+
+static void property_get_bool(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ BoolProperty *prop = opaque;
+ bool value;
+
+ value = prop->get(obj, errp);
+ visit_type_bool(v, &value, name, errp);
+}
+
+static void property_set_bool(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ BoolProperty *prop = opaque;
+ bool value;
+ Error *local_err = NULL;
+
+ visit_type_bool(v, &value, name, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
+ prop->set(obj, value, errp);
+}
+
+static void property_release_bool(Object *obj, const char *name,
+ void *opaque)
+{
+ BoolProperty *prop = opaque;
+ g_free(prop);
+}
+
+void object_property_add_bool(Object *obj, const char *name,
+ bool (*get)(Object *, Error **),
+ void (*set)(Object *, bool, Error **),
+ Error **errp)
+{
+ BoolProperty *prop = g_malloc0(sizeof(*prop));
+
+ prop->get = get;
+ prop->set = set;
+
+ object_property_add(obj, name, "bool",
+ get ? property_get_bool : NULL,
+ set ? property_set_bool : NULL,
+ property_release_bool,
+ prop, errp);
+}
+
+static char *qdev_get_type(Object *obj, Error **errp)
+{
+ return g_strdup(object_get_typename(obj));
+}
+
+static void property_get_uint8_ptr(Object *obj, Visitor *v,
+ void *opaque, const char *name,
+ Error **errp)
+{
+ uint8_t value = *(uint8_t *)opaque;
+ visit_type_uint8(v, &value, name, errp);
+}
+
+static void property_get_uint16_ptr(Object *obj, Visitor *v,
+ void *opaque, const char *name,
+ Error **errp)
+{
+ uint16_t value = *(uint16_t *)opaque;
+ visit_type_uint16(v, &value, name, errp);
+}
+
+static void property_get_uint32_ptr(Object *obj, Visitor *v,
+ void *opaque, const char *name,
+ Error **errp)
+{
+ uint32_t value = *(uint32_t *)opaque;
+ visit_type_uint32(v, &value, name, errp);
+}
+
+static void property_get_uint64_ptr(Object *obj, Visitor *v,
+ void *opaque, const char *name,
+ Error **errp)
+{
+ uint64_t value = *(uint64_t *)opaque;
+ visit_type_uint64(v, &value, name, errp);
+}
+
+void object_property_add_uint8_ptr(Object *obj, const char *name,
+ const uint8_t *v, Error **errp)
+{
+ object_property_add(obj, name, "uint8", property_get_uint8_ptr,
+ NULL, NULL, (void *)v, errp);
+}
+
+void object_property_add_uint16_ptr(Object *obj, const char *name,
+ const uint16_t *v, Error **errp)
+{
+ object_property_add(obj, name, "uint16", property_get_uint16_ptr,
+ NULL, NULL, (void *)v, errp);
+}
+
+void object_property_add_uint32_ptr(Object *obj, const char *name,
+ const uint32_t *v, Error **errp)
+{
+ object_property_add(obj, name, "uint32", property_get_uint32_ptr,
+ NULL, NULL, (void *)v, errp);
+}
+
+void object_property_add_uint64_ptr(Object *obj, const char *name,
+ const uint64_t *v, Error **errp)
+{
+ object_property_add(obj, name, "uint64", property_get_uint64_ptr,
+ NULL, NULL, (void *)v, errp);
+}
+
+static void object_instance_init(Object *obj)
+{
+ object_property_add_str(obj, "type", qdev_get_type, NULL, NULL);
+}
+
+static void register_types(void)
+{
+ static TypeInfo interface_info = {
+ .name = TYPE_INTERFACE,
+ .class_size = sizeof(InterfaceClass),
+ .abstract = true,
+ };
+
+ static TypeInfo object_info = {
+ .name = TYPE_OBJECT,
+ .instance_size = sizeof(Object),
+ .instance_init = object_instance_init,
+ .abstract = true,
+ };
+
+ type_interface = type_register_internal(&interface_info);
+ type_register_internal(&object_info);
+}
+
+type_init(register_types)
diff --git a/qom/qom-qobject.c b/qom/qom-qobject.c
new file mode 100644
index 0000000..6384b8e
--- /dev/null
+++ b/qom/qom-qobject.c
@@ -0,0 +1,44 @@
+/*
+ * QEMU Object Model - QObject wrappers
+ *
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * Author: Paolo Bonzini <pbonzini@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu-common.h"
+#include "qom/object.h"
+#include "qom/qom-qobject.h"
+#include "qapi/visitor.h"
+#include "qapi/qmp-input-visitor.h"
+#include "qapi/qmp-output-visitor.h"
+
+void object_property_set_qobject(Object *obj, QObject *value,
+ const char *name, Error **errp)
+{
+ QmpInputVisitor *mi;
+ mi = qmp_input_visitor_new(value);
+ object_property_set(obj, qmp_input_get_visitor(mi), name, errp);
+
+ qmp_input_visitor_cleanup(mi);
+}
+
+QObject *object_property_get_qobject(Object *obj, const char *name,
+ Error **errp)
+{
+ QObject *ret = NULL;
+ Error *local_err = NULL;
+ QmpOutputVisitor *mo;
+
+ mo = qmp_output_visitor_new();
+ object_property_get(obj, qmp_output_get_visitor(mo), name, &local_err);
+ if (!local_err) {
+ ret = qmp_output_get_qobject(mo);
+ }
+ error_propagate(errp, local_err);
+ qmp_output_visitor_cleanup(mo);
+ return ret;
+}
diff --git a/scripts/ordereddict.py b/scripts/ordereddict.py
new file mode 100644
index 0000000..7242b50
--- /dev/null
+++ b/scripts/ordereddict.py
@@ -0,0 +1,127 @@
+# Copyright (c) 2009 Raymond Hettinger
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+from UserDict import DictMixin
+
+class OrderedDict(dict, DictMixin):
+
+ def __init__(self, *args, **kwds):
+ if len(args) > 1:
+ raise TypeError('expected at most 1 arguments, got %d' % len(args))
+ try:
+ self.__end
+ except AttributeError:
+ self.clear()
+ self.update(*args, **kwds)
+
+ def clear(self):
+ self.__end = end = []
+ end += [None, end, end] # sentinel node for doubly linked list
+ self.__map = {} # key --> [key, prev, next]
+ dict.clear(self)
+
+ def __setitem__(self, key, value):
+ if key not in self:
+ end = self.__end
+ curr = end[1]
+ curr[2] = end[1] = self.__map[key] = [key, curr, end]
+ dict.__setitem__(self, key, value)
+
+ def __delitem__(self, key):
+ dict.__delitem__(self, key)
+ key, prev, next = self.__map.pop(key)
+ prev[2] = next
+ next[1] = prev
+
+ def __iter__(self):
+ end = self.__end
+ curr = end[2]
+ while curr is not end:
+ yield curr[0]
+ curr = curr[2]
+
+ def __reversed__(self):
+ end = self.__end
+ curr = end[1]
+ while curr is not end:
+ yield curr[0]
+ curr = curr[1]
+
+ def popitem(self, last=True):
+ if not self:
+ raise KeyError('dictionary is empty')
+ if last:
+ key = reversed(self).next()
+ else:
+ key = iter(self).next()
+ value = self.pop(key)
+ return key, value
+
+ def __reduce__(self):
+ items = [[k, self[k]] for k in self]
+ tmp = self.__map, self.__end
+ del self.__map, self.__end
+ inst_dict = vars(self).copy()
+ self.__map, self.__end = tmp
+ if inst_dict:
+ return (self.__class__, (items,), inst_dict)
+ return self.__class__, (items,)
+
+ def keys(self):
+ return list(self)
+
+ setdefault = DictMixin.setdefault
+ update = DictMixin.update
+ pop = DictMixin.pop
+ values = DictMixin.values
+ items = DictMixin.items
+ iterkeys = DictMixin.iterkeys
+ itervalues = DictMixin.itervalues
+ iteritems = DictMixin.iteritems
+
+ def __repr__(self):
+ if not self:
+ return '%s()' % (self.__class__.__name__,)
+ return '%s(%r)' % (self.__class__.__name__, self.items())
+
+ def copy(self):
+ return self.__class__(self)
+
+ @classmethod
+ def fromkeys(cls, iterable, value=None):
+ d = cls()
+ for key in iterable:
+ d[key] = value
+ return d
+
+ def __eq__(self, other):
+ if isinstance(other, OrderedDict):
+ if len(self) != len(other):
+ return False
+ for p, q in zip(self.items(), other.items()):
+ if p != q:
+ return False
+ return True
+ return dict.__eq__(self, other)
+
+ def __ne__(self, other):
+ return not self == other
diff --git a/scripts/ordereddict.pyc b/scripts/ordereddict.pyc
new file mode 100644
index 0000000..07a8129
--- /dev/null
+++ b/scripts/ordereddict.pyc
Binary files differ
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
new file mode 100644
index 0000000..b12b696
--- /dev/null
+++ b/scripts/qapi-commands.py
@@ -0,0 +1,483 @@
+#
+# QAPI command marshaller generator
+#
+# Copyright IBM, Corp. 2011
+#
+# Authors:
+# Anthony Liguori <aliguori@us.ibm.com>
+# Michael Roth <mdroth@linux.vnet.ibm.com>
+#
+# This work is licensed under the terms of the GNU GPLv2.
+# See the COPYING.LIB file in the top-level directory.
+
+from ordereddict import OrderedDict
+from qapi import *
+import sys
+import os
+import getopt
+import errno
+
+def type_visitor(name):
+ if type(name) == list:
+ return 'visit_type_%sList' % name[0]
+ else:
+ return 'visit_type_%s' % name
+
+def generate_decl_enum(name, members, genlist=True):
+ return mcgen('''
+
+void %(visitor)s(Visitor *m, %(name)s * obj, const char *name, Error **errp);
+''',
+ visitor=type_visitor(name))
+
+def generate_command_decl(name, args, ret_type):
+ arglist=""
+ for argname, argtype, optional, structured in parse_args(args):
+ argtype = c_type(argtype)
+ if argtype == "char *":
+ argtype = "const char *"
+ if optional:
+ arglist += "bool has_%s, " % c_var(argname)
+ arglist += "%s %s, " % (argtype, c_var(argname))
+ return mcgen('''
+%(ret_type)s qmp_%(name)s(%(args)sError **errp);
+''',
+ ret_type=c_type(ret_type), name=c_fun(name), args=arglist).strip()
+
+def gen_sync_call(name, args, ret_type, indent=0):
+ ret = ""
+ arglist=""
+ retval=""
+ if ret_type:
+ retval = "retval = "
+ for argname, argtype, optional, structured in parse_args(args):
+ if optional:
+ arglist += "has_%s, " % c_var(argname)
+ arglist += "%s, " % (c_var(argname))
+ push_indent(indent)
+ ret = mcgen('''
+%(retval)sqmp_%(name)s(%(args)serrp);
+
+''',
+ name=c_fun(name), args=arglist, retval=retval).rstrip()
+ if ret_type:
+ ret += "\n" + mcgen(''''
+if (!error_is_set(errp)) {
+ %(marshal_output_call)s
+}
+''',
+ marshal_output_call=gen_marshal_output_call(name, ret_type)).rstrip()
+ pop_indent(indent)
+ return ret.rstrip()
+
+
+def gen_marshal_output_call(name, ret_type):
+ if not ret_type:
+ return ""
+ return "qmp_marshal_output_%s(retval, ret, errp);" % c_fun(name)
+
+def gen_visitor_output_containers_decl(ret_type):
+ ret = ""
+ push_indent()
+ if ret_type:
+ ret += mcgen('''
+QmpOutputVisitor *mo;
+QapiDeallocVisitor *md;
+Visitor *v;
+''')
+ pop_indent()
+
+ return ret
+
+def gen_visitor_input_containers_decl(args):
+ ret = ""
+
+ push_indent()
+ if len(args) > 0:
+ ret += mcgen('''
+QmpInputVisitor *mi;
+QapiDeallocVisitor *md;
+Visitor *v;
+''')
+ pop_indent()
+
+ return ret.rstrip()
+
+def gen_visitor_input_vars_decl(args):
+ ret = ""
+ push_indent()
+ for argname, argtype, optional, structured in parse_args(args):
+ if optional:
+ ret += mcgen('''
+bool has_%(argname)s = false;
+''',
+ argname=c_var(argname))
+ if c_type(argtype).endswith("*"):
+ ret += mcgen('''
+%(argtype)s %(argname)s = NULL;
+''',
+ argname=c_var(argname), argtype=c_type(argtype))
+ else:
+ ret += mcgen('''
+%(argtype)s %(argname)s;
+''',
+ argname=c_var(argname), argtype=c_type(argtype))
+
+ pop_indent()
+ return ret.rstrip()
+
+def gen_visitor_input_block(args, obj, dealloc=False):
+ ret = ""
+ errparg = 'errp'
+
+ if len(args) == 0:
+ return ret
+
+ push_indent()
+
+ if dealloc:
+ errparg = 'NULL'
+ ret += mcgen('''
+md = qapi_dealloc_visitor_new();
+v = qapi_dealloc_get_visitor(md);
+''')
+ else:
+ ret += mcgen('''
+mi = qmp_input_visitor_new_strict(%(obj)s);
+v = qmp_input_get_visitor(mi);
+''',
+ obj=obj)
+
+ for argname, argtype, optional, structured in parse_args(args):
+ if optional:
+ ret += mcgen('''
+visit_start_optional(v, &has_%(c_name)s, "%(name)s", %(errp)s);
+if (has_%(c_name)s) {
+''',
+ c_name=c_var(argname), name=argname, errp=errparg)
+ push_indent()
+ ret += mcgen('''
+%(visitor)s(v, &%(c_name)s, "%(name)s", %(errp)s);
+''',
+ c_name=c_var(argname), name=argname, argtype=argtype,
+ visitor=type_visitor(argtype), errp=errparg)
+ if optional:
+ pop_indent()
+ ret += mcgen('''
+}
+visit_end_optional(v, %(errp)s);
+''', errp=errparg)
+
+ if dealloc:
+ ret += mcgen('''
+qapi_dealloc_visitor_cleanup(md);
+''')
+ else:
+ ret += mcgen('''
+qmp_input_visitor_cleanup(mi);
+''')
+ pop_indent()
+ return ret.rstrip()
+
+def gen_marshal_output(name, args, ret_type, middle_mode):
+ if not ret_type:
+ return ""
+
+ ret = mcgen('''
+static void qmp_marshal_output_%(c_name)s(%(c_ret_type)s ret_in, QObject **ret_out, Error **errp)
+{
+ QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
+ QmpOutputVisitor *mo = qmp_output_visitor_new();
+ Visitor *v;
+
+ v = qmp_output_get_visitor(mo);
+ %(visitor)s(v, &ret_in, "unused", errp);
+ if (!error_is_set(errp)) {
+ *ret_out = qmp_output_get_qobject(mo);
+ }
+ qmp_output_visitor_cleanup(mo);
+ v = qapi_dealloc_get_visitor(md);
+ %(visitor)s(v, &ret_in, "unused", NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+''',
+ c_ret_type=c_type(ret_type), c_name=c_fun(name),
+ visitor=type_visitor(ret_type))
+
+ return ret
+
+def gen_marshal_input_decl(name, args, ret_type, middle_mode):
+ if middle_mode:
+ return 'int qmp_marshal_input_%s(Monitor *mon, const QDict *qdict, QObject **ret)' % c_fun(name)
+ else:
+ return 'static void qmp_marshal_input_%s(QDict *args, QObject **ret, Error **errp)' % c_fun(name)
+
+
+
+def gen_marshal_input(name, args, ret_type, middle_mode):
+ hdr = gen_marshal_input_decl(name, args, ret_type, middle_mode)
+
+ ret = mcgen('''
+%(header)s
+{
+''',
+ header=hdr)
+
+ if middle_mode:
+ ret += mcgen('''
+ Error *local_err = NULL;
+ Error **errp = &local_err;
+ QDict *args = (QDict *)qdict;
+''')
+
+ if ret_type:
+ if c_type(ret_type).endswith("*"):
+ retval = " %s retval = NULL;" % c_type(ret_type)
+ else:
+ retval = " %s retval;" % c_type(ret_type)
+ ret += mcgen('''
+%(retval)s
+''',
+ retval=retval)
+
+ if len(args) > 0:
+ ret += mcgen('''
+%(visitor_input_containers_decl)s
+%(visitor_input_vars_decl)s
+
+%(visitor_input_block)s
+
+''',
+ visitor_input_containers_decl=gen_visitor_input_containers_decl(args),
+ visitor_input_vars_decl=gen_visitor_input_vars_decl(args),
+ visitor_input_block=gen_visitor_input_block(args, "QOBJECT(args)"))
+ else:
+ ret += mcgen('''
+ (void)args;
+''')
+
+ ret += mcgen('''
+ if (error_is_set(errp)) {
+ goto out;
+ }
+%(sync_call)s
+''',
+ sync_call=gen_sync_call(name, args, ret_type, indent=4))
+ ret += mcgen('''
+
+out:
+''')
+ ret += mcgen('''
+%(visitor_input_block_cleanup)s
+''',
+ visitor_input_block_cleanup=gen_visitor_input_block(args, None,
+ dealloc=True))
+
+ if middle_mode:
+ ret += mcgen('''
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
+ return 0;
+''')
+ else:
+ ret += mcgen('''
+ return;
+''')
+
+ ret += mcgen('''
+}
+''')
+
+ return ret
+
+def option_value_matches(opt, val, cmd):
+ if opt in cmd and cmd[opt] == val:
+ return True
+ return False
+
+def gen_registry(commands):
+ registry=""
+ push_indent()
+ for cmd in commands:
+ options = 'QCO_NO_OPTIONS'
+ if option_value_matches('success-response', 'no', cmd):
+ options = 'QCO_NO_SUCCESS_RESP'
+
+ registry += mcgen('''
+qmp_register_command("%(name)s", qmp_marshal_input_%(c_name)s, %(opts)s);
+''',
+ name=cmd['command'], c_name=c_fun(cmd['command']),
+ opts=options)
+ pop_indent()
+ ret = mcgen('''
+static void qmp_init_marshal(void)
+{
+%(registry)s
+}
+
+qapi_init(qmp_init_marshal);
+''',
+ registry=registry.rstrip())
+ return ret
+
+def gen_command_decl_prologue(header, guard, prefix=""):
+ ret = mcgen('''
+/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QAPI function prototypes
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef %(guard)s
+#define %(guard)s
+
+#include "%(prefix)sqapi-types.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/error.h"
+
+''',
+ header=basename(header), guard=guardname(header), prefix=prefix)
+ return ret
+
+def gen_command_def_prologue(prefix="", proxy=False):
+ ret = mcgen('''
+/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QMP->QAPI command dispatch
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include "qemu-common.h"
+#include "qemu/module.h"
+#include "qapi/qmp/qerror.h"
+#include "qapi/qmp/types.h"
+#include "qapi/qmp/dispatch.h"
+#include "qapi/visitor.h"
+#include "qapi/qmp-output-visitor.h"
+#include "qapi/qmp-input-visitor.h"
+#include "qapi/dealloc-visitor.h"
+#include "%(prefix)sqapi-types.h"
+#include "%(prefix)sqapi-visit.h"
+
+''',
+ prefix=prefix)
+ if not proxy:
+ ret += '#include "%sqmp-commands.h"' % prefix
+ return ret + "\n\n"
+
+
+try:
+ opts, args = getopt.gnu_getopt(sys.argv[1:], "chp:o:m",
+ ["source", "header", "prefix=",
+ "output-dir=", "type=", "middle"])
+except getopt.GetoptError, err:
+ print str(err)
+ sys.exit(1)
+
+output_dir = ""
+prefix = ""
+dispatch_type = "sync"
+c_file = 'qmp-marshal.c'
+h_file = 'qmp-commands.h'
+middle_mode = False
+
+do_c = False
+do_h = False
+
+for o, a in opts:
+ if o in ("-p", "--prefix"):
+ prefix = a
+ elif o in ("-o", "--output-dir"):
+ output_dir = a + "/"
+ elif o in ("-t", "--type"):
+ dispatch_type = a
+ elif o in ("-m", "--middle"):
+ middle_mode = True
+ elif o in ("-c", "--source"):
+ do_c = True
+ elif o in ("-h", "--header"):
+ do_h = True
+
+if not do_c and not do_h:
+ do_c = True
+ do_h = True
+
+c_file = output_dir + prefix + c_file
+h_file = output_dir + prefix + h_file
+
+def maybe_open(really, name, opt):
+ if really:
+ return open(name, opt)
+ else:
+ import StringIO
+ return StringIO.StringIO()
+
+try:
+ os.makedirs(output_dir)
+except os.error, e:
+ if e.errno != errno.EEXIST:
+ raise
+
+exprs = parse_schema(sys.stdin)
+commands = filter(lambda expr: expr.has_key('command'), exprs)
+commands = filter(lambda expr: not expr.has_key('gen'), commands)
+
+if dispatch_type == "sync":
+ fdecl = maybe_open(do_h, h_file, 'w')
+ fdef = maybe_open(do_c, c_file, 'w')
+ ret = gen_command_decl_prologue(header=basename(h_file), guard=guardname(h_file), prefix=prefix)
+ fdecl.write(ret)
+ ret = gen_command_def_prologue(prefix=prefix)
+ fdef.write(ret)
+
+ for cmd in commands:
+ arglist = []
+ ret_type = None
+ if cmd.has_key('data'):
+ arglist = cmd['data']
+ if cmd.has_key('returns'):
+ ret_type = cmd['returns']
+ ret = generate_command_decl(cmd['command'], arglist, ret_type) + "\n"
+ fdecl.write(ret)
+ if ret_type:
+ ret = gen_marshal_output(cmd['command'], arglist, ret_type, middle_mode) + "\n"
+ fdef.write(ret)
+
+ if middle_mode:
+ fdecl.write('%s;\n' % gen_marshal_input_decl(cmd['command'], arglist, ret_type, middle_mode))
+
+ ret = gen_marshal_input(cmd['command'], arglist, ret_type, middle_mode) + "\n"
+ fdef.write(ret)
+
+ fdecl.write("\n#endif\n");
+
+ if not middle_mode:
+ ret = gen_registry(commands)
+ fdef.write(ret)
+
+ fdef.flush()
+ fdef.close()
+ fdecl.flush()
+ fdecl.close()
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
new file mode 100644
index 0000000..4a1652b
--- /dev/null
+++ b/scripts/qapi-types.py
@@ -0,0 +1,455 @@
+#
+# QAPI types generator
+#
+# Copyright IBM, Corp. 2011
+#
+# Authors:
+# Anthony Liguori <aliguori@us.ibm.com>
+#
+# This work is licensed under the terms of the GNU GPLv2.
+# See the COPYING.LIB file in the top-level directory.
+
+from ordereddict import OrderedDict
+from qapi import *
+import sys
+import os
+import getopt
+import errno
+
+def generate_fwd_struct(name, members, builtin_type=False):
+ if builtin_type:
+ return mcgen('''
+
+typedef struct %(name)sList
+{
+ union {
+ %(type)s value;
+ uint64_t padding;
+ };
+ struct %(name)sList *next;
+} %(name)sList;
+''',
+ type=c_type(name),
+ name=name)
+
+ return mcgen('''
+
+typedef struct %(name)s %(name)s;
+
+typedef struct %(name)sList
+{
+ union {
+ %(name)s *value;
+ uint64_t padding;
+ };
+ struct %(name)sList *next;
+} %(name)sList;
+''',
+ name=name)
+
+def generate_fwd_enum_struct(name, members):
+ return mcgen('''
+typedef struct %(name)sList
+{
+ union {
+ %(name)s value;
+ uint64_t padding;
+ };
+ struct %(name)sList *next;
+} %(name)sList;
+''',
+ name=name)
+
+def generate_struct_fields(members):
+ ret = ''
+
+ for argname, argentry, optional, structured in parse_args(members):
+ if optional:
+ ret += mcgen('''
+ bool has_%(c_name)s;
+''',
+ c_name=c_var(argname))
+ if structured:
+ push_indent()
+ ret += generate_struct({ "field": argname, "data": argentry})
+ pop_indent()
+ else:
+ ret += mcgen('''
+ %(c_type)s %(c_name)s;
+''',
+ c_type=c_type(argentry), c_name=c_var(argname))
+
+ return ret
+
+def generate_struct(expr):
+
+ structname = expr.get('type', "")
+ fieldname = expr.get('field', "")
+ members = expr['data']
+ base = expr.get('base')
+
+ ret = mcgen('''
+struct %(name)s
+{
+''',
+ name=structname)
+
+ if base:
+ ret += generate_struct_fields({'base': base})
+
+ ret += generate_struct_fields(members)
+
+ if len(fieldname):
+ fieldname = " " + fieldname
+ ret += mcgen('''
+}%(field)s;
+''',
+ field=fieldname)
+
+ return ret
+
+def generate_enum_lookup(name, values):
+ ret = mcgen('''
+const char *%(name)s_lookup[] = {
+''',
+ name=name)
+ i = 0
+ for value in values:
+ ret += mcgen('''
+ "%(value)s",
+''',
+ value=value)
+
+ ret += mcgen('''
+ NULL,
+};
+
+''')
+ return ret
+
+def generate_enum_name(name):
+ if name.isupper():
+ return c_fun(name, False)
+ new_name = ''
+ for c in c_fun(name, False):
+ if c.isupper():
+ new_name += '_'
+ new_name += c
+ return new_name.lstrip('_').upper()
+
+def generate_enum(name, values):
+ lookup_decl = mcgen('''
+extern const char *%(name)s_lookup[];
+''',
+ name=name)
+
+ enum_decl = mcgen('''
+typedef enum %(name)s
+{
+''',
+ name=name)
+
+ # append automatically generated _MAX value
+ enum_values = values + [ 'MAX' ]
+
+ i = 0
+ for value in enum_values:
+ enum_decl += mcgen('''
+ %(abbrev)s_%(value)s = %(i)d,
+''',
+ abbrev=de_camel_case(name).upper(),
+ value=generate_enum_name(value),
+ i=i)
+ i += 1
+
+ enum_decl += mcgen('''
+} %(name)s;
+''',
+ name=name)
+
+ return lookup_decl + enum_decl
+
+def generate_anon_union_qtypes(expr):
+
+ name = expr['union']
+ members = expr['data']
+
+ ret = mcgen('''
+const int %(name)s_qtypes[QTYPE_MAX] = {
+''',
+ name=name)
+
+ for key in members:
+ qapi_type = members[key]
+ if builtin_type_qtypes.has_key(qapi_type):
+ qtype = builtin_type_qtypes[qapi_type]
+ elif find_struct(qapi_type):
+ qtype = "QTYPE_QDICT"
+ elif find_union(qapi_type):
+ qtype = "QTYPE_QDICT"
+ else:
+ assert False, "Invalid anonymous union member"
+
+ ret += mcgen('''
+ [ %(qtype)s ] = %(abbrev)s_KIND_%(enum)s,
+''',
+ qtype = qtype,
+ abbrev = de_camel_case(name).upper(),
+ enum = c_fun(de_camel_case(key),False).upper())
+
+ ret += mcgen('''
+};
+''')
+ return ret
+
+
+def generate_union(expr):
+
+ name = expr['union']
+ typeinfo = expr['data']
+
+ base = expr.get('base')
+ discriminator = expr.get('discriminator')
+
+ ret = mcgen('''
+struct %(name)s
+{
+ %(name)sKind kind;
+ union {
+ void *data;
+''',
+ name=name)
+
+ for key in typeinfo:
+ ret += mcgen('''
+ %(c_type)s %(c_name)s;
+''',
+ c_type=c_type(typeinfo[key]),
+ c_name=c_fun(key))
+
+ ret += mcgen('''
+ };
+''')
+
+ if base:
+ base_fields = find_struct(base)['data']
+ if discriminator:
+ base_fields = base_fields.copy()
+ del base_fields[discriminator]
+ ret += generate_struct_fields(base_fields)
+ else:
+ assert not discriminator
+
+ ret += mcgen('''
+};
+''')
+ if discriminator == {}:
+ ret += mcgen('''
+extern const int %(name)s_qtypes[];
+''',
+ name=name)
+
+
+ return ret
+
+def generate_type_cleanup_decl(name):
+ ret = mcgen('''
+void qapi_free_%(type)s(%(c_type)s obj);
+''',
+ c_type=c_type(name),type=name)
+ return ret
+
+def generate_type_cleanup(name):
+ ret = mcgen('''
+
+void qapi_free_%(type)s(%(c_type)s obj)
+{
+ QapiDeallocVisitor *md;
+ Visitor *v;
+
+ if (!obj) {
+ return;
+ }
+
+ md = qapi_dealloc_visitor_new();
+ v = qapi_dealloc_get_visitor(md);
+ visit_type_%(type)s(v, &obj, NULL, NULL);
+ qapi_dealloc_visitor_cleanup(md);
+}
+''',
+ c_type=c_type(name),type=name)
+ return ret
+
+
+try:
+ opts, args = getopt.gnu_getopt(sys.argv[1:], "chbp:o:",
+ ["source", "header", "builtins",
+ "prefix=", "output-dir="])
+except getopt.GetoptError, err:
+ print str(err)
+ sys.exit(1)
+
+output_dir = ""
+prefix = ""
+c_file = 'qapi-types.c'
+h_file = 'qapi-types.h'
+
+do_c = False
+do_h = False
+do_builtins = False
+
+for o, a in opts:
+ if o in ("-p", "--prefix"):
+ prefix = a
+ elif o in ("-o", "--output-dir"):
+ output_dir = a + "/"
+ elif o in ("-c", "--source"):
+ do_c = True
+ elif o in ("-h", "--header"):
+ do_h = True
+ elif o in ("-b", "--builtins"):
+ do_builtins = True
+
+if not do_c and not do_h:
+ do_c = True
+ do_h = True
+
+c_file = output_dir + prefix + c_file
+h_file = output_dir + prefix + h_file
+
+try:
+ os.makedirs(output_dir)
+except os.error, e:
+ if e.errno != errno.EEXIST:
+ raise
+
+def maybe_open(really, name, opt):
+ if really:
+ return open(name, opt)
+ else:
+ import StringIO
+ return StringIO.StringIO()
+
+fdef = maybe_open(do_c, c_file, 'w')
+fdecl = maybe_open(do_h, h_file, 'w')
+
+fdef.write(mcgen('''
+/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * deallocation functions for schema-defined QAPI types
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ * Michael Roth <mdroth@linux.vnet.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include "qapi/dealloc-visitor.h"
+#include "%(prefix)sqapi-types.h"
+#include "%(prefix)sqapi-visit.h"
+
+''', prefix=prefix))
+
+fdecl.write(mcgen('''
+/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QAPI types
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef %(guard)s
+#define %(guard)s
+
+#include <stdbool.h>
+#include <stdint.h>
+
+''',
+ guard=guardname(h_file)))
+
+exprs = parse_schema(sys.stdin)
+exprs = filter(lambda expr: not expr.has_key('gen'), exprs)
+
+fdecl.write(guardstart("QAPI_TYPES_BUILTIN_STRUCT_DECL"))
+for typename in builtin_types:
+ fdecl.write(generate_fwd_struct(typename, None, builtin_type=True))
+fdecl.write(guardend("QAPI_TYPES_BUILTIN_STRUCT_DECL"))
+
+for expr in exprs:
+ ret = "\n"
+ if expr.has_key('type'):
+ ret += generate_fwd_struct(expr['type'], expr['data'])
+ elif expr.has_key('enum'):
+ ret += generate_enum(expr['enum'], expr['data']) + "\n"
+ ret += generate_fwd_enum_struct(expr['enum'], expr['data'])
+ fdef.write(generate_enum_lookup(expr['enum'], expr['data']))
+ elif expr.has_key('union'):
+ ret += generate_fwd_struct(expr['union'], expr['data']) + "\n"
+ ret += generate_enum('%sKind' % expr['union'], expr['data'].keys())
+ fdef.write(generate_enum_lookup('%sKind' % expr['union'], expr['data'].keys()))
+ if expr.get('discriminator') == {}:
+ fdef.write(generate_anon_union_qtypes(expr))
+ else:
+ continue
+ fdecl.write(ret)
+
+# to avoid header dependency hell, we always generate declarations
+# for built-in types in our header files and simply guard them
+fdecl.write(guardstart("QAPI_TYPES_BUILTIN_CLEANUP_DECL"))
+for typename in builtin_types:
+ fdecl.write(generate_type_cleanup_decl(typename + "List"))
+fdecl.write(guardend("QAPI_TYPES_BUILTIN_CLEANUP_DECL"))
+
+# ...this doesn't work for cases where we link in multiple objects that
+# have the functions defined, so we use -b option to provide control
+# over these cases
+if do_builtins:
+ fdef.write(guardstart("QAPI_TYPES_BUILTIN_CLEANUP_DEF"))
+ for typename in builtin_types:
+ fdef.write(generate_type_cleanup(typename + "List"))
+ fdef.write(guardend("QAPI_TYPES_BUILTIN_CLEANUP_DEF"))
+
+for expr in exprs:
+ ret = "\n"
+ if expr.has_key('type'):
+ ret += generate_struct(expr) + "\n"
+ ret += generate_type_cleanup_decl(expr['type'] + "List")
+ fdef.write(generate_type_cleanup(expr['type'] + "List") + "\n")
+ ret += generate_type_cleanup_decl(expr['type'])
+ fdef.write(generate_type_cleanup(expr['type']) + "\n")
+ elif expr.has_key('union'):
+ ret += generate_union(expr)
+ ret += generate_type_cleanup_decl(expr['union'] + "List")
+ fdef.write(generate_type_cleanup(expr['union'] + "List") + "\n")
+ ret += generate_type_cleanup_decl(expr['union'])
+ fdef.write(generate_type_cleanup(expr['union']) + "\n")
+ elif expr.has_key('enum'):
+ ret += generate_type_cleanup_decl(expr['enum'] + "List")
+ fdef.write(generate_type_cleanup(expr['enum'] + "List") + "\n")
+ else:
+ continue
+ fdecl.write(ret)
+
+fdecl.write('''
+#endif
+''')
+
+fdecl.flush()
+fdecl.close()
+
+fdef.flush()
+fdef.close()
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
new file mode 100644
index 0000000..65f1a54
--- /dev/null
+++ b/scripts/qapi-visit.py
@@ -0,0 +1,535 @@
+#
+# QAPI visitor generator
+#
+# Copyright IBM, Corp. 2011
+#
+# Authors:
+# Anthony Liguori <aliguori@us.ibm.com>
+# Michael Roth <mdroth@linux.vnet.ibm.com>
+#
+# This work is licensed under the terms of the GNU GPLv2.
+# See the COPYING.LIB file in the top-level directory.
+
+from ordereddict import OrderedDict
+from qapi import *
+import sys
+import os
+import getopt
+import errno
+
+def generate_visit_struct_fields(name, field_prefix, fn_prefix, members, base = None):
+ substructs = []
+ ret = ''
+ if not fn_prefix:
+ full_name = name
+ else:
+ full_name = "%s_%s" % (name, fn_prefix)
+
+ for argname, argentry, optional, structured in parse_args(members):
+ if structured:
+ if not fn_prefix:
+ nested_fn_prefix = argname
+ else:
+ nested_fn_prefix = "%s_%s" % (fn_prefix, argname)
+
+ nested_field_prefix = "%s%s." % (field_prefix, argname)
+ ret += generate_visit_struct_fields(name, nested_field_prefix,
+ nested_fn_prefix, argentry)
+
+ ret += mcgen('''
+
+static void visit_type_%(full_name)s_fields(Visitor *m, %(name)s ** obj, Error **errp)
+{
+ Error *err = NULL;
+''',
+ name=name, full_name=full_name)
+ push_indent()
+
+ if base:
+ ret += mcgen('''
+visit_start_implicit_struct(m, obj ? (void**) &(*obj)->%(c_name)s : NULL, sizeof(%(type)s), &err);
+if (!err) {
+ visit_type_%(type)s_fields(m, obj ? &(*obj)->%(c_prefix)s%(c_name)s : NULL, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+}
+''',
+ c_prefix=c_var(field_prefix),
+ type=type_name(base), c_name=c_var('base'))
+
+ for argname, argentry, optional, structured in parse_args(members):
+ if optional:
+ ret += mcgen('''
+visit_start_optional(m, obj ? &(*obj)->%(c_prefix)shas_%(c_name)s : NULL, "%(name)s", &err);
+if (obj && (*obj)->%(prefix)shas_%(c_name)s) {
+''',
+ c_prefix=c_var(field_prefix), prefix=field_prefix,
+ c_name=c_var(argname), name=argname)
+ push_indent()
+
+ if structured:
+ ret += generate_visit_struct_body(full_name, argname, argentry)
+ else:
+ ret += mcgen('''
+visit_type_%(type)s(m, obj ? &(*obj)->%(c_prefix)s%(c_name)s : NULL, "%(name)s", &err);
+''',
+ c_prefix=c_var(field_prefix), prefix=field_prefix,
+ type=type_name(argentry), c_name=c_var(argname),
+ name=argname)
+
+ if optional:
+ pop_indent()
+ ret += mcgen('''
+}
+visit_end_optional(m, &err);
+''')
+
+ pop_indent()
+ ret += mcgen('''
+
+ error_propagate(errp, err);
+}
+''')
+ return ret
+
+
+def generate_visit_struct_body(field_prefix, name, members):
+ ret = mcgen('''
+if (!error_is_set(errp)) {
+''')
+ push_indent()
+
+ if not field_prefix:
+ full_name = name
+ else:
+ full_name = "%s_%s" % (field_prefix, name)
+
+ if len(field_prefix):
+ ret += mcgen('''
+Error **errp = &err; /* from outer scope */
+Error *err = NULL;
+visit_start_struct(m, NULL, "", "%(name)s", 0, &err);
+''',
+ name=name)
+ else:
+ ret += mcgen('''
+Error *err = NULL;
+visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), &err);
+''',
+ name=name)
+
+ ret += mcgen('''
+if (!err) {
+ if (!obj || *obj) {
+ visit_type_%(name)s_fields(m, obj, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ }
+''',
+ name=full_name)
+
+ pop_indent()
+ ret += mcgen('''
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+}
+''')
+ return ret
+
+def generate_visit_struct(expr):
+
+ name = expr['type']
+ members = expr['data']
+ base = expr.get('base')
+
+ ret = generate_visit_struct_fields(name, "", "", members, base)
+
+ ret += mcgen('''
+
+void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **errp)
+{
+''',
+ name=name)
+
+ push_indent()
+ ret += generate_visit_struct_body("", name, members)
+ pop_indent()
+
+ ret += mcgen('''
+}
+''')
+ return ret
+
+def generate_visit_list(name, members):
+ return mcgen('''
+
+void visit_type_%(name)sList(Visitor *m, %(name)sList ** obj, const char *name, Error **errp)
+{
+ GenericList *i, **prev = (GenericList **)obj;
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_list(m, name, &err);
+ if (!err) {
+ for (; (i = visit_next_list(m, prev, &err)) != NULL; prev = &i) {
+ %(name)sList *native_i = (%(name)sList *)i;
+ visit_type_%(name)s(m, &native_i->value, NULL, &err);
+ }
+ error_propagate(errp, err);
+ err = NULL;
+
+ /* Always call end_list if start_list succeeded. */
+ visit_end_list(m, &err);
+ }
+ error_propagate(errp, err);
+ }
+}
+''',
+ name=name)
+
+def generate_visit_enum(name, members):
+ return mcgen('''
+
+void visit_type_%(name)s(Visitor *m, %(name)s * obj, const char *name, Error **errp)
+{
+ visit_type_enum(m, (int *)obj, %(name)s_lookup, "%(name)s", name, errp);
+}
+''',
+ name=name)
+
+def generate_visit_anon_union(name, members):
+ ret = mcgen('''
+
+void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_implicit_struct(m, (void**) obj, sizeof(%(name)s), &err);
+ visit_get_next_type(m, (int*) &(*obj)->kind, %(name)s_qtypes, name, &err);
+ switch ((*obj)->kind) {
+''',
+ name=name)
+
+ for key in members:
+ assert (members[key] in builtin_types
+ or find_struct(members[key])
+ or find_union(members[key])), "Invalid anonymous union member"
+
+ ret += mcgen('''
+ case %(abbrev)s_KIND_%(enum)s:
+ visit_type_%(c_type)s(m, &(*obj)->%(c_name)s, name, &err);
+ break;
+''',
+ abbrev = de_camel_case(name).upper(),
+ enum = c_fun(de_camel_case(key),False).upper(),
+ c_type = type_name(members[key]),
+ c_name = c_fun(key))
+
+ ret += mcgen('''
+ default:
+ abort();
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }
+}
+''')
+
+ return ret
+
+
+def generate_visit_union(expr):
+
+ name = expr['union']
+ members = expr['data']
+
+ base = expr.get('base')
+ discriminator = expr.get('discriminator')
+
+ if discriminator == {}:
+ assert not base
+ return generate_visit_anon_union(name, members)
+
+ ret = generate_visit_enum('%sKind' % name, members.keys())
+
+ if base:
+ base_fields = find_struct(base)['data']
+ if discriminator:
+ base_fields = base_fields.copy()
+ del base_fields[discriminator]
+ ret += generate_visit_struct_fields(name, "", "", base_fields)
+
+ ret += mcgen('''
+
+void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **errp)
+{
+ Error *err = NULL;
+
+ if (!error_is_set(errp)) {
+ visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), &err);
+ if (!err) {
+ if (obj && *obj) {
+''',
+ name=name)
+
+
+ push_indent()
+ push_indent()
+ push_indent()
+
+ if base:
+ ret += mcgen('''
+ visit_type_%(name)s_fields(m, obj, &err);
+''',
+ name=name)
+
+ pop_indent()
+
+ if not discriminator:
+ desc_type = "type"
+ else:
+ desc_type = discriminator
+ ret += mcgen('''
+ visit_type_%(name)sKind(m, &(*obj)->kind, "%(type)s", &err);
+ if (!err) {
+ switch ((*obj)->kind) {
+''',
+ name=name, type=desc_type)
+
+ for key in members:
+ if not discriminator:
+ fmt = 'visit_type_%(c_type)s(m, &(*obj)->%(c_name)s, "data", &err);'
+ else:
+ fmt = '''visit_start_implicit_struct(m, (void**) &(*obj)->%(c_name)s, sizeof(%(c_type)s), &err);
+ if (!err) {
+ visit_type_%(c_type)s_fields(m, &(*obj)->%(c_name)s, &err);
+ error_propagate(errp, err);
+ err = NULL;
+ visit_end_implicit_struct(m, &err);
+ }'''
+
+ ret += mcgen('''
+ case %(abbrev)s_KIND_%(enum)s:
+ ''' + fmt + '''
+ break;
+''',
+ abbrev = de_camel_case(name).upper(),
+ enum = c_fun(de_camel_case(key),False).upper(),
+ c_type=type_name(members[key]),
+ c_name=c_fun(key))
+
+ ret += mcgen('''
+ default:
+ abort();
+ }
+ }
+ error_propagate(errp, err);
+ err = NULL;
+ }
+''')
+ pop_indent()
+ ret += mcgen('''
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+}
+''')
+
+ pop_indent();
+ ret += mcgen('''
+}
+''')
+
+ return ret
+
+def generate_declaration(name, members, genlist=True, builtin_type=False):
+ ret = ""
+ if not builtin_type:
+ ret += mcgen('''
+
+void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **errp);
+''',
+ name=name)
+
+ if genlist:
+ ret += mcgen('''
+void visit_type_%(name)sList(Visitor *m, %(name)sList ** obj, const char *name, Error **errp);
+''',
+ name=name)
+
+ return ret
+
+def generate_enum_declaration(name, members, genlist=True):
+ ret = ""
+ if genlist:
+ ret += mcgen('''
+void visit_type_%(name)sList(Visitor *m, %(name)sList ** obj, const char *name, Error **errp);
+''',
+ name=name)
+
+ return ret
+
+def generate_decl_enum(name, members, genlist=True):
+ return mcgen('''
+
+void visit_type_%(name)s(Visitor *m, %(name)s * obj, const char *name, Error **errp);
+''',
+ name=name)
+
+try:
+ opts, args = getopt.gnu_getopt(sys.argv[1:], "chbp:o:",
+ ["source", "header", "builtins", "prefix=",
+ "output-dir="])
+except getopt.GetoptError, err:
+ print str(err)
+ sys.exit(1)
+
+output_dir = ""
+prefix = ""
+c_file = 'qapi-visit.c'
+h_file = 'qapi-visit.h'
+
+do_c = False
+do_h = False
+do_builtins = False
+
+for o, a in opts:
+ if o in ("-p", "--prefix"):
+ prefix = a
+ elif o in ("-o", "--output-dir"):
+ output_dir = a + "/"
+ elif o in ("-c", "--source"):
+ do_c = True
+ elif o in ("-h", "--header"):
+ do_h = True
+ elif o in ("-b", "--builtins"):
+ do_builtins = True
+
+if not do_c and not do_h:
+ do_c = True
+ do_h = True
+
+c_file = output_dir + prefix + c_file
+h_file = output_dir + prefix + h_file
+
+try:
+ os.makedirs(output_dir)
+except os.error, e:
+ if e.errno != errno.EEXIST:
+ raise
+
+def maybe_open(really, name, opt):
+ if really:
+ return open(name, opt)
+ else:
+ import StringIO
+ return StringIO.StringIO()
+
+fdef = maybe_open(do_c, c_file, 'w')
+fdecl = maybe_open(do_h, h_file, 'w')
+
+fdef.write(mcgen('''
+/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QAPI visitor functions
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#include "qemu-common.h"
+#include "%(header)s"
+''',
+ header=basename(h_file)))
+
+fdecl.write(mcgen('''
+/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
+
+/*
+ * schema-defined QAPI visitor function
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING.LIB file in the top-level directory.
+ *
+ */
+
+#ifndef %(guard)s
+#define %(guard)s
+
+#include "qapi/visitor.h"
+#include "%(prefix)sqapi-types.h"
+
+''',
+ prefix=prefix, guard=guardname(h_file)))
+
+exprs = parse_schema(sys.stdin)
+
+# to avoid header dependency hell, we always generate declarations
+# for built-in types in our header files and simply guard them
+fdecl.write(guardstart("QAPI_VISIT_BUILTIN_VISITOR_DECL"))
+for typename in builtin_types:
+ fdecl.write(generate_declaration(typename, None, genlist=True,
+ builtin_type=True))
+fdecl.write(guardend("QAPI_VISIT_BUILTIN_VISITOR_DECL"))
+
+# ...this doesn't work for cases where we link in multiple objects that
+# have the functions defined, so we use -b option to provide control
+# over these cases
+if do_builtins:
+ fdef.write(guardstart("QAPI_VISIT_BUILTIN_VISITOR_DEF"))
+ for typename in builtin_types:
+ fdef.write(generate_visit_list(typename, None))
+ fdef.write(guardend("QAPI_VISIT_BUILTIN_VISITOR_DEF"))
+
+for expr in exprs:
+ if expr.has_key('type'):
+ ret = generate_visit_struct(expr)
+ ret += generate_visit_list(expr['type'], expr['data'])
+ fdef.write(ret)
+
+ ret = generate_declaration(expr['type'], expr['data'])
+ fdecl.write(ret)
+ elif expr.has_key('union'):
+ ret = generate_visit_union(expr)
+ ret += generate_visit_list(expr['union'], expr['data'])
+ fdef.write(ret)
+
+ ret = generate_decl_enum('%sKind' % expr['union'], expr['data'].keys())
+ ret += generate_declaration(expr['union'], expr['data'])
+ fdecl.write(ret)
+ elif expr.has_key('enum'):
+ ret = generate_visit_list(expr['enum'], expr['data'])
+ ret += generate_visit_enum(expr['enum'], expr['data'])
+ fdef.write(ret)
+
+ ret = generate_decl_enum(expr['enum'], expr['data'])
+ ret += generate_enum_declaration(expr['enum'], expr['data'])
+ fdecl.write(ret)
+
+fdecl.write('''
+#endif
+''')
+
+fdecl.flush()
+fdecl.close()
+
+fdef.flush()
+fdef.close()
diff --git a/scripts/qapi.py b/scripts/qapi.py
new file mode 100644
index 0000000..750e9fb
--- /dev/null
+++ b/scripts/qapi.py
@@ -0,0 +1,375 @@
+#
+# QAPI helper library
+#
+# Copyright IBM, Corp. 2011
+# Copyright (c) 2013 Red Hat Inc.
+#
+# Authors:
+# Anthony Liguori <aliguori@us.ibm.com>
+# Markus Armbruster <armbru@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPLv2.
+# See the COPYING.LIB file in the top-level directory.
+
+from ordereddict import OrderedDict
+import sys
+
+builtin_types = [
+ 'str', 'int', 'number', 'bool',
+ 'int8', 'int16', 'int32', 'int64',
+ 'uint8', 'uint16', 'uint32', 'uint64'
+]
+
+builtin_type_qtypes = {
+ 'str': 'QTYPE_QSTRING',
+ 'int': 'QTYPE_QINT',
+ 'number': 'QTYPE_QFLOAT',
+ 'bool': 'QTYPE_QBOOL',
+ 'int8': 'QTYPE_QINT',
+ 'int16': 'QTYPE_QINT',
+ 'int32': 'QTYPE_QINT',
+ 'int64': 'QTYPE_QINT',
+ 'uint8': 'QTYPE_QINT',
+ 'uint16': 'QTYPE_QINT',
+ 'uint32': 'QTYPE_QINT',
+ 'uint64': 'QTYPE_QINT',
+}
+
+class QAPISchemaError(Exception):
+ def __init__(self, schema, msg):
+ self.fp = schema.fp
+ self.msg = msg
+ self.line = self.col = 1
+ for ch in schema.src[0:schema.pos]:
+ if ch == '\n':
+ self.line += 1
+ self.col = 1
+ elif ch == '\t':
+ self.col = (self.col + 7) % 8 + 1
+ else:
+ self.col += 1
+
+ def __str__(self):
+ return "%s:%s:%s: %s" % (self.fp.name, self.line, self.col, self.msg)
+
+class QAPISchema:
+
+ def __init__(self, fp):
+ self.fp = fp
+ self.src = fp.read()
+ if self.src == '' or self.src[-1] != '\n':
+ self.src += '\n'
+ self.cursor = 0
+ self.exprs = []
+ self.accept()
+
+ while self.tok != None:
+ self.exprs.append(self.get_expr(False))
+
+ def accept(self):
+ while True:
+ self.tok = self.src[self.cursor]
+ self.pos = self.cursor
+ self.cursor += 1
+ self.val = None
+
+ if self.tok == '#':
+ self.cursor = self.src.find('\n', self.cursor)
+ elif self.tok in ['{', '}', ':', ',', '[', ']']:
+ return
+ elif self.tok == "'":
+ string = ''
+ esc = False
+ while True:
+ ch = self.src[self.cursor]
+ self.cursor += 1
+ if ch == '\n':
+ raise QAPISchemaError(self,
+ 'Missing terminating "\'"')
+ if esc:
+ string += ch
+ esc = False
+ elif ch == "\\":
+ esc = True
+ elif ch == "'":
+ self.val = string
+ return
+ else:
+ string += ch
+ elif self.tok == '\n':
+ if self.cursor == len(self.src):
+ self.tok = None
+ return
+ elif not self.tok.isspace():
+ raise QAPISchemaError(self, 'Stray "%s"' % self.tok)
+
+ def get_members(self):
+ expr = OrderedDict()
+ if self.tok == '}':
+ self.accept()
+ return expr
+ if self.tok != "'":
+ raise QAPISchemaError(self, 'Expected string or "}"')
+ while True:
+ key = self.val
+ self.accept()
+ if self.tok != ':':
+ raise QAPISchemaError(self, 'Expected ":"')
+ self.accept()
+ expr[key] = self.get_expr(True)
+ if self.tok == '}':
+ self.accept()
+ return expr
+ if self.tok != ',':
+ raise QAPISchemaError(self, 'Expected "," or "}"')
+ self.accept()
+ if self.tok != "'":
+ raise QAPISchemaError(self, 'Expected string')
+
+ def get_values(self):
+ expr = []
+ if self.tok == ']':
+ self.accept()
+ return expr
+ if not self.tok in [ '{', '[', "'" ]:
+ raise QAPISchemaError(self, 'Expected "{", "[", "]" or string')
+ while True:
+ expr.append(self.get_expr(True))
+ if self.tok == ']':
+ self.accept()
+ return expr
+ if self.tok != ',':
+ raise QAPISchemaError(self, 'Expected "," or "]"')
+ self.accept()
+
+ def get_expr(self, nested):
+ if self.tok != '{' and not nested:
+ raise QAPISchemaError(self, 'Expected "{"')
+ if self.tok == '{':
+ self.accept()
+ expr = self.get_members()
+ elif self.tok == '[':
+ self.accept()
+ expr = self.get_values()
+ elif self.tok == "'":
+ expr = self.val
+ self.accept()
+ else:
+ raise QAPISchemaError(self, 'Expected "{", "[" or string')
+ return expr
+
+def parse_schema(fp):
+ try:
+ schema = QAPISchema(fp)
+ except QAPISchemaError, e:
+ print >>sys.stderr, e
+ exit(1)
+
+ exprs = []
+
+ for expr in schema.exprs:
+ if expr.has_key('enum'):
+ add_enum(expr['enum'])
+ elif expr.has_key('union'):
+ add_union(expr)
+ add_enum('%sKind' % expr['union'])
+ elif expr.has_key('type'):
+ add_struct(expr)
+ exprs.append(expr)
+
+ return exprs
+
+def parse_args(typeinfo):
+ if isinstance(typeinfo, basestring):
+ struct = find_struct(typeinfo)
+ assert struct != None
+ typeinfo = struct['data']
+
+ for member in typeinfo:
+ argname = member
+ argentry = typeinfo[member]
+ optional = False
+ structured = False
+ if member.startswith('*'):
+ argname = member[1:]
+ optional = True
+ if isinstance(argentry, OrderedDict):
+ structured = True
+ yield (argname, argentry, optional, structured)
+
+def de_camel_case(name):
+ new_name = ''
+ for ch in name:
+ if ch.isupper() and new_name:
+ new_name += '_'
+ if ch == '-':
+ new_name += '_'
+ else:
+ new_name += ch.lower()
+ return new_name
+
+def camel_case(name):
+ new_name = ''
+ first = True
+ for ch in name:
+ if ch in ['_', '-']:
+ first = True
+ elif first:
+ new_name += ch.upper()
+ first = False
+ else:
+ new_name += ch.lower()
+ return new_name
+
+def c_var(name, protect=True):
+ # ANSI X3J11/88-090, 3.1.1
+ c89_words = set(['auto', 'break', 'case', 'char', 'const', 'continue',
+ 'default', 'do', 'double', 'else', 'enum', 'extern', 'float',
+ 'for', 'goto', 'if', 'int', 'long', 'register', 'return',
+ 'short', 'signed', 'sizeof', 'static', 'struct', 'switch',
+ 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while'])
+ # ISO/IEC 9899:1999, 6.4.1
+ c99_words = set(['inline', 'restrict', '_Bool', '_Complex', '_Imaginary'])
+ # ISO/IEC 9899:2011, 6.4.1
+ c11_words = set(['_Alignas', '_Alignof', '_Atomic', '_Generic', '_Noreturn',
+ '_Static_assert', '_Thread_local'])
+ # GCC http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/C-Extensions.html
+ # excluding _.*
+ gcc_words = set(['asm', 'typeof'])
+ # C++ ISO/IEC 14882:2003 2.11
+ cpp_words = set(['bool', 'catch', 'class', 'const_cast', 'delete',
+ 'dynamic_cast', 'explicit', 'false', 'friend', 'mutable',
+ 'namespace', 'new', 'operator', 'private', 'protected',
+ 'public', 'reinterpret_cast', 'static_cast', 'template',
+ 'this', 'throw', 'true', 'try', 'typeid', 'typename',
+ 'using', 'virtual', 'wchar_t',
+ # alternative representations
+ 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
+ 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq'])
+ # namespace pollution:
+ polluted_words = set(['unix'])
+ if protect and (name in c89_words | c99_words | c11_words | gcc_words | cpp_words | polluted_words):
+ return "q_" + name
+ return name.replace('-', '_').lstrip("*")
+
+def c_fun(name, protect=True):
+ return c_var(name, protect).replace('.', '_')
+
+def c_list_type(name):
+ return '%sList' % name
+
+def type_name(name):
+ if type(name) == list:
+ return c_list_type(name[0])
+ return name
+
+enum_types = []
+struct_types = []
+union_types = []
+
+def add_struct(definition):
+ global struct_types
+ struct_types.append(definition)
+
+def find_struct(name):
+ global struct_types
+ for struct in struct_types:
+ if struct['type'] == name:
+ return struct
+ return None
+
+def add_union(definition):
+ global union_types
+ union_types.append(definition)
+
+def find_union(name):
+ global union_types
+ for union in union_types:
+ if union['union'] == name:
+ return union
+ return None
+
+def add_enum(name):
+ global enum_types
+ enum_types.append(name)
+
+def is_enum(name):
+ global enum_types
+ return (name in enum_types)
+
+def c_type(name):
+ if name == 'str':
+ return 'char *'
+ elif name == 'int':
+ return 'int64_t'
+ elif (name == 'int8' or name == 'int16' or name == 'int32' or
+ name == 'int64' or name == 'uint8' or name == 'uint16' or
+ name == 'uint32' or name == 'uint64'):
+ return name + '_t'
+ elif name == 'size':
+ return 'uint64_t'
+ elif name == 'bool':
+ return 'bool'
+ elif name == 'number':
+ return 'double'
+ elif type(name) == list:
+ return '%s *' % c_list_type(name[0])
+ elif is_enum(name):
+ return name
+ elif name == None or len(name) == 0:
+ return 'void'
+ elif name == name.upper():
+ return '%sEvent *' % camel_case(name)
+ else:
+ return '%s *' % name
+
+def genindent(count):
+ ret = ""
+ for i in range(count):
+ ret += " "
+ return ret
+
+indent_level = 0
+
+def push_indent(indent_amount=4):
+ global indent_level
+ indent_level += indent_amount
+
+def pop_indent(indent_amount=4):
+ global indent_level
+ indent_level -= indent_amount
+
+def cgen(code, **kwds):
+ indent = genindent(indent_level)
+ lines = code.split('\n')
+ lines = map(lambda x: indent + x, lines)
+ return '\n'.join(lines) % kwds + '\n'
+
+def mcgen(code, **kwds):
+ return cgen('\n'.join(code.split('\n')[1:-1]), **kwds)
+
+def basename(filename):
+ return filename.split("/")[-1]
+
+def guardname(filename):
+ guard = basename(filename).rsplit(".", 1)[0]
+ for substr in [".", " ", "-"]:
+ guard = guard.replace(substr, "_")
+ return guard.upper() + '_H'
+
+def guardstart(name):
+ return mcgen('''
+
+#ifndef %(name)s
+#define %(name)s
+
+''',
+ name=guardname(name))
+
+def guardend(name):
+ return mcgen('''
+
+#endif /* %(name)s */
+
+''',
+ name=guardname(name))
diff --git a/scripts/qapi.pyc b/scripts/qapi.pyc
new file mode 100644
index 0000000..9c6f775
--- /dev/null
+++ b/scripts/qapi.pyc
Binary files differ
diff --git a/util/error.c b/util/error.c
new file mode 100644
index 0000000..3ee362a
--- /dev/null
+++ b/util/error.c
@@ -0,0 +1,161 @@
+/*
+ * QEMU Error Objects
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2. See
+ * the COPYING.LIB file in the top-level directory.
+ */
+
+#include "qemu-common.h"
+#include "qapi/error.h"
+#include "qapi/qmp/qjson.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi-types.h"
+#include "qapi/qmp/qerror.h"
+
+struct Error
+{
+ char *msg;
+ ErrorClass err_class;
+};
+
+void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...)
+{
+ Error *err;
+ va_list ap;
+ int saved_errno = errno;
+
+ if (errp == NULL) {
+ return;
+ }
+ assert(*errp == NULL);
+
+ err = g_malloc0(sizeof(*err));
+
+ va_start(ap, fmt);
+ err->msg = g_strdup_vprintf(fmt, ap);
+ va_end(ap);
+ err->err_class = err_class;
+
+ *errp = err;
+
+ errno = saved_errno;
+}
+
+void error_set_errno(Error **errp, int os_errno, ErrorClass err_class,
+ const char *fmt, ...)
+{
+ Error *err;
+ char *msg1;
+ va_list ap;
+ int saved_errno = errno;
+
+ if (errp == NULL) {
+ return;
+ }
+ assert(*errp == NULL);
+
+ err = g_malloc0(sizeof(*err));
+
+ va_start(ap, fmt);
+ msg1 = g_strdup_vprintf(fmt, ap);
+ if (os_errno != 0) {
+ err->msg = g_strdup_printf("%s: %s", msg1, strerror(os_errno));
+ g_free(msg1);
+ } else {
+ err->msg = msg1;
+ }
+ va_end(ap);
+ err->err_class = err_class;
+
+ *errp = err;
+
+ errno = saved_errno;
+}
+
+void error_setg_file_open(Error **errp, int os_errno, const char *filename)
+{
+ error_setg_errno(errp, os_errno, "Could not open '%s'", filename);
+}
+
+#ifdef _WIN32
+
+void error_set_win32(Error **errp, int win32_err, ErrorClass err_class,
+ const char *fmt, ...)
+{
+ Error *err;
+ char *msg1;
+ va_list ap;
+
+ if (errp == NULL) {
+ return;
+ }
+ assert(*errp == NULL);
+
+ err = g_malloc0(sizeof(*err));
+
+ va_start(ap, fmt);
+ msg1 = g_strdup_vprintf(fmt, ap);
+ if (win32_err != 0) {
+ char *msg2 = g_win32_error_message(win32_err);
+ err->msg = g_strdup_printf("%s: %s (error: %x)", msg1, msg2,
+ (unsigned)win32_err);
+ g_free(msg2);
+ g_free(msg1);
+ } else {
+ err->msg = msg1;
+ }
+ va_end(ap);
+ err->err_class = err_class;
+
+ *errp = err;
+}
+
+#endif
+
+Error *error_copy(const Error *err)
+{
+ Error *err_new;
+
+ err_new = g_malloc0(sizeof(*err));
+ err_new->msg = g_strdup(err->msg);
+ err_new->err_class = err->err_class;
+
+ return err_new;
+}
+
+bool error_is_set(Error **errp)
+{
+ return (errp && *errp);
+}
+
+ErrorClass error_get_class(const Error *err)
+{
+ return err->err_class;
+}
+
+const char *error_get_pretty(Error *err)
+{
+ return err->msg;
+}
+
+void error_free(Error *err)
+{
+ if (err) {
+ g_free(err->msg);
+ g_free(err);
+ }
+}
+
+void error_propagate(Error **dst_err, Error *local_err)
+{
+ if (dst_err && !*dst_err) {
+ *dst_err = local_err;
+ } else if (local_err) {
+ error_free(local_err);
+ }
+}
diff --git a/util/unicode.c b/util/unicode.c
new file mode 100644
index 0000000..d1c8658
--- /dev/null
+++ b/util/unicode.c
@@ -0,0 +1,100 @@
+/*
+ * Dealing with Unicode
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * Authors:
+ * Markus Armbruster <armbru@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later. See the COPYING file in the top-level directory.
+ */
+
+#include "qemu-common.h"
+
+/**
+ * mod_utf8_codepoint:
+ * @s: string encoded in modified UTF-8
+ * @n: maximum number of bytes to read from @s, if less than 6
+ * @end: set to end of sequence on return
+ *
+ * Convert the modified UTF-8 sequence at the start of @s. Modified
+ * UTF-8 is exactly like UTF-8, except U+0000 is encoded as
+ * "\xC0\x80".
+ *
+ * If @n is zero or @s points to a zero byte, the sequence is invalid,
+ * and @end is set to @s.
+ *
+ * If @s points to an impossible byte (0xFE or 0xFF) or a continuation
+ * byte, the sequence is invalid, and @end is set to @s + 1
+ *
+ * Else, the first byte determines how many continuation bytes are
+ * expected. If there are fewer, the sequence is invalid, and @end is
+ * set to @s + 1 + actual number of continuation bytes. Else, the
+ * sequence is well-formed, and @end is set to @s + 1 + expected
+ * number of continuation bytes.
+ *
+ * A well-formed sequence is valid unless it encodes a codepoint
+ * outside the Unicode range U+0000..U+10FFFF, one of Unicode's 66
+ * noncharacters, a surrogate codepoint, or is overlong. Except the
+ * overlong sequence "\xC0\x80" is valid.
+ *
+ * Conversion succeeds if and only if the sequence is valid.
+ *
+ * Returns: the Unicode codepoint on success, -1 on failure.
+ */
+int mod_utf8_codepoint(const char *s, size_t n, char **end)
+{
+ static int min_cp[5] = { 0x80, 0x800, 0x10000, 0x200000, 0x4000000 };
+ const unsigned char *p;
+ unsigned byte, mask, len, i;
+ int cp;
+
+ if (n == 0 || *s == 0) {
+ /* empty sequence */
+ *end = (char *)s;
+ return -1;
+ }
+
+ p = (const unsigned char *)s;
+ byte = *p++;
+ if (byte < 0x80) {
+ cp = byte; /* one byte sequence */
+ } else if (byte >= 0xFE) {
+ cp = -1; /* impossible bytes 0xFE, 0xFF */
+ } else if ((byte & 0x40) == 0) {
+ cp = -1; /* unexpected continuation byte */
+ } else {
+ /* multi-byte sequence */
+ len = 0;
+ for (mask = 0x80; byte & mask; mask >>= 1) {
+ len++;
+ }
+ assert(len > 1 && len < 7);
+ cp = byte & (mask - 1);
+ for (i = 1; i < len; i++) {
+ byte = i < n ? *p : 0;
+ if ((byte & 0xC0) != 0x80) {
+ cp = -1; /* continuation byte missing */
+ goto out;
+ }
+ p++;
+ cp <<= 6;
+ cp |= byte & 0x3F;
+ }
+ if (cp > 0x10FFFF) {
+ cp = -1; /* beyond Unicode range */
+ } else if ((cp >= 0xFDD0 && cp <= 0xFDEF)
+ || (cp & 0xFFFE) == 0xFFFE) {
+ cp = -1; /* noncharacter */
+ } else if (cp >= 0xD800 && cp <= 0xDFFF) {
+ cp = -1; /* surrogate code point */
+ } else if (cp < min_cp[len - 2] && !(cp == 0 && len == 2)) {
+ cp = -1; /* overlong, not \xC0\x80 */
+ }
+ }
+
+out:
+ *end = (char *)p;
+ return cp;
+}