1/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
2
3/*
4 * Schema-defined QAPI/QMP commands
5 *
6 * Copyright IBM, Corp. 2011
7 * Copyright (C) 2014-2018 Red Hat, Inc.
8 *
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
11 */
12
13#include "qemu/osdep.h"
14#include "qapi/visitor.h"
15#include "qapi/qmp/qdict.h"
16#include "qapi/qobject-output-visitor.h"
17#include "qapi/qobject-input-visitor.h"
18#include "qapi/dealloc-visitor.h"
19#include "qapi/error.h"
20#include "qapi-visit-block.h"
21#include "qapi-commands-block.h"
22
23
24static void qmp_marshal_output_PRManagerInfoList(PRManagerInfoList *ret_in, QObject **ret_out, Error **errp)
25{
26 Error *err = NULL;
27 Visitor *v;
28
29 v = qobject_output_visitor_new(ret_out);
30 visit_type_PRManagerInfoList(v, "unused", &ret_in, &err);
31 if (!err) {
32 visit_complete(v, ret_out);
33 }
34 error_propagate(errp, err);
35 visit_free(v);
36 v = qapi_dealloc_visitor_new();
37 visit_type_PRManagerInfoList(v, "unused", &ret_in, NULL);
38 visit_free(v);
39}
40
41void qmp_marshal_query_pr_managers(QDict *args, QObject **ret, Error **errp)
42{
43 Error *err = NULL;
44 PRManagerInfoList *retval;
45 Visitor *v = NULL;
46
47 if (args) {
48 v = qobject_input_visitor_new(QOBJECT(args));
49 visit_start_struct(v, NULL, NULL, 0, &err);
50 if (err) {
51 goto out;
52 }
53
54 if (!err) {
55 visit_check_struct(v, &err);
56 }
57 visit_end_struct(v, NULL);
58 if (err) {
59 goto out;
60 }
61 }
62
63 retval = qmp_query_pr_managers(&err);
64 if (err) {
65 goto out;
66 }
67
68 qmp_marshal_output_PRManagerInfoList(retval, ret, &err);
69
70out:
71 error_propagate(errp, err);
72 visit_free(v);
73 if (args) {
74 v = qapi_dealloc_visitor_new();
75 visit_start_struct(v, NULL, NULL, 0, NULL);
76
77 visit_end_struct(v, NULL);
78 visit_free(v);
79 }
80}
81
82void qmp_marshal_blockdev_snapshot_internal_sync(QDict *args, QObject **ret, Error **errp)
83{
84 Error *err = NULL;
85 Visitor *v;
86 BlockdevSnapshotInternal arg = {0};
87
88 v = qobject_input_visitor_new(QOBJECT(args));
89 visit_start_struct(v, NULL, NULL, 0, &err);
90 if (err) {
91 goto out;
92 }
93 visit_type_BlockdevSnapshotInternal_members(v, &arg, &err);
94 if (!err) {
95 visit_check_struct(v, &err);
96 }
97 visit_end_struct(v, NULL);
98 if (err) {
99 goto out;
100 }
101
102 qmp_blockdev_snapshot_internal_sync(arg.device, arg.name, &err);
103
104out:
105 error_propagate(errp, err);
106 visit_free(v);
107 v = qapi_dealloc_visitor_new();
108 visit_start_struct(v, NULL, NULL, 0, NULL);
109 visit_type_BlockdevSnapshotInternal_members(v, &arg, NULL);
110 visit_end_struct(v, NULL);
111 visit_free(v);
112}
113
114static void qmp_marshal_output_SnapshotInfo(SnapshotInfo *ret_in, QObject **ret_out, Error **errp)
115{
116 Error *err = NULL;
117 Visitor *v;
118
119 v = qobject_output_visitor_new(ret_out);
120 visit_type_SnapshotInfo(v, "unused", &ret_in, &err);
121 if (!err) {
122 visit_complete(v, ret_out);
123 }
124 error_propagate(errp, err);
125 visit_free(v);
126 v = qapi_dealloc_visitor_new();
127 visit_type_SnapshotInfo(v, "unused", &ret_in, NULL);
128 visit_free(v);
129}
130
131void qmp_marshal_blockdev_snapshot_delete_internal_sync(QDict *args, QObject **ret, Error **errp)
132{
133 Error *err = NULL;
134 SnapshotInfo *retval;
135 Visitor *v;
136 q_obj_blockdev_snapshot_delete_internal_sync_arg arg = {0};
137
138 v = qobject_input_visitor_new(QOBJECT(args));
139 visit_start_struct(v, NULL, NULL, 0, &err);
140 if (err) {
141 goto out;
142 }
143 visit_type_q_obj_blockdev_snapshot_delete_internal_sync_arg_members(v, &arg, &err);
144 if (!err) {
145 visit_check_struct(v, &err);
146 }
147 visit_end_struct(v, NULL);
148 if (err) {
149 goto out;
150 }
151
152 retval = qmp_blockdev_snapshot_delete_internal_sync(arg.device, arg.has_id, arg.id, arg.has_name, arg.name, &err);
153 if (err) {
154 goto out;
155 }
156
157 qmp_marshal_output_SnapshotInfo(retval, ret, &err);
158
159out:
160 error_propagate(errp, err);
161 visit_free(v);
162 v = qapi_dealloc_visitor_new();
163 visit_start_struct(v, NULL, NULL, 0, NULL);
164 visit_type_q_obj_blockdev_snapshot_delete_internal_sync_arg_members(v, &arg, NULL);
165 visit_end_struct(v, NULL);
166 visit_free(v);
167}
168
169void qmp_marshal_eject(QDict *args, QObject **ret, Error **errp)
170{
171 Error *err = NULL;
172 Visitor *v;
173 q_obj_eject_arg arg = {0};
174
175 v = qobject_input_visitor_new(QOBJECT(args));
176 visit_start_struct(v, NULL, NULL, 0, &err);
177 if (err) {
178 goto out;
179 }
180 visit_type_q_obj_eject_arg_members(v, &arg, &err);
181 if (!err) {
182 visit_check_struct(v, &err);
183 }
184 visit_end_struct(v, NULL);
185 if (err) {
186 goto out;
187 }
188
189 qmp_eject(arg.has_device, arg.device, arg.has_id, arg.id, arg.has_force, arg.force, &err);
190
191out:
192 error_propagate(errp, err);
193 visit_free(v);
194 v = qapi_dealloc_visitor_new();
195 visit_start_struct(v, NULL, NULL, 0, NULL);
196 visit_type_q_obj_eject_arg_members(v, &arg, NULL);
197 visit_end_struct(v, NULL);
198 visit_free(v);
199}
200
201void qmp_marshal_nbd_server_start(QDict *args, QObject **ret, Error **errp)
202{
203 Error *err = NULL;
204 Visitor *v;
205 q_obj_nbd_server_start_arg arg = {0};
206
207 v = qobject_input_visitor_new(QOBJECT(args));
208 visit_start_struct(v, NULL, NULL, 0, &err);
209 if (err) {
210 goto out;
211 }
212 visit_type_q_obj_nbd_server_start_arg_members(v, &arg, &err);
213 if (!err) {
214 visit_check_struct(v, &err);
215 }
216 visit_end_struct(v, NULL);
217 if (err) {
218 goto out;
219 }
220
221 qmp_nbd_server_start(arg.addr, arg.has_tls_creds, arg.tls_creds, arg.has_tls_authz, arg.tls_authz, &err);
222
223out:
224 error_propagate(errp, err);
225 visit_free(v);
226 v = qapi_dealloc_visitor_new();
227 visit_start_struct(v, NULL, NULL, 0, NULL);
228 visit_type_q_obj_nbd_server_start_arg_members(v, &arg, NULL);
229 visit_end_struct(v, NULL);
230 visit_free(v);
231}
232
233void qmp_marshal_nbd_server_add(QDict *args, QObject **ret, Error **errp)
234{
235 Error *err = NULL;
236 Visitor *v;
237 q_obj_nbd_server_add_arg arg = {0};
238
239 v = qobject_input_visitor_new(QOBJECT(args));
240 visit_start_struct(v, NULL, NULL, 0, &err);
241 if (err) {
242 goto out;
243 }
244 visit_type_q_obj_nbd_server_add_arg_members(v, &arg, &err);
245 if (!err) {
246 visit_check_struct(v, &err);
247 }
248 visit_end_struct(v, NULL);
249 if (err) {
250 goto out;
251 }
252
253 qmp_nbd_server_add(arg.device, arg.has_name, arg.name, arg.has_writable, arg.writable, arg.has_bitmap, arg.bitmap, &err);
254
255out:
256 error_propagate(errp, err);
257 visit_free(v);
258 v = qapi_dealloc_visitor_new();
259 visit_start_struct(v, NULL, NULL, 0, NULL);
260 visit_type_q_obj_nbd_server_add_arg_members(v, &arg, NULL);
261 visit_end_struct(v, NULL);
262 visit_free(v);
263}
264
265void qmp_marshal_nbd_server_remove(QDict *args, QObject **ret, Error **errp)
266{
267 Error *err = NULL;
268 Visitor *v;
269 q_obj_nbd_server_remove_arg arg = {0};
270
271 v = qobject_input_visitor_new(QOBJECT(args));
272 visit_start_struct(v, NULL, NULL, 0, &err);
273 if (err) {
274 goto out;
275 }
276 visit_type_q_obj_nbd_server_remove_arg_members(v, &arg, &err);
277 if (!err) {
278 visit_check_struct(v, &err);
279 }
280 visit_end_struct(v, NULL);
281 if (err) {
282 goto out;
283 }
284
285 qmp_nbd_server_remove(arg.name, arg.has_mode, arg.mode, &err);
286
287out:
288 error_propagate(errp, err);
289 visit_free(v);
290 v = qapi_dealloc_visitor_new();
291 visit_start_struct(v, NULL, NULL, 0, NULL);
292 visit_type_q_obj_nbd_server_remove_arg_members(v, &arg, NULL);
293 visit_end_struct(v, NULL);
294 visit_free(v);
295}
296
297void qmp_marshal_nbd_server_stop(QDict *args, QObject **ret, Error **errp)
298{
299 Error *err = NULL;
300 Visitor *v = NULL;
301
302 if (args) {
303 v = qobject_input_visitor_new(QOBJECT(args));
304 visit_start_struct(v, NULL, NULL, 0, &err);
305 if (err) {
306 goto out;
307 }
308
309 if (!err) {
310 visit_check_struct(v, &err);
311 }
312 visit_end_struct(v, NULL);
313 if (err) {
314 goto out;
315 }
316 }
317
318 qmp_nbd_server_stop(&err);
319
320out:
321 error_propagate(errp, err);
322 visit_free(v);
323 if (args) {
324 v = qapi_dealloc_visitor_new();
325 visit_start_struct(v, NULL, NULL, 0, NULL);
326
327 visit_end_struct(v, NULL);
328 visit_free(v);
329 }
330}
331
332/* Dummy declaration to prevent empty .o file */
333char qapi_dummy_qapi_commands_block_c;
334