hw/misc/iotkit-sysctl: Handle CPU_WAIT, NMI_ENABLE for SSE-300
[qemu/ar7.git] / include / qapi / clone-visitor.h
blobadf9a788e2320755f430f3981ff46728aed5d210
1 /*
2 * Clone Visitor
4 * Copyright (C) 2016 Red Hat, Inc.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
9 */
11 #ifndef QAPI_CLONE_VISITOR_H
12 #define QAPI_CLONE_VISITOR_H
14 #include "qapi/visitor.h"
17 * The clone visitor is for direct use only by the QAPI_CLONE() macro;
18 * it requires that the root visit occur on an object, list, or
19 * alternate, and is not usable directly on built-in QAPI types.
21 typedef struct QapiCloneVisitor QapiCloneVisitor;
23 void *qapi_clone(const void *src, bool (*visit_type)(Visitor *, const char *,
24 void **, Error **));
25 void qapi_clone_members(void *dst, const void *src, size_t sz,
26 bool (*visit_type_members)(Visitor *, void *,
27 Error **));
30 * Deep-clone QAPI object @src of the given @type, and return the result.
32 * Not usable on QAPI scalars (integers, strings, enums), nor on a
33 * QAPI object that references the 'any' type. Safe when @src is NULL.
35 #define QAPI_CLONE(type, src) \
36 ((type *)qapi_clone(src, \
37 (bool (*)(Visitor *, const char *, void **, \
38 Error **))visit_type_ ## type))
41 * Copy deep clones of @type members from @src to @dst.
43 * Not usable on QAPI scalars (integers, strings, enums), nor on a
44 * QAPI object that references the 'any' type.
46 #define QAPI_CLONE_MEMBERS(type, dst, src) \
47 qapi_clone_members(dst, src, sizeof(type), \
48 (bool (*)(Visitor *, void *, \
49 Error **))visit_type_ ## type ## _members)
51 #endif