1 | /* AUTOMATICALLY GENERATED, DO NOT MODIFY */ |
2 | |
3 | /* |
4 | * Schema-defined QAPI/QMP commands |
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/visitor.h" |
15 | #include "qapi/qmp/qdict.h" |
16 | #include "qapi/qobject-output-visitor.h" |
17 | #include "qapi/qobject-input-visitor.h" |
18 | #include "qapi/dealloc-visitor.h" |
19 | #include "qapi/error.h" |
20 | #include "qapi-visit-machine.h" |
21 | #include "qapi-commands-machine.h" |
22 | |
23 | |
24 | static void qmp_marshal_output_CpuInfoList(CpuInfoList *ret_in, QObject **ret_out, Error **errp) |
25 | { |
26 | Error *err = NULL; |
27 | Visitor *v; |
28 | |
29 | v = qobject_output_visitor_new(ret_out); |
30 | visit_type_CpuInfoList(v, "unused" , &ret_in, &err); |
31 | if (!err) { |
32 | visit_complete(v, ret_out); |
33 | } |
34 | error_propagate(errp, err); |
35 | visit_free(v); |
36 | v = qapi_dealloc_visitor_new(); |
37 | visit_type_CpuInfoList(v, "unused" , &ret_in, NULL); |
38 | visit_free(v); |
39 | } |
40 | |
41 | void qmp_marshal_query_cpus(QDict *args, QObject **ret, Error **errp) |
42 | { |
43 | Error *err = NULL; |
44 | CpuInfoList *retval; |
45 | Visitor *v = NULL; |
46 | |
47 | if (args) { |
48 | v = qobject_input_visitor_new(QOBJECT(args)); |
49 | visit_start_struct(v, NULL, NULL, 0, &err); |
50 | if (err) { |
51 | goto out; |
52 | } |
53 | |
54 | if (!err) { |
55 | visit_check_struct(v, &err); |
56 | } |
57 | visit_end_struct(v, NULL); |
58 | if (err) { |
59 | goto out; |
60 | } |
61 | } |
62 | |
63 | retval = qmp_query_cpus(&err); |
64 | if (err) { |
65 | goto out; |
66 | } |
67 | |
68 | qmp_marshal_output_CpuInfoList(retval, ret, &err); |
69 | |
70 | out: |
71 | error_propagate(errp, err); |
72 | visit_free(v); |
73 | if (args) { |
74 | v = qapi_dealloc_visitor_new(); |
75 | visit_start_struct(v, NULL, NULL, 0, NULL); |
76 | |
77 | visit_end_struct(v, NULL); |
78 | visit_free(v); |
79 | } |
80 | } |
81 | |
82 | static void qmp_marshal_output_CpuInfoFastList(CpuInfoFastList *ret_in, QObject **ret_out, Error **errp) |
83 | { |
84 | Error *err = NULL; |
85 | Visitor *v; |
86 | |
87 | v = qobject_output_visitor_new(ret_out); |
88 | visit_type_CpuInfoFastList(v, "unused" , &ret_in, &err); |
89 | if (!err) { |
90 | visit_complete(v, ret_out); |
91 | } |
92 | error_propagate(errp, err); |
93 | visit_free(v); |
94 | v = qapi_dealloc_visitor_new(); |
95 | visit_type_CpuInfoFastList(v, "unused" , &ret_in, NULL); |
96 | visit_free(v); |
97 | } |
98 | |
99 | void qmp_marshal_query_cpus_fast(QDict *args, QObject **ret, Error **errp) |
100 | { |
101 | Error *err = NULL; |
102 | CpuInfoFastList *retval; |
103 | Visitor *v = NULL; |
104 | |
105 | if (args) { |
106 | v = qobject_input_visitor_new(QOBJECT(args)); |
107 | visit_start_struct(v, NULL, NULL, 0, &err); |
108 | if (err) { |
109 | goto out; |
110 | } |
111 | |
112 | if (!err) { |
113 | visit_check_struct(v, &err); |
114 | } |
115 | visit_end_struct(v, NULL); |
116 | if (err) { |
117 | goto out; |
118 | } |
119 | } |
120 | |
121 | retval = qmp_query_cpus_fast(&err); |
122 | if (err) { |
123 | goto out; |
124 | } |
125 | |
126 | qmp_marshal_output_CpuInfoFastList(retval, ret, &err); |
127 | |
128 | out: |
129 | error_propagate(errp, err); |
130 | visit_free(v); |
131 | if (args) { |
132 | v = qapi_dealloc_visitor_new(); |
133 | visit_start_struct(v, NULL, NULL, 0, NULL); |
134 | |
135 | visit_end_struct(v, NULL); |
136 | visit_free(v); |
137 | } |
138 | } |
139 | |
140 | void qmp_marshal_cpu_add(QDict *args, QObject **ret, Error **errp) |
141 | { |
142 | Error *err = NULL; |
143 | Visitor *v; |
144 | q_obj_cpu_add_arg arg = {0}; |
145 | |
146 | v = qobject_input_visitor_new(QOBJECT(args)); |
147 | visit_start_struct(v, NULL, NULL, 0, &err); |
148 | if (err) { |
149 | goto out; |
150 | } |
151 | visit_type_q_obj_cpu_add_arg_members(v, &arg, &err); |
152 | if (!err) { |
153 | visit_check_struct(v, &err); |
154 | } |
155 | visit_end_struct(v, NULL); |
156 | if (err) { |
157 | goto out; |
158 | } |
159 | |
160 | qmp_cpu_add(arg.id, &err); |
161 | |
162 | out: |
163 | error_propagate(errp, err); |
164 | visit_free(v); |
165 | v = qapi_dealloc_visitor_new(); |
166 | visit_start_struct(v, NULL, NULL, 0, NULL); |
167 | visit_type_q_obj_cpu_add_arg_members(v, &arg, NULL); |
168 | visit_end_struct(v, NULL); |
169 | visit_free(v); |
170 | } |
171 | |
172 | static void qmp_marshal_output_MachineInfoList(MachineInfoList *ret_in, QObject **ret_out, Error **errp) |
173 | { |
174 | Error *err = NULL; |
175 | Visitor *v; |
176 | |
177 | v = qobject_output_visitor_new(ret_out); |
178 | visit_type_MachineInfoList(v, "unused" , &ret_in, &err); |
179 | if (!err) { |
180 | visit_complete(v, ret_out); |
181 | } |
182 | error_propagate(errp, err); |
183 | visit_free(v); |
184 | v = qapi_dealloc_visitor_new(); |
185 | visit_type_MachineInfoList(v, "unused" , &ret_in, NULL); |
186 | visit_free(v); |
187 | } |
188 | |
189 | void qmp_marshal_query_machines(QDict *args, QObject **ret, Error **errp) |
190 | { |
191 | Error *err = NULL; |
192 | MachineInfoList *retval; |
193 | Visitor *v = NULL; |
194 | |
195 | if (args) { |
196 | v = qobject_input_visitor_new(QOBJECT(args)); |
197 | visit_start_struct(v, NULL, NULL, 0, &err); |
198 | if (err) { |
199 | goto out; |
200 | } |
201 | |
202 | if (!err) { |
203 | visit_check_struct(v, &err); |
204 | } |
205 | visit_end_struct(v, NULL); |
206 | if (err) { |
207 | goto out; |
208 | } |
209 | } |
210 | |
211 | retval = qmp_query_machines(&err); |
212 | if (err) { |
213 | goto out; |
214 | } |
215 | |
216 | qmp_marshal_output_MachineInfoList(retval, ret, &err); |
217 | |
218 | out: |
219 | error_propagate(errp, err); |
220 | visit_free(v); |
221 | if (args) { |
222 | v = qapi_dealloc_visitor_new(); |
223 | visit_start_struct(v, NULL, NULL, 0, NULL); |
224 | |
225 | visit_end_struct(v, NULL); |
226 | visit_free(v); |
227 | } |
228 | } |
229 | |
230 | static void qmp_marshal_output_CurrentMachineParams(CurrentMachineParams *ret_in, QObject **ret_out, Error **errp) |
231 | { |
232 | Error *err = NULL; |
233 | Visitor *v; |
234 | |
235 | v = qobject_output_visitor_new(ret_out); |
236 | visit_type_CurrentMachineParams(v, "unused" , &ret_in, &err); |
237 | if (!err) { |
238 | visit_complete(v, ret_out); |
239 | } |
240 | error_propagate(errp, err); |
241 | visit_free(v); |
242 | v = qapi_dealloc_visitor_new(); |
243 | visit_type_CurrentMachineParams(v, "unused" , &ret_in, NULL); |
244 | visit_free(v); |
245 | } |
246 | |
247 | void qmp_marshal_query_current_machine(QDict *args, QObject **ret, Error **errp) |
248 | { |
249 | Error *err = NULL; |
250 | CurrentMachineParams *retval; |
251 | Visitor *v = NULL; |
252 | |
253 | if (args) { |
254 | v = qobject_input_visitor_new(QOBJECT(args)); |
255 | visit_start_struct(v, NULL, NULL, 0, &err); |
256 | if (err) { |
257 | goto out; |
258 | } |
259 | |
260 | if (!err) { |
261 | visit_check_struct(v, &err); |
262 | } |
263 | visit_end_struct(v, NULL); |
264 | if (err) { |
265 | goto out; |
266 | } |
267 | } |
268 | |
269 | retval = qmp_query_current_machine(&err); |
270 | if (err) { |
271 | goto out; |
272 | } |
273 | |
274 | qmp_marshal_output_CurrentMachineParams(retval, ret, &err); |
275 | |
276 | out: |
277 | error_propagate(errp, err); |
278 | visit_free(v); |
279 | if (args) { |
280 | v = qapi_dealloc_visitor_new(); |
281 | visit_start_struct(v, NULL, NULL, 0, NULL); |
282 | |
283 | visit_end_struct(v, NULL); |
284 | visit_free(v); |
285 | } |
286 | } |
287 | |
288 | static void qmp_marshal_output_TargetInfo(TargetInfo *ret_in, QObject **ret_out, Error **errp) |
289 | { |
290 | Error *err = NULL; |
291 | Visitor *v; |
292 | |
293 | v = qobject_output_visitor_new(ret_out); |
294 | visit_type_TargetInfo(v, "unused" , &ret_in, &err); |
295 | if (!err) { |
296 | visit_complete(v, ret_out); |
297 | } |
298 | error_propagate(errp, err); |
299 | visit_free(v); |
300 | v = qapi_dealloc_visitor_new(); |
301 | visit_type_TargetInfo(v, "unused" , &ret_in, NULL); |
302 | visit_free(v); |
303 | } |
304 | |
305 | void qmp_marshal_query_target(QDict *args, QObject **ret, Error **errp) |
306 | { |
307 | Error *err = NULL; |
308 | TargetInfo *retval; |
309 | Visitor *v = NULL; |
310 | |
311 | if (args) { |
312 | v = qobject_input_visitor_new(QOBJECT(args)); |
313 | visit_start_struct(v, NULL, NULL, 0, &err); |
314 | if (err) { |
315 | goto out; |
316 | } |
317 | |
318 | if (!err) { |
319 | visit_check_struct(v, &err); |
320 | } |
321 | visit_end_struct(v, NULL); |
322 | if (err) { |
323 | goto out; |
324 | } |
325 | } |
326 | |
327 | retval = qmp_query_target(&err); |
328 | if (err) { |
329 | goto out; |
330 | } |
331 | |
332 | qmp_marshal_output_TargetInfo(retval, ret, &err); |
333 | |
334 | out: |
335 | error_propagate(errp, err); |
336 | visit_free(v); |
337 | if (args) { |
338 | v = qapi_dealloc_visitor_new(); |
339 | visit_start_struct(v, NULL, NULL, 0, NULL); |
340 | |
341 | visit_end_struct(v, NULL); |
342 | visit_free(v); |
343 | } |
344 | } |
345 | |
346 | static void qmp_marshal_output_MemdevList(MemdevList *ret_in, QObject **ret_out, Error **errp) |
347 | { |
348 | Error *err = NULL; |
349 | Visitor *v; |
350 | |
351 | v = qobject_output_visitor_new(ret_out); |
352 | visit_type_MemdevList(v, "unused" , &ret_in, &err); |
353 | if (!err) { |
354 | visit_complete(v, ret_out); |
355 | } |
356 | error_propagate(errp, err); |
357 | visit_free(v); |
358 | v = qapi_dealloc_visitor_new(); |
359 | visit_type_MemdevList(v, "unused" , &ret_in, NULL); |
360 | visit_free(v); |
361 | } |
362 | |
363 | void qmp_marshal_query_memdev(QDict *args, QObject **ret, Error **errp) |
364 | { |
365 | Error *err = NULL; |
366 | MemdevList *retval; |
367 | Visitor *v = NULL; |
368 | |
369 | if (args) { |
370 | v = qobject_input_visitor_new(QOBJECT(args)); |
371 | visit_start_struct(v, NULL, NULL, 0, &err); |
372 | if (err) { |
373 | goto out; |
374 | } |
375 | |
376 | if (!err) { |
377 | visit_check_struct(v, &err); |
378 | } |
379 | visit_end_struct(v, NULL); |
380 | if (err) { |
381 | goto out; |
382 | } |
383 | } |
384 | |
385 | retval = qmp_query_memdev(&err); |
386 | if (err) { |
387 | goto out; |
388 | } |
389 | |
390 | qmp_marshal_output_MemdevList(retval, ret, &err); |
391 | |
392 | out: |
393 | error_propagate(errp, err); |
394 | visit_free(v); |
395 | if (args) { |
396 | v = qapi_dealloc_visitor_new(); |
397 | visit_start_struct(v, NULL, NULL, 0, NULL); |
398 | |
399 | visit_end_struct(v, NULL); |
400 | visit_free(v); |
401 | } |
402 | } |
403 | |
404 | static void qmp_marshal_output_HotpluggableCPUList(HotpluggableCPUList *ret_in, QObject **ret_out, Error **errp) |
405 | { |
406 | Error *err = NULL; |
407 | Visitor *v; |
408 | |
409 | v = qobject_output_visitor_new(ret_out); |
410 | visit_type_HotpluggableCPUList(v, "unused" , &ret_in, &err); |
411 | if (!err) { |
412 | visit_complete(v, ret_out); |
413 | } |
414 | error_propagate(errp, err); |
415 | visit_free(v); |
416 | v = qapi_dealloc_visitor_new(); |
417 | visit_type_HotpluggableCPUList(v, "unused" , &ret_in, NULL); |
418 | visit_free(v); |
419 | } |
420 | |
421 | void qmp_marshal_query_hotpluggable_cpus(QDict *args, QObject **ret, Error **errp) |
422 | { |
423 | Error *err = NULL; |
424 | HotpluggableCPUList *retval; |
425 | Visitor *v = NULL; |
426 | |
427 | if (args) { |
428 | v = qobject_input_visitor_new(QOBJECT(args)); |
429 | visit_start_struct(v, NULL, NULL, 0, &err); |
430 | if (err) { |
431 | goto out; |
432 | } |
433 | |
434 | if (!err) { |
435 | visit_check_struct(v, &err); |
436 | } |
437 | visit_end_struct(v, NULL); |
438 | if (err) { |
439 | goto out; |
440 | } |
441 | } |
442 | |
443 | retval = qmp_query_hotpluggable_cpus(&err); |
444 | if (err) { |
445 | goto out; |
446 | } |
447 | |
448 | qmp_marshal_output_HotpluggableCPUList(retval, ret, &err); |
449 | |
450 | out: |
451 | error_propagate(errp, err); |
452 | visit_free(v); |
453 | if (args) { |
454 | v = qapi_dealloc_visitor_new(); |
455 | visit_start_struct(v, NULL, NULL, 0, NULL); |
456 | |
457 | visit_end_struct(v, NULL); |
458 | visit_free(v); |
459 | } |
460 | } |
461 | |
462 | void qmp_marshal_set_numa_node(QDict *args, QObject **ret, Error **errp) |
463 | { |
464 | Error *err = NULL; |
465 | Visitor *v; |
466 | NumaOptions arg = {0}; |
467 | |
468 | v = qobject_input_visitor_new(QOBJECT(args)); |
469 | visit_start_struct(v, NULL, NULL, 0, &err); |
470 | if (err) { |
471 | goto out; |
472 | } |
473 | visit_type_NumaOptions_members(v, &arg, &err); |
474 | if (!err) { |
475 | visit_check_struct(v, &err); |
476 | } |
477 | visit_end_struct(v, NULL); |
478 | if (err) { |
479 | goto out; |
480 | } |
481 | |
482 | qmp_set_numa_node(&arg, &err); |
483 | |
484 | out: |
485 | error_propagate(errp, err); |
486 | visit_free(v); |
487 | v = qapi_dealloc_visitor_new(); |
488 | visit_start_struct(v, NULL, NULL, 0, NULL); |
489 | visit_type_NumaOptions_members(v, &arg, NULL); |
490 | visit_end_struct(v, NULL); |
491 | visit_free(v); |
492 | } |
493 | |
494 | /* Dummy declaration to prevent empty .o file */ |
495 | char qapi_dummy_qapi_commands_machine_c; |
496 | |