/src/qemu/build-oss-fuzz/qapi/qapi-commands-control.c
Line | Count | Source |
1 | | /* AUTOMATICALLY GENERATED by qapi-gen.py 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/compat-policy.h" |
15 | | #include "qapi/visitor.h" |
16 | | #include "qobject/qdict.h" |
17 | | #include "qapi/dealloc-visitor.h" |
18 | | #include "qapi/error.h" |
19 | | #include "qapi-visit-control.h" |
20 | | #include "qapi-commands-control.h" |
21 | | #include "qobject/qjson.h" |
22 | | #include "trace/trace-qapi_commands_control_trace_events.h" |
23 | | |
24 | | void qmp_marshal_qmp_capabilities(QDict *args, QObject **ret, Error **errp) |
25 | 0 | { |
26 | 0 | Error *err = NULL; |
27 | 0 | bool ok = false; |
28 | 0 | Visitor *v; |
29 | 0 | q_obj_qmp_capabilities_arg arg = {0}; |
30 | |
|
31 | 0 | v = qobject_input_visitor_new_qmp(QOBJECT(args)); |
32 | 0 | if (!visit_start_struct(v, NULL, NULL, 0, errp)) { |
33 | 0 | goto out; |
34 | 0 | } |
35 | 0 | if (visit_type_q_obj_qmp_capabilities_arg_members(v, &arg, errp)) { |
36 | 0 | ok = visit_check_struct(v, errp); |
37 | 0 | } |
38 | 0 | visit_end_struct(v, NULL); |
39 | 0 | if (!ok) { |
40 | 0 | goto out; |
41 | 0 | } |
42 | | |
43 | 0 | if (trace_event_get_state_backends(TRACE_QMP_ENTER_QMP_CAPABILITIES)) { |
44 | 0 | g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args)); |
45 | |
|
46 | 0 | trace_qmp_enter_qmp_capabilities(req_json->str); |
47 | 0 | } |
48 | |
|
49 | 0 | qmp_qmp_capabilities(arg.has_enable, arg.enable, &err); |
50 | 0 | if (err) { |
51 | 0 | trace_qmp_exit_qmp_capabilities(error_get_pretty(err), false); |
52 | 0 | error_propagate(errp, err); |
53 | 0 | goto out; |
54 | 0 | } |
55 | | |
56 | 0 | trace_qmp_exit_qmp_capabilities("{}", true); |
57 | |
|
58 | 0 | out: |
59 | 0 | visit_free(v); |
60 | 0 | v = qapi_dealloc_visitor_new(); |
61 | 0 | visit_start_struct(v, NULL, NULL, 0, NULL); |
62 | 0 | visit_type_q_obj_qmp_capabilities_arg_members(v, &arg, NULL); |
63 | 0 | visit_end_struct(v, NULL); |
64 | 0 | visit_free(v); |
65 | 0 | } |
66 | | |
67 | | void qmp_marshal_query_version(QDict *args, QObject **ret, Error **errp) |
68 | 0 | { |
69 | 0 | Error *err = NULL; |
70 | 0 | bool ok = false; |
71 | 0 | Visitor *v; |
72 | 0 | VersionInfo *retval; |
73 | 0 | Visitor *ov; |
74 | |
|
75 | 0 | v = qobject_input_visitor_new_qmp(QOBJECT(args)); |
76 | 0 | if (!visit_start_struct(v, NULL, NULL, 0, errp)) { |
77 | 0 | goto out; |
78 | 0 | } |
79 | 0 | ok = visit_check_struct(v, errp); |
80 | 0 | visit_end_struct(v, NULL); |
81 | 0 | if (!ok) { |
82 | 0 | goto out; |
83 | 0 | } |
84 | | |
85 | 0 | if (trace_event_get_state_backends(TRACE_QMP_ENTER_QUERY_VERSION)) { |
86 | 0 | g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args)); |
87 | |
|
88 | 0 | trace_qmp_enter_query_version(req_json->str); |
89 | 0 | } |
90 | |
|
91 | 0 | retval = qmp_query_version(&err); |
92 | 0 | if (err) { |
93 | 0 | trace_qmp_exit_query_version(error_get_pretty(err), false); |
94 | 0 | error_propagate(errp, err); |
95 | 0 | goto out; |
96 | 0 | } |
97 | | |
98 | 0 | ov = qobject_output_visitor_new_qmp(ret); |
99 | 0 | if (visit_type_VersionInfo(ov, "unused", &retval, errp)) { |
100 | 0 | visit_complete(ov, ret); |
101 | 0 | } |
102 | 0 | visit_free(ov); |
103 | 0 | ov = qapi_dealloc_visitor_new(); |
104 | 0 | visit_type_VersionInfo(ov, "unused", &retval, NULL); |
105 | 0 | visit_free(ov); |
106 | |
|
107 | 0 | if (trace_event_get_state_backends(TRACE_QMP_EXIT_QUERY_VERSION)) { |
108 | 0 | g_autoptr(GString) ret_json = qobject_to_json(*ret); |
109 | |
|
110 | 0 | trace_qmp_exit_query_version(ret_json->str, true); |
111 | 0 | } |
112 | |
|
113 | 0 | out: |
114 | 0 | visit_free(v); |
115 | 0 | v = qapi_dealloc_visitor_new(); |
116 | 0 | visit_start_struct(v, NULL, NULL, 0, NULL); |
117 | 0 | visit_end_struct(v, NULL); |
118 | 0 | visit_free(v); |
119 | 0 | } |
120 | | |
121 | | void qmp_marshal_query_commands(QDict *args, QObject **ret, Error **errp) |
122 | 0 | { |
123 | 0 | Error *err = NULL; |
124 | 0 | bool ok = false; |
125 | 0 | Visitor *v; |
126 | 0 | CommandInfoList *retval; |
127 | 0 | Visitor *ov; |
128 | |
|
129 | 0 | v = qobject_input_visitor_new_qmp(QOBJECT(args)); |
130 | 0 | if (!visit_start_struct(v, NULL, NULL, 0, errp)) { |
131 | 0 | goto out; |
132 | 0 | } |
133 | 0 | ok = visit_check_struct(v, errp); |
134 | 0 | visit_end_struct(v, NULL); |
135 | 0 | if (!ok) { |
136 | 0 | goto out; |
137 | 0 | } |
138 | | |
139 | 0 | if (trace_event_get_state_backends(TRACE_QMP_ENTER_QUERY_COMMANDS)) { |
140 | 0 | g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args)); |
141 | |
|
142 | 0 | trace_qmp_enter_query_commands(req_json->str); |
143 | 0 | } |
144 | |
|
145 | 0 | retval = qmp_query_commands(&err); |
146 | 0 | if (err) { |
147 | 0 | trace_qmp_exit_query_commands(error_get_pretty(err), false); |
148 | 0 | error_propagate(errp, err); |
149 | 0 | goto out; |
150 | 0 | } |
151 | | |
152 | 0 | ov = qobject_output_visitor_new_qmp(ret); |
153 | 0 | if (visit_type_CommandInfoList(ov, "unused", &retval, errp)) { |
154 | 0 | visit_complete(ov, ret); |
155 | 0 | } |
156 | 0 | visit_free(ov); |
157 | 0 | ov = qapi_dealloc_visitor_new(); |
158 | 0 | visit_type_CommandInfoList(ov, "unused", &retval, NULL); |
159 | 0 | visit_free(ov); |
160 | |
|
161 | 0 | if (trace_event_get_state_backends(TRACE_QMP_EXIT_QUERY_COMMANDS)) { |
162 | 0 | g_autoptr(GString) ret_json = qobject_to_json(*ret); |
163 | |
|
164 | 0 | trace_qmp_exit_query_commands(ret_json->str, true); |
165 | 0 | } |
166 | |
|
167 | 0 | out: |
168 | 0 | visit_free(v); |
169 | 0 | v = qapi_dealloc_visitor_new(); |
170 | 0 | visit_start_struct(v, NULL, NULL, 0, NULL); |
171 | 0 | visit_end_struct(v, NULL); |
172 | 0 | visit_free(v); |
173 | 0 | } |
174 | | |
175 | | void qmp_marshal_quit(QDict *args, QObject **ret, Error **errp) |
176 | 0 | { |
177 | 0 | Error *err = NULL; |
178 | 0 | bool ok = false; |
179 | 0 | Visitor *v; |
180 | |
|
181 | 0 | v = qobject_input_visitor_new_qmp(QOBJECT(args)); |
182 | 0 | if (!visit_start_struct(v, NULL, NULL, 0, errp)) { |
183 | 0 | goto out; |
184 | 0 | } |
185 | 0 | ok = visit_check_struct(v, errp); |
186 | 0 | visit_end_struct(v, NULL); |
187 | 0 | if (!ok) { |
188 | 0 | goto out; |
189 | 0 | } |
190 | | |
191 | 0 | if (trace_event_get_state_backends(TRACE_QMP_ENTER_QUIT)) { |
192 | 0 | g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args)); |
193 | |
|
194 | 0 | trace_qmp_enter_quit(req_json->str); |
195 | 0 | } |
196 | |
|
197 | 0 | qmp_quit(&err); |
198 | 0 | if (err) { |
199 | 0 | trace_qmp_exit_quit(error_get_pretty(err), false); |
200 | 0 | error_propagate(errp, err); |
201 | 0 | goto out; |
202 | 0 | } |
203 | | |
204 | 0 | trace_qmp_exit_quit("{}", true); |
205 | |
|
206 | 0 | out: |
207 | 0 | visit_free(v); |
208 | 0 | v = qapi_dealloc_visitor_new(); |
209 | 0 | visit_start_struct(v, NULL, NULL, 0, NULL); |
210 | | visit_end_struct(v, NULL); |
211 | 0 | visit_free(v); |
212 | 0 | } |
213 | | |
214 | | /* Dummy declaration to prevent empty .o file */ |
215 | | char qapi_dummy_qapi_commands_control_c; |