Coverage Report

Created: 2026-11-20 08:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qemu/build-oss-fuzz/qapi/qapi-visit-block.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-block.h"
16
#include "qapi-features.h"
17
18
bool visit_type_BiosAtaTranslation(Visitor *v, const char *name,
19
                 BiosAtaTranslation *obj, Error **errp)
20
0
{
21
0
    int value = *obj;
22
0
    bool ok = visit_type_enum(v, name, &value, &BiosAtaTranslation_lookup, errp);
23
0
    *obj = value;
24
0
    return ok;
25
0
}
26
27
bool visit_type_FloppyDriveType(Visitor *v, const char *name,
28
                 FloppyDriveType *obj, Error **errp)
29
0
{
30
0
    int value = *obj;
31
0
    bool ok = visit_type_enum(v, name, &value, &FloppyDriveType_lookup, errp);
32
0
    *obj = value;
33
0
    return ok;
34
0
}
35
36
bool visit_type_PRManagerInfo_members(Visitor *v, PRManagerInfo *obj, Error **errp)
37
0
{
38
0
    if (!visit_type_str(v, "id", &obj->id, errp)) {
39
0
        return false;
40
0
    }
41
0
    if (!visit_type_bool(v, "connected", &obj->connected, errp)) {
42
0
        return false;
43
0
    }
44
0
    return true;
45
0
}
46
47
bool visit_type_PRManagerInfo(Visitor *v, const char *name,
48
                 PRManagerInfo **obj, Error **errp)
49
0
{
50
0
    bool ok = false;
51
52
0
    if (!visit_start_struct(v, name, (void **)obj, sizeof(PRManagerInfo), errp)) {
53
0
        return false;
54
0
    }
55
0
    if (!*obj) {
56
        /* incomplete */
57
0
        assert(visit_is_dealloc(v));
58
0
        ok = true;
59
0
        goto out_obj;
60
0
    }
61
0
    if (!visit_type_PRManagerInfo_members(v, *obj, errp)) {
62
0
        goto out_obj;
63
0
    }
64
0
    ok = visit_check_struct(v, errp);
65
0
out_obj:
66
0
    visit_end_struct(v, (void **)obj);
67
0
    if (!ok && visit_is_input(v)) {
68
0
        qapi_free_PRManagerInfo(*obj);
69
0
        *obj = NULL;
70
0
    }
71
0
    return ok;
72
0
}
73
74
bool visit_type_PRManagerInfoList(Visitor *v, const char *name,
75
                 PRManagerInfoList **obj, Error **errp)
76
0
{
77
0
    bool ok = false;
78
0
    PRManagerInfoList *tail;
79
0
    size_t size = sizeof(**obj);
80
81
0
    if (!visit_start_list(v, name, (GenericList **)obj, size, errp)) {
82
0
        return false;
83
0
    }
84
85
0
    for (tail = *obj; tail;
86
0
         tail = (PRManagerInfoList *)visit_next_list(v, (GenericList *)tail, size)) {
87
0
        if (!visit_type_PRManagerInfo(v, NULL, &tail->value, errp)) {
88
0
            goto out_obj;
89
0
        }
90
0
    }
91
92
0
    ok = visit_check_list(v, errp);
93
0
out_obj:
94
0
    visit_end_list(v, (void **)obj);
95
0
    if (!ok && visit_is_input(v)) {
96
0
        qapi_free_PRManagerInfoList(*obj);
97
0
        *obj = NULL;
98
0
    }
99
0
    return ok;
100
0
}
101
102
bool visit_type_q_obj_eject_arg_members(Visitor *v, q_obj_eject_arg *obj, Error **errp)
103
0
{
104
0
    bool has_device = !!obj->device;
105
0
    bool has_id = !!obj->id;
106
107
0
    if (visit_optional(v, "device", &has_device)) {
108
0
        if (visit_policy_reject(v, "device", 1u << QAPI_FEATURE_DEPRECATED, errp)) {
109
0
            return false;
110
0
        }
111
0
        if (!visit_policy_skip(v, "device", 1u << QAPI_FEATURE_DEPRECATED)) {
112
0
            if (!visit_type_str(v, "device", &obj->device, errp)) {
113
0
                return false;
114
0
            }
115
0
        }
116
0
    }
117
0
    if (visit_optional(v, "id", &has_id)) {
118
0
        if (!visit_type_str(v, "id", &obj->id, errp)) {
119
0
            return false;
120
0
        }
121
0
    }
122
0
    if (visit_optional(v, "force", &obj->has_force)) {
123
0
        if (!visit_type_bool(v, "force", &obj->force, errp)) {
124
0
            return false;
125
0
        }
126
0
    }
127
0
    return true;
128
0
}
129
130
bool visit_type_q_obj_blockdev_open_tray_arg_members(Visitor *v, q_obj_blockdev_open_tray_arg *obj, Error **errp)
131
0
{
132
0
    bool has_device = !!obj->device;
133
0
    bool has_id = !!obj->id;
134
135
0
    if (visit_optional(v, "device", &has_device)) {
136
0
        if (visit_policy_reject(v, "device", 1u << QAPI_FEATURE_DEPRECATED, errp)) {
137
0
            return false;
138
0
        }
139
0
        if (!visit_policy_skip(v, "device", 1u << QAPI_FEATURE_DEPRECATED)) {
140
0
            if (!visit_type_str(v, "device", &obj->device, errp)) {
141
0
                return false;
142
0
            }
143
0
        }
144
0
    }
145
0
    if (visit_optional(v, "id", &has_id)) {
146
0
        if (!visit_type_str(v, "id", &obj->id, errp)) {
147
0
            return false;
148
0
        }
149
0
    }
150
0
    if (visit_optional(v, "force", &obj->has_force)) {
151
0
        if (!visit_type_bool(v, "force", &obj->force, errp)) {
152
0
            return false;
153
0
        }
154
0
    }
155
0
    return true;
156
0
}
157
158
bool visit_type_q_obj_blockdev_close_tray_arg_members(Visitor *v, q_obj_blockdev_close_tray_arg *obj, Error **errp)
159
0
{
160
0
    bool has_device = !!obj->device;
161
0
    bool has_id = !!obj->id;
162
163
0
    if (visit_optional(v, "device", &has_device)) {
164
0
        if (visit_policy_reject(v, "device", 1u << QAPI_FEATURE_DEPRECATED, errp)) {
165
0
            return false;
166
0
        }
167
0
        if (!visit_policy_skip(v, "device", 1u << QAPI_FEATURE_DEPRECATED)) {
168
0
            if (!visit_type_str(v, "device", &obj->device, errp)) {
169
0
                return false;
170
0
            }
171
0
        }
172
0
    }
173
0
    if (visit_optional(v, "id", &has_id)) {
174
0
        if (!visit_type_str(v, "id", &obj->id, errp)) {
175
0
            return false;
176
0
        }
177
0
    }
178
0
    return true;
179
0
}
180
181
bool visit_type_q_obj_blockdev_remove_medium_arg_members(Visitor *v, q_obj_blockdev_remove_medium_arg *obj, Error **errp)
182
0
{
183
0
    if (!visit_type_str(v, "id", &obj->id, errp)) {
184
0
        return false;
185
0
    }
186
0
    return true;
187
0
}
188
189
bool visit_type_q_obj_blockdev_insert_medium_arg_members(Visitor *v, q_obj_blockdev_insert_medium_arg *obj, Error **errp)
190
0
{
191
0
    if (!visit_type_str(v, "id", &obj->id, errp)) {
192
0
        return false;
193
0
    }
194
0
    if (!visit_type_str(v, "node-name", &obj->node_name, errp)) {
195
0
        return false;
196
0
    }
197
0
    return true;
198
0
}
199
200
bool visit_type_BlockdevChangeReadOnlyMode(Visitor *v, const char *name,
201
                 BlockdevChangeReadOnlyMode *obj, Error **errp)
202
0
{
203
0
    int value = *obj;
204
0
    bool ok = visit_type_enum(v, name, &value, &BlockdevChangeReadOnlyMode_lookup, errp);
205
0
    *obj = value;
206
0
    return ok;
207
0
}
208
209
bool visit_type_q_obj_blockdev_change_medium_arg_members(Visitor *v, q_obj_blockdev_change_medium_arg *obj, Error **errp)
210
0
{
211
0
    bool has_device = !!obj->device;
212
0
    bool has_id = !!obj->id;
213
0
    bool has_format = !!obj->format;
214
215
0
    if (visit_optional(v, "device", &has_device)) {
216
0
        if (visit_policy_reject(v, "device", 1u << QAPI_FEATURE_DEPRECATED, errp)) {
217
0
            return false;
218
0
        }
219
0
        if (!visit_policy_skip(v, "device", 1u << QAPI_FEATURE_DEPRECATED)) {
220
0
            if (!visit_type_str(v, "device", &obj->device, errp)) {
221
0
                return false;
222
0
            }
223
0
        }
224
0
    }
225
0
    if (visit_optional(v, "id", &has_id)) {
226
0
        if (!visit_type_str(v, "id", &obj->id, errp)) {
227
0
            return false;
228
0
        }
229
0
    }
230
0
    if (!visit_type_str(v, "filename", &obj->filename, errp)) {
231
0
        return false;
232
0
    }
233
0
    if (visit_optional(v, "format", &has_format)) {
234
0
        if (!visit_type_str(v, "format", &obj->format, errp)) {
235
0
            return false;
236
0
        }
237
0
    }
238
0
    if (visit_optional(v, "force", &obj->has_force)) {
239
0
        if (!visit_type_bool(v, "force", &obj->force, errp)) {
240
0
            return false;
241
0
        }
242
0
    }
243
0
    if (visit_optional(v, "read-only-mode", &obj->has_read_only_mode)) {
244
0
        if (!visit_type_BlockdevChangeReadOnlyMode(v, "read-only-mode", &obj->read_only_mode, errp)) {
245
0
            return false;
246
0
        }
247
0
    }
248
0
    return true;
249
0
}
250
251
bool visit_type_q_obj_DEVICE_TRAY_MOVED_arg_members(Visitor *v, q_obj_DEVICE_TRAY_MOVED_arg *obj, Error **errp)
252
0
{
253
0
    if (!visit_type_str(v, "device", &obj->device, errp)) {
254
0
        return false;
255
0
    }
256
0
    if (!visit_type_str(v, "id", &obj->id, errp)) {
257
0
        return false;
258
0
    }
259
0
    if (!visit_type_bool(v, "tray-open", &obj->tray_open, errp)) {
260
0
        return false;
261
0
    }
262
0
    return true;
263
0
}
264
265
bool visit_type_q_obj_PR_MANAGER_STATUS_CHANGED_arg_members(Visitor *v, q_obj_PR_MANAGER_STATUS_CHANGED_arg *obj, Error **errp)
266
0
{
267
0
    if (!visit_type_str(v, "id", &obj->id, errp)) {
268
0
        return false;
269
0
    }
270
0
    if (!visit_type_bool(v, "connected", &obj->connected, errp)) {
271
0
        return false;
272
0
    }
273
0
    return true;
274
0
}
275
276
bool visit_type_q_obj_block_latency_histogram_set_arg_members(Visitor *v, q_obj_block_latency_histogram_set_arg *obj, Error **errp)
277
0
{
278
0
    if (!visit_type_str(v, "id", &obj->id, errp)) {
279
0
        return false;
280
0
    }
281
0
    if (visit_optional(v, "boundaries", &obj->has_boundaries)) {
282
0
        if (!visit_type_uint64List(v, "boundaries", &obj->boundaries, errp)) {
283
0
            return false;
284
0
        }
285
0
    }
286
0
    if (visit_optional(v, "boundaries-read", &obj->has_boundaries_read)) {
287
0
        if (!visit_type_uint64List(v, "boundaries-read", &obj->boundaries_read, errp)) {
288
0
            return false;
289
0
        }
290
0
    }
291
0
    if (visit_optional(v, "boundaries-write", &obj->has_boundaries_write)) {
292
0
        if (!visit_type_uint64List(v, "boundaries-write", &obj->boundaries_write, errp)) {
293
0
            return false;
294
0
        }
295
0
    }
296
0
    if (visit_optional(v, "boundaries-zap", &obj->has_boundaries_zap)) {
297
0
        if (!visit_type_uint64List(v, "boundaries-zap", &obj->boundaries_zap, errp)) {
298
0
            return false;
299
0
        }
300
0
    }
301
0
    if (visit_optional(v, "boundaries-flush", &obj->has_boundaries_flush)) {
302
0
        if (!visit_type_uint64List(v, "boundaries-flush", &obj->boundaries_flush, errp)) {
303
0
            return false;
304
0
        }
305
0
    }
306
0
    return true;
307
0
}
308
309
bool visit_type_q_obj_x_qemu_io_arg_members(Visitor *v, q_obj_x_qemu_io_arg *obj, Error **errp)
310
0
{
311
0
    bool has_device = !!obj->device;
312
0
    bool has_qdev = !!obj->qdev;
313
314
0
    if (visit_optional(v, "device", &has_device)) {
315
0
        if (!visit_type_str(v, "device", &obj->device, errp)) {
316
0
            return false;
317
0
        }
318
0
    }
319
0
    if (visit_optional(v, "qdev", &has_qdev)) {
320
0
        if (!visit_type_str(v, "qdev", &obj->qdev, errp)) {
321
0
            return false;
322
0
        }
323
0
    }
324
0
    if (!visit_type_str(v, "command", &obj->command, errp)) {
325
0
        return false;
326
0
    }
327
0
    return true;
328
0
}
329
330
/* Dummy declaration to prevent empty .o file */
331
char qapi_dummy_qapi_visit_block_c;