qmp-marshal.c revision 910aea96b67d7f0357f586c47f20848ec435aa1b
1/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
2
3/*
4 * schema-defined QMP->QAPI command dispatch
5 *
6 * Copyright IBM, Corp. 2011
7 *
8 * Authors:
9 *  Anthony Liguori   <aliguori@us.ibm.com>
10 *
11 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
12 * See the COPYING.LIB file in the top-level directory.
13 *
14 */
15
16#include "qemu-common.h"
17#include "qemu/module.h"
18#include "qapi/qmp/qerror.h"
19#include "qapi/qmp/types.h"
20#include "qapi/qmp/dispatch.h"
21#include "qapi/visitor.h"
22#include "qapi/qmp-output-visitor.h"
23#include "qapi/qmp-input-visitor.h"
24#include "qapi/dealloc-visitor.h"
25#include "qapi-types.h"
26#include "qapi-visit.h"
27
28#include "qmp-commands.h"
29
30int qmp_marshal_input_add_client(Monitor *mon, const QDict *qdict, QObject **ret)
31{
32    Error *local_err = NULL;
33    Error **errp = &local_err;
34    QDict *args = (QDict *)qdict;
35    QmpInputVisitor *mi;
36    QapiDeallocVisitor *md;
37    Visitor *v;
38    char * protocol = NULL;
39    char * fdname = NULL;
40    bool has_skipauth = false;
41    bool skipauth;
42    bool has_tls = false;
43    bool tls;
44
45    mi = qmp_input_visitor_new_strict(QOBJECT(args));
46    v = qmp_input_get_visitor(mi);
47    visit_type_str(v, &protocol, "protocol", errp);
48    visit_type_str(v, &fdname, "fdname", errp);
49    visit_start_optional(v, &has_skipauth, "skipauth", errp);
50    if (has_skipauth) {
51        visit_type_bool(v, &skipauth, "skipauth", errp);
52    }
53    visit_end_optional(v, errp);
54    visit_start_optional(v, &has_tls, "tls", errp);
55    if (has_tls) {
56        visit_type_bool(v, &tls, "tls", errp);
57    }
58    visit_end_optional(v, errp);
59    qmp_input_visitor_cleanup(mi);
60
61    if (error_is_set(errp)) {
62        goto out;
63    }
64    qmp_add_client(protocol, fdname, has_skipauth, skipauth, has_tls, tls, errp);
65
66out:
67    md = qapi_dealloc_visitor_new();
68    v = qapi_dealloc_get_visitor(md);
69    visit_type_str(v, &protocol, "protocol", NULL);
70    visit_type_str(v, &fdname, "fdname", NULL);
71    visit_start_optional(v, &has_skipauth, "skipauth", NULL);
72    if (has_skipauth) {
73        visit_type_bool(v, &skipauth, "skipauth", NULL);
74    }
75    visit_end_optional(v, NULL);
76    visit_start_optional(v, &has_tls, "tls", NULL);
77    if (has_tls) {
78        visit_type_bool(v, &tls, "tls", NULL);
79    }
80    visit_end_optional(v, NULL);
81    qapi_dealloc_visitor_cleanup(md);
82
83    if (local_err) {
84        qerror_report_err(local_err);
85        error_free(local_err);
86        return -1;
87    }
88    return 0;
89}
90
91static void qmp_marshal_output_query_name(NameInfo * ret_in, QObject **ret_out, Error **errp)
92{
93    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
94    QmpOutputVisitor *mo = qmp_output_visitor_new();
95    Visitor *v;
96
97    v = qmp_output_get_visitor(mo);
98    visit_type_NameInfo(v, &ret_in, "unused", errp);
99    if (!error_is_set(errp)) {
100        *ret_out = qmp_output_get_qobject(mo);
101    }
102    qmp_output_visitor_cleanup(mo);
103    v = qapi_dealloc_get_visitor(md);
104    visit_type_NameInfo(v, &ret_in, "unused", NULL);
105    qapi_dealloc_visitor_cleanup(md);
106}
107
108int qmp_marshal_input_query_name(Monitor *mon, const QDict *qdict, QObject **ret)
109{
110    Error *local_err = NULL;
111    Error **errp = &local_err;
112    QDict *args = (QDict *)qdict;
113    NameInfo * retval = NULL;
114    (void)args;
115    if (error_is_set(errp)) {
116        goto out;
117    }
118    retval = qmp_query_name(errp);
119    if (!error_is_set(errp)) {
120        qmp_marshal_output_query_name(retval, ret, errp);
121    }
122
123out:
124
125
126    if (local_err) {
127        qerror_report_err(local_err);
128        error_free(local_err);
129        return -1;
130    }
131    return 0;
132}
133
134static void qmp_marshal_output_query_version(VersionInfo * ret_in, QObject **ret_out, Error **errp)
135{
136    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
137    QmpOutputVisitor *mo = qmp_output_visitor_new();
138    Visitor *v;
139
140    v = qmp_output_get_visitor(mo);
141    visit_type_VersionInfo(v, &ret_in, "unused", errp);
142    if (!error_is_set(errp)) {
143        *ret_out = qmp_output_get_qobject(mo);
144    }
145    qmp_output_visitor_cleanup(mo);
146    v = qapi_dealloc_get_visitor(md);
147    visit_type_VersionInfo(v, &ret_in, "unused", NULL);
148    qapi_dealloc_visitor_cleanup(md);
149}
150
151int qmp_marshal_input_query_version(Monitor *mon, const QDict *qdict, QObject **ret)
152{
153    Error *local_err = NULL;
154    Error **errp = &local_err;
155    QDict *args = (QDict *)qdict;
156    VersionInfo * retval = NULL;
157    (void)args;
158    if (error_is_set(errp)) {
159        goto out;
160    }
161    retval = qmp_query_version(errp);
162    if (!error_is_set(errp)) {
163        qmp_marshal_output_query_version(retval, ret, errp);
164    }
165
166out:
167
168
169    if (local_err) {
170        qerror_report_err(local_err);
171        error_free(local_err);
172        return -1;
173    }
174    return 0;
175}
176
177static void qmp_marshal_output_query_kvm(KvmInfo * ret_in, QObject **ret_out, Error **errp)
178{
179    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
180    QmpOutputVisitor *mo = qmp_output_visitor_new();
181    Visitor *v;
182
183    v = qmp_output_get_visitor(mo);
184    visit_type_KvmInfo(v, &ret_in, "unused", errp);
185    if (!error_is_set(errp)) {
186        *ret_out = qmp_output_get_qobject(mo);
187    }
188    qmp_output_visitor_cleanup(mo);
189    v = qapi_dealloc_get_visitor(md);
190    visit_type_KvmInfo(v, &ret_in, "unused", NULL);
191    qapi_dealloc_visitor_cleanup(md);
192}
193
194int qmp_marshal_input_query_kvm(Monitor *mon, const QDict *qdict, QObject **ret)
195{
196    Error *local_err = NULL;
197    Error **errp = &local_err;
198    QDict *args = (QDict *)qdict;
199    KvmInfo * retval = NULL;
200    (void)args;
201    if (error_is_set(errp)) {
202        goto out;
203    }
204    retval = qmp_query_kvm(errp);
205    if (!error_is_set(errp)) {
206        qmp_marshal_output_query_kvm(retval, ret, errp);
207    }
208
209out:
210
211
212    if (local_err) {
213        qerror_report_err(local_err);
214        error_free(local_err);
215        return -1;
216    }
217    return 0;
218}
219
220static void qmp_marshal_output_query_status(StatusInfo * ret_in, QObject **ret_out, Error **errp)
221{
222    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
223    QmpOutputVisitor *mo = qmp_output_visitor_new();
224    Visitor *v;
225
226    v = qmp_output_get_visitor(mo);
227    visit_type_StatusInfo(v, &ret_in, "unused", errp);
228    if (!error_is_set(errp)) {
229        *ret_out = qmp_output_get_qobject(mo);
230    }
231    qmp_output_visitor_cleanup(mo);
232    v = qapi_dealloc_get_visitor(md);
233    visit_type_StatusInfo(v, &ret_in, "unused", NULL);
234    qapi_dealloc_visitor_cleanup(md);
235}
236
237int qmp_marshal_input_query_status(Monitor *mon, const QDict *qdict, QObject **ret)
238{
239    Error *local_err = NULL;
240    Error **errp = &local_err;
241    QDict *args = (QDict *)qdict;
242    StatusInfo * retval = NULL;
243    (void)args;
244    if (error_is_set(errp)) {
245        goto out;
246    }
247    retval = qmp_query_status(errp);
248    if (!error_is_set(errp)) {
249        qmp_marshal_output_query_status(retval, ret, errp);
250    }
251
252out:
253
254
255    if (local_err) {
256        qerror_report_err(local_err);
257        error_free(local_err);
258        return -1;
259    }
260    return 0;
261}
262
263static void qmp_marshal_output_query_uuid(UuidInfo * ret_in, QObject **ret_out, Error **errp)
264{
265    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
266    QmpOutputVisitor *mo = qmp_output_visitor_new();
267    Visitor *v;
268
269    v = qmp_output_get_visitor(mo);
270    visit_type_UuidInfo(v, &ret_in, "unused", errp);
271    if (!error_is_set(errp)) {
272        *ret_out = qmp_output_get_qobject(mo);
273    }
274    qmp_output_visitor_cleanup(mo);
275    v = qapi_dealloc_get_visitor(md);
276    visit_type_UuidInfo(v, &ret_in, "unused", NULL);
277    qapi_dealloc_visitor_cleanup(md);
278}
279
280int qmp_marshal_input_query_uuid(Monitor *mon, const QDict *qdict, QObject **ret)
281{
282    Error *local_err = NULL;
283    Error **errp = &local_err;
284    QDict *args = (QDict *)qdict;
285    UuidInfo * retval = NULL;
286    (void)args;
287    if (error_is_set(errp)) {
288        goto out;
289    }
290    retval = qmp_query_uuid(errp);
291    if (!error_is_set(errp)) {
292        qmp_marshal_output_query_uuid(retval, ret, errp);
293    }
294
295out:
296
297
298    if (local_err) {
299        qerror_report_err(local_err);
300        error_free(local_err);
301        return -1;
302    }
303    return 0;
304}
305
306static void qmp_marshal_output_query_chardev(ChardevInfoList * ret_in, QObject **ret_out, Error **errp)
307{
308    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
309    QmpOutputVisitor *mo = qmp_output_visitor_new();
310    Visitor *v;
311
312    v = qmp_output_get_visitor(mo);
313    visit_type_ChardevInfoList(v, &ret_in, "unused", errp);
314    if (!error_is_set(errp)) {
315        *ret_out = qmp_output_get_qobject(mo);
316    }
317    qmp_output_visitor_cleanup(mo);
318    v = qapi_dealloc_get_visitor(md);
319    visit_type_ChardevInfoList(v, &ret_in, "unused", NULL);
320    qapi_dealloc_visitor_cleanup(md);
321}
322
323int qmp_marshal_input_query_chardev(Monitor *mon, const QDict *qdict, QObject **ret)
324{
325    Error *local_err = NULL;
326    Error **errp = &local_err;
327    QDict *args = (QDict *)qdict;
328    ChardevInfoList * retval = NULL;
329    (void)args;
330    if (error_is_set(errp)) {
331        goto out;
332    }
333    retval = qmp_query_chardev(errp);
334    if (!error_is_set(errp)) {
335        qmp_marshal_output_query_chardev(retval, ret, errp);
336    }
337
338out:
339
340
341    if (local_err) {
342        qerror_report_err(local_err);
343        error_free(local_err);
344        return -1;
345    }
346    return 0;
347}
348
349int qmp_marshal_input_ringbuf_write(Monitor *mon, const QDict *qdict, QObject **ret)
350{
351    Error *local_err = NULL;
352    Error **errp = &local_err;
353    QDict *args = (QDict *)qdict;
354    QmpInputVisitor *mi;
355    QapiDeallocVisitor *md;
356    Visitor *v;
357    char * device = NULL;
358    char * data = NULL;
359    bool has_format = false;
360    DataFormat format;
361
362    mi = qmp_input_visitor_new_strict(QOBJECT(args));
363    v = qmp_input_get_visitor(mi);
364    visit_type_str(v, &device, "device", errp);
365    visit_type_str(v, &data, "data", errp);
366    visit_start_optional(v, &has_format, "format", errp);
367    if (has_format) {
368        visit_type_DataFormat(v, &format, "format", errp);
369    }
370    visit_end_optional(v, errp);
371    qmp_input_visitor_cleanup(mi);
372
373    if (error_is_set(errp)) {
374        goto out;
375    }
376    qmp_ringbuf_write(device, data, has_format, format, errp);
377
378out:
379    md = qapi_dealloc_visitor_new();
380    v = qapi_dealloc_get_visitor(md);
381    visit_type_str(v, &device, "device", NULL);
382    visit_type_str(v, &data, "data", NULL);
383    visit_start_optional(v, &has_format, "format", NULL);
384    if (has_format) {
385        visit_type_DataFormat(v, &format, "format", NULL);
386    }
387    visit_end_optional(v, NULL);
388    qapi_dealloc_visitor_cleanup(md);
389
390    if (local_err) {
391        qerror_report_err(local_err);
392        error_free(local_err);
393        return -1;
394    }
395    return 0;
396}
397
398static void qmp_marshal_output_ringbuf_read(char * ret_in, QObject **ret_out, Error **errp)
399{
400    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
401    QmpOutputVisitor *mo = qmp_output_visitor_new();
402    Visitor *v;
403
404    v = qmp_output_get_visitor(mo);
405    visit_type_str(v, &ret_in, "unused", errp);
406    if (!error_is_set(errp)) {
407        *ret_out = qmp_output_get_qobject(mo);
408    }
409    qmp_output_visitor_cleanup(mo);
410    v = qapi_dealloc_get_visitor(md);
411    visit_type_str(v, &ret_in, "unused", NULL);
412    qapi_dealloc_visitor_cleanup(md);
413}
414
415int qmp_marshal_input_ringbuf_read(Monitor *mon, const QDict *qdict, QObject **ret)
416{
417    Error *local_err = NULL;
418    Error **errp = &local_err;
419    QDict *args = (QDict *)qdict;
420    char * retval = NULL;
421    QmpInputVisitor *mi;
422    QapiDeallocVisitor *md;
423    Visitor *v;
424    char * device = NULL;
425    int64_t size;
426    bool has_format = false;
427    DataFormat format;
428
429    mi = qmp_input_visitor_new_strict(QOBJECT(args));
430    v = qmp_input_get_visitor(mi);
431    visit_type_str(v, &device, "device", errp);
432    visit_type_int(v, &size, "size", errp);
433    visit_start_optional(v, &has_format, "format", errp);
434    if (has_format) {
435        visit_type_DataFormat(v, &format, "format", errp);
436    }
437    visit_end_optional(v, errp);
438    qmp_input_visitor_cleanup(mi);
439
440    if (error_is_set(errp)) {
441        goto out;
442    }
443    retval = qmp_ringbuf_read(device, size, has_format, format, errp);
444    if (!error_is_set(errp)) {
445        qmp_marshal_output_ringbuf_read(retval, ret, errp);
446    }
447
448out:
449    md = qapi_dealloc_visitor_new();
450    v = qapi_dealloc_get_visitor(md);
451    visit_type_str(v, &device, "device", NULL);
452    visit_type_int(v, &size, "size", NULL);
453    visit_start_optional(v, &has_format, "format", NULL);
454    if (has_format) {
455        visit_type_DataFormat(v, &format, "format", NULL);
456    }
457    visit_end_optional(v, NULL);
458    qapi_dealloc_visitor_cleanup(md);
459
460    if (local_err) {
461        qerror_report_err(local_err);
462        error_free(local_err);
463        return -1;
464    }
465    return 0;
466}
467
468static void qmp_marshal_output_query_commands(CommandInfoList * ret_in, QObject **ret_out, Error **errp)
469{
470    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
471    QmpOutputVisitor *mo = qmp_output_visitor_new();
472    Visitor *v;
473
474    v = qmp_output_get_visitor(mo);
475    visit_type_CommandInfoList(v, &ret_in, "unused", errp);
476    if (!error_is_set(errp)) {
477        *ret_out = qmp_output_get_qobject(mo);
478    }
479    qmp_output_visitor_cleanup(mo);
480    v = qapi_dealloc_get_visitor(md);
481    visit_type_CommandInfoList(v, &ret_in, "unused", NULL);
482    qapi_dealloc_visitor_cleanup(md);
483}
484
485int qmp_marshal_input_query_commands(Monitor *mon, const QDict *qdict, QObject **ret)
486{
487    Error *local_err = NULL;
488    Error **errp = &local_err;
489    QDict *args = (QDict *)qdict;
490    CommandInfoList * retval = NULL;
491    (void)args;
492    if (error_is_set(errp)) {
493        goto out;
494    }
495    retval = qmp_query_commands(errp);
496    if (!error_is_set(errp)) {
497        qmp_marshal_output_query_commands(retval, ret, errp);
498    }
499
500out:
501
502
503    if (local_err) {
504        qerror_report_err(local_err);
505        error_free(local_err);
506        return -1;
507    }
508    return 0;
509}
510
511static void qmp_marshal_output_query_events(EventInfoList * ret_in, QObject **ret_out, Error **errp)
512{
513    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
514    QmpOutputVisitor *mo = qmp_output_visitor_new();
515    Visitor *v;
516
517    v = qmp_output_get_visitor(mo);
518    visit_type_EventInfoList(v, &ret_in, "unused", errp);
519    if (!error_is_set(errp)) {
520        *ret_out = qmp_output_get_qobject(mo);
521    }
522    qmp_output_visitor_cleanup(mo);
523    v = qapi_dealloc_get_visitor(md);
524    visit_type_EventInfoList(v, &ret_in, "unused", NULL);
525    qapi_dealloc_visitor_cleanup(md);
526}
527
528int qmp_marshal_input_query_events(Monitor *mon, const QDict *qdict, QObject **ret)
529{
530    Error *local_err = NULL;
531    Error **errp = &local_err;
532    QDict *args = (QDict *)qdict;
533    EventInfoList * retval = NULL;
534    (void)args;
535    if (error_is_set(errp)) {
536        goto out;
537    }
538    retval = qmp_query_events(errp);
539    if (!error_is_set(errp)) {
540        qmp_marshal_output_query_events(retval, ret, errp);
541    }
542
543out:
544
545
546    if (local_err) {
547        qerror_report_err(local_err);
548        error_free(local_err);
549        return -1;
550    }
551    return 0;
552}
553
554static void qmp_marshal_output_query_migrate(MigrationInfo * ret_in, QObject **ret_out, Error **errp)
555{
556    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
557    QmpOutputVisitor *mo = qmp_output_visitor_new();
558    Visitor *v;
559
560    v = qmp_output_get_visitor(mo);
561    visit_type_MigrationInfo(v, &ret_in, "unused", errp);
562    if (!error_is_set(errp)) {
563        *ret_out = qmp_output_get_qobject(mo);
564    }
565    qmp_output_visitor_cleanup(mo);
566    v = qapi_dealloc_get_visitor(md);
567    visit_type_MigrationInfo(v, &ret_in, "unused", NULL);
568    qapi_dealloc_visitor_cleanup(md);
569}
570
571int qmp_marshal_input_query_migrate(Monitor *mon, const QDict *qdict, QObject **ret)
572{
573    Error *local_err = NULL;
574    Error **errp = &local_err;
575    QDict *args = (QDict *)qdict;
576    MigrationInfo * retval = NULL;
577    (void)args;
578    if (error_is_set(errp)) {
579        goto out;
580    }
581    retval = qmp_query_migrate(errp);
582    if (!error_is_set(errp)) {
583        qmp_marshal_output_query_migrate(retval, ret, errp);
584    }
585
586out:
587
588
589    if (local_err) {
590        qerror_report_err(local_err);
591        error_free(local_err);
592        return -1;
593    }
594    return 0;
595}
596
597int qmp_marshal_input_migrate_set_capabilities(Monitor *mon, const QDict *qdict, QObject **ret)
598{
599    Error *local_err = NULL;
600    Error **errp = &local_err;
601    QDict *args = (QDict *)qdict;
602    QmpInputVisitor *mi;
603    QapiDeallocVisitor *md;
604    Visitor *v;
605    MigrationCapabilityStatusList * capabilities = NULL;
606
607    mi = qmp_input_visitor_new_strict(QOBJECT(args));
608    v = qmp_input_get_visitor(mi);
609    visit_type_MigrationCapabilityStatusList(v, &capabilities, "capabilities", errp);
610    qmp_input_visitor_cleanup(mi);
611
612    if (error_is_set(errp)) {
613        goto out;
614    }
615    qmp_migrate_set_capabilities(capabilities, errp);
616
617out:
618    md = qapi_dealloc_visitor_new();
619    v = qapi_dealloc_get_visitor(md);
620    visit_type_MigrationCapabilityStatusList(v, &capabilities, "capabilities", NULL);
621    qapi_dealloc_visitor_cleanup(md);
622
623    if (local_err) {
624        qerror_report_err(local_err);
625        error_free(local_err);
626        return -1;
627    }
628    return 0;
629}
630
631static void qmp_marshal_output_query_migrate_capabilities(MigrationCapabilityStatusList * ret_in, QObject **ret_out, Error **errp)
632{
633    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
634    QmpOutputVisitor *mo = qmp_output_visitor_new();
635    Visitor *v;
636
637    v = qmp_output_get_visitor(mo);
638    visit_type_MigrationCapabilityStatusList(v, &ret_in, "unused", errp);
639    if (!error_is_set(errp)) {
640        *ret_out = qmp_output_get_qobject(mo);
641    }
642    qmp_output_visitor_cleanup(mo);
643    v = qapi_dealloc_get_visitor(md);
644    visit_type_MigrationCapabilityStatusList(v, &ret_in, "unused", NULL);
645    qapi_dealloc_visitor_cleanup(md);
646}
647
648int qmp_marshal_input_query_migrate_capabilities(Monitor *mon, const QDict *qdict, QObject **ret)
649{
650    Error *local_err = NULL;
651    Error **errp = &local_err;
652    QDict *args = (QDict *)qdict;
653    MigrationCapabilityStatusList * retval = NULL;
654    (void)args;
655    if (error_is_set(errp)) {
656        goto out;
657    }
658    retval = qmp_query_migrate_capabilities(errp);
659    if (!error_is_set(errp)) {
660        qmp_marshal_output_query_migrate_capabilities(retval, ret, errp);
661    }
662
663out:
664
665
666    if (local_err) {
667        qerror_report_err(local_err);
668        error_free(local_err);
669        return -1;
670    }
671    return 0;
672}
673
674static void qmp_marshal_output_query_mice(MouseInfoList * ret_in, QObject **ret_out, Error **errp)
675{
676    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
677    QmpOutputVisitor *mo = qmp_output_visitor_new();
678    Visitor *v;
679
680    v = qmp_output_get_visitor(mo);
681    visit_type_MouseInfoList(v, &ret_in, "unused", errp);
682    if (!error_is_set(errp)) {
683        *ret_out = qmp_output_get_qobject(mo);
684    }
685    qmp_output_visitor_cleanup(mo);
686    v = qapi_dealloc_get_visitor(md);
687    visit_type_MouseInfoList(v, &ret_in, "unused", NULL);
688    qapi_dealloc_visitor_cleanup(md);
689}
690
691int qmp_marshal_input_query_mice(Monitor *mon, const QDict *qdict, QObject **ret)
692{
693    Error *local_err = NULL;
694    Error **errp = &local_err;
695    QDict *args = (QDict *)qdict;
696    MouseInfoList * retval = NULL;
697    (void)args;
698    if (error_is_set(errp)) {
699        goto out;
700    }
701    retval = qmp_query_mice(errp);
702    if (!error_is_set(errp)) {
703        qmp_marshal_output_query_mice(retval, ret, errp);
704    }
705
706out:
707
708
709    if (local_err) {
710        qerror_report_err(local_err);
711        error_free(local_err);
712        return -1;
713    }
714    return 0;
715}
716
717static void qmp_marshal_output_query_cpus(CpuInfoList * ret_in, QObject **ret_out, Error **errp)
718{
719    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
720    QmpOutputVisitor *mo = qmp_output_visitor_new();
721    Visitor *v;
722
723    v = qmp_output_get_visitor(mo);
724    visit_type_CpuInfoList(v, &ret_in, "unused", errp);
725    if (!error_is_set(errp)) {
726        *ret_out = qmp_output_get_qobject(mo);
727    }
728    qmp_output_visitor_cleanup(mo);
729    v = qapi_dealloc_get_visitor(md);
730    visit_type_CpuInfoList(v, &ret_in, "unused", NULL);
731    qapi_dealloc_visitor_cleanup(md);
732}
733
734int qmp_marshal_input_query_cpus(Monitor *mon, const QDict *qdict, QObject **ret)
735{
736    Error *local_err = NULL;
737    Error **errp = &local_err;
738    QDict *args = (QDict *)qdict;
739    CpuInfoList * retval = NULL;
740    (void)args;
741    if (error_is_set(errp)) {
742        goto out;
743    }
744    retval = qmp_query_cpus(errp);
745    if (!error_is_set(errp)) {
746        qmp_marshal_output_query_cpus(retval, ret, errp);
747    }
748
749out:
750
751
752    if (local_err) {
753        qerror_report_err(local_err);
754        error_free(local_err);
755        return -1;
756    }
757    return 0;
758}
759
760static void qmp_marshal_output_query_block(BlockInfoList * ret_in, QObject **ret_out, Error **errp)
761{
762    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
763    QmpOutputVisitor *mo = qmp_output_visitor_new();
764    Visitor *v;
765
766    v = qmp_output_get_visitor(mo);
767    visit_type_BlockInfoList(v, &ret_in, "unused", errp);
768    if (!error_is_set(errp)) {
769        *ret_out = qmp_output_get_qobject(mo);
770    }
771    qmp_output_visitor_cleanup(mo);
772    v = qapi_dealloc_get_visitor(md);
773    visit_type_BlockInfoList(v, &ret_in, "unused", NULL);
774    qapi_dealloc_visitor_cleanup(md);
775}
776
777int qmp_marshal_input_query_block(Monitor *mon, const QDict *qdict, QObject **ret)
778{
779    Error *local_err = NULL;
780    Error **errp = &local_err;
781    QDict *args = (QDict *)qdict;
782    BlockInfoList * retval = NULL;
783    (void)args;
784    if (error_is_set(errp)) {
785        goto out;
786    }
787    retval = qmp_query_block(errp);
788    if (!error_is_set(errp)) {
789        qmp_marshal_output_query_block(retval, ret, errp);
790    }
791
792out:
793
794
795    if (local_err) {
796        qerror_report_err(local_err);
797        error_free(local_err);
798        return -1;
799    }
800    return 0;
801}
802
803static void qmp_marshal_output_query_blockstats(BlockStatsList * ret_in, QObject **ret_out, Error **errp)
804{
805    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
806    QmpOutputVisitor *mo = qmp_output_visitor_new();
807    Visitor *v;
808
809    v = qmp_output_get_visitor(mo);
810    visit_type_BlockStatsList(v, &ret_in, "unused", errp);
811    if (!error_is_set(errp)) {
812        *ret_out = qmp_output_get_qobject(mo);
813    }
814    qmp_output_visitor_cleanup(mo);
815    v = qapi_dealloc_get_visitor(md);
816    visit_type_BlockStatsList(v, &ret_in, "unused", NULL);
817    qapi_dealloc_visitor_cleanup(md);
818}
819
820int qmp_marshal_input_query_blockstats(Monitor *mon, const QDict *qdict, QObject **ret)
821{
822    Error *local_err = NULL;
823    Error **errp = &local_err;
824    QDict *args = (QDict *)qdict;
825    BlockStatsList * retval = NULL;
826    (void)args;
827    if (error_is_set(errp)) {
828        goto out;
829    }
830    retval = qmp_query_blockstats(errp);
831    if (!error_is_set(errp)) {
832        qmp_marshal_output_query_blockstats(retval, ret, errp);
833    }
834
835out:
836
837
838    if (local_err) {
839        qerror_report_err(local_err);
840        error_free(local_err);
841        return -1;
842    }
843    return 0;
844}
845
846static void qmp_marshal_output_query_vnc(VncInfo * ret_in, QObject **ret_out, Error **errp)
847{
848    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
849    QmpOutputVisitor *mo = qmp_output_visitor_new();
850    Visitor *v;
851
852    v = qmp_output_get_visitor(mo);
853    visit_type_VncInfo(v, &ret_in, "unused", errp);
854    if (!error_is_set(errp)) {
855        *ret_out = qmp_output_get_qobject(mo);
856    }
857    qmp_output_visitor_cleanup(mo);
858    v = qapi_dealloc_get_visitor(md);
859    visit_type_VncInfo(v, &ret_in, "unused", NULL);
860    qapi_dealloc_visitor_cleanup(md);
861}
862
863int qmp_marshal_input_query_vnc(Monitor *mon, const QDict *qdict, QObject **ret)
864{
865    Error *local_err = NULL;
866    Error **errp = &local_err;
867    QDict *args = (QDict *)qdict;
868    VncInfo * retval = NULL;
869    (void)args;
870    if (error_is_set(errp)) {
871        goto out;
872    }
873    retval = qmp_query_vnc(errp);
874    if (!error_is_set(errp)) {
875        qmp_marshal_output_query_vnc(retval, ret, errp);
876    }
877
878out:
879
880
881    if (local_err) {
882        qerror_report_err(local_err);
883        error_free(local_err);
884        return -1;
885    }
886    return 0;
887}
888
889static void qmp_marshal_output_query_spice(SpiceInfo * ret_in, QObject **ret_out, Error **errp)
890{
891    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
892    QmpOutputVisitor *mo = qmp_output_visitor_new();
893    Visitor *v;
894
895    v = qmp_output_get_visitor(mo);
896    visit_type_SpiceInfo(v, &ret_in, "unused", errp);
897    if (!error_is_set(errp)) {
898        *ret_out = qmp_output_get_qobject(mo);
899    }
900    qmp_output_visitor_cleanup(mo);
901    v = qapi_dealloc_get_visitor(md);
902    visit_type_SpiceInfo(v, &ret_in, "unused", NULL);
903    qapi_dealloc_visitor_cleanup(md);
904}
905
906int qmp_marshal_input_query_spice(Monitor *mon, const QDict *qdict, QObject **ret)
907{
908    Error *local_err = NULL;
909    Error **errp = &local_err;
910    QDict *args = (QDict *)qdict;
911    SpiceInfo * retval = NULL;
912    (void)args;
913    if (error_is_set(errp)) {
914        goto out;
915    }
916    retval = qmp_query_spice(errp);
917    if (!error_is_set(errp)) {
918        qmp_marshal_output_query_spice(retval, ret, errp);
919    }
920
921out:
922
923
924    if (local_err) {
925        qerror_report_err(local_err);
926        error_free(local_err);
927        return -1;
928    }
929    return 0;
930}
931
932static void qmp_marshal_output_query_balloon(BalloonInfo * ret_in, QObject **ret_out, Error **errp)
933{
934    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
935    QmpOutputVisitor *mo = qmp_output_visitor_new();
936    Visitor *v;
937
938    v = qmp_output_get_visitor(mo);
939    visit_type_BalloonInfo(v, &ret_in, "unused", errp);
940    if (!error_is_set(errp)) {
941        *ret_out = qmp_output_get_qobject(mo);
942    }
943    qmp_output_visitor_cleanup(mo);
944    v = qapi_dealloc_get_visitor(md);
945    visit_type_BalloonInfo(v, &ret_in, "unused", NULL);
946    qapi_dealloc_visitor_cleanup(md);
947}
948
949int qmp_marshal_input_query_balloon(Monitor *mon, const QDict *qdict, QObject **ret)
950{
951    Error *local_err = NULL;
952    Error **errp = &local_err;
953    QDict *args = (QDict *)qdict;
954    BalloonInfo * retval = NULL;
955    (void)args;
956    if (error_is_set(errp)) {
957        goto out;
958    }
959    retval = qmp_query_balloon(errp);
960    if (!error_is_set(errp)) {
961        qmp_marshal_output_query_balloon(retval, ret, errp);
962    }
963
964out:
965
966
967    if (local_err) {
968        qerror_report_err(local_err);
969        error_free(local_err);
970        return -1;
971    }
972    return 0;
973}
974
975static void qmp_marshal_output_query_pci(PciInfoList * ret_in, QObject **ret_out, Error **errp)
976{
977    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
978    QmpOutputVisitor *mo = qmp_output_visitor_new();
979    Visitor *v;
980
981    v = qmp_output_get_visitor(mo);
982    visit_type_PciInfoList(v, &ret_in, "unused", errp);
983    if (!error_is_set(errp)) {
984        *ret_out = qmp_output_get_qobject(mo);
985    }
986    qmp_output_visitor_cleanup(mo);
987    v = qapi_dealloc_get_visitor(md);
988    visit_type_PciInfoList(v, &ret_in, "unused", NULL);
989    qapi_dealloc_visitor_cleanup(md);
990}
991
992int qmp_marshal_input_query_pci(Monitor *mon, const QDict *qdict, QObject **ret)
993{
994    Error *local_err = NULL;
995    Error **errp = &local_err;
996    QDict *args = (QDict *)qdict;
997    PciInfoList * retval = NULL;
998    (void)args;
999    if (error_is_set(errp)) {
1000        goto out;
1001    }
1002    retval = qmp_query_pci(errp);
1003    if (!error_is_set(errp)) {
1004        qmp_marshal_output_query_pci(retval, ret, errp);
1005    }
1006
1007out:
1008
1009
1010    if (local_err) {
1011        qerror_report_err(local_err);
1012        error_free(local_err);
1013        return -1;
1014    }
1015    return 0;
1016}
1017
1018static void qmp_marshal_output_query_block_jobs(BlockJobInfoList * ret_in, QObject **ret_out, Error **errp)
1019{
1020    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
1021    QmpOutputVisitor *mo = qmp_output_visitor_new();
1022    Visitor *v;
1023
1024    v = qmp_output_get_visitor(mo);
1025    visit_type_BlockJobInfoList(v, &ret_in, "unused", errp);
1026    if (!error_is_set(errp)) {
1027        *ret_out = qmp_output_get_qobject(mo);
1028    }
1029    qmp_output_visitor_cleanup(mo);
1030    v = qapi_dealloc_get_visitor(md);
1031    visit_type_BlockJobInfoList(v, &ret_in, "unused", NULL);
1032    qapi_dealloc_visitor_cleanup(md);
1033}
1034
1035int qmp_marshal_input_query_block_jobs(Monitor *mon, const QDict *qdict, QObject **ret)
1036{
1037    Error *local_err = NULL;
1038    Error **errp = &local_err;
1039    QDict *args = (QDict *)qdict;
1040    BlockJobInfoList * retval = NULL;
1041    (void)args;
1042    if (error_is_set(errp)) {
1043        goto out;
1044    }
1045    retval = qmp_query_block_jobs(errp);
1046    if (!error_is_set(errp)) {
1047        qmp_marshal_output_query_block_jobs(retval, ret, errp);
1048    }
1049
1050out:
1051
1052
1053    if (local_err) {
1054        qerror_report_err(local_err);
1055        error_free(local_err);
1056        return -1;
1057    }
1058    return 0;
1059}
1060
1061int qmp_marshal_input_quit(Monitor *mon, const QDict *qdict, QObject **ret)
1062{
1063    Error *local_err = NULL;
1064    Error **errp = &local_err;
1065    QDict *args = (QDict *)qdict;
1066    (void)args;
1067    if (error_is_set(errp)) {
1068        goto out;
1069    }
1070    qmp_quit(errp);
1071
1072out:
1073
1074
1075    if (local_err) {
1076        qerror_report_err(local_err);
1077        error_free(local_err);
1078        return -1;
1079    }
1080    return 0;
1081}
1082
1083int qmp_marshal_input_stop(Monitor *mon, const QDict *qdict, QObject **ret)
1084{
1085    Error *local_err = NULL;
1086    Error **errp = &local_err;
1087    QDict *args = (QDict *)qdict;
1088    (void)args;
1089    if (error_is_set(errp)) {
1090        goto out;
1091    }
1092    qmp_stop(errp);
1093
1094out:
1095
1096
1097    if (local_err) {
1098        qerror_report_err(local_err);
1099        error_free(local_err);
1100        return -1;
1101    }
1102    return 0;
1103}
1104
1105int qmp_marshal_input_system_reset(Monitor *mon, const QDict *qdict, QObject **ret)
1106{
1107    Error *local_err = NULL;
1108    Error **errp = &local_err;
1109    QDict *args = (QDict *)qdict;
1110    (void)args;
1111    if (error_is_set(errp)) {
1112        goto out;
1113    }
1114    qmp_system_reset(errp);
1115
1116out:
1117
1118
1119    if (local_err) {
1120        qerror_report_err(local_err);
1121        error_free(local_err);
1122        return -1;
1123    }
1124    return 0;
1125}
1126
1127int qmp_marshal_input_system_powerdown(Monitor *mon, const QDict *qdict, QObject **ret)
1128{
1129    Error *local_err = NULL;
1130    Error **errp = &local_err;
1131    QDict *args = (QDict *)qdict;
1132    (void)args;
1133    if (error_is_set(errp)) {
1134        goto out;
1135    }
1136    qmp_system_powerdown(errp);
1137
1138out:
1139
1140
1141    if (local_err) {
1142        qerror_report_err(local_err);
1143        error_free(local_err);
1144        return -1;
1145    }
1146    return 0;
1147}
1148
1149int qmp_marshal_input_cpu(Monitor *mon, const QDict *qdict, QObject **ret)
1150{
1151    Error *local_err = NULL;
1152    Error **errp = &local_err;
1153    QDict *args = (QDict *)qdict;
1154    QmpInputVisitor *mi;
1155    QapiDeallocVisitor *md;
1156    Visitor *v;
1157    int64_t index;
1158
1159    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1160    v = qmp_input_get_visitor(mi);
1161    visit_type_int(v, &index, "index", errp);
1162    qmp_input_visitor_cleanup(mi);
1163
1164    if (error_is_set(errp)) {
1165        goto out;
1166    }
1167    qmp_cpu(index, errp);
1168
1169out:
1170    md = qapi_dealloc_visitor_new();
1171    v = qapi_dealloc_get_visitor(md);
1172    visit_type_int(v, &index, "index", NULL);
1173    qapi_dealloc_visitor_cleanup(md);
1174
1175    if (local_err) {
1176        qerror_report_err(local_err);
1177        error_free(local_err);
1178        return -1;
1179    }
1180    return 0;
1181}
1182
1183int qmp_marshal_input_cpu_add(Monitor *mon, const QDict *qdict, QObject **ret)
1184{
1185    Error *local_err = NULL;
1186    Error **errp = &local_err;
1187    QDict *args = (QDict *)qdict;
1188    QmpInputVisitor *mi;
1189    QapiDeallocVisitor *md;
1190    Visitor *v;
1191    int64_t id;
1192
1193    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1194    v = qmp_input_get_visitor(mi);
1195    visit_type_int(v, &id, "id", errp);
1196    qmp_input_visitor_cleanup(mi);
1197
1198    if (error_is_set(errp)) {
1199        goto out;
1200    }
1201    qmp_cpu_add(id, errp);
1202
1203out:
1204    md = qapi_dealloc_visitor_new();
1205    v = qapi_dealloc_get_visitor(md);
1206    visit_type_int(v, &id, "id", NULL);
1207    qapi_dealloc_visitor_cleanup(md);
1208
1209    if (local_err) {
1210        qerror_report_err(local_err);
1211        error_free(local_err);
1212        return -1;
1213    }
1214    return 0;
1215}
1216
1217int qmp_marshal_input_memsave(Monitor *mon, const QDict *qdict, QObject **ret)
1218{
1219    Error *local_err = NULL;
1220    Error **errp = &local_err;
1221    QDict *args = (QDict *)qdict;
1222    QmpInputVisitor *mi;
1223    QapiDeallocVisitor *md;
1224    Visitor *v;
1225    int64_t val;
1226    int64_t size;
1227    char * filename = NULL;
1228    bool has_cpu_index = false;
1229    int64_t cpu_index;
1230
1231    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1232    v = qmp_input_get_visitor(mi);
1233    visit_type_int(v, &val, "val", errp);
1234    visit_type_int(v, &size, "size", errp);
1235    visit_type_str(v, &filename, "filename", errp);
1236    visit_start_optional(v, &has_cpu_index, "cpu-index", errp);
1237    if (has_cpu_index) {
1238        visit_type_int(v, &cpu_index, "cpu-index", errp);
1239    }
1240    visit_end_optional(v, errp);
1241    qmp_input_visitor_cleanup(mi);
1242
1243    if (error_is_set(errp)) {
1244        goto out;
1245    }
1246    qmp_memsave(val, size, filename, has_cpu_index, cpu_index, errp);
1247
1248out:
1249    md = qapi_dealloc_visitor_new();
1250    v = qapi_dealloc_get_visitor(md);
1251    visit_type_int(v, &val, "val", NULL);
1252    visit_type_int(v, &size, "size", NULL);
1253    visit_type_str(v, &filename, "filename", NULL);
1254    visit_start_optional(v, &has_cpu_index, "cpu-index", NULL);
1255    if (has_cpu_index) {
1256        visit_type_int(v, &cpu_index, "cpu-index", NULL);
1257    }
1258    visit_end_optional(v, NULL);
1259    qapi_dealloc_visitor_cleanup(md);
1260
1261    if (local_err) {
1262        qerror_report_err(local_err);
1263        error_free(local_err);
1264        return -1;
1265    }
1266    return 0;
1267}
1268
1269int qmp_marshal_input_pmemsave(Monitor *mon, const QDict *qdict, QObject **ret)
1270{
1271    Error *local_err = NULL;
1272    Error **errp = &local_err;
1273    QDict *args = (QDict *)qdict;
1274    QmpInputVisitor *mi;
1275    QapiDeallocVisitor *md;
1276    Visitor *v;
1277    int64_t val;
1278    int64_t size;
1279    char * filename = NULL;
1280
1281    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1282    v = qmp_input_get_visitor(mi);
1283    visit_type_int(v, &val, "val", errp);
1284    visit_type_int(v, &size, "size", errp);
1285    visit_type_str(v, &filename, "filename", errp);
1286    qmp_input_visitor_cleanup(mi);
1287
1288    if (error_is_set(errp)) {
1289        goto out;
1290    }
1291    qmp_pmemsave(val, size, filename, errp);
1292
1293out:
1294    md = qapi_dealloc_visitor_new();
1295    v = qapi_dealloc_get_visitor(md);
1296    visit_type_int(v, &val, "val", NULL);
1297    visit_type_int(v, &size, "size", NULL);
1298    visit_type_str(v, &filename, "filename", NULL);
1299    qapi_dealloc_visitor_cleanup(md);
1300
1301    if (local_err) {
1302        qerror_report_err(local_err);
1303        error_free(local_err);
1304        return -1;
1305    }
1306    return 0;
1307}
1308
1309int qmp_marshal_input_cont(Monitor *mon, const QDict *qdict, QObject **ret)
1310{
1311    Error *local_err = NULL;
1312    Error **errp = &local_err;
1313    QDict *args = (QDict *)qdict;
1314    (void)args;
1315    if (error_is_set(errp)) {
1316        goto out;
1317    }
1318    qmp_cont(errp);
1319
1320out:
1321
1322
1323    if (local_err) {
1324        qerror_report_err(local_err);
1325        error_free(local_err);
1326        return -1;
1327    }
1328    return 0;
1329}
1330
1331int qmp_marshal_input_system_wakeup(Monitor *mon, const QDict *qdict, QObject **ret)
1332{
1333    Error *local_err = NULL;
1334    Error **errp = &local_err;
1335    QDict *args = (QDict *)qdict;
1336    (void)args;
1337    if (error_is_set(errp)) {
1338        goto out;
1339    }
1340    qmp_system_wakeup(errp);
1341
1342out:
1343
1344
1345    if (local_err) {
1346        qerror_report_err(local_err);
1347        error_free(local_err);
1348        return -1;
1349    }
1350    return 0;
1351}
1352
1353int qmp_marshal_input_inject_nmi(Monitor *mon, const QDict *qdict, QObject **ret)
1354{
1355    Error *local_err = NULL;
1356    Error **errp = &local_err;
1357    QDict *args = (QDict *)qdict;
1358    (void)args;
1359    if (error_is_set(errp)) {
1360        goto out;
1361    }
1362    qmp_inject_nmi(errp);
1363
1364out:
1365
1366
1367    if (local_err) {
1368        qerror_report_err(local_err);
1369        error_free(local_err);
1370        return -1;
1371    }
1372    return 0;
1373}
1374
1375int qmp_marshal_input_set_link(Monitor *mon, const QDict *qdict, QObject **ret)
1376{
1377    Error *local_err = NULL;
1378    Error **errp = &local_err;
1379    QDict *args = (QDict *)qdict;
1380    QmpInputVisitor *mi;
1381    QapiDeallocVisitor *md;
1382    Visitor *v;
1383    char * name = NULL;
1384    bool up;
1385
1386    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1387    v = qmp_input_get_visitor(mi);
1388    visit_type_str(v, &name, "name", errp);
1389    visit_type_bool(v, &up, "up", errp);
1390    qmp_input_visitor_cleanup(mi);
1391
1392    if (error_is_set(errp)) {
1393        goto out;
1394    }
1395    qmp_set_link(name, up, errp);
1396
1397out:
1398    md = qapi_dealloc_visitor_new();
1399    v = qapi_dealloc_get_visitor(md);
1400    visit_type_str(v, &name, "name", NULL);
1401    visit_type_bool(v, &up, "up", NULL);
1402    qapi_dealloc_visitor_cleanup(md);
1403
1404    if (local_err) {
1405        qerror_report_err(local_err);
1406        error_free(local_err);
1407        return -1;
1408    }
1409    return 0;
1410}
1411
1412int qmp_marshal_input_block_passwd(Monitor *mon, const QDict *qdict, QObject **ret)
1413{
1414    Error *local_err = NULL;
1415    Error **errp = &local_err;
1416    QDict *args = (QDict *)qdict;
1417    QmpInputVisitor *mi;
1418    QapiDeallocVisitor *md;
1419    Visitor *v;
1420    char * device = NULL;
1421    char * password = NULL;
1422
1423    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1424    v = qmp_input_get_visitor(mi);
1425    visit_type_str(v, &device, "device", errp);
1426    visit_type_str(v, &password, "password", errp);
1427    qmp_input_visitor_cleanup(mi);
1428
1429    if (error_is_set(errp)) {
1430        goto out;
1431    }
1432    qmp_block_passwd(device, password, errp);
1433
1434out:
1435    md = qapi_dealloc_visitor_new();
1436    v = qapi_dealloc_get_visitor(md);
1437    visit_type_str(v, &device, "device", NULL);
1438    visit_type_str(v, &password, "password", NULL);
1439    qapi_dealloc_visitor_cleanup(md);
1440
1441    if (local_err) {
1442        qerror_report_err(local_err);
1443        error_free(local_err);
1444        return -1;
1445    }
1446    return 0;
1447}
1448
1449int qmp_marshal_input_balloon(Monitor *mon, const QDict *qdict, QObject **ret)
1450{
1451    Error *local_err = NULL;
1452    Error **errp = &local_err;
1453    QDict *args = (QDict *)qdict;
1454    QmpInputVisitor *mi;
1455    QapiDeallocVisitor *md;
1456    Visitor *v;
1457    int64_t value;
1458
1459    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1460    v = qmp_input_get_visitor(mi);
1461    visit_type_int(v, &value, "value", errp);
1462    qmp_input_visitor_cleanup(mi);
1463
1464    if (error_is_set(errp)) {
1465        goto out;
1466    }
1467    qmp_balloon(value, errp);
1468
1469out:
1470    md = qapi_dealloc_visitor_new();
1471    v = qapi_dealloc_get_visitor(md);
1472    visit_type_int(v, &value, "value", NULL);
1473    qapi_dealloc_visitor_cleanup(md);
1474
1475    if (local_err) {
1476        qerror_report_err(local_err);
1477        error_free(local_err);
1478        return -1;
1479    }
1480    return 0;
1481}
1482
1483int qmp_marshal_input_block_resize(Monitor *mon, const QDict *qdict, QObject **ret)
1484{
1485    Error *local_err = NULL;
1486    Error **errp = &local_err;
1487    QDict *args = (QDict *)qdict;
1488    QmpInputVisitor *mi;
1489    QapiDeallocVisitor *md;
1490    Visitor *v;
1491    char * device = NULL;
1492    int64_t size;
1493
1494    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1495    v = qmp_input_get_visitor(mi);
1496    visit_type_str(v, &device, "device", errp);
1497    visit_type_int(v, &size, "size", errp);
1498    qmp_input_visitor_cleanup(mi);
1499
1500    if (error_is_set(errp)) {
1501        goto out;
1502    }
1503    qmp_block_resize(device, size, errp);
1504
1505out:
1506    md = qapi_dealloc_visitor_new();
1507    v = qapi_dealloc_get_visitor(md);
1508    visit_type_str(v, &device, "device", NULL);
1509    visit_type_int(v, &size, "size", NULL);
1510    qapi_dealloc_visitor_cleanup(md);
1511
1512    if (local_err) {
1513        qerror_report_err(local_err);
1514        error_free(local_err);
1515        return -1;
1516    }
1517    return 0;
1518}
1519
1520int qmp_marshal_input_transaction(Monitor *mon, const QDict *qdict, QObject **ret)
1521{
1522    Error *local_err = NULL;
1523    Error **errp = &local_err;
1524    QDict *args = (QDict *)qdict;
1525    QmpInputVisitor *mi;
1526    QapiDeallocVisitor *md;
1527    Visitor *v;
1528    TransactionActionList * actions = NULL;
1529
1530    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1531    v = qmp_input_get_visitor(mi);
1532    visit_type_TransactionActionList(v, &actions, "actions", errp);
1533    qmp_input_visitor_cleanup(mi);
1534
1535    if (error_is_set(errp)) {
1536        goto out;
1537    }
1538    qmp_transaction(actions, errp);
1539
1540out:
1541    md = qapi_dealloc_visitor_new();
1542    v = qapi_dealloc_get_visitor(md);
1543    visit_type_TransactionActionList(v, &actions, "actions", NULL);
1544    qapi_dealloc_visitor_cleanup(md);
1545
1546    if (local_err) {
1547        qerror_report_err(local_err);
1548        error_free(local_err);
1549        return -1;
1550    }
1551    return 0;
1552}
1553
1554int qmp_marshal_input_blockdev_snapshot_sync(Monitor *mon, const QDict *qdict, QObject **ret)
1555{
1556    Error *local_err = NULL;
1557    Error **errp = &local_err;
1558    QDict *args = (QDict *)qdict;
1559    QmpInputVisitor *mi;
1560    QapiDeallocVisitor *md;
1561    Visitor *v;
1562    char * device = NULL;
1563    char * snapshot_file = NULL;
1564    bool has_format = false;
1565    char * format = NULL;
1566    bool has_mode = false;
1567    NewImageMode mode;
1568
1569    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1570    v = qmp_input_get_visitor(mi);
1571    visit_type_str(v, &device, "device", errp);
1572    visit_type_str(v, &snapshot_file, "snapshot-file", errp);
1573    visit_start_optional(v, &has_format, "format", errp);
1574    if (has_format) {
1575        visit_type_str(v, &format, "format", errp);
1576    }
1577    visit_end_optional(v, errp);
1578    visit_start_optional(v, &has_mode, "mode", errp);
1579    if (has_mode) {
1580        visit_type_NewImageMode(v, &mode, "mode", errp);
1581    }
1582    visit_end_optional(v, errp);
1583    qmp_input_visitor_cleanup(mi);
1584
1585    if (error_is_set(errp)) {
1586        goto out;
1587    }
1588    qmp_blockdev_snapshot_sync(device, snapshot_file, has_format, format, has_mode, mode, errp);
1589
1590out:
1591    md = qapi_dealloc_visitor_new();
1592    v = qapi_dealloc_get_visitor(md);
1593    visit_type_str(v, &device, "device", NULL);
1594    visit_type_str(v, &snapshot_file, "snapshot-file", NULL);
1595    visit_start_optional(v, &has_format, "format", NULL);
1596    if (has_format) {
1597        visit_type_str(v, &format, "format", NULL);
1598    }
1599    visit_end_optional(v, NULL);
1600    visit_start_optional(v, &has_mode, "mode", NULL);
1601    if (has_mode) {
1602        visit_type_NewImageMode(v, &mode, "mode", NULL);
1603    }
1604    visit_end_optional(v, NULL);
1605    qapi_dealloc_visitor_cleanup(md);
1606
1607    if (local_err) {
1608        qerror_report_err(local_err);
1609        error_free(local_err);
1610        return -1;
1611    }
1612    return 0;
1613}
1614
1615int qmp_marshal_input_blockdev_snapshot_internal_sync(Monitor *mon, const QDict *qdict, QObject **ret)
1616{
1617    Error *local_err = NULL;
1618    Error **errp = &local_err;
1619    QDict *args = (QDict *)qdict;
1620    QmpInputVisitor *mi;
1621    QapiDeallocVisitor *md;
1622    Visitor *v;
1623    char * device = NULL;
1624    char * name = NULL;
1625
1626    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1627    v = qmp_input_get_visitor(mi);
1628    visit_type_str(v, &device, "device", errp);
1629    visit_type_str(v, &name, "name", errp);
1630    qmp_input_visitor_cleanup(mi);
1631
1632    if (error_is_set(errp)) {
1633        goto out;
1634    }
1635    qmp_blockdev_snapshot_internal_sync(device, name, errp);
1636
1637out:
1638    md = qapi_dealloc_visitor_new();
1639    v = qapi_dealloc_get_visitor(md);
1640    visit_type_str(v, &device, "device", NULL);
1641    visit_type_str(v, &name, "name", NULL);
1642    qapi_dealloc_visitor_cleanup(md);
1643
1644    if (local_err) {
1645        qerror_report_err(local_err);
1646        error_free(local_err);
1647        return -1;
1648    }
1649    return 0;
1650}
1651
1652static void qmp_marshal_output_blockdev_snapshot_delete_internal_sync(SnapshotInfo * ret_in, QObject **ret_out, Error **errp)
1653{
1654    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
1655    QmpOutputVisitor *mo = qmp_output_visitor_new();
1656    Visitor *v;
1657
1658    v = qmp_output_get_visitor(mo);
1659    visit_type_SnapshotInfo(v, &ret_in, "unused", errp);
1660    if (!error_is_set(errp)) {
1661        *ret_out = qmp_output_get_qobject(mo);
1662    }
1663    qmp_output_visitor_cleanup(mo);
1664    v = qapi_dealloc_get_visitor(md);
1665    visit_type_SnapshotInfo(v, &ret_in, "unused", NULL);
1666    qapi_dealloc_visitor_cleanup(md);
1667}
1668
1669int qmp_marshal_input_blockdev_snapshot_delete_internal_sync(Monitor *mon, const QDict *qdict, QObject **ret)
1670{
1671    Error *local_err = NULL;
1672    Error **errp = &local_err;
1673    QDict *args = (QDict *)qdict;
1674    SnapshotInfo * retval = NULL;
1675    QmpInputVisitor *mi;
1676    QapiDeallocVisitor *md;
1677    Visitor *v;
1678    char * device = NULL;
1679    bool has_id = false;
1680    char * id = NULL;
1681    bool has_name = false;
1682    char * name = NULL;
1683
1684    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1685    v = qmp_input_get_visitor(mi);
1686    visit_type_str(v, &device, "device", errp);
1687    visit_start_optional(v, &has_id, "id", errp);
1688    if (has_id) {
1689        visit_type_str(v, &id, "id", errp);
1690    }
1691    visit_end_optional(v, errp);
1692    visit_start_optional(v, &has_name, "name", errp);
1693    if (has_name) {
1694        visit_type_str(v, &name, "name", errp);
1695    }
1696    visit_end_optional(v, errp);
1697    qmp_input_visitor_cleanup(mi);
1698
1699    if (error_is_set(errp)) {
1700        goto out;
1701    }
1702    retval = qmp_blockdev_snapshot_delete_internal_sync(device, has_id, id, has_name, name, errp);
1703    if (!error_is_set(errp)) {
1704        qmp_marshal_output_blockdev_snapshot_delete_internal_sync(retval, ret, errp);
1705    }
1706
1707out:
1708    md = qapi_dealloc_visitor_new();
1709    v = qapi_dealloc_get_visitor(md);
1710    visit_type_str(v, &device, "device", NULL);
1711    visit_start_optional(v, &has_id, "id", NULL);
1712    if (has_id) {
1713        visit_type_str(v, &id, "id", NULL);
1714    }
1715    visit_end_optional(v, NULL);
1716    visit_start_optional(v, &has_name, "name", NULL);
1717    if (has_name) {
1718        visit_type_str(v, &name, "name", NULL);
1719    }
1720    visit_end_optional(v, NULL);
1721    qapi_dealloc_visitor_cleanup(md);
1722
1723    if (local_err) {
1724        qerror_report_err(local_err);
1725        error_free(local_err);
1726        return -1;
1727    }
1728    return 0;
1729}
1730
1731static void qmp_marshal_output_human_monitor_command(char * ret_in, QObject **ret_out, Error **errp)
1732{
1733    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
1734    QmpOutputVisitor *mo = qmp_output_visitor_new();
1735    Visitor *v;
1736
1737    v = qmp_output_get_visitor(mo);
1738    visit_type_str(v, &ret_in, "unused", errp);
1739    if (!error_is_set(errp)) {
1740        *ret_out = qmp_output_get_qobject(mo);
1741    }
1742    qmp_output_visitor_cleanup(mo);
1743    v = qapi_dealloc_get_visitor(md);
1744    visit_type_str(v, &ret_in, "unused", NULL);
1745    qapi_dealloc_visitor_cleanup(md);
1746}
1747
1748int qmp_marshal_input_human_monitor_command(Monitor *mon, const QDict *qdict, QObject **ret)
1749{
1750    Error *local_err = NULL;
1751    Error **errp = &local_err;
1752    QDict *args = (QDict *)qdict;
1753    char * retval = NULL;
1754    QmpInputVisitor *mi;
1755    QapiDeallocVisitor *md;
1756    Visitor *v;
1757    char * command_line = NULL;
1758    bool has_cpu_index = false;
1759    int64_t cpu_index;
1760
1761    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1762    v = qmp_input_get_visitor(mi);
1763    visit_type_str(v, &command_line, "command-line", errp);
1764    visit_start_optional(v, &has_cpu_index, "cpu-index", errp);
1765    if (has_cpu_index) {
1766        visit_type_int(v, &cpu_index, "cpu-index", errp);
1767    }
1768    visit_end_optional(v, errp);
1769    qmp_input_visitor_cleanup(mi);
1770
1771    if (error_is_set(errp)) {
1772        goto out;
1773    }
1774    retval = qmp_human_monitor_command(command_line, has_cpu_index, cpu_index, errp);
1775    if (!error_is_set(errp)) {
1776        qmp_marshal_output_human_monitor_command(retval, ret, errp);
1777    }
1778
1779out:
1780    md = qapi_dealloc_visitor_new();
1781    v = qapi_dealloc_get_visitor(md);
1782    visit_type_str(v, &command_line, "command-line", NULL);
1783    visit_start_optional(v, &has_cpu_index, "cpu-index", NULL);
1784    if (has_cpu_index) {
1785        visit_type_int(v, &cpu_index, "cpu-index", NULL);
1786    }
1787    visit_end_optional(v, NULL);
1788    qapi_dealloc_visitor_cleanup(md);
1789
1790    if (local_err) {
1791        qerror_report_err(local_err);
1792        error_free(local_err);
1793        return -1;
1794    }
1795    return 0;
1796}
1797
1798int qmp_marshal_input_block_commit(Monitor *mon, const QDict *qdict, QObject **ret)
1799{
1800    Error *local_err = NULL;
1801    Error **errp = &local_err;
1802    QDict *args = (QDict *)qdict;
1803    QmpInputVisitor *mi;
1804    QapiDeallocVisitor *md;
1805    Visitor *v;
1806    char * device = NULL;
1807    bool has_base = false;
1808    char * base = NULL;
1809    char * top = NULL;
1810    bool has_speed = false;
1811    int64_t speed;
1812
1813    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1814    v = qmp_input_get_visitor(mi);
1815    visit_type_str(v, &device, "device", errp);
1816    visit_start_optional(v, &has_base, "base", errp);
1817    if (has_base) {
1818        visit_type_str(v, &base, "base", errp);
1819    }
1820    visit_end_optional(v, errp);
1821    visit_type_str(v, &top, "top", errp);
1822    visit_start_optional(v, &has_speed, "speed", errp);
1823    if (has_speed) {
1824        visit_type_int(v, &speed, "speed", errp);
1825    }
1826    visit_end_optional(v, errp);
1827    qmp_input_visitor_cleanup(mi);
1828
1829    if (error_is_set(errp)) {
1830        goto out;
1831    }
1832    qmp_block_commit(device, has_base, base, top, has_speed, speed, errp);
1833
1834out:
1835    md = qapi_dealloc_visitor_new();
1836    v = qapi_dealloc_get_visitor(md);
1837    visit_type_str(v, &device, "device", NULL);
1838    visit_start_optional(v, &has_base, "base", NULL);
1839    if (has_base) {
1840        visit_type_str(v, &base, "base", NULL);
1841    }
1842    visit_end_optional(v, NULL);
1843    visit_type_str(v, &top, "top", NULL);
1844    visit_start_optional(v, &has_speed, "speed", NULL);
1845    if (has_speed) {
1846        visit_type_int(v, &speed, "speed", NULL);
1847    }
1848    visit_end_optional(v, NULL);
1849    qapi_dealloc_visitor_cleanup(md);
1850
1851    if (local_err) {
1852        qerror_report_err(local_err);
1853        error_free(local_err);
1854        return -1;
1855    }
1856    return 0;
1857}
1858
1859int qmp_marshal_input_drive_backup(Monitor *mon, const QDict *qdict, QObject **ret)
1860{
1861    Error *local_err = NULL;
1862    Error **errp = &local_err;
1863    QDict *args = (QDict *)qdict;
1864    QmpInputVisitor *mi;
1865    QapiDeallocVisitor *md;
1866    Visitor *v;
1867    char * device = NULL;
1868    char * target = NULL;
1869    bool has_format = false;
1870    char * format = NULL;
1871    MirrorSyncMode sync;
1872    bool has_mode = false;
1873    NewImageMode mode;
1874    bool has_speed = false;
1875    int64_t speed;
1876    bool has_on_source_error = false;
1877    BlockdevOnError on_source_error;
1878    bool has_on_target_error = false;
1879    BlockdevOnError on_target_error;
1880
1881    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1882    v = qmp_input_get_visitor(mi);
1883    visit_type_str(v, &device, "device", errp);
1884    visit_type_str(v, &target, "target", errp);
1885    visit_start_optional(v, &has_format, "format", errp);
1886    if (has_format) {
1887        visit_type_str(v, &format, "format", errp);
1888    }
1889    visit_end_optional(v, errp);
1890    visit_type_MirrorSyncMode(v, &sync, "sync", errp);
1891    visit_start_optional(v, &has_mode, "mode", errp);
1892    if (has_mode) {
1893        visit_type_NewImageMode(v, &mode, "mode", errp);
1894    }
1895    visit_end_optional(v, errp);
1896    visit_start_optional(v, &has_speed, "speed", errp);
1897    if (has_speed) {
1898        visit_type_int(v, &speed, "speed", errp);
1899    }
1900    visit_end_optional(v, errp);
1901    visit_start_optional(v, &has_on_source_error, "on-source-error", errp);
1902    if (has_on_source_error) {
1903        visit_type_BlockdevOnError(v, &on_source_error, "on-source-error", errp);
1904    }
1905    visit_end_optional(v, errp);
1906    visit_start_optional(v, &has_on_target_error, "on-target-error", errp);
1907    if (has_on_target_error) {
1908        visit_type_BlockdevOnError(v, &on_target_error, "on-target-error", errp);
1909    }
1910    visit_end_optional(v, errp);
1911    qmp_input_visitor_cleanup(mi);
1912
1913    if (error_is_set(errp)) {
1914        goto out;
1915    }
1916    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);
1917
1918out:
1919    md = qapi_dealloc_visitor_new();
1920    v = qapi_dealloc_get_visitor(md);
1921    visit_type_str(v, &device, "device", NULL);
1922    visit_type_str(v, &target, "target", NULL);
1923    visit_start_optional(v, &has_format, "format", NULL);
1924    if (has_format) {
1925        visit_type_str(v, &format, "format", NULL);
1926    }
1927    visit_end_optional(v, NULL);
1928    visit_type_MirrorSyncMode(v, &sync, "sync", NULL);
1929    visit_start_optional(v, &has_mode, "mode", NULL);
1930    if (has_mode) {
1931        visit_type_NewImageMode(v, &mode, "mode", NULL);
1932    }
1933    visit_end_optional(v, NULL);
1934    visit_start_optional(v, &has_speed, "speed", NULL);
1935    if (has_speed) {
1936        visit_type_int(v, &speed, "speed", NULL);
1937    }
1938    visit_end_optional(v, NULL);
1939    visit_start_optional(v, &has_on_source_error, "on-source-error", NULL);
1940    if (has_on_source_error) {
1941        visit_type_BlockdevOnError(v, &on_source_error, "on-source-error", NULL);
1942    }
1943    visit_end_optional(v, NULL);
1944    visit_start_optional(v, &has_on_target_error, "on-target-error", NULL);
1945    if (has_on_target_error) {
1946        visit_type_BlockdevOnError(v, &on_target_error, "on-target-error", NULL);
1947    }
1948    visit_end_optional(v, NULL);
1949    qapi_dealloc_visitor_cleanup(md);
1950
1951    if (local_err) {
1952        qerror_report_err(local_err);
1953        error_free(local_err);
1954        return -1;
1955    }
1956    return 0;
1957}
1958
1959int qmp_marshal_input_drive_mirror(Monitor *mon, const QDict *qdict, QObject **ret)
1960{
1961    Error *local_err = NULL;
1962    Error **errp = &local_err;
1963    QDict *args = (QDict *)qdict;
1964    QmpInputVisitor *mi;
1965    QapiDeallocVisitor *md;
1966    Visitor *v;
1967    char * device = NULL;
1968    char * target = NULL;
1969    bool has_format = false;
1970    char * format = NULL;
1971    MirrorSyncMode sync;
1972    bool has_mode = false;
1973    NewImageMode mode;
1974    bool has_speed = false;
1975    int64_t speed;
1976    bool has_granularity = false;
1977    uint32_t granularity;
1978    bool has_buf_size = false;
1979    int64_t buf_size;
1980    bool has_on_source_error = false;
1981    BlockdevOnError on_source_error;
1982    bool has_on_target_error = false;
1983    BlockdevOnError on_target_error;
1984
1985    mi = qmp_input_visitor_new_strict(QOBJECT(args));
1986    v = qmp_input_get_visitor(mi);
1987    visit_type_str(v, &device, "device", errp);
1988    visit_type_str(v, &target, "target", errp);
1989    visit_start_optional(v, &has_format, "format", errp);
1990    if (has_format) {
1991        visit_type_str(v, &format, "format", errp);
1992    }
1993    visit_end_optional(v, errp);
1994    visit_type_MirrorSyncMode(v, &sync, "sync", errp);
1995    visit_start_optional(v, &has_mode, "mode", errp);
1996    if (has_mode) {
1997        visit_type_NewImageMode(v, &mode, "mode", errp);
1998    }
1999    visit_end_optional(v, errp);
2000    visit_start_optional(v, &has_speed, "speed", errp);
2001    if (has_speed) {
2002        visit_type_int(v, &speed, "speed", errp);
2003    }
2004    visit_end_optional(v, errp);
2005    visit_start_optional(v, &has_granularity, "granularity", errp);
2006    if (has_granularity) {
2007        visit_type_uint32(v, &granularity, "granularity", errp);
2008    }
2009    visit_end_optional(v, errp);
2010    visit_start_optional(v, &has_buf_size, "buf-size", errp);
2011    if (has_buf_size) {
2012        visit_type_int(v, &buf_size, "buf-size", errp);
2013    }
2014    visit_end_optional(v, errp);
2015    visit_start_optional(v, &has_on_source_error, "on-source-error", errp);
2016    if (has_on_source_error) {
2017        visit_type_BlockdevOnError(v, &on_source_error, "on-source-error", errp);
2018    }
2019    visit_end_optional(v, errp);
2020    visit_start_optional(v, &has_on_target_error, "on-target-error", errp);
2021    if (has_on_target_error) {
2022        visit_type_BlockdevOnError(v, &on_target_error, "on-target-error", errp);
2023    }
2024    visit_end_optional(v, errp);
2025    qmp_input_visitor_cleanup(mi);
2026
2027    if (error_is_set(errp)) {
2028        goto out;
2029    }
2030    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);
2031
2032out:
2033    md = qapi_dealloc_visitor_new();
2034    v = qapi_dealloc_get_visitor(md);
2035    visit_type_str(v, &device, "device", NULL);
2036    visit_type_str(v, &target, "target", NULL);
2037    visit_start_optional(v, &has_format, "format", NULL);
2038    if (has_format) {
2039        visit_type_str(v, &format, "format", NULL);
2040    }
2041    visit_end_optional(v, NULL);
2042    visit_type_MirrorSyncMode(v, &sync, "sync", NULL);
2043    visit_start_optional(v, &has_mode, "mode", NULL);
2044    if (has_mode) {
2045        visit_type_NewImageMode(v, &mode, "mode", NULL);
2046    }
2047    visit_end_optional(v, NULL);
2048    visit_start_optional(v, &has_speed, "speed", NULL);
2049    if (has_speed) {
2050        visit_type_int(v, &speed, "speed", NULL);
2051    }
2052    visit_end_optional(v, NULL);
2053    visit_start_optional(v, &has_granularity, "granularity", NULL);
2054    if (has_granularity) {
2055        visit_type_uint32(v, &granularity, "granularity", NULL);
2056    }
2057    visit_end_optional(v, NULL);
2058    visit_start_optional(v, &has_buf_size, "buf-size", NULL);
2059    if (has_buf_size) {
2060        visit_type_int(v, &buf_size, "buf-size", NULL);
2061    }
2062    visit_end_optional(v, NULL);
2063    visit_start_optional(v, &has_on_source_error, "on-source-error", NULL);
2064    if (has_on_source_error) {
2065        visit_type_BlockdevOnError(v, &on_source_error, "on-source-error", NULL);
2066    }
2067    visit_end_optional(v, NULL);
2068    visit_start_optional(v, &has_on_target_error, "on-target-error", NULL);
2069    if (has_on_target_error) {
2070        visit_type_BlockdevOnError(v, &on_target_error, "on-target-error", NULL);
2071    }
2072    visit_end_optional(v, NULL);
2073    qapi_dealloc_visitor_cleanup(md);
2074
2075    if (local_err) {
2076        qerror_report_err(local_err);
2077        error_free(local_err);
2078        return -1;
2079    }
2080    return 0;
2081}
2082
2083int qmp_marshal_input_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret)
2084{
2085    Error *local_err = NULL;
2086    Error **errp = &local_err;
2087    QDict *args = (QDict *)qdict;
2088    (void)args;
2089    if (error_is_set(errp)) {
2090        goto out;
2091    }
2092    qmp_migrate_cancel(errp);
2093
2094out:
2095
2096
2097    if (local_err) {
2098        qerror_report_err(local_err);
2099        error_free(local_err);
2100        return -1;
2101    }
2102    return 0;
2103}
2104
2105int qmp_marshal_input_migrate_set_downtime(Monitor *mon, const QDict *qdict, QObject **ret)
2106{
2107    Error *local_err = NULL;
2108    Error **errp = &local_err;
2109    QDict *args = (QDict *)qdict;
2110    QmpInputVisitor *mi;
2111    QapiDeallocVisitor *md;
2112    Visitor *v;
2113    double value;
2114
2115    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2116    v = qmp_input_get_visitor(mi);
2117    visit_type_number(v, &value, "value", errp);
2118    qmp_input_visitor_cleanup(mi);
2119
2120    if (error_is_set(errp)) {
2121        goto out;
2122    }
2123    qmp_migrate_set_downtime(value, errp);
2124
2125out:
2126    md = qapi_dealloc_visitor_new();
2127    v = qapi_dealloc_get_visitor(md);
2128    visit_type_number(v, &value, "value", NULL);
2129    qapi_dealloc_visitor_cleanup(md);
2130
2131    if (local_err) {
2132        qerror_report_err(local_err);
2133        error_free(local_err);
2134        return -1;
2135    }
2136    return 0;
2137}
2138
2139int qmp_marshal_input_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret)
2140{
2141    Error *local_err = NULL;
2142    Error **errp = &local_err;
2143    QDict *args = (QDict *)qdict;
2144    QmpInputVisitor *mi;
2145    QapiDeallocVisitor *md;
2146    Visitor *v;
2147    int64_t value;
2148
2149    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2150    v = qmp_input_get_visitor(mi);
2151    visit_type_int(v, &value, "value", errp);
2152    qmp_input_visitor_cleanup(mi);
2153
2154    if (error_is_set(errp)) {
2155        goto out;
2156    }
2157    qmp_migrate_set_speed(value, errp);
2158
2159out:
2160    md = qapi_dealloc_visitor_new();
2161    v = qapi_dealloc_get_visitor(md);
2162    visit_type_int(v, &value, "value", NULL);
2163    qapi_dealloc_visitor_cleanup(md);
2164
2165    if (local_err) {
2166        qerror_report_err(local_err);
2167        error_free(local_err);
2168        return -1;
2169    }
2170    return 0;
2171}
2172
2173int qmp_marshal_input_migrate_set_cache_size(Monitor *mon, const QDict *qdict, QObject **ret)
2174{
2175    Error *local_err = NULL;
2176    Error **errp = &local_err;
2177    QDict *args = (QDict *)qdict;
2178    QmpInputVisitor *mi;
2179    QapiDeallocVisitor *md;
2180    Visitor *v;
2181    int64_t value;
2182
2183    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2184    v = qmp_input_get_visitor(mi);
2185    visit_type_int(v, &value, "value", errp);
2186    qmp_input_visitor_cleanup(mi);
2187
2188    if (error_is_set(errp)) {
2189        goto out;
2190    }
2191    qmp_migrate_set_cache_size(value, errp);
2192
2193out:
2194    md = qapi_dealloc_visitor_new();
2195    v = qapi_dealloc_get_visitor(md);
2196    visit_type_int(v, &value, "value", NULL);
2197    qapi_dealloc_visitor_cleanup(md);
2198
2199    if (local_err) {
2200        qerror_report_err(local_err);
2201        error_free(local_err);
2202        return -1;
2203    }
2204    return 0;
2205}
2206
2207static void qmp_marshal_output_query_migrate_cache_size(int64_t ret_in, QObject **ret_out, Error **errp)
2208{
2209    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
2210    QmpOutputVisitor *mo = qmp_output_visitor_new();
2211    Visitor *v;
2212
2213    v = qmp_output_get_visitor(mo);
2214    visit_type_int(v, &ret_in, "unused", errp);
2215    if (!error_is_set(errp)) {
2216        *ret_out = qmp_output_get_qobject(mo);
2217    }
2218    qmp_output_visitor_cleanup(mo);
2219    v = qapi_dealloc_get_visitor(md);
2220    visit_type_int(v, &ret_in, "unused", NULL);
2221    qapi_dealloc_visitor_cleanup(md);
2222}
2223
2224int qmp_marshal_input_query_migrate_cache_size(Monitor *mon, const QDict *qdict, QObject **ret)
2225{
2226    Error *local_err = NULL;
2227    Error **errp = &local_err;
2228    QDict *args = (QDict *)qdict;
2229    int64_t retval;
2230    (void)args;
2231    if (error_is_set(errp)) {
2232        goto out;
2233    }
2234    retval = qmp_query_migrate_cache_size(errp);
2235    if (!error_is_set(errp)) {
2236        qmp_marshal_output_query_migrate_cache_size(retval, ret, errp);
2237    }
2238
2239out:
2240
2241
2242    if (local_err) {
2243        qerror_report_err(local_err);
2244        error_free(local_err);
2245        return -1;
2246    }
2247    return 0;
2248}
2249
2250static void qmp_marshal_output_qom_list(ObjectPropertyInfoList * ret_in, QObject **ret_out, Error **errp)
2251{
2252    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
2253    QmpOutputVisitor *mo = qmp_output_visitor_new();
2254    Visitor *v;
2255
2256    v = qmp_output_get_visitor(mo);
2257    visit_type_ObjectPropertyInfoList(v, &ret_in, "unused", errp);
2258    if (!error_is_set(errp)) {
2259        *ret_out = qmp_output_get_qobject(mo);
2260    }
2261    qmp_output_visitor_cleanup(mo);
2262    v = qapi_dealloc_get_visitor(md);
2263    visit_type_ObjectPropertyInfoList(v, &ret_in, "unused", NULL);
2264    qapi_dealloc_visitor_cleanup(md);
2265}
2266
2267int qmp_marshal_input_qom_list(Monitor *mon, const QDict *qdict, QObject **ret)
2268{
2269    Error *local_err = NULL;
2270    Error **errp = &local_err;
2271    QDict *args = (QDict *)qdict;
2272    ObjectPropertyInfoList * retval = NULL;
2273    QmpInputVisitor *mi;
2274    QapiDeallocVisitor *md;
2275    Visitor *v;
2276    char * path = NULL;
2277
2278    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2279    v = qmp_input_get_visitor(mi);
2280    visit_type_str(v, &path, "path", errp);
2281    qmp_input_visitor_cleanup(mi);
2282
2283    if (error_is_set(errp)) {
2284        goto out;
2285    }
2286    retval = qmp_qom_list(path, errp);
2287    if (!error_is_set(errp)) {
2288        qmp_marshal_output_qom_list(retval, ret, errp);
2289    }
2290
2291out:
2292    md = qapi_dealloc_visitor_new();
2293    v = qapi_dealloc_get_visitor(md);
2294    visit_type_str(v, &path, "path", NULL);
2295    qapi_dealloc_visitor_cleanup(md);
2296
2297    if (local_err) {
2298        qerror_report_err(local_err);
2299        error_free(local_err);
2300        return -1;
2301    }
2302    return 0;
2303}
2304
2305int qmp_marshal_input_set_password(Monitor *mon, const QDict *qdict, QObject **ret)
2306{
2307    Error *local_err = NULL;
2308    Error **errp = &local_err;
2309    QDict *args = (QDict *)qdict;
2310    QmpInputVisitor *mi;
2311    QapiDeallocVisitor *md;
2312    Visitor *v;
2313    char * protocol = NULL;
2314    char * password = NULL;
2315    bool has_connected = false;
2316    char * connected = NULL;
2317
2318    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2319    v = qmp_input_get_visitor(mi);
2320    visit_type_str(v, &protocol, "protocol", errp);
2321    visit_type_str(v, &password, "password", errp);
2322    visit_start_optional(v, &has_connected, "connected", errp);
2323    if (has_connected) {
2324        visit_type_str(v, &connected, "connected", errp);
2325    }
2326    visit_end_optional(v, errp);
2327    qmp_input_visitor_cleanup(mi);
2328
2329    if (error_is_set(errp)) {
2330        goto out;
2331    }
2332    qmp_set_password(protocol, password, has_connected, connected, errp);
2333
2334out:
2335    md = qapi_dealloc_visitor_new();
2336    v = qapi_dealloc_get_visitor(md);
2337    visit_type_str(v, &protocol, "protocol", NULL);
2338    visit_type_str(v, &password, "password", NULL);
2339    visit_start_optional(v, &has_connected, "connected", NULL);
2340    if (has_connected) {
2341        visit_type_str(v, &connected, "connected", NULL);
2342    }
2343    visit_end_optional(v, NULL);
2344    qapi_dealloc_visitor_cleanup(md);
2345
2346    if (local_err) {
2347        qerror_report_err(local_err);
2348        error_free(local_err);
2349        return -1;
2350    }
2351    return 0;
2352}
2353
2354int qmp_marshal_input_expire_password(Monitor *mon, const QDict *qdict, QObject **ret)
2355{
2356    Error *local_err = NULL;
2357    Error **errp = &local_err;
2358    QDict *args = (QDict *)qdict;
2359    QmpInputVisitor *mi;
2360    QapiDeallocVisitor *md;
2361    Visitor *v;
2362    char * protocol = NULL;
2363    char * time = NULL;
2364
2365    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2366    v = qmp_input_get_visitor(mi);
2367    visit_type_str(v, &protocol, "protocol", errp);
2368    visit_type_str(v, &time, "time", errp);
2369    qmp_input_visitor_cleanup(mi);
2370
2371    if (error_is_set(errp)) {
2372        goto out;
2373    }
2374    qmp_expire_password(protocol, time, errp);
2375
2376out:
2377    md = qapi_dealloc_visitor_new();
2378    v = qapi_dealloc_get_visitor(md);
2379    visit_type_str(v, &protocol, "protocol", NULL);
2380    visit_type_str(v, &time, "time", NULL);
2381    qapi_dealloc_visitor_cleanup(md);
2382
2383    if (local_err) {
2384        qerror_report_err(local_err);
2385        error_free(local_err);
2386        return -1;
2387    }
2388    return 0;
2389}
2390
2391int qmp_marshal_input_eject(Monitor *mon, const QDict *qdict, QObject **ret)
2392{
2393    Error *local_err = NULL;
2394    Error **errp = &local_err;
2395    QDict *args = (QDict *)qdict;
2396    QmpInputVisitor *mi;
2397    QapiDeallocVisitor *md;
2398    Visitor *v;
2399    char * device = NULL;
2400    bool has_force = false;
2401    bool force;
2402
2403    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2404    v = qmp_input_get_visitor(mi);
2405    visit_type_str(v, &device, "device", errp);
2406    visit_start_optional(v, &has_force, "force", errp);
2407    if (has_force) {
2408        visit_type_bool(v, &force, "force", errp);
2409    }
2410    visit_end_optional(v, errp);
2411    qmp_input_visitor_cleanup(mi);
2412
2413    if (error_is_set(errp)) {
2414        goto out;
2415    }
2416    qmp_eject(device, has_force, force, errp);
2417
2418out:
2419    md = qapi_dealloc_visitor_new();
2420    v = qapi_dealloc_get_visitor(md);
2421    visit_type_str(v, &device, "device", NULL);
2422    visit_start_optional(v, &has_force, "force", NULL);
2423    if (has_force) {
2424        visit_type_bool(v, &force, "force", NULL);
2425    }
2426    visit_end_optional(v, NULL);
2427    qapi_dealloc_visitor_cleanup(md);
2428
2429    if (local_err) {
2430        qerror_report_err(local_err);
2431        error_free(local_err);
2432        return -1;
2433    }
2434    return 0;
2435}
2436
2437int qmp_marshal_input_change_vnc_password(Monitor *mon, const QDict *qdict, QObject **ret)
2438{
2439    Error *local_err = NULL;
2440    Error **errp = &local_err;
2441    QDict *args = (QDict *)qdict;
2442    QmpInputVisitor *mi;
2443    QapiDeallocVisitor *md;
2444    Visitor *v;
2445    char * password = NULL;
2446
2447    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2448    v = qmp_input_get_visitor(mi);
2449    visit_type_str(v, &password, "password", errp);
2450    qmp_input_visitor_cleanup(mi);
2451
2452    if (error_is_set(errp)) {
2453        goto out;
2454    }
2455    qmp_change_vnc_password(password, errp);
2456
2457out:
2458    md = qapi_dealloc_visitor_new();
2459    v = qapi_dealloc_get_visitor(md);
2460    visit_type_str(v, &password, "password", NULL);
2461    qapi_dealloc_visitor_cleanup(md);
2462
2463    if (local_err) {
2464        qerror_report_err(local_err);
2465        error_free(local_err);
2466        return -1;
2467    }
2468    return 0;
2469}
2470
2471int qmp_marshal_input_change(Monitor *mon, const QDict *qdict, QObject **ret)
2472{
2473    Error *local_err = NULL;
2474    Error **errp = &local_err;
2475    QDict *args = (QDict *)qdict;
2476    QmpInputVisitor *mi;
2477    QapiDeallocVisitor *md;
2478    Visitor *v;
2479    char * device = NULL;
2480    char * target = NULL;
2481    bool has_arg = false;
2482    char * arg = NULL;
2483
2484    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2485    v = qmp_input_get_visitor(mi);
2486    visit_type_str(v, &device, "device", errp);
2487    visit_type_str(v, &target, "target", errp);
2488    visit_start_optional(v, &has_arg, "arg", errp);
2489    if (has_arg) {
2490        visit_type_str(v, &arg, "arg", errp);
2491    }
2492    visit_end_optional(v, errp);
2493    qmp_input_visitor_cleanup(mi);
2494
2495    if (error_is_set(errp)) {
2496        goto out;
2497    }
2498    qmp_change(device, target, has_arg, arg, errp);
2499
2500out:
2501    md = qapi_dealloc_visitor_new();
2502    v = qapi_dealloc_get_visitor(md);
2503    visit_type_str(v, &device, "device", NULL);
2504    visit_type_str(v, &target, "target", NULL);
2505    visit_start_optional(v, &has_arg, "arg", NULL);
2506    if (has_arg) {
2507        visit_type_str(v, &arg, "arg", NULL);
2508    }
2509    visit_end_optional(v, NULL);
2510    qapi_dealloc_visitor_cleanup(md);
2511
2512    if (local_err) {
2513        qerror_report_err(local_err);
2514        error_free(local_err);
2515        return -1;
2516    }
2517    return 0;
2518}
2519
2520int qmp_marshal_input_block_set_io_throttle(Monitor *mon, const QDict *qdict, QObject **ret)
2521{
2522    Error *local_err = NULL;
2523    Error **errp = &local_err;
2524    QDict *args = (QDict *)qdict;
2525    QmpInputVisitor *mi;
2526    QapiDeallocVisitor *md;
2527    Visitor *v;
2528    char * device = NULL;
2529    int64_t bps;
2530    int64_t bps_rd;
2531    int64_t bps_wr;
2532    int64_t iops;
2533    int64_t iops_rd;
2534    int64_t iops_wr;
2535    bool has_bps_max = false;
2536    int64_t bps_max;
2537    bool has_bps_rd_max = false;
2538    int64_t bps_rd_max;
2539    bool has_bps_wr_max = false;
2540    int64_t bps_wr_max;
2541    bool has_iops_max = false;
2542    int64_t iops_max;
2543    bool has_iops_rd_max = false;
2544    int64_t iops_rd_max;
2545    bool has_iops_wr_max = false;
2546    int64_t iops_wr_max;
2547    bool has_iops_size = false;
2548    int64_t iops_size;
2549
2550    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2551    v = qmp_input_get_visitor(mi);
2552    visit_type_str(v, &device, "device", errp);
2553    visit_type_int(v, &bps, "bps", errp);
2554    visit_type_int(v, &bps_rd, "bps_rd", errp);
2555    visit_type_int(v, &bps_wr, "bps_wr", errp);
2556    visit_type_int(v, &iops, "iops", errp);
2557    visit_type_int(v, &iops_rd, "iops_rd", errp);
2558    visit_type_int(v, &iops_wr, "iops_wr", errp);
2559    visit_start_optional(v, &has_bps_max, "bps_max", errp);
2560    if (has_bps_max) {
2561        visit_type_int(v, &bps_max, "bps_max", errp);
2562    }
2563    visit_end_optional(v, errp);
2564    visit_start_optional(v, &has_bps_rd_max, "bps_rd_max", errp);
2565    if (has_bps_rd_max) {
2566        visit_type_int(v, &bps_rd_max, "bps_rd_max", errp);
2567    }
2568    visit_end_optional(v, errp);
2569    visit_start_optional(v, &has_bps_wr_max, "bps_wr_max", errp);
2570    if (has_bps_wr_max) {
2571        visit_type_int(v, &bps_wr_max, "bps_wr_max", errp);
2572    }
2573    visit_end_optional(v, errp);
2574    visit_start_optional(v, &has_iops_max, "iops_max", errp);
2575    if (has_iops_max) {
2576        visit_type_int(v, &iops_max, "iops_max", errp);
2577    }
2578    visit_end_optional(v, errp);
2579    visit_start_optional(v, &has_iops_rd_max, "iops_rd_max", errp);
2580    if (has_iops_rd_max) {
2581        visit_type_int(v, &iops_rd_max, "iops_rd_max", errp);
2582    }
2583    visit_end_optional(v, errp);
2584    visit_start_optional(v, &has_iops_wr_max, "iops_wr_max", errp);
2585    if (has_iops_wr_max) {
2586        visit_type_int(v, &iops_wr_max, "iops_wr_max", errp);
2587    }
2588    visit_end_optional(v, errp);
2589    visit_start_optional(v, &has_iops_size, "iops_size", errp);
2590    if (has_iops_size) {
2591        visit_type_int(v, &iops_size, "iops_size", errp);
2592    }
2593    visit_end_optional(v, errp);
2594    qmp_input_visitor_cleanup(mi);
2595
2596    if (error_is_set(errp)) {
2597        goto out;
2598    }
2599    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);
2600
2601out:
2602    md = qapi_dealloc_visitor_new();
2603    v = qapi_dealloc_get_visitor(md);
2604    visit_type_str(v, &device, "device", NULL);
2605    visit_type_int(v, &bps, "bps", NULL);
2606    visit_type_int(v, &bps_rd, "bps_rd", NULL);
2607    visit_type_int(v, &bps_wr, "bps_wr", NULL);
2608    visit_type_int(v, &iops, "iops", NULL);
2609    visit_type_int(v, &iops_rd, "iops_rd", NULL);
2610    visit_type_int(v, &iops_wr, "iops_wr", NULL);
2611    visit_start_optional(v, &has_bps_max, "bps_max", NULL);
2612    if (has_bps_max) {
2613        visit_type_int(v, &bps_max, "bps_max", NULL);
2614    }
2615    visit_end_optional(v, NULL);
2616    visit_start_optional(v, &has_bps_rd_max, "bps_rd_max", NULL);
2617    if (has_bps_rd_max) {
2618        visit_type_int(v, &bps_rd_max, "bps_rd_max", NULL);
2619    }
2620    visit_end_optional(v, NULL);
2621    visit_start_optional(v, &has_bps_wr_max, "bps_wr_max", NULL);
2622    if (has_bps_wr_max) {
2623        visit_type_int(v, &bps_wr_max, "bps_wr_max", NULL);
2624    }
2625    visit_end_optional(v, NULL);
2626    visit_start_optional(v, &has_iops_max, "iops_max", NULL);
2627    if (has_iops_max) {
2628        visit_type_int(v, &iops_max, "iops_max", NULL);
2629    }
2630    visit_end_optional(v, NULL);
2631    visit_start_optional(v, &has_iops_rd_max, "iops_rd_max", NULL);
2632    if (has_iops_rd_max) {
2633        visit_type_int(v, &iops_rd_max, "iops_rd_max", NULL);
2634    }
2635    visit_end_optional(v, NULL);
2636    visit_start_optional(v, &has_iops_wr_max, "iops_wr_max", NULL);
2637    if (has_iops_wr_max) {
2638        visit_type_int(v, &iops_wr_max, "iops_wr_max", NULL);
2639    }
2640    visit_end_optional(v, NULL);
2641    visit_start_optional(v, &has_iops_size, "iops_size", NULL);
2642    if (has_iops_size) {
2643        visit_type_int(v, &iops_size, "iops_size", NULL);
2644    }
2645    visit_end_optional(v, NULL);
2646    qapi_dealloc_visitor_cleanup(md);
2647
2648    if (local_err) {
2649        qerror_report_err(local_err);
2650        error_free(local_err);
2651        return -1;
2652    }
2653    return 0;
2654}
2655
2656int qmp_marshal_input_block_stream(Monitor *mon, const QDict *qdict, QObject **ret)
2657{
2658    Error *local_err = NULL;
2659    Error **errp = &local_err;
2660    QDict *args = (QDict *)qdict;
2661    QmpInputVisitor *mi;
2662    QapiDeallocVisitor *md;
2663    Visitor *v;
2664    char * device = NULL;
2665    bool has_base = false;
2666    char * base = NULL;
2667    bool has_speed = false;
2668    int64_t speed;
2669    bool has_on_error = false;
2670    BlockdevOnError on_error;
2671
2672    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2673    v = qmp_input_get_visitor(mi);
2674    visit_type_str(v, &device, "device", errp);
2675    visit_start_optional(v, &has_base, "base", errp);
2676    if (has_base) {
2677        visit_type_str(v, &base, "base", errp);
2678    }
2679    visit_end_optional(v, errp);
2680    visit_start_optional(v, &has_speed, "speed", errp);
2681    if (has_speed) {
2682        visit_type_int(v, &speed, "speed", errp);
2683    }
2684    visit_end_optional(v, errp);
2685    visit_start_optional(v, &has_on_error, "on-error", errp);
2686    if (has_on_error) {
2687        visit_type_BlockdevOnError(v, &on_error, "on-error", errp);
2688    }
2689    visit_end_optional(v, errp);
2690    qmp_input_visitor_cleanup(mi);
2691
2692    if (error_is_set(errp)) {
2693        goto out;
2694    }
2695    qmp_block_stream(device, has_base, base, has_speed, speed, has_on_error, on_error, errp);
2696
2697out:
2698    md = qapi_dealloc_visitor_new();
2699    v = qapi_dealloc_get_visitor(md);
2700    visit_type_str(v, &device, "device", NULL);
2701    visit_start_optional(v, &has_base, "base", NULL);
2702    if (has_base) {
2703        visit_type_str(v, &base, "base", NULL);
2704    }
2705    visit_end_optional(v, NULL);
2706    visit_start_optional(v, &has_speed, "speed", NULL);
2707    if (has_speed) {
2708        visit_type_int(v, &speed, "speed", NULL);
2709    }
2710    visit_end_optional(v, NULL);
2711    visit_start_optional(v, &has_on_error, "on-error", NULL);
2712    if (has_on_error) {
2713        visit_type_BlockdevOnError(v, &on_error, "on-error", NULL);
2714    }
2715    visit_end_optional(v, NULL);
2716    qapi_dealloc_visitor_cleanup(md);
2717
2718    if (local_err) {
2719        qerror_report_err(local_err);
2720        error_free(local_err);
2721        return -1;
2722    }
2723    return 0;
2724}
2725
2726int qmp_marshal_input_block_job_set_speed(Monitor *mon, const QDict *qdict, QObject **ret)
2727{
2728    Error *local_err = NULL;
2729    Error **errp = &local_err;
2730    QDict *args = (QDict *)qdict;
2731    QmpInputVisitor *mi;
2732    QapiDeallocVisitor *md;
2733    Visitor *v;
2734    char * device = NULL;
2735    int64_t speed;
2736
2737    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2738    v = qmp_input_get_visitor(mi);
2739    visit_type_str(v, &device, "device", errp);
2740    visit_type_int(v, &speed, "speed", errp);
2741    qmp_input_visitor_cleanup(mi);
2742
2743    if (error_is_set(errp)) {
2744        goto out;
2745    }
2746    qmp_block_job_set_speed(device, speed, errp);
2747
2748out:
2749    md = qapi_dealloc_visitor_new();
2750    v = qapi_dealloc_get_visitor(md);
2751    visit_type_str(v, &device, "device", NULL);
2752    visit_type_int(v, &speed, "speed", NULL);
2753    qapi_dealloc_visitor_cleanup(md);
2754
2755    if (local_err) {
2756        qerror_report_err(local_err);
2757        error_free(local_err);
2758        return -1;
2759    }
2760    return 0;
2761}
2762
2763int qmp_marshal_input_block_job_cancel(Monitor *mon, const QDict *qdict, QObject **ret)
2764{
2765    Error *local_err = NULL;
2766    Error **errp = &local_err;
2767    QDict *args = (QDict *)qdict;
2768    QmpInputVisitor *mi;
2769    QapiDeallocVisitor *md;
2770    Visitor *v;
2771    char * device = NULL;
2772    bool has_force = false;
2773    bool force;
2774
2775    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2776    v = qmp_input_get_visitor(mi);
2777    visit_type_str(v, &device, "device", errp);
2778    visit_start_optional(v, &has_force, "force", errp);
2779    if (has_force) {
2780        visit_type_bool(v, &force, "force", errp);
2781    }
2782    visit_end_optional(v, errp);
2783    qmp_input_visitor_cleanup(mi);
2784
2785    if (error_is_set(errp)) {
2786        goto out;
2787    }
2788    qmp_block_job_cancel(device, has_force, force, errp);
2789
2790out:
2791    md = qapi_dealloc_visitor_new();
2792    v = qapi_dealloc_get_visitor(md);
2793    visit_type_str(v, &device, "device", NULL);
2794    visit_start_optional(v, &has_force, "force", NULL);
2795    if (has_force) {
2796        visit_type_bool(v, &force, "force", NULL);
2797    }
2798    visit_end_optional(v, NULL);
2799    qapi_dealloc_visitor_cleanup(md);
2800
2801    if (local_err) {
2802        qerror_report_err(local_err);
2803        error_free(local_err);
2804        return -1;
2805    }
2806    return 0;
2807}
2808
2809int qmp_marshal_input_block_job_pause(Monitor *mon, const QDict *qdict, QObject **ret)
2810{
2811    Error *local_err = NULL;
2812    Error **errp = &local_err;
2813    QDict *args = (QDict *)qdict;
2814    QmpInputVisitor *mi;
2815    QapiDeallocVisitor *md;
2816    Visitor *v;
2817    char * device = NULL;
2818
2819    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2820    v = qmp_input_get_visitor(mi);
2821    visit_type_str(v, &device, "device", errp);
2822    qmp_input_visitor_cleanup(mi);
2823
2824    if (error_is_set(errp)) {
2825        goto out;
2826    }
2827    qmp_block_job_pause(device, errp);
2828
2829out:
2830    md = qapi_dealloc_visitor_new();
2831    v = qapi_dealloc_get_visitor(md);
2832    visit_type_str(v, &device, "device", NULL);
2833    qapi_dealloc_visitor_cleanup(md);
2834
2835    if (local_err) {
2836        qerror_report_err(local_err);
2837        error_free(local_err);
2838        return -1;
2839    }
2840    return 0;
2841}
2842
2843int qmp_marshal_input_block_job_resume(Monitor *mon, const QDict *qdict, QObject **ret)
2844{
2845    Error *local_err = NULL;
2846    Error **errp = &local_err;
2847    QDict *args = (QDict *)qdict;
2848    QmpInputVisitor *mi;
2849    QapiDeallocVisitor *md;
2850    Visitor *v;
2851    char * device = NULL;
2852
2853    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2854    v = qmp_input_get_visitor(mi);
2855    visit_type_str(v, &device, "device", errp);
2856    qmp_input_visitor_cleanup(mi);
2857
2858    if (error_is_set(errp)) {
2859        goto out;
2860    }
2861    qmp_block_job_resume(device, errp);
2862
2863out:
2864    md = qapi_dealloc_visitor_new();
2865    v = qapi_dealloc_get_visitor(md);
2866    visit_type_str(v, &device, "device", NULL);
2867    qapi_dealloc_visitor_cleanup(md);
2868
2869    if (local_err) {
2870        qerror_report_err(local_err);
2871        error_free(local_err);
2872        return -1;
2873    }
2874    return 0;
2875}
2876
2877int qmp_marshal_input_block_job_complete(Monitor *mon, const QDict *qdict, QObject **ret)
2878{
2879    Error *local_err = NULL;
2880    Error **errp = &local_err;
2881    QDict *args = (QDict *)qdict;
2882    QmpInputVisitor *mi;
2883    QapiDeallocVisitor *md;
2884    Visitor *v;
2885    char * device = NULL;
2886
2887    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2888    v = qmp_input_get_visitor(mi);
2889    visit_type_str(v, &device, "device", errp);
2890    qmp_input_visitor_cleanup(mi);
2891
2892    if (error_is_set(errp)) {
2893        goto out;
2894    }
2895    qmp_block_job_complete(device, errp);
2896
2897out:
2898    md = qapi_dealloc_visitor_new();
2899    v = qapi_dealloc_get_visitor(md);
2900    visit_type_str(v, &device, "device", NULL);
2901    qapi_dealloc_visitor_cleanup(md);
2902
2903    if (local_err) {
2904        qerror_report_err(local_err);
2905        error_free(local_err);
2906        return -1;
2907    }
2908    return 0;
2909}
2910
2911static void qmp_marshal_output_qom_list_types(ObjectTypeInfoList * ret_in, QObject **ret_out, Error **errp)
2912{
2913    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
2914    QmpOutputVisitor *mo = qmp_output_visitor_new();
2915    Visitor *v;
2916
2917    v = qmp_output_get_visitor(mo);
2918    visit_type_ObjectTypeInfoList(v, &ret_in, "unused", errp);
2919    if (!error_is_set(errp)) {
2920        *ret_out = qmp_output_get_qobject(mo);
2921    }
2922    qmp_output_visitor_cleanup(mo);
2923    v = qapi_dealloc_get_visitor(md);
2924    visit_type_ObjectTypeInfoList(v, &ret_in, "unused", NULL);
2925    qapi_dealloc_visitor_cleanup(md);
2926}
2927
2928int qmp_marshal_input_qom_list_types(Monitor *mon, const QDict *qdict, QObject **ret)
2929{
2930    Error *local_err = NULL;
2931    Error **errp = &local_err;
2932    QDict *args = (QDict *)qdict;
2933    ObjectTypeInfoList * retval = NULL;
2934    QmpInputVisitor *mi;
2935    QapiDeallocVisitor *md;
2936    Visitor *v;
2937    bool has_implements = false;
2938    char * implements = NULL;
2939    bool has_abstract = false;
2940    bool abstract;
2941
2942    mi = qmp_input_visitor_new_strict(QOBJECT(args));
2943    v = qmp_input_get_visitor(mi);
2944    visit_start_optional(v, &has_implements, "implements", errp);
2945    if (has_implements) {
2946        visit_type_str(v, &implements, "implements", errp);
2947    }
2948    visit_end_optional(v, errp);
2949    visit_start_optional(v, &has_abstract, "abstract", errp);
2950    if (has_abstract) {
2951        visit_type_bool(v, &abstract, "abstract", errp);
2952    }
2953    visit_end_optional(v, errp);
2954    qmp_input_visitor_cleanup(mi);
2955
2956    if (error_is_set(errp)) {
2957        goto out;
2958    }
2959    retval = qmp_qom_list_types(has_implements, implements, has_abstract, abstract, errp);
2960    if (!error_is_set(errp)) {
2961        qmp_marshal_output_qom_list_types(retval, ret, errp);
2962    }
2963
2964out:
2965    md = qapi_dealloc_visitor_new();
2966    v = qapi_dealloc_get_visitor(md);
2967    visit_start_optional(v, &has_implements, "implements", NULL);
2968    if (has_implements) {
2969        visit_type_str(v, &implements, "implements", NULL);
2970    }
2971    visit_end_optional(v, NULL);
2972    visit_start_optional(v, &has_abstract, "abstract", NULL);
2973    if (has_abstract) {
2974        visit_type_bool(v, &abstract, "abstract", NULL);
2975    }
2976    visit_end_optional(v, NULL);
2977    qapi_dealloc_visitor_cleanup(md);
2978
2979    if (local_err) {
2980        qerror_report_err(local_err);
2981        error_free(local_err);
2982        return -1;
2983    }
2984    return 0;
2985}
2986
2987static void qmp_marshal_output_device_list_properties(DevicePropertyInfoList * ret_in, QObject **ret_out, Error **errp)
2988{
2989    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
2990    QmpOutputVisitor *mo = qmp_output_visitor_new();
2991    Visitor *v;
2992
2993    v = qmp_output_get_visitor(mo);
2994    visit_type_DevicePropertyInfoList(v, &ret_in, "unused", errp);
2995    if (!error_is_set(errp)) {
2996        *ret_out = qmp_output_get_qobject(mo);
2997    }
2998    qmp_output_visitor_cleanup(mo);
2999    v = qapi_dealloc_get_visitor(md);
3000    visit_type_DevicePropertyInfoList(v, &ret_in, "unused", NULL);
3001    qapi_dealloc_visitor_cleanup(md);
3002}
3003
3004int qmp_marshal_input_device_list_properties(Monitor *mon, const QDict *qdict, QObject **ret)
3005{
3006    Error *local_err = NULL;
3007    Error **errp = &local_err;
3008    QDict *args = (QDict *)qdict;
3009    DevicePropertyInfoList * retval = NULL;
3010    QmpInputVisitor *mi;
3011    QapiDeallocVisitor *md;
3012    Visitor *v;
3013    char * q_typename = NULL;
3014
3015    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3016    v = qmp_input_get_visitor(mi);
3017    visit_type_str(v, &q_typename, "typename", errp);
3018    qmp_input_visitor_cleanup(mi);
3019
3020    if (error_is_set(errp)) {
3021        goto out;
3022    }
3023    retval = qmp_device_list_properties(q_typename, errp);
3024    if (!error_is_set(errp)) {
3025        qmp_marshal_output_device_list_properties(retval, ret, errp);
3026    }
3027
3028out:
3029    md = qapi_dealloc_visitor_new();
3030    v = qapi_dealloc_get_visitor(md);
3031    visit_type_str(v, &q_typename, "typename", NULL);
3032    qapi_dealloc_visitor_cleanup(md);
3033
3034    if (local_err) {
3035        qerror_report_err(local_err);
3036        error_free(local_err);
3037        return -1;
3038    }
3039    return 0;
3040}
3041
3042int qmp_marshal_input_migrate(Monitor *mon, const QDict *qdict, QObject **ret)
3043{
3044    Error *local_err = NULL;
3045    Error **errp = &local_err;
3046    QDict *args = (QDict *)qdict;
3047    QmpInputVisitor *mi;
3048    QapiDeallocVisitor *md;
3049    Visitor *v;
3050    char * uri = NULL;
3051    bool has_blk = false;
3052    bool blk;
3053    bool has_inc = false;
3054    bool inc;
3055    bool has_detach = false;
3056    bool detach;
3057
3058    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3059    v = qmp_input_get_visitor(mi);
3060    visit_type_str(v, &uri, "uri", errp);
3061    visit_start_optional(v, &has_blk, "blk", errp);
3062    if (has_blk) {
3063        visit_type_bool(v, &blk, "blk", errp);
3064    }
3065    visit_end_optional(v, errp);
3066    visit_start_optional(v, &has_inc, "inc", errp);
3067    if (has_inc) {
3068        visit_type_bool(v, &inc, "inc", errp);
3069    }
3070    visit_end_optional(v, errp);
3071    visit_start_optional(v, &has_detach, "detach", errp);
3072    if (has_detach) {
3073        visit_type_bool(v, &detach, "detach", errp);
3074    }
3075    visit_end_optional(v, errp);
3076    qmp_input_visitor_cleanup(mi);
3077
3078    if (error_is_set(errp)) {
3079        goto out;
3080    }
3081    qmp_migrate(uri, has_blk, blk, has_inc, inc, has_detach, detach, errp);
3082
3083out:
3084    md = qapi_dealloc_visitor_new();
3085    v = qapi_dealloc_get_visitor(md);
3086    visit_type_str(v, &uri, "uri", NULL);
3087    visit_start_optional(v, &has_blk, "blk", NULL);
3088    if (has_blk) {
3089        visit_type_bool(v, &blk, "blk", NULL);
3090    }
3091    visit_end_optional(v, NULL);
3092    visit_start_optional(v, &has_inc, "inc", NULL);
3093    if (has_inc) {
3094        visit_type_bool(v, &inc, "inc", NULL);
3095    }
3096    visit_end_optional(v, NULL);
3097    visit_start_optional(v, &has_detach, "detach", NULL);
3098    if (has_detach) {
3099        visit_type_bool(v, &detach, "detach", NULL);
3100    }
3101    visit_end_optional(v, NULL);
3102    qapi_dealloc_visitor_cleanup(md);
3103
3104    if (local_err) {
3105        qerror_report_err(local_err);
3106        error_free(local_err);
3107        return -1;
3108    }
3109    return 0;
3110}
3111
3112int qmp_marshal_input_xen_save_devices_state(Monitor *mon, const QDict *qdict, QObject **ret)
3113{
3114    Error *local_err = NULL;
3115    Error **errp = &local_err;
3116    QDict *args = (QDict *)qdict;
3117    QmpInputVisitor *mi;
3118    QapiDeallocVisitor *md;
3119    Visitor *v;
3120    char * filename = NULL;
3121
3122    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3123    v = qmp_input_get_visitor(mi);
3124    visit_type_str(v, &filename, "filename", errp);
3125    qmp_input_visitor_cleanup(mi);
3126
3127    if (error_is_set(errp)) {
3128        goto out;
3129    }
3130    qmp_xen_save_devices_state(filename, errp);
3131
3132out:
3133    md = qapi_dealloc_visitor_new();
3134    v = qapi_dealloc_get_visitor(md);
3135    visit_type_str(v, &filename, "filename", NULL);
3136    qapi_dealloc_visitor_cleanup(md);
3137
3138    if (local_err) {
3139        qerror_report_err(local_err);
3140        error_free(local_err);
3141        return -1;
3142    }
3143    return 0;
3144}
3145
3146int qmp_marshal_input_xen_set_global_dirty_log(Monitor *mon, const QDict *qdict, QObject **ret)
3147{
3148    Error *local_err = NULL;
3149    Error **errp = &local_err;
3150    QDict *args = (QDict *)qdict;
3151    QmpInputVisitor *mi;
3152    QapiDeallocVisitor *md;
3153    Visitor *v;
3154    bool enable;
3155
3156    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3157    v = qmp_input_get_visitor(mi);
3158    visit_type_bool(v, &enable, "enable", errp);
3159    qmp_input_visitor_cleanup(mi);
3160
3161    if (error_is_set(errp)) {
3162        goto out;
3163    }
3164    qmp_xen_set_global_dirty_log(enable, errp);
3165
3166out:
3167    md = qapi_dealloc_visitor_new();
3168    v = qapi_dealloc_get_visitor(md);
3169    visit_type_bool(v, &enable, "enable", NULL);
3170    qapi_dealloc_visitor_cleanup(md);
3171
3172    if (local_err) {
3173        qerror_report_err(local_err);
3174        error_free(local_err);
3175        return -1;
3176    }
3177    return 0;
3178}
3179
3180int qmp_marshal_input_device_del(Monitor *mon, const QDict *qdict, QObject **ret)
3181{
3182    Error *local_err = NULL;
3183    Error **errp = &local_err;
3184    QDict *args = (QDict *)qdict;
3185    QmpInputVisitor *mi;
3186    QapiDeallocVisitor *md;
3187    Visitor *v;
3188    char * id = NULL;
3189
3190    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3191    v = qmp_input_get_visitor(mi);
3192    visit_type_str(v, &id, "id", errp);
3193    qmp_input_visitor_cleanup(mi);
3194
3195    if (error_is_set(errp)) {
3196        goto out;
3197    }
3198    qmp_device_del(id, errp);
3199
3200out:
3201    md = qapi_dealloc_visitor_new();
3202    v = qapi_dealloc_get_visitor(md);
3203    visit_type_str(v, &id, "id", NULL);
3204    qapi_dealloc_visitor_cleanup(md);
3205
3206    if (local_err) {
3207        qerror_report_err(local_err);
3208        error_free(local_err);
3209        return -1;
3210    }
3211    return 0;
3212}
3213
3214int qmp_marshal_input_dump_guest_memory(Monitor *mon, const QDict *qdict, QObject **ret)
3215{
3216    Error *local_err = NULL;
3217    Error **errp = &local_err;
3218    QDict *args = (QDict *)qdict;
3219    QmpInputVisitor *mi;
3220    QapiDeallocVisitor *md;
3221    Visitor *v;
3222    bool paging;
3223    char * protocol = NULL;
3224    bool has_begin = false;
3225    int64_t begin;
3226    bool has_length = false;
3227    int64_t length;
3228
3229    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3230    v = qmp_input_get_visitor(mi);
3231    visit_type_bool(v, &paging, "paging", errp);
3232    visit_type_str(v, &protocol, "protocol", errp);
3233    visit_start_optional(v, &has_begin, "begin", errp);
3234    if (has_begin) {
3235        visit_type_int(v, &begin, "begin", errp);
3236    }
3237    visit_end_optional(v, errp);
3238    visit_start_optional(v, &has_length, "length", errp);
3239    if (has_length) {
3240        visit_type_int(v, &length, "length", errp);
3241    }
3242    visit_end_optional(v, errp);
3243    qmp_input_visitor_cleanup(mi);
3244
3245    if (error_is_set(errp)) {
3246        goto out;
3247    }
3248    qmp_dump_guest_memory(paging, protocol, has_begin, begin, has_length, length, errp);
3249
3250out:
3251    md = qapi_dealloc_visitor_new();
3252    v = qapi_dealloc_get_visitor(md);
3253    visit_type_bool(v, &paging, "paging", NULL);
3254    visit_type_str(v, &protocol, "protocol", NULL);
3255    visit_start_optional(v, &has_begin, "begin", NULL);
3256    if (has_begin) {
3257        visit_type_int(v, &begin, "begin", NULL);
3258    }
3259    visit_end_optional(v, NULL);
3260    visit_start_optional(v, &has_length, "length", NULL);
3261    if (has_length) {
3262        visit_type_int(v, &length, "length", NULL);
3263    }
3264    visit_end_optional(v, NULL);
3265    qapi_dealloc_visitor_cleanup(md);
3266
3267    if (local_err) {
3268        qerror_report_err(local_err);
3269        error_free(local_err);
3270        return -1;
3271    }
3272    return 0;
3273}
3274
3275int qmp_marshal_input_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret)
3276{
3277    Error *local_err = NULL;
3278    Error **errp = &local_err;
3279    QDict *args = (QDict *)qdict;
3280    QmpInputVisitor *mi;
3281    QapiDeallocVisitor *md;
3282    Visitor *v;
3283    char * id = NULL;
3284
3285    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3286    v = qmp_input_get_visitor(mi);
3287    visit_type_str(v, &id, "id", errp);
3288    qmp_input_visitor_cleanup(mi);
3289
3290    if (error_is_set(errp)) {
3291        goto out;
3292    }
3293    qmp_netdev_del(id, errp);
3294
3295out:
3296    md = qapi_dealloc_visitor_new();
3297    v = qapi_dealloc_get_visitor(md);
3298    visit_type_str(v, &id, "id", NULL);
3299    qapi_dealloc_visitor_cleanup(md);
3300
3301    if (local_err) {
3302        qerror_report_err(local_err);
3303        error_free(local_err);
3304        return -1;
3305    }
3306    return 0;
3307}
3308
3309int qmp_marshal_input_getfd(Monitor *mon, const QDict *qdict, QObject **ret)
3310{
3311    Error *local_err = NULL;
3312    Error **errp = &local_err;
3313    QDict *args = (QDict *)qdict;
3314    QmpInputVisitor *mi;
3315    QapiDeallocVisitor *md;
3316    Visitor *v;
3317    char * fdname = NULL;
3318
3319    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3320    v = qmp_input_get_visitor(mi);
3321    visit_type_str(v, &fdname, "fdname", errp);
3322    qmp_input_visitor_cleanup(mi);
3323
3324    if (error_is_set(errp)) {
3325        goto out;
3326    }
3327    qmp_getfd(fdname, errp);
3328
3329out:
3330    md = qapi_dealloc_visitor_new();
3331    v = qapi_dealloc_get_visitor(md);
3332    visit_type_str(v, &fdname, "fdname", NULL);
3333    qapi_dealloc_visitor_cleanup(md);
3334
3335    if (local_err) {
3336        qerror_report_err(local_err);
3337        error_free(local_err);
3338        return -1;
3339    }
3340    return 0;
3341}
3342
3343int qmp_marshal_input_closefd(Monitor *mon, const QDict *qdict, QObject **ret)
3344{
3345    Error *local_err = NULL;
3346    Error **errp = &local_err;
3347    QDict *args = (QDict *)qdict;
3348    QmpInputVisitor *mi;
3349    QapiDeallocVisitor *md;
3350    Visitor *v;
3351    char * fdname = NULL;
3352
3353    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3354    v = qmp_input_get_visitor(mi);
3355    visit_type_str(v, &fdname, "fdname", errp);
3356    qmp_input_visitor_cleanup(mi);
3357
3358    if (error_is_set(errp)) {
3359        goto out;
3360    }
3361    qmp_closefd(fdname, errp);
3362
3363out:
3364    md = qapi_dealloc_visitor_new();
3365    v = qapi_dealloc_get_visitor(md);
3366    visit_type_str(v, &fdname, "fdname", NULL);
3367    qapi_dealloc_visitor_cleanup(md);
3368
3369    if (local_err) {
3370        qerror_report_err(local_err);
3371        error_free(local_err);
3372        return -1;
3373    }
3374    return 0;
3375}
3376
3377static void qmp_marshal_output_query_machines(MachineInfoList * ret_in, QObject **ret_out, Error **errp)
3378{
3379    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
3380    QmpOutputVisitor *mo = qmp_output_visitor_new();
3381    Visitor *v;
3382
3383    v = qmp_output_get_visitor(mo);
3384    visit_type_MachineInfoList(v, &ret_in, "unused", errp);
3385    if (!error_is_set(errp)) {
3386        *ret_out = qmp_output_get_qobject(mo);
3387    }
3388    qmp_output_visitor_cleanup(mo);
3389    v = qapi_dealloc_get_visitor(md);
3390    visit_type_MachineInfoList(v, &ret_in, "unused", NULL);
3391    qapi_dealloc_visitor_cleanup(md);
3392}
3393
3394int qmp_marshal_input_query_machines(Monitor *mon, const QDict *qdict, QObject **ret)
3395{
3396    Error *local_err = NULL;
3397    Error **errp = &local_err;
3398    QDict *args = (QDict *)qdict;
3399    MachineInfoList * retval = NULL;
3400    (void)args;
3401    if (error_is_set(errp)) {
3402        goto out;
3403    }
3404    retval = qmp_query_machines(errp);
3405    if (!error_is_set(errp)) {
3406        qmp_marshal_output_query_machines(retval, ret, errp);
3407    }
3408
3409out:
3410
3411
3412    if (local_err) {
3413        qerror_report_err(local_err);
3414        error_free(local_err);
3415        return -1;
3416    }
3417    return 0;
3418}
3419
3420static void qmp_marshal_output_query_cpu_definitions(CpuDefinitionInfoList * ret_in, QObject **ret_out, Error **errp)
3421{
3422    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
3423    QmpOutputVisitor *mo = qmp_output_visitor_new();
3424    Visitor *v;
3425
3426    v = qmp_output_get_visitor(mo);
3427    visit_type_CpuDefinitionInfoList(v, &ret_in, "unused", errp);
3428    if (!error_is_set(errp)) {
3429        *ret_out = qmp_output_get_qobject(mo);
3430    }
3431    qmp_output_visitor_cleanup(mo);
3432    v = qapi_dealloc_get_visitor(md);
3433    visit_type_CpuDefinitionInfoList(v, &ret_in, "unused", NULL);
3434    qapi_dealloc_visitor_cleanup(md);
3435}
3436
3437int qmp_marshal_input_query_cpu_definitions(Monitor *mon, const QDict *qdict, QObject **ret)
3438{
3439    Error *local_err = NULL;
3440    Error **errp = &local_err;
3441    QDict *args = (QDict *)qdict;
3442    CpuDefinitionInfoList * retval = NULL;
3443    (void)args;
3444    if (error_is_set(errp)) {
3445        goto out;
3446    }
3447    retval = qmp_query_cpu_definitions(errp);
3448    if (!error_is_set(errp)) {
3449        qmp_marshal_output_query_cpu_definitions(retval, ret, errp);
3450    }
3451
3452out:
3453
3454
3455    if (local_err) {
3456        qerror_report_err(local_err);
3457        error_free(local_err);
3458        return -1;
3459    }
3460    return 0;
3461}
3462
3463static void qmp_marshal_output_add_fd(AddfdInfo * ret_in, QObject **ret_out, Error **errp)
3464{
3465    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
3466    QmpOutputVisitor *mo = qmp_output_visitor_new();
3467    Visitor *v;
3468
3469    v = qmp_output_get_visitor(mo);
3470    visit_type_AddfdInfo(v, &ret_in, "unused", errp);
3471    if (!error_is_set(errp)) {
3472        *ret_out = qmp_output_get_qobject(mo);
3473    }
3474    qmp_output_visitor_cleanup(mo);
3475    v = qapi_dealloc_get_visitor(md);
3476    visit_type_AddfdInfo(v, &ret_in, "unused", NULL);
3477    qapi_dealloc_visitor_cleanup(md);
3478}
3479
3480int qmp_marshal_input_add_fd(Monitor *mon, const QDict *qdict, QObject **ret)
3481{
3482    Error *local_err = NULL;
3483    Error **errp = &local_err;
3484    QDict *args = (QDict *)qdict;
3485    AddfdInfo * retval = NULL;
3486    QmpInputVisitor *mi;
3487    QapiDeallocVisitor *md;
3488    Visitor *v;
3489    bool has_fdset_id = false;
3490    int64_t fdset_id;
3491    bool has_opaque = false;
3492    char * opaque = NULL;
3493
3494    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3495    v = qmp_input_get_visitor(mi);
3496    visit_start_optional(v, &has_fdset_id, "fdset-id", errp);
3497    if (has_fdset_id) {
3498        visit_type_int(v, &fdset_id, "fdset-id", errp);
3499    }
3500    visit_end_optional(v, errp);
3501    visit_start_optional(v, &has_opaque, "opaque", errp);
3502    if (has_opaque) {
3503        visit_type_str(v, &opaque, "opaque", errp);
3504    }
3505    visit_end_optional(v, errp);
3506    qmp_input_visitor_cleanup(mi);
3507
3508    if (error_is_set(errp)) {
3509        goto out;
3510    }
3511    retval = qmp_add_fd(has_fdset_id, fdset_id, has_opaque, opaque, errp);
3512    if (!error_is_set(errp)) {
3513        qmp_marshal_output_add_fd(retval, ret, errp);
3514    }
3515
3516out:
3517    md = qapi_dealloc_visitor_new();
3518    v = qapi_dealloc_get_visitor(md);
3519    visit_start_optional(v, &has_fdset_id, "fdset-id", NULL);
3520    if (has_fdset_id) {
3521        visit_type_int(v, &fdset_id, "fdset-id", NULL);
3522    }
3523    visit_end_optional(v, NULL);
3524    visit_start_optional(v, &has_opaque, "opaque", NULL);
3525    if (has_opaque) {
3526        visit_type_str(v, &opaque, "opaque", NULL);
3527    }
3528    visit_end_optional(v, NULL);
3529    qapi_dealloc_visitor_cleanup(md);
3530
3531    if (local_err) {
3532        qerror_report_err(local_err);
3533        error_free(local_err);
3534        return -1;
3535    }
3536    return 0;
3537}
3538
3539int qmp_marshal_input_remove_fd(Monitor *mon, const QDict *qdict, QObject **ret)
3540{
3541    Error *local_err = NULL;
3542    Error **errp = &local_err;
3543    QDict *args = (QDict *)qdict;
3544    QmpInputVisitor *mi;
3545    QapiDeallocVisitor *md;
3546    Visitor *v;
3547    int64_t fdset_id;
3548    bool has_fd = false;
3549    int64_t fd;
3550
3551    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3552    v = qmp_input_get_visitor(mi);
3553    visit_type_int(v, &fdset_id, "fdset-id", errp);
3554    visit_start_optional(v, &has_fd, "fd", errp);
3555    if (has_fd) {
3556        visit_type_int(v, &fd, "fd", errp);
3557    }
3558    visit_end_optional(v, errp);
3559    qmp_input_visitor_cleanup(mi);
3560
3561    if (error_is_set(errp)) {
3562        goto out;
3563    }
3564    qmp_remove_fd(fdset_id, has_fd, fd, errp);
3565
3566out:
3567    md = qapi_dealloc_visitor_new();
3568    v = qapi_dealloc_get_visitor(md);
3569    visit_type_int(v, &fdset_id, "fdset-id", NULL);
3570    visit_start_optional(v, &has_fd, "fd", NULL);
3571    if (has_fd) {
3572        visit_type_int(v, &fd, "fd", NULL);
3573    }
3574    visit_end_optional(v, NULL);
3575    qapi_dealloc_visitor_cleanup(md);
3576
3577    if (local_err) {
3578        qerror_report_err(local_err);
3579        error_free(local_err);
3580        return -1;
3581    }
3582    return 0;
3583}
3584
3585static void qmp_marshal_output_query_fdsets(FdsetInfoList * ret_in, QObject **ret_out, Error **errp)
3586{
3587    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
3588    QmpOutputVisitor *mo = qmp_output_visitor_new();
3589    Visitor *v;
3590
3591    v = qmp_output_get_visitor(mo);
3592    visit_type_FdsetInfoList(v, &ret_in, "unused", errp);
3593    if (!error_is_set(errp)) {
3594        *ret_out = qmp_output_get_qobject(mo);
3595    }
3596    qmp_output_visitor_cleanup(mo);
3597    v = qapi_dealloc_get_visitor(md);
3598    visit_type_FdsetInfoList(v, &ret_in, "unused", NULL);
3599    qapi_dealloc_visitor_cleanup(md);
3600}
3601
3602int qmp_marshal_input_query_fdsets(Monitor *mon, const QDict *qdict, QObject **ret)
3603{
3604    Error *local_err = NULL;
3605    Error **errp = &local_err;
3606    QDict *args = (QDict *)qdict;
3607    FdsetInfoList * retval = NULL;
3608    (void)args;
3609    if (error_is_set(errp)) {
3610        goto out;
3611    }
3612    retval = qmp_query_fdsets(errp);
3613    if (!error_is_set(errp)) {
3614        qmp_marshal_output_query_fdsets(retval, ret, errp);
3615    }
3616
3617out:
3618
3619
3620    if (local_err) {
3621        qerror_report_err(local_err);
3622        error_free(local_err);
3623        return -1;
3624    }
3625    return 0;
3626}
3627
3628static void qmp_marshal_output_query_target(TargetInfo * ret_in, QObject **ret_out, Error **errp)
3629{
3630    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
3631    QmpOutputVisitor *mo = qmp_output_visitor_new();
3632    Visitor *v;
3633
3634    v = qmp_output_get_visitor(mo);
3635    visit_type_TargetInfo(v, &ret_in, "unused", errp);
3636    if (!error_is_set(errp)) {
3637        *ret_out = qmp_output_get_qobject(mo);
3638    }
3639    qmp_output_visitor_cleanup(mo);
3640    v = qapi_dealloc_get_visitor(md);
3641    visit_type_TargetInfo(v, &ret_in, "unused", NULL);
3642    qapi_dealloc_visitor_cleanup(md);
3643}
3644
3645int qmp_marshal_input_query_target(Monitor *mon, const QDict *qdict, QObject **ret)
3646{
3647    Error *local_err = NULL;
3648    Error **errp = &local_err;
3649    QDict *args = (QDict *)qdict;
3650    TargetInfo * retval = NULL;
3651    (void)args;
3652    if (error_is_set(errp)) {
3653        goto out;
3654    }
3655    retval = qmp_query_target(errp);
3656    if (!error_is_set(errp)) {
3657        qmp_marshal_output_query_target(retval, ret, errp);
3658    }
3659
3660out:
3661
3662
3663    if (local_err) {
3664        qerror_report_err(local_err);
3665        error_free(local_err);
3666        return -1;
3667    }
3668    return 0;
3669}
3670
3671int qmp_marshal_input_send_key(Monitor *mon, const QDict *qdict, QObject **ret)
3672{
3673    Error *local_err = NULL;
3674    Error **errp = &local_err;
3675    QDict *args = (QDict *)qdict;
3676    QmpInputVisitor *mi;
3677    QapiDeallocVisitor *md;
3678    Visitor *v;
3679    KeyValueList * keys = NULL;
3680    bool has_hold_time = false;
3681    int64_t hold_time;
3682
3683    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3684    v = qmp_input_get_visitor(mi);
3685    visit_type_KeyValueList(v, &keys, "keys", errp);
3686    visit_start_optional(v, &has_hold_time, "hold-time", errp);
3687    if (has_hold_time) {
3688        visit_type_int(v, &hold_time, "hold-time", errp);
3689    }
3690    visit_end_optional(v, errp);
3691    qmp_input_visitor_cleanup(mi);
3692
3693    if (error_is_set(errp)) {
3694        goto out;
3695    }
3696    qmp_send_key(keys, has_hold_time, hold_time, errp);
3697
3698out:
3699    md = qapi_dealloc_visitor_new();
3700    v = qapi_dealloc_get_visitor(md);
3701    visit_type_KeyValueList(v, &keys, "keys", NULL);
3702    visit_start_optional(v, &has_hold_time, "hold-time", NULL);
3703    if (has_hold_time) {
3704        visit_type_int(v, &hold_time, "hold-time", NULL);
3705    }
3706    visit_end_optional(v, NULL);
3707    qapi_dealloc_visitor_cleanup(md);
3708
3709    if (local_err) {
3710        qerror_report_err(local_err);
3711        error_free(local_err);
3712        return -1;
3713    }
3714    return 0;
3715}
3716
3717int qmp_marshal_input_screendump(Monitor *mon, const QDict *qdict, QObject **ret)
3718{
3719    Error *local_err = NULL;
3720    Error **errp = &local_err;
3721    QDict *args = (QDict *)qdict;
3722    QmpInputVisitor *mi;
3723    QapiDeallocVisitor *md;
3724    Visitor *v;
3725    char * filename = NULL;
3726
3727    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3728    v = qmp_input_get_visitor(mi);
3729    visit_type_str(v, &filename, "filename", errp);
3730    qmp_input_visitor_cleanup(mi);
3731
3732    if (error_is_set(errp)) {
3733        goto out;
3734    }
3735    qmp_screendump(filename, errp);
3736
3737out:
3738    md = qapi_dealloc_visitor_new();
3739    v = qapi_dealloc_get_visitor(md);
3740    visit_type_str(v, &filename, "filename", NULL);
3741    qapi_dealloc_visitor_cleanup(md);
3742
3743    if (local_err) {
3744        qerror_report_err(local_err);
3745        error_free(local_err);
3746        return -1;
3747    }
3748    return 0;
3749}
3750
3751int qmp_marshal_input_nbd_server_start(Monitor *mon, const QDict *qdict, QObject **ret)
3752{
3753    Error *local_err = NULL;
3754    Error **errp = &local_err;
3755    QDict *args = (QDict *)qdict;
3756    QmpInputVisitor *mi;
3757    QapiDeallocVisitor *md;
3758    Visitor *v;
3759    SocketAddress * addr = NULL;
3760
3761    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3762    v = qmp_input_get_visitor(mi);
3763    visit_type_SocketAddress(v, &addr, "addr", errp);
3764    qmp_input_visitor_cleanup(mi);
3765
3766    if (error_is_set(errp)) {
3767        goto out;
3768    }
3769    qmp_nbd_server_start(addr, errp);
3770
3771out:
3772    md = qapi_dealloc_visitor_new();
3773    v = qapi_dealloc_get_visitor(md);
3774    visit_type_SocketAddress(v, &addr, "addr", NULL);
3775    qapi_dealloc_visitor_cleanup(md);
3776
3777    if (local_err) {
3778        qerror_report_err(local_err);
3779        error_free(local_err);
3780        return -1;
3781    }
3782    return 0;
3783}
3784
3785int qmp_marshal_input_nbd_server_add(Monitor *mon, const QDict *qdict, QObject **ret)
3786{
3787    Error *local_err = NULL;
3788    Error **errp = &local_err;
3789    QDict *args = (QDict *)qdict;
3790    QmpInputVisitor *mi;
3791    QapiDeallocVisitor *md;
3792    Visitor *v;
3793    char * device = NULL;
3794    bool has_writable = false;
3795    bool writable;
3796
3797    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3798    v = qmp_input_get_visitor(mi);
3799    visit_type_str(v, &device, "device", errp);
3800    visit_start_optional(v, &has_writable, "writable", errp);
3801    if (has_writable) {
3802        visit_type_bool(v, &writable, "writable", errp);
3803    }
3804    visit_end_optional(v, errp);
3805    qmp_input_visitor_cleanup(mi);
3806
3807    if (error_is_set(errp)) {
3808        goto out;
3809    }
3810    qmp_nbd_server_add(device, has_writable, writable, errp);
3811
3812out:
3813    md = qapi_dealloc_visitor_new();
3814    v = qapi_dealloc_get_visitor(md);
3815    visit_type_str(v, &device, "device", NULL);
3816    visit_start_optional(v, &has_writable, "writable", NULL);
3817    if (has_writable) {
3818        visit_type_bool(v, &writable, "writable", NULL);
3819    }
3820    visit_end_optional(v, NULL);
3821    qapi_dealloc_visitor_cleanup(md);
3822
3823    if (local_err) {
3824        qerror_report_err(local_err);
3825        error_free(local_err);
3826        return -1;
3827    }
3828    return 0;
3829}
3830
3831int qmp_marshal_input_nbd_server_stop(Monitor *mon, const QDict *qdict, QObject **ret)
3832{
3833    Error *local_err = NULL;
3834    Error **errp = &local_err;
3835    QDict *args = (QDict *)qdict;
3836    (void)args;
3837    if (error_is_set(errp)) {
3838        goto out;
3839    }
3840    qmp_nbd_server_stop(errp);
3841
3842out:
3843
3844
3845    if (local_err) {
3846        qerror_report_err(local_err);
3847        error_free(local_err);
3848        return -1;
3849    }
3850    return 0;
3851}
3852
3853static void qmp_marshal_output_chardev_add(ChardevReturn * ret_in, QObject **ret_out, Error **errp)
3854{
3855    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
3856    QmpOutputVisitor *mo = qmp_output_visitor_new();
3857    Visitor *v;
3858
3859    v = qmp_output_get_visitor(mo);
3860    visit_type_ChardevReturn(v, &ret_in, "unused", errp);
3861    if (!error_is_set(errp)) {
3862        *ret_out = qmp_output_get_qobject(mo);
3863    }
3864    qmp_output_visitor_cleanup(mo);
3865    v = qapi_dealloc_get_visitor(md);
3866    visit_type_ChardevReturn(v, &ret_in, "unused", NULL);
3867    qapi_dealloc_visitor_cleanup(md);
3868}
3869
3870int qmp_marshal_input_chardev_add(Monitor *mon, const QDict *qdict, QObject **ret)
3871{
3872    Error *local_err = NULL;
3873    Error **errp = &local_err;
3874    QDict *args = (QDict *)qdict;
3875    ChardevReturn * retval = NULL;
3876    QmpInputVisitor *mi;
3877    QapiDeallocVisitor *md;
3878    Visitor *v;
3879    char * id = NULL;
3880    ChardevBackend * backend = NULL;
3881
3882    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3883    v = qmp_input_get_visitor(mi);
3884    visit_type_str(v, &id, "id", errp);
3885    visit_type_ChardevBackend(v, &backend, "backend", errp);
3886    qmp_input_visitor_cleanup(mi);
3887
3888    if (error_is_set(errp)) {
3889        goto out;
3890    }
3891    retval = qmp_chardev_add(id, backend, errp);
3892    if (!error_is_set(errp)) {
3893        qmp_marshal_output_chardev_add(retval, ret, errp);
3894    }
3895
3896out:
3897    md = qapi_dealloc_visitor_new();
3898    v = qapi_dealloc_get_visitor(md);
3899    visit_type_str(v, &id, "id", NULL);
3900    visit_type_ChardevBackend(v, &backend, "backend", NULL);
3901    qapi_dealloc_visitor_cleanup(md);
3902
3903    if (local_err) {
3904        qerror_report_err(local_err);
3905        error_free(local_err);
3906        return -1;
3907    }
3908    return 0;
3909}
3910
3911int qmp_marshal_input_chardev_remove(Monitor *mon, const QDict *qdict, QObject **ret)
3912{
3913    Error *local_err = NULL;
3914    Error **errp = &local_err;
3915    QDict *args = (QDict *)qdict;
3916    QmpInputVisitor *mi;
3917    QapiDeallocVisitor *md;
3918    Visitor *v;
3919    char * id = NULL;
3920
3921    mi = qmp_input_visitor_new_strict(QOBJECT(args));
3922    v = qmp_input_get_visitor(mi);
3923    visit_type_str(v, &id, "id", errp);
3924    qmp_input_visitor_cleanup(mi);
3925
3926    if (error_is_set(errp)) {
3927        goto out;
3928    }
3929    qmp_chardev_remove(id, errp);
3930
3931out:
3932    md = qapi_dealloc_visitor_new();
3933    v = qapi_dealloc_get_visitor(md);
3934    visit_type_str(v, &id, "id", NULL);
3935    qapi_dealloc_visitor_cleanup(md);
3936
3937    if (local_err) {
3938        qerror_report_err(local_err);
3939        error_free(local_err);
3940        return -1;
3941    }
3942    return 0;
3943}
3944
3945static void qmp_marshal_output_query_tpm_models(TpmModelList * ret_in, QObject **ret_out, Error **errp)
3946{
3947    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
3948    QmpOutputVisitor *mo = qmp_output_visitor_new();
3949    Visitor *v;
3950
3951    v = qmp_output_get_visitor(mo);
3952    visit_type_TpmModelList(v, &ret_in, "unused", errp);
3953    if (!error_is_set(errp)) {
3954        *ret_out = qmp_output_get_qobject(mo);
3955    }
3956    qmp_output_visitor_cleanup(mo);
3957    v = qapi_dealloc_get_visitor(md);
3958    visit_type_TpmModelList(v, &ret_in, "unused", NULL);
3959    qapi_dealloc_visitor_cleanup(md);
3960}
3961
3962int qmp_marshal_input_query_tpm_models(Monitor *mon, const QDict *qdict, QObject **ret)
3963{
3964    Error *local_err = NULL;
3965    Error **errp = &local_err;
3966    QDict *args = (QDict *)qdict;
3967    TpmModelList * retval = NULL;
3968    (void)args;
3969    if (error_is_set(errp)) {
3970        goto out;
3971    }
3972    retval = qmp_query_tpm_models(errp);
3973    if (!error_is_set(errp)) {
3974        qmp_marshal_output_query_tpm_models(retval, ret, errp);
3975    }
3976
3977out:
3978
3979
3980    if (local_err) {
3981        qerror_report_err(local_err);
3982        error_free(local_err);
3983        return -1;
3984    }
3985    return 0;
3986}
3987
3988static void qmp_marshal_output_query_tpm_types(TpmTypeList * ret_in, QObject **ret_out, Error **errp)
3989{
3990    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
3991    QmpOutputVisitor *mo = qmp_output_visitor_new();
3992    Visitor *v;
3993
3994    v = qmp_output_get_visitor(mo);
3995    visit_type_TpmTypeList(v, &ret_in, "unused", errp);
3996    if (!error_is_set(errp)) {
3997        *ret_out = qmp_output_get_qobject(mo);
3998    }
3999    qmp_output_visitor_cleanup(mo);
4000    v = qapi_dealloc_get_visitor(md);
4001    visit_type_TpmTypeList(v, &ret_in, "unused", NULL);
4002    qapi_dealloc_visitor_cleanup(md);
4003}
4004
4005int qmp_marshal_input_query_tpm_types(Monitor *mon, const QDict *qdict, QObject **ret)
4006{
4007    Error *local_err = NULL;
4008    Error **errp = &local_err;
4009    QDict *args = (QDict *)qdict;
4010    TpmTypeList * retval = NULL;
4011    (void)args;
4012    if (error_is_set(errp)) {
4013        goto out;
4014    }
4015    retval = qmp_query_tpm_types(errp);
4016    if (!error_is_set(errp)) {
4017        qmp_marshal_output_query_tpm_types(retval, ret, errp);
4018    }
4019
4020out:
4021
4022
4023    if (local_err) {
4024        qerror_report_err(local_err);
4025        error_free(local_err);
4026        return -1;
4027    }
4028    return 0;
4029}
4030
4031static void qmp_marshal_output_query_tpm(TPMInfoList * ret_in, QObject **ret_out, Error **errp)
4032{
4033    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
4034    QmpOutputVisitor *mo = qmp_output_visitor_new();
4035    Visitor *v;
4036
4037    v = qmp_output_get_visitor(mo);
4038    visit_type_TPMInfoList(v, &ret_in, "unused", errp);
4039    if (!error_is_set(errp)) {
4040        *ret_out = qmp_output_get_qobject(mo);
4041    }
4042    qmp_output_visitor_cleanup(mo);
4043    v = qapi_dealloc_get_visitor(md);
4044    visit_type_TPMInfoList(v, &ret_in, "unused", NULL);
4045    qapi_dealloc_visitor_cleanup(md);
4046}
4047
4048int qmp_marshal_input_query_tpm(Monitor *mon, const QDict *qdict, QObject **ret)
4049{
4050    Error *local_err = NULL;
4051    Error **errp = &local_err;
4052    QDict *args = (QDict *)qdict;
4053    TPMInfoList * retval = NULL;
4054    (void)args;
4055    if (error_is_set(errp)) {
4056        goto out;
4057    }
4058    retval = qmp_query_tpm(errp);
4059    if (!error_is_set(errp)) {
4060        qmp_marshal_output_query_tpm(retval, ret, errp);
4061    }
4062
4063out:
4064
4065
4066    if (local_err) {
4067        qerror_report_err(local_err);
4068        error_free(local_err);
4069        return -1;
4070    }
4071    return 0;
4072}
4073
4074static void qmp_marshal_output_query_command_line_options(CommandLineOptionInfoList * ret_in, QObject **ret_out, Error **errp)
4075{
4076    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
4077    QmpOutputVisitor *mo = qmp_output_visitor_new();
4078    Visitor *v;
4079
4080    v = qmp_output_get_visitor(mo);
4081    visit_type_CommandLineOptionInfoList(v, &ret_in, "unused", errp);
4082    if (!error_is_set(errp)) {
4083        *ret_out = qmp_output_get_qobject(mo);
4084    }
4085    qmp_output_visitor_cleanup(mo);
4086    v = qapi_dealloc_get_visitor(md);
4087    visit_type_CommandLineOptionInfoList(v, &ret_in, "unused", NULL);
4088    qapi_dealloc_visitor_cleanup(md);
4089}
4090
4091int qmp_marshal_input_query_command_line_options(Monitor *mon, const QDict *qdict, QObject **ret)
4092{
4093    Error *local_err = NULL;
4094    Error **errp = &local_err;
4095    QDict *args = (QDict *)qdict;
4096    CommandLineOptionInfoList * retval = NULL;
4097    QmpInputVisitor *mi;
4098    QapiDeallocVisitor *md;
4099    Visitor *v;
4100    bool has_option = false;
4101    char * option = NULL;
4102
4103    mi = qmp_input_visitor_new_strict(QOBJECT(args));
4104    v = qmp_input_get_visitor(mi);
4105    visit_start_optional(v, &has_option, "option", errp);
4106    if (has_option) {
4107        visit_type_str(v, &option, "option", errp);
4108    }
4109    visit_end_optional(v, errp);
4110    qmp_input_visitor_cleanup(mi);
4111
4112    if (error_is_set(errp)) {
4113        goto out;
4114    }
4115    retval = qmp_query_command_line_options(has_option, option, errp);
4116    if (!error_is_set(errp)) {
4117        qmp_marshal_output_query_command_line_options(retval, ret, errp);
4118    }
4119
4120out:
4121    md = qapi_dealloc_visitor_new();
4122    v = qapi_dealloc_get_visitor(md);
4123    visit_start_optional(v, &has_option, "option", NULL);
4124    if (has_option) {
4125        visit_type_str(v, &option, "option", NULL);
4126    }
4127    visit_end_optional(v, NULL);
4128    qapi_dealloc_visitor_cleanup(md);
4129
4130    if (local_err) {
4131        qerror_report_err(local_err);
4132        error_free(local_err);
4133        return -1;
4134    }
4135    return 0;
4136}
4137
4138static void qmp_marshal_output_query_rx_filter(RxFilterInfoList * ret_in, QObject **ret_out, Error **errp)
4139{
4140    QapiDeallocVisitor *md = qapi_dealloc_visitor_new();
4141    QmpOutputVisitor *mo = qmp_output_visitor_new();
4142    Visitor *v;
4143
4144    v = qmp_output_get_visitor(mo);
4145    visit_type_RxFilterInfoList(v, &ret_in, "unused", errp);
4146    if (!error_is_set(errp)) {
4147        *ret_out = qmp_output_get_qobject(mo);
4148    }
4149    qmp_output_visitor_cleanup(mo);
4150    v = qapi_dealloc_get_visitor(md);
4151    visit_type_RxFilterInfoList(v, &ret_in, "unused", NULL);
4152    qapi_dealloc_visitor_cleanup(md);
4153}
4154
4155int qmp_marshal_input_query_rx_filter(Monitor *mon, const QDict *qdict, QObject **ret)
4156{
4157    Error *local_err = NULL;
4158    Error **errp = &local_err;
4159    QDict *args = (QDict *)qdict;
4160    RxFilterInfoList * retval = NULL;
4161    QmpInputVisitor *mi;
4162    QapiDeallocVisitor *md;
4163    Visitor *v;
4164    bool has_name = false;
4165    char * name = NULL;
4166
4167    mi = qmp_input_visitor_new_strict(QOBJECT(args));
4168    v = qmp_input_get_visitor(mi);
4169    visit_start_optional(v, &has_name, "name", errp);
4170    if (has_name) {
4171        visit_type_str(v, &name, "name", errp);
4172    }
4173    visit_end_optional(v, errp);
4174    qmp_input_visitor_cleanup(mi);
4175
4176    if (error_is_set(errp)) {
4177        goto out;
4178    }
4179    retval = qmp_query_rx_filter(has_name, name, errp);
4180    if (!error_is_set(errp)) {
4181        qmp_marshal_output_query_rx_filter(retval, ret, errp);
4182    }
4183
4184out:
4185    md = qapi_dealloc_visitor_new();
4186    v = qapi_dealloc_get_visitor(md);
4187    visit_start_optional(v, &has_name, "name", NULL);
4188    if (has_name) {
4189        visit_type_str(v, &name, "name", NULL);
4190    }
4191    visit_end_optional(v, NULL);
4192    qapi_dealloc_visitor_cleanup(md);
4193
4194    if (local_err) {
4195        qerror_report_err(local_err);
4196        error_free(local_err);
4197        return -1;
4198    }
4199    return 0;
4200}
4201
4202int qmp_marshal_input_blockdev_add(Monitor *mon, const QDict *qdict, QObject **ret)
4203{
4204    Error *local_err = NULL;
4205    Error **errp = &local_err;
4206    QDict *args = (QDict *)qdict;
4207    QmpInputVisitor *mi;
4208    QapiDeallocVisitor *md;
4209    Visitor *v;
4210    BlockdevOptions * options = NULL;
4211
4212    mi = qmp_input_visitor_new_strict(QOBJECT(args));
4213    v = qmp_input_get_visitor(mi);
4214    visit_type_BlockdevOptions(v, &options, "options", errp);
4215    qmp_input_visitor_cleanup(mi);
4216
4217    if (error_is_set(errp)) {
4218        goto out;
4219    }
4220    qmp_blockdev_add(options, errp);
4221
4222out:
4223    md = qapi_dealloc_visitor_new();
4224    v = qapi_dealloc_get_visitor(md);
4225    visit_type_BlockdevOptions(v, &options, "options", NULL);
4226    qapi_dealloc_visitor_cleanup(md);
4227
4228    if (local_err) {
4229        qerror_report_err(local_err);
4230        error_free(local_err);
4231        return -1;
4232    }
4233    return 0;
4234}
4235
4236