1 | /* AUTOMATICALLY GENERATED, DO NOT MODIFY */ |
2 | |
3 | /* |
4 | * Schema-defined QAPI visitors |
5 | * |
6 | * Copyright IBM, Corp. 2011 |
7 | * Copyright (C) 2014-2018 Red Hat, Inc. |
8 | * |
9 | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. |
10 | * See the COPYING.LIB file in the top-level directory. |
11 | */ |
12 | |
13 | #include "qemu/osdep.h" |
14 | #include "qapi/error.h" |
15 | #include "qapi/qmp/qerror.h" |
16 | #include "qapi-visit-run-state.h" |
17 | |
18 | void visit_type_RunState(Visitor *v, const char *name, RunState *obj, Error **errp) |
19 | { |
20 | int value = *obj; |
21 | visit_type_enum(v, name, &value, &RunState_lookup, errp); |
22 | *obj = value; |
23 | } |
24 | |
25 | void visit_type_ShutdownCause(Visitor *v, const char *name, ShutdownCause *obj, Error **errp) |
26 | { |
27 | int value = *obj; |
28 | visit_type_enum(v, name, &value, &ShutdownCause_lookup, errp); |
29 | *obj = value; |
30 | } |
31 | |
32 | void visit_type_StatusInfo_members(Visitor *v, StatusInfo *obj, Error **errp) |
33 | { |
34 | Error *err = NULL; |
35 | |
36 | visit_type_bool(v, "running" , &obj->running, &err); |
37 | if (err) { |
38 | goto out; |
39 | } |
40 | visit_type_bool(v, "singlestep" , &obj->singlestep, &err); |
41 | if (err) { |
42 | goto out; |
43 | } |
44 | visit_type_RunState(v, "status" , &obj->status, &err); |
45 | if (err) { |
46 | goto out; |
47 | } |
48 | |
49 | out: |
50 | error_propagate(errp, err); |
51 | } |
52 | |
53 | void visit_type_StatusInfo(Visitor *v, const char *name, StatusInfo **obj, Error **errp) |
54 | { |
55 | Error *err = NULL; |
56 | |
57 | visit_start_struct(v, name, (void **)obj, sizeof(StatusInfo), &err); |
58 | if (err) { |
59 | goto out; |
60 | } |
61 | if (!*obj) { |
62 | goto out_obj; |
63 | } |
64 | visit_type_StatusInfo_members(v, *obj, &err); |
65 | if (err) { |
66 | goto out_obj; |
67 | } |
68 | visit_check_struct(v, &err); |
69 | out_obj: |
70 | visit_end_struct(v, (void **)obj); |
71 | if (err && visit_is_input(v)) { |
72 | qapi_free_StatusInfo(*obj); |
73 | *obj = NULL; |
74 | } |
75 | out: |
76 | error_propagate(errp, err); |
77 | } |
78 | |
79 | void visit_type_q_obj_SHUTDOWN_arg_members(Visitor *v, q_obj_SHUTDOWN_arg *obj, Error **errp) |
80 | { |
81 | Error *err = NULL; |
82 | |
83 | visit_type_bool(v, "guest" , &obj->guest, &err); |
84 | if (err) { |
85 | goto out; |
86 | } |
87 | visit_type_ShutdownCause(v, "reason" , &obj->reason, &err); |
88 | if (err) { |
89 | goto out; |
90 | } |
91 | |
92 | out: |
93 | error_propagate(errp, err); |
94 | } |
95 | |
96 | void visit_type_q_obj_RESET_arg_members(Visitor *v, q_obj_RESET_arg *obj, Error **errp) |
97 | { |
98 | Error *err = NULL; |
99 | |
100 | visit_type_bool(v, "guest" , &obj->guest, &err); |
101 | if (err) { |
102 | goto out; |
103 | } |
104 | visit_type_ShutdownCause(v, "reason" , &obj->reason, &err); |
105 | if (err) { |
106 | goto out; |
107 | } |
108 | |
109 | out: |
110 | error_propagate(errp, err); |
111 | } |
112 | |
113 | void visit_type_q_obj_WATCHDOG_arg_members(Visitor *v, q_obj_WATCHDOG_arg *obj, Error **errp) |
114 | { |
115 | Error *err = NULL; |
116 | |
117 | visit_type_WatchdogAction(v, "action" , &obj->action, &err); |
118 | if (err) { |
119 | goto out; |
120 | } |
121 | |
122 | out: |
123 | error_propagate(errp, err); |
124 | } |
125 | |
126 | void visit_type_WatchdogAction(Visitor *v, const char *name, WatchdogAction *obj, Error **errp) |
127 | { |
128 | int value = *obj; |
129 | visit_type_enum(v, name, &value, &WatchdogAction_lookup, errp); |
130 | *obj = value; |
131 | } |
132 | |
133 | void visit_type_q_obj_watchdog_set_action_arg_members(Visitor *v, q_obj_watchdog_set_action_arg *obj, Error **errp) |
134 | { |
135 | Error *err = NULL; |
136 | |
137 | visit_type_WatchdogAction(v, "action" , &obj->action, &err); |
138 | if (err) { |
139 | goto out; |
140 | } |
141 | |
142 | out: |
143 | error_propagate(errp, err); |
144 | } |
145 | |
146 | void visit_type_q_obj_GUEST_PANICKED_arg_members(Visitor *v, q_obj_GUEST_PANICKED_arg *obj, Error **errp) |
147 | { |
148 | Error *err = NULL; |
149 | |
150 | visit_type_GuestPanicAction(v, "action" , &obj->action, &err); |
151 | if (err) { |
152 | goto out; |
153 | } |
154 | if (visit_optional(v, "info" , &obj->has_info)) { |
155 | visit_type_GuestPanicInformation(v, "info" , &obj->info, &err); |
156 | if (err) { |
157 | goto out; |
158 | } |
159 | } |
160 | |
161 | out: |
162 | error_propagate(errp, err); |
163 | } |
164 | |
165 | void visit_type_GuestPanicAction(Visitor *v, const char *name, GuestPanicAction *obj, Error **errp) |
166 | { |
167 | int value = *obj; |
168 | visit_type_enum(v, name, &value, &GuestPanicAction_lookup, errp); |
169 | *obj = value; |
170 | } |
171 | |
172 | void visit_type_GuestPanicInformationType(Visitor *v, const char *name, GuestPanicInformationType *obj, Error **errp) |
173 | { |
174 | int value = *obj; |
175 | visit_type_enum(v, name, &value, &GuestPanicInformationType_lookup, errp); |
176 | *obj = value; |
177 | } |
178 | |
179 | void visit_type_q_obj_GuestPanicInformation_base_members(Visitor *v, q_obj_GuestPanicInformation_base *obj, Error **errp) |
180 | { |
181 | Error *err = NULL; |
182 | |
183 | visit_type_GuestPanicInformationType(v, "type" , &obj->type, &err); |
184 | if (err) { |
185 | goto out; |
186 | } |
187 | |
188 | out: |
189 | error_propagate(errp, err); |
190 | } |
191 | |
192 | void visit_type_GuestPanicInformation_members(Visitor *v, GuestPanicInformation *obj, Error **errp) |
193 | { |
194 | Error *err = NULL; |
195 | |
196 | visit_type_q_obj_GuestPanicInformation_base_members(v, (q_obj_GuestPanicInformation_base *)obj, &err); |
197 | if (err) { |
198 | goto out; |
199 | } |
200 | switch (obj->type) { |
201 | case GUEST_PANIC_INFORMATION_TYPE_HYPER_V: |
202 | visit_type_GuestPanicInformationHyperV_members(v, &obj->u.hyper_v, &err); |
203 | break; |
204 | case GUEST_PANIC_INFORMATION_TYPE_S390: |
205 | visit_type_GuestPanicInformationS390_members(v, &obj->u.s390, &err); |
206 | break; |
207 | default: |
208 | abort(); |
209 | } |
210 | |
211 | out: |
212 | error_propagate(errp, err); |
213 | } |
214 | |
215 | void visit_type_GuestPanicInformation(Visitor *v, const char *name, GuestPanicInformation **obj, Error **errp) |
216 | { |
217 | Error *err = NULL; |
218 | |
219 | visit_start_struct(v, name, (void **)obj, sizeof(GuestPanicInformation), &err); |
220 | if (err) { |
221 | goto out; |
222 | } |
223 | if (!*obj) { |
224 | goto out_obj; |
225 | } |
226 | visit_type_GuestPanicInformation_members(v, *obj, &err); |
227 | if (err) { |
228 | goto out_obj; |
229 | } |
230 | visit_check_struct(v, &err); |
231 | out_obj: |
232 | visit_end_struct(v, (void **)obj); |
233 | if (err && visit_is_input(v)) { |
234 | qapi_free_GuestPanicInformation(*obj); |
235 | *obj = NULL; |
236 | } |
237 | out: |
238 | error_propagate(errp, err); |
239 | } |
240 | |
241 | void visit_type_GuestPanicInformationHyperV_members(Visitor *v, GuestPanicInformationHyperV *obj, Error **errp) |
242 | { |
243 | Error *err = NULL; |
244 | |
245 | visit_type_uint64(v, "arg1" , &obj->arg1, &err); |
246 | if (err) { |
247 | goto out; |
248 | } |
249 | visit_type_uint64(v, "arg2" , &obj->arg2, &err); |
250 | if (err) { |
251 | goto out; |
252 | } |
253 | visit_type_uint64(v, "arg3" , &obj->arg3, &err); |
254 | if (err) { |
255 | goto out; |
256 | } |
257 | visit_type_uint64(v, "arg4" , &obj->arg4, &err); |
258 | if (err) { |
259 | goto out; |
260 | } |
261 | visit_type_uint64(v, "arg5" , &obj->arg5, &err); |
262 | if (err) { |
263 | goto out; |
264 | } |
265 | |
266 | out: |
267 | error_propagate(errp, err); |
268 | } |
269 | |
270 | void visit_type_GuestPanicInformationHyperV(Visitor *v, const char *name, GuestPanicInformationHyperV **obj, Error **errp) |
271 | { |
272 | Error *err = NULL; |
273 | |
274 | visit_start_struct(v, name, (void **)obj, sizeof(GuestPanicInformationHyperV), &err); |
275 | if (err) { |
276 | goto out; |
277 | } |
278 | if (!*obj) { |
279 | goto out_obj; |
280 | } |
281 | visit_type_GuestPanicInformationHyperV_members(v, *obj, &err); |
282 | if (err) { |
283 | goto out_obj; |
284 | } |
285 | visit_check_struct(v, &err); |
286 | out_obj: |
287 | visit_end_struct(v, (void **)obj); |
288 | if (err && visit_is_input(v)) { |
289 | qapi_free_GuestPanicInformationHyperV(*obj); |
290 | *obj = NULL; |
291 | } |
292 | out: |
293 | error_propagate(errp, err); |
294 | } |
295 | |
296 | void visit_type_S390CrashReason(Visitor *v, const char *name, S390CrashReason *obj, Error **errp) |
297 | { |
298 | int value = *obj; |
299 | visit_type_enum(v, name, &value, &S390CrashReason_lookup, errp); |
300 | *obj = value; |
301 | } |
302 | |
303 | void visit_type_GuestPanicInformationS390_members(Visitor *v, GuestPanicInformationS390 *obj, Error **errp) |
304 | { |
305 | Error *err = NULL; |
306 | |
307 | visit_type_uint32(v, "core" , &obj->core, &err); |
308 | if (err) { |
309 | goto out; |
310 | } |
311 | visit_type_uint64(v, "psw-mask" , &obj->psw_mask, &err); |
312 | if (err) { |
313 | goto out; |
314 | } |
315 | visit_type_uint64(v, "psw-addr" , &obj->psw_addr, &err); |
316 | if (err) { |
317 | goto out; |
318 | } |
319 | visit_type_S390CrashReason(v, "reason" , &obj->reason, &err); |
320 | if (err) { |
321 | goto out; |
322 | } |
323 | |
324 | out: |
325 | error_propagate(errp, err); |
326 | } |
327 | |
328 | void visit_type_GuestPanicInformationS390(Visitor *v, const char *name, GuestPanicInformationS390 **obj, Error **errp) |
329 | { |
330 | Error *err = NULL; |
331 | |
332 | visit_start_struct(v, name, (void **)obj, sizeof(GuestPanicInformationS390), &err); |
333 | if (err) { |
334 | goto out; |
335 | } |
336 | if (!*obj) { |
337 | goto out_obj; |
338 | } |
339 | visit_type_GuestPanicInformationS390_members(v, *obj, &err); |
340 | if (err) { |
341 | goto out_obj; |
342 | } |
343 | visit_check_struct(v, &err); |
344 | out_obj: |
345 | visit_end_struct(v, (void **)obj); |
346 | if (err && visit_is_input(v)) { |
347 | qapi_free_GuestPanicInformationS390(*obj); |
348 | *obj = NULL; |
349 | } |
350 | out: |
351 | error_propagate(errp, err); |
352 | } |
353 | |
354 | /* Dummy declaration to prevent empty .o file */ |
355 | char qapi_dummy_qapi_visit_run_state_c; |
356 | |