Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Core Definitions for QAPI/QMP Command Registry |
| 3 | * |
Eric Blake | 08f9541 | 2016-01-29 06:48:59 -0700 | [diff] [blame] | 4 | * Copyright (C) 2012-2016 Red Hat, Inc. |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 5 | * Copyright IBM, Corp. 2011 |
| 6 | * |
| 7 | * Authors: |
| 8 | * Anthony Liguori <aliguori@us.ibm.com> |
| 9 | * |
| 10 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. |
| 11 | * See the COPYING.LIB file in the top-level directory. |
| 12 | * |
| 13 | */ |
| 14 | |
Peter Maydell | cbf2115 | 2016-01-29 17:49:57 +0000 | [diff] [blame] | 15 | #include "qemu/osdep.h" |
Daniel P. Berrange | b3db211 | 2016-09-30 15:45:27 +0100 | [diff] [blame^] | 16 | #include "qapi/qobject-output-visitor.h" |
Paolo Bonzini | 7b1b5d1 | 2012-12-17 18:19:43 +0100 | [diff] [blame] | 17 | #include "qapi/visitor-impl.h" |
Paolo Bonzini | 1de7afc | 2012-12-17 18:20:00 +0100 | [diff] [blame] | 18 | #include "qemu/queue.h" |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 19 | #include "qemu-common.h" |
Paolo Bonzini | 7b1b5d1 | 2012-12-17 18:19:43 +0100 | [diff] [blame] | 20 | #include "qapi/qmp/types.h" |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 21 | |
| 22 | typedef struct QStackEntry |
| 23 | { |
| 24 | QObject *value; |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 25 | void *qapi; /* sanity check that caller uses same pointer */ |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 26 | QSLIST_ENTRY(QStackEntry) node; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 27 | } QStackEntry; |
| 28 | |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 29 | struct QmpOutputVisitor |
| 30 | { |
| 31 | Visitor visitor; |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 32 | QSLIST_HEAD(, QStackEntry) stack; /* Stack of unfinished containers */ |
Eric Blake | 455ba08 | 2016-01-29 06:49:01 -0700 | [diff] [blame] | 33 | QObject *root; /* Root of the output visit */ |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 34 | QObject **result; /* User's storage location for result */ |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | #define qmp_output_add(qov, name, value) \ |
| 38 | qmp_output_add_obj(qov, name, QOBJECT(value)) |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 39 | #define qmp_output_push(qov, value, qapi) \ |
| 40 | qmp_output_push_obj(qov, QOBJECT(value), qapi) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 41 | |
| 42 | static QmpOutputVisitor *to_qov(Visitor *v) |
| 43 | { |
| 44 | return container_of(v, QmpOutputVisitor, visitor); |
| 45 | } |
| 46 | |
Eric Blake | a861564 | 2016-01-29 06:49:00 -0700 | [diff] [blame] | 47 | /* Push @value onto the stack of current QObjects being built */ |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 48 | static void qmp_output_push_obj(QmpOutputVisitor *qov, QObject *value, |
| 49 | void *qapi) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 50 | { |
Anthony Liguori | 7267c09 | 2011-08-20 22:09:37 -0500 | [diff] [blame] | 51 | QStackEntry *e = g_malloc0(sizeof(*e)); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 52 | |
Eric Blake | 455ba08 | 2016-01-29 06:49:01 -0700 | [diff] [blame] | 53 | assert(qov->root); |
Eric Blake | a861564 | 2016-01-29 06:49:00 -0700 | [diff] [blame] | 54 | assert(value); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 55 | e->value = value; |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 56 | e->qapi = qapi; |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 57 | QSLIST_INSERT_HEAD(&qov->stack, e, node); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 58 | } |
| 59 | |
Eric Blake | a861564 | 2016-01-29 06:49:00 -0700 | [diff] [blame] | 60 | /* Pop a value off the stack of QObjects being built, and return it. */ |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 61 | static QObject *qmp_output_pop(QmpOutputVisitor *qov, void *qapi) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 62 | { |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 63 | QStackEntry *e = QSLIST_FIRST(&qov->stack); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 64 | QObject *value; |
Eric Blake | a861564 | 2016-01-29 06:49:00 -0700 | [diff] [blame] | 65 | |
| 66 | assert(e); |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 67 | assert(e->qapi == qapi); |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 68 | QSLIST_REMOVE_HEAD(&qov->stack, node); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 69 | value = e->value; |
Eric Blake | a861564 | 2016-01-29 06:49:00 -0700 | [diff] [blame] | 70 | assert(value); |
Anthony Liguori | 7267c09 | 2011-08-20 22:09:37 -0500 | [diff] [blame] | 71 | g_free(e); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 72 | return value; |
| 73 | } |
| 74 | |
Eric Blake | a861564 | 2016-01-29 06:49:00 -0700 | [diff] [blame] | 75 | /* Add @value to the current QObject being built. |
| 76 | * If the stack is visiting a dictionary or list, @value is now owned |
| 77 | * by that container. Otherwise, @value is now the root. */ |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 78 | static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name, |
| 79 | QObject *value) |
| 80 | { |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 81 | QStackEntry *e = QSLIST_FIRST(&qov->stack); |
Eric Blake | 455ba08 | 2016-01-29 06:49:01 -0700 | [diff] [blame] | 82 | QObject *cur = e ? e->value : NULL; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 83 | |
Eric Blake | 455ba08 | 2016-01-29 06:49:01 -0700 | [diff] [blame] | 84 | if (!cur) { |
Eric Blake | 56a6f02 | 2016-04-28 15:45:26 -0600 | [diff] [blame] | 85 | /* Don't allow reuse of visitor on more than one root */ |
| 86 | assert(!qov->root); |
Eric Blake | 455ba08 | 2016-01-29 06:49:01 -0700 | [diff] [blame] | 87 | qov->root = value; |
| 88 | } else { |
| 89 | switch (qobject_type(cur)) { |
| 90 | case QTYPE_QDICT: |
| 91 | assert(name); |
| 92 | qdict_put_obj(qobject_to_qdict(cur), name, value); |
| 93 | break; |
| 94 | case QTYPE_QLIST: |
Eric Blake | 56a6f02 | 2016-04-28 15:45:26 -0600 | [diff] [blame] | 95 | assert(!name); |
Eric Blake | 455ba08 | 2016-01-29 06:49:01 -0700 | [diff] [blame] | 96 | qlist_append_obj(qobject_to_qlist(cur), value); |
| 97 | break; |
| 98 | default: |
| 99 | g_assert_not_reached(); |
| 100 | } |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 101 | } |
| 102 | } |
| 103 | |
Eric Blake | 0b2a0d6 | 2016-01-29 06:48:56 -0700 | [diff] [blame] | 104 | static void qmp_output_start_struct(Visitor *v, const char *name, void **obj, |
Eric Blake | 337283d | 2016-01-29 06:48:57 -0700 | [diff] [blame] | 105 | size_t unused, Error **errp) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 106 | { |
| 107 | QmpOutputVisitor *qov = to_qov(v); |
| 108 | QDict *dict = qdict_new(); |
| 109 | |
| 110 | qmp_output_add(qov, name, dict); |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 111 | qmp_output_push(qov, dict, obj); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 112 | } |
| 113 | |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 114 | static void qmp_output_end_struct(Visitor *v, void **obj) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 115 | { |
| 116 | QmpOutputVisitor *qov = to_qov(v); |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 117 | QObject *value = qmp_output_pop(qov, obj); |
Eric Blake | 56a6f02 | 2016-04-28 15:45:26 -0600 | [diff] [blame] | 118 | assert(qobject_type(value) == QTYPE_QDICT); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 119 | } |
| 120 | |
Eric Blake | d9f62dd | 2016-04-28 15:45:31 -0600 | [diff] [blame] | 121 | static void qmp_output_start_list(Visitor *v, const char *name, |
| 122 | GenericList **listp, size_t size, |
| 123 | Error **errp) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 124 | { |
| 125 | QmpOutputVisitor *qov = to_qov(v); |
| 126 | QList *list = qlist_new(); |
| 127 | |
| 128 | qmp_output_add(qov, name, list); |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 129 | qmp_output_push(qov, list, listp); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 130 | } |
| 131 | |
Eric Blake | d9f62dd | 2016-04-28 15:45:31 -0600 | [diff] [blame] | 132 | static GenericList *qmp_output_next_list(Visitor *v, GenericList *tail, |
Eric Blake | e65d89b | 2016-02-17 23:48:23 -0700 | [diff] [blame] | 133 | size_t size) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 134 | { |
Eric Blake | d9f62dd | 2016-04-28 15:45:31 -0600 | [diff] [blame] | 135 | return tail->next; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 136 | } |
| 137 | |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 138 | static void qmp_output_end_list(Visitor *v, void **obj) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 139 | { |
| 140 | QmpOutputVisitor *qov = to_qov(v); |
Eric Blake | 1158bb2 | 2016-06-09 10:48:34 -0600 | [diff] [blame] | 141 | QObject *value = qmp_output_pop(qov, obj); |
Eric Blake | 56a6f02 | 2016-04-28 15:45:26 -0600 | [diff] [blame] | 142 | assert(qobject_type(value) == QTYPE_QLIST); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 143 | } |
| 144 | |
Eric Blake | 0b2a0d6 | 2016-01-29 06:48:56 -0700 | [diff] [blame] | 145 | static void qmp_output_type_int64(Visitor *v, const char *name, int64_t *obj, |
Eric Blake | 4c40314 | 2016-01-29 06:48:49 -0700 | [diff] [blame] | 146 | Error **errp) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 147 | { |
| 148 | QmpOutputVisitor *qov = to_qov(v); |
| 149 | qmp_output_add(qov, name, qint_from_int(*obj)); |
| 150 | } |
| 151 | |
Eric Blake | 0b2a0d6 | 2016-01-29 06:48:56 -0700 | [diff] [blame] | 152 | static void qmp_output_type_uint64(Visitor *v, const char *name, uint64_t *obj, |
Eric Blake | f755dea | 2016-01-29 06:48:50 -0700 | [diff] [blame] | 153 | Error **errp) |
| 154 | { |
Daniel P. Berrange | b3db211 | 2016-09-30 15:45:27 +0100 | [diff] [blame^] | 155 | /* FIXME values larger than INT64_MAX become negative */ |
Eric Blake | f755dea | 2016-01-29 06:48:50 -0700 | [diff] [blame] | 156 | QmpOutputVisitor *qov = to_qov(v); |
| 157 | qmp_output_add(qov, name, qint_from_int(*obj)); |
| 158 | } |
| 159 | |
Eric Blake | 0b2a0d6 | 2016-01-29 06:48:56 -0700 | [diff] [blame] | 160 | static void qmp_output_type_bool(Visitor *v, const char *name, bool *obj, |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 161 | Error **errp) |
| 162 | { |
| 163 | QmpOutputVisitor *qov = to_qov(v); |
Eric Blake | fc48ffc | 2015-05-15 16:24:59 -0600 | [diff] [blame] | 164 | qmp_output_add(qov, name, qbool_from_bool(*obj)); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 165 | } |
| 166 | |
Eric Blake | 0b2a0d6 | 2016-01-29 06:48:56 -0700 | [diff] [blame] | 167 | static void qmp_output_type_str(Visitor *v, const char *name, char **obj, |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 168 | Error **errp) |
| 169 | { |
| 170 | QmpOutputVisitor *qov = to_qov(v); |
| 171 | if (*obj) { |
| 172 | qmp_output_add(qov, name, qstring_from_str(*obj)); |
| 173 | } else { |
| 174 | qmp_output_add(qov, name, qstring_from_str("")); |
| 175 | } |
| 176 | } |
| 177 | |
Eric Blake | 0b2a0d6 | 2016-01-29 06:48:56 -0700 | [diff] [blame] | 178 | static void qmp_output_type_number(Visitor *v, const char *name, double *obj, |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 179 | Error **errp) |
| 180 | { |
| 181 | QmpOutputVisitor *qov = to_qov(v); |
| 182 | qmp_output_add(qov, name, qfloat_from_double(*obj)); |
| 183 | } |
| 184 | |
Eric Blake | 0b2a0d6 | 2016-01-29 06:48:56 -0700 | [diff] [blame] | 185 | static void qmp_output_type_any(Visitor *v, const char *name, QObject **obj, |
Markus Armbruster | 28770e0 | 2015-09-16 13:06:24 +0200 | [diff] [blame] | 186 | Error **errp) |
| 187 | { |
| 188 | QmpOutputVisitor *qov = to_qov(v); |
| 189 | qobject_incref(*obj); |
| 190 | qmp_output_add_obj(qov, name, *obj); |
| 191 | } |
| 192 | |
Eric Blake | 3bc97fd | 2016-04-28 15:45:22 -0600 | [diff] [blame] | 193 | static void qmp_output_type_null(Visitor *v, const char *name, Error **errp) |
| 194 | { |
Eric Blake | 3df016f | 2016-04-28 15:45:23 -0600 | [diff] [blame] | 195 | QmpOutputVisitor *qov = to_qov(v); |
| 196 | qmp_output_add_obj(qov, name, qnull()); |
Eric Blake | 3bc97fd | 2016-04-28 15:45:22 -0600 | [diff] [blame] | 197 | } |
| 198 | |
Eric Blake | 56a6f02 | 2016-04-28 15:45:26 -0600 | [diff] [blame] | 199 | /* Finish building, and return the root object. |
| 200 | * The root object is never null. The caller becomes the object's |
| 201 | * owner, and should use qobject_decref() when done with it. */ |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 202 | static void qmp_output_complete(Visitor *v, void *opaque) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 203 | { |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 204 | QmpOutputVisitor *qov = to_qov(v); |
| 205 | |
Eric Blake | 56a6f02 | 2016-04-28 15:45:26 -0600 | [diff] [blame] | 206 | /* A visit must have occurred, with each start paired with end. */ |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 207 | assert(qov->root && QSLIST_EMPTY(&qov->stack)); |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 208 | assert(opaque == qov->result); |
Eric Blake | 56a6f02 | 2016-04-28 15:45:26 -0600 | [diff] [blame] | 209 | |
| 210 | qobject_incref(qov->root); |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 211 | *qov->result = qov->root; |
| 212 | qov->result = NULL; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 213 | } |
| 214 | |
Eric Blake | 2c0ef9f | 2016-06-09 10:48:35 -0600 | [diff] [blame] | 215 | static void qmp_output_free(Visitor *v) |
| 216 | { |
| 217 | QmpOutputVisitor *qov = to_qov(v); |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 218 | QStackEntry *e; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 219 | |
Paolo Bonzini | fc76ae8 | 2016-07-07 17:53:17 +0200 | [diff] [blame] | 220 | while (!QSLIST_EMPTY(&qov->stack)) { |
| 221 | e = QSLIST_FIRST(&qov->stack); |
| 222 | QSLIST_REMOVE_HEAD(&qov->stack, node); |
Anthony Liguori | 7267c09 | 2011-08-20 22:09:37 -0500 | [diff] [blame] | 223 | g_free(e); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 224 | } |
| 225 | |
Eric Blake | 1830f22 | 2016-06-09 10:48:40 -0600 | [diff] [blame] | 226 | qobject_decref(qov->root); |
| 227 | g_free(qov); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 228 | } |
| 229 | |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 230 | Visitor *qmp_output_visitor_new(QObject **result) |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 231 | { |
| 232 | QmpOutputVisitor *v; |
| 233 | |
Anthony Liguori | 7267c09 | 2011-08-20 22:09:37 -0500 | [diff] [blame] | 234 | v = g_malloc0(sizeof(*v)); |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 235 | |
Eric Blake | 983f52d | 2016-04-28 15:45:09 -0600 | [diff] [blame] | 236 | v->visitor.type = VISITOR_OUTPUT; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 237 | v->visitor.start_struct = qmp_output_start_struct; |
| 238 | v->visitor.end_struct = qmp_output_end_struct; |
| 239 | v->visitor.start_list = qmp_output_start_list; |
| 240 | v->visitor.next_list = qmp_output_next_list; |
| 241 | v->visitor.end_list = qmp_output_end_list; |
Eric Blake | 4c40314 | 2016-01-29 06:48:49 -0700 | [diff] [blame] | 242 | v->visitor.type_int64 = qmp_output_type_int64; |
Eric Blake | f755dea | 2016-01-29 06:48:50 -0700 | [diff] [blame] | 243 | v->visitor.type_uint64 = qmp_output_type_uint64; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 244 | v->visitor.type_bool = qmp_output_type_bool; |
| 245 | v->visitor.type_str = qmp_output_type_str; |
| 246 | v->visitor.type_number = qmp_output_type_number; |
Markus Armbruster | 28770e0 | 2015-09-16 13:06:24 +0200 | [diff] [blame] | 247 | v->visitor.type_any = qmp_output_type_any; |
Eric Blake | 3bc97fd | 2016-04-28 15:45:22 -0600 | [diff] [blame] | 248 | v->visitor.type_null = qmp_output_type_null; |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 249 | v->visitor.complete = qmp_output_complete; |
Eric Blake | 2c0ef9f | 2016-06-09 10:48:35 -0600 | [diff] [blame] | 250 | v->visitor.free = qmp_output_free; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 251 | |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 252 | *result = NULL; |
| 253 | v->result = result; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 254 | |
Eric Blake | 3b098d5 | 2016-06-09 10:48:43 -0600 | [diff] [blame] | 255 | return &v->visitor; |
Michael Roth | e4e6aa1 | 2011-07-19 14:50:34 -0500 | [diff] [blame] | 256 | } |