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-commands-run-state.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-run-state.h"
20
#include "qapi-commands-run-state.h"
21
#include "qobject/qjson.h"
22
#include "trace/trace-qapi_commands_run_state_trace_events.h"
23
24
void qmp_marshal_query_status(QDict *args, QObject **ret, Error **errp)
25
0
{
26
0
    Error *err = NULL;
27
0
    bool ok = false;
28
0
    Visitor *v;
29
0
    StatusInfo *retval;
30
0
    Visitor *ov;
31
32
0
    v = qobject_input_visitor_new_qmp(QOBJECT(args));
33
0
    if (!visit_start_struct(v, NULL, NULL, 0, errp)) {
34
0
        goto out;
35
0
    }
36
0
    ok = visit_check_struct(v, errp);
37
0
    visit_end_struct(v, NULL);
38
0
    if (!ok) {
39
0
        goto out;
40
0
    }
41
42
0
    if (trace_event_get_state_backends(TRACE_QMP_ENTER_QUERY_STATUS)) {
43
0
        g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args));
44
45
0
        trace_qmp_enter_query_status(req_json->str);
46
0
    }
47
48
0
    retval = qmp_query_status(&err);
49
0
    if (err) {
50
0
        trace_qmp_exit_query_status(error_get_pretty(err), false);
51
0
        error_propagate(errp, err);
52
0
        goto out;
53
0
    }
54
55
0
    ov = qobject_output_visitor_new_qmp(ret);
56
0
    if (visit_type_StatusInfo(ov, "unused", &retval, errp)) {
57
0
        visit_complete(ov, ret);
58
0
    }
59
0
    visit_free(ov);
60
0
    ov = qapi_dealloc_visitor_new();
61
0
    visit_type_StatusInfo(ov, "unused", &retval, NULL);
62
0
    visit_free(ov);
63
64
0
    if (trace_event_get_state_backends(TRACE_QMP_EXIT_QUERY_STATUS)) {
65
0
        g_autoptr(GString) ret_json = qobject_to_json(*ret);
66
67
0
        trace_qmp_exit_query_status(ret_json->str, true);
68
0
    }
69
70
0
out:
71
0
    visit_free(v);
72
0
    v = qapi_dealloc_visitor_new();
73
0
    visit_start_struct(v, NULL, NULL, 0, NULL);
74
0
    visit_end_struct(v, NULL);
75
0
    visit_free(v);
76
0
}
77
78
void qmp_marshal_watchdog_set_action(QDict *args, QObject **ret, Error **errp)
79
0
{
80
0
    Error *err = NULL;
81
0
    bool ok = false;
82
0
    Visitor *v;
83
0
    q_obj_watchdog_set_action_arg arg = {0};
84
85
0
    v = qobject_input_visitor_new_qmp(QOBJECT(args));
86
0
    if (!visit_start_struct(v, NULL, NULL, 0, errp)) {
87
0
        goto out;
88
0
    }
89
0
    if (visit_type_q_obj_watchdog_set_action_arg_members(v, &arg, errp)) {
90
0
        ok = visit_check_struct(v, errp);
91
0
    }
92
0
    visit_end_struct(v, NULL);
93
0
    if (!ok) {
94
0
        goto out;
95
0
    }
96
97
0
    if (trace_event_get_state_backends(TRACE_QMP_ENTER_WATCHDOG_SET_ACTION)) {
98
0
        g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args));
99
100
0
        trace_qmp_enter_watchdog_set_action(req_json->str);
101
0
    }
102
103
0
    qmp_watchdog_set_action(arg.action, &err);
104
0
    if (err) {
105
0
        trace_qmp_exit_watchdog_set_action(error_get_pretty(err), false);
106
0
        error_propagate(errp, err);
107
0
        goto out;
108
0
    }
109
110
0
    trace_qmp_exit_watchdog_set_action("{}", true);
111
112
0
out:
113
0
    visit_free(v);
114
0
    v = qapi_dealloc_visitor_new();
115
0
    visit_start_struct(v, NULL, NULL, 0, NULL);
116
0
    visit_type_q_obj_watchdog_set_action_arg_members(v, &arg, NULL);
117
0
    visit_end_struct(v, NULL);
118
0
    visit_free(v);
119
0
}
120
121
void qmp_marshal_set_action(QDict *args, QObject **ret, Error **errp)
122
0
{
123
0
    Error *err = NULL;
124
0
    bool ok = false;
125
0
    Visitor *v;
126
0
    q_obj_set_action_arg arg = {0};
127
128
0
    v = qobject_input_visitor_new_qmp(QOBJECT(args));
129
0
    if (!visit_start_struct(v, NULL, NULL, 0, errp)) {
130
0
        goto out;
131
0
    }
132
0
    if (visit_type_q_obj_set_action_arg_members(v, &arg, errp)) {
133
0
        ok = visit_check_struct(v, errp);
134
0
    }
135
0
    visit_end_struct(v, NULL);
136
0
    if (!ok) {
137
0
        goto out;
138
0
    }
139
140
0
    if (trace_event_get_state_backends(TRACE_QMP_ENTER_SET_ACTION)) {
141
0
        g_autoptr(GString) req_json = qobject_to_json(QOBJECT(args));
142
143
0
        trace_qmp_enter_set_action(req_json->str);
144
0
    }
145
146
0
    qmp_set_action(arg.has_reboot, arg.reboot, arg.has_shutdown, arg.shutdown, arg.has_panic, arg.panic, arg.has_watchdog, arg.watchdog, &err);
147
0
    if (err) {
148
0
        trace_qmp_exit_set_action(error_get_pretty(err), false);
149
0
        error_propagate(errp, err);
150
0
        goto out;
151
0
    }
152
153
0
    trace_qmp_exit_set_action("{}", true);
154
155
0
out:
156
0
    visit_free(v);
157
0
    v = qapi_dealloc_visitor_new();
158
0
    visit_start_struct(v, NULL, NULL, 0, NULL);
159
0
    visit_type_q_obj_set_action_arg_members(v, &arg, NULL);
160
    visit_end_struct(v, NULL);
161
0
    visit_free(v);
162
0
}
163
164
/* Dummy declaration to prevent empty .o file */
165
char qapi_dummy_qapi_commands_run_state_c;