/src/qemu/build-oss-fuzz/qapi/qapi-visit-acpi.c
Line | Count | Source |
1 | | /* AUTOMATICALLY GENERATED by qapi-gen.py DO NOT MODIFY */ |
2 | | |
3 | | /* |
4 | | * Schema-defined QAPI visitors |
5 | | * |
6 | | * Copyright IBM, Corp. 2011 |
7 | | * Copyright (C) 2014-2018 Red Hat, Inc. |
8 | | * |
9 | | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. |
10 | | * See the COPYING.LIB file in the top-level directory. |
11 | | */ |
12 | | |
13 | | #include "qemu/osdep.h" |
14 | | #include "qapi/error.h" |
15 | | #include "qapi-visit-acpi.h" |
16 | | #include "qapi-features.h" |
17 | | |
18 | | bool visit_type_AcpiTableOptions_members(Visitor *v, AcpiTableOptions *obj, Error **errp) |
19 | 0 | { |
20 | 0 | bool has_sig = !!obj->sig; |
21 | 0 | bool has_oem_id = !!obj->oem_id; |
22 | 0 | bool has_oem_table_id = !!obj->oem_table_id; |
23 | 0 | bool has_asl_compiler_id = !!obj->asl_compiler_id; |
24 | 0 | bool has_file = !!obj->file; |
25 | 0 | bool has_data = !!obj->data; |
26 | |
|
27 | 0 | if (visit_optional(v, "sig", &has_sig)) { |
28 | 0 | if (!visit_type_str(v, "sig", &obj->sig, errp)) { |
29 | 0 | return false; |
30 | 0 | } |
31 | 0 | } |
32 | 0 | if (visit_optional(v, "rev", &obj->has_rev)) { |
33 | 0 | if (!visit_type_uint8(v, "rev", &obj->rev, errp)) { |
34 | 0 | return false; |
35 | 0 | } |
36 | 0 | } |
37 | 0 | if (visit_optional(v, "oem_id", &has_oem_id)) { |
38 | 0 | if (!visit_type_str(v, "oem_id", &obj->oem_id, errp)) { |
39 | 0 | return false; |
40 | 0 | } |
41 | 0 | } |
42 | 0 | if (visit_optional(v, "oem_table_id", &has_oem_table_id)) { |
43 | 0 | if (!visit_type_str(v, "oem_table_id", &obj->oem_table_id, errp)) { |
44 | 0 | return false; |
45 | 0 | } |
46 | 0 | } |
47 | 0 | if (visit_optional(v, "oem_rev", &obj->has_oem_rev)) { |
48 | 0 | if (!visit_type_uint32(v, "oem_rev", &obj->oem_rev, errp)) { |
49 | 0 | return false; |
50 | 0 | } |
51 | 0 | } |
52 | 0 | if (visit_optional(v, "asl_compiler_id", &has_asl_compiler_id)) { |
53 | 0 | if (!visit_type_str(v, "asl_compiler_id", &obj->asl_compiler_id, errp)) { |
54 | 0 | return false; |
55 | 0 | } |
56 | 0 | } |
57 | 0 | if (visit_optional(v, "asl_compiler_rev", &obj->has_asl_compiler_rev)) { |
58 | 0 | if (!visit_type_uint32(v, "asl_compiler_rev", &obj->asl_compiler_rev, errp)) { |
59 | 0 | return false; |
60 | 0 | } |
61 | 0 | } |
62 | 0 | if (visit_optional(v, "file", &has_file)) { |
63 | 0 | if (!visit_type_str(v, "file", &obj->file, errp)) { |
64 | 0 | return false; |
65 | 0 | } |
66 | 0 | } |
67 | 0 | if (visit_optional(v, "data", &has_data)) { |
68 | 0 | if (!visit_type_str(v, "data", &obj->data, errp)) { |
69 | 0 | return false; |
70 | 0 | } |
71 | 0 | } |
72 | 0 | return true; |
73 | 0 | } |
74 | | |
75 | | bool visit_type_AcpiTableOptions(Visitor *v, const char *name, |
76 | | AcpiTableOptions **obj, Error **errp) |
77 | 0 | { |
78 | 0 | bool ok = false; |
79 | |
|
80 | 0 | if (!visit_start_struct(v, name, (void **)obj, sizeof(AcpiTableOptions), errp)) { |
81 | 0 | return false; |
82 | 0 | } |
83 | 0 | if (!*obj) { |
84 | | /* incomplete */ |
85 | 0 | assert(visit_is_dealloc(v)); |
86 | 0 | ok = true; |
87 | 0 | goto out_obj; |
88 | 0 | } |
89 | 0 | if (!visit_type_AcpiTableOptions_members(v, *obj, errp)) { |
90 | 0 | goto out_obj; |
91 | 0 | } |
92 | 0 | ok = visit_check_struct(v, errp); |
93 | 0 | out_obj: |
94 | 0 | visit_end_struct(v, (void **)obj); |
95 | 0 | if (!ok && visit_is_input(v)) { |
96 | 0 | qapi_free_AcpiTableOptions(*obj); |
97 | 0 | *obj = NULL; |
98 | 0 | } |
99 | 0 | return ok; |
100 | 0 | } |
101 | | |
102 | | bool visit_type_ACPISlotType(Visitor *v, const char *name, |
103 | | ACPISlotType *obj, Error **errp) |
104 | 0 | { |
105 | 0 | int value = *obj; |
106 | 0 | bool ok = visit_type_enum(v, name, &value, &ACPISlotType_lookup, errp); |
107 | 0 | *obj = value; |
108 | 0 | return ok; |
109 | 0 | } |
110 | | |
111 | | bool visit_type_ACPIOSTInfo_members(Visitor *v, ACPIOSTInfo *obj, Error **errp) |
112 | 0 | { |
113 | 0 | bool has_device = !!obj->device; |
114 | |
|
115 | 0 | if (visit_optional(v, "device", &has_device)) { |
116 | 0 | if (!visit_type_str(v, "device", &obj->device, errp)) { |
117 | 0 | return false; |
118 | 0 | } |
119 | 0 | } |
120 | 0 | if (!visit_type_str(v, "slot", &obj->slot, errp)) { |
121 | 0 | return false; |
122 | 0 | } |
123 | 0 | if (!visit_type_ACPISlotType(v, "slot-type", &obj->slot_type, errp)) { |
124 | 0 | return false; |
125 | 0 | } |
126 | 0 | if (!visit_type_int(v, "source", &obj->source, errp)) { |
127 | 0 | return false; |
128 | 0 | } |
129 | 0 | if (!visit_type_int(v, "status", &obj->status, errp)) { |
130 | 0 | return false; |
131 | 0 | } |
132 | 0 | return true; |
133 | 0 | } |
134 | | |
135 | | bool visit_type_ACPIOSTInfo(Visitor *v, const char *name, |
136 | | ACPIOSTInfo **obj, Error **errp) |
137 | 0 | { |
138 | 0 | bool ok = false; |
139 | |
|
140 | 0 | if (!visit_start_struct(v, name, (void **)obj, sizeof(ACPIOSTInfo), errp)) { |
141 | 0 | return false; |
142 | 0 | } |
143 | 0 | if (!*obj) { |
144 | | /* incomplete */ |
145 | 0 | assert(visit_is_dealloc(v)); |
146 | 0 | ok = true; |
147 | 0 | goto out_obj; |
148 | 0 | } |
149 | 0 | if (!visit_type_ACPIOSTInfo_members(v, *obj, errp)) { |
150 | 0 | goto out_obj; |
151 | 0 | } |
152 | 0 | ok = visit_check_struct(v, errp); |
153 | 0 | out_obj: |
154 | 0 | visit_end_struct(v, (void **)obj); |
155 | 0 | if (!ok && visit_is_input(v)) { |
156 | 0 | qapi_free_ACPIOSTInfo(*obj); |
157 | 0 | *obj = NULL; |
158 | 0 | } |
159 | 0 | return ok; |
160 | 0 | } |
161 | | |
162 | | bool visit_type_ACPIOSTInfoList(Visitor *v, const char *name, |
163 | | ACPIOSTInfoList **obj, Error **errp) |
164 | 0 | { |
165 | 0 | bool ok = false; |
166 | 0 | ACPIOSTInfoList *tail; |
167 | 0 | size_t size = sizeof(**obj); |
168 | |
|
169 | 0 | if (!visit_start_list(v, name, (GenericList **)obj, size, errp)) { |
170 | 0 | return false; |
171 | 0 | } |
172 | | |
173 | 0 | for (tail = *obj; tail; |
174 | 0 | tail = (ACPIOSTInfoList *)visit_next_list(v, (GenericList *)tail, size)) { |
175 | 0 | if (!visit_type_ACPIOSTInfo(v, NULL, &tail->value, errp)) { |
176 | 0 | goto out_obj; |
177 | 0 | } |
178 | 0 | } |
179 | | |
180 | 0 | ok = visit_check_list(v, errp); |
181 | 0 | out_obj: |
182 | 0 | visit_end_list(v, (void **)obj); |
183 | 0 | if (!ok && visit_is_input(v)) { |
184 | 0 | qapi_free_ACPIOSTInfoList(*obj); |
185 | 0 | *obj = NULL; |
186 | 0 | } |
187 | 0 | return ok; |
188 | 0 | } |
189 | | |
190 | | bool visit_type_q_obj_ACPI_DEVICE_OST_arg_members(Visitor *v, q_obj_ACPI_DEVICE_OST_arg *obj, Error **errp) |
191 | 0 | { |
192 | 0 | if (!visit_type_ACPIOSTInfo(v, "info", &obj->info, errp)) { |
193 | 0 | return false; |
194 | 0 | } |
195 | 0 | return true; |
196 | 0 | } |
197 | | |
198 | | /* Dummy declaration to prevent empty .o file */ |
199 | | char qapi_dummy_qapi_visit_acpi_c; |