]> git.proxmox.com Git - qemu.git/blame - qerror.h
user: Restore debug usage message for '-d ?' in user mode emulation
[qemu.git] / qerror.h
CommitLineData
9f9daf9a 1/*
41836a9f 2 * QError Module
9f9daf9a
LC
3 *
4 * Copyright (C) 2009 Red Hat Inc.
5 *
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
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#ifndef QERROR_H
13#define QERROR_H
14
15#include "qdict.h"
77e595e7 16#include "qstring.h"
827b0813 17#include "qemu-error.h"
9f9daf9a
LC
18#include <stdarg.h>
19
20typedef struct QErrorStringTable {
21 const char *desc;
22 const char *error_fmt;
23} QErrorStringTable;
24
25typedef struct QError {
26 QObject_HEAD;
27 QDict *error;
827b0813 28 Location loc;
9f9daf9a
LC
29 int linenr;
30 const char *file;
31 const char *func;
32 const QErrorStringTable *entry;
33} QError;
34
35QError *qerror_new(void);
36QError *qerror_from_info(const char *file, int linenr, const char *func,
8b7968f7 37 const char *fmt, va_list *va) GCC_FMT_ATTR(4, 0);
77e595e7 38QString *qerror_human(const QError *qerror);
827b0813 39void qerror_print(QError *qerror);
0167f772 40void qerror_report_internal(const char *file, int linenr, const char *func,
e5924d89 41 const char *fmt, ...) GCC_FMT_ATTR(4, 5);
87c2f591 42QString *qerror_format(const char *fmt, QDict *error);
0167f772
MA
43#define qerror_report(fmt, ...) \
44 qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
9f9daf9a
LC
45QError *qobject_to_qerror(const QObject *obj);
46
47/*
48 * QError class list
9d494c4b
MA
49 * Please keep the definitions in alphabetical order.
50 * Use "grep '^#define QERR_' qerror.h | sort -c" to check.
9f9daf9a 51 */
56e9f563
MA
52#define QERR_BAD_BUS_FOR_DEVICE \
53 "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
54
7bbd8237
MA
55#define QERR_BUS_NOT_FOUND \
56 "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
57
8eae73b5
MA
58#define QERR_BUS_NO_HOTPLUG \
59 "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
60
4b9d4683 61#define QERR_COMMAND_NOT_FOUND \
e16a1812 62 "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
4b9d4683 63
0df37c41 64#define QERR_DEVICE_ENCRYPTED \
e16a1812 65 "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
9f9daf9a 66
4d9a1a15
MA
67#define QERR_DEVICE_INIT_FAILED \
68 "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
69
5124eb59
MA
70#define QERR_DEVICE_IN_USE \
71 "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
72
fc5469d8 73#define QERR_DEVICE_LOCKED \
b0868380
MA
74 "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
75
1ae78718
MA
76#define QERR_DEVICE_MULTIPLE_BUSSES \
77 "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
78
055f6122 79#define QERR_DEVICE_NOT_ACTIVE \
e16a1812
MA
80 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
81
9d494c4b
MA
82#define QERR_DEVICE_NOT_ENCRYPTED \
83 "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
84
e16a1812
MA
85#define QERR_DEVICE_NOT_FOUND \
86 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
055f6122 87
5cfe0264
MA
88#define QERR_DEVICE_NOT_REMOVABLE \
89 "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
90
07574baf
MA
91#define QERR_DEVICE_NO_BUS \
92 "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
93
180c22e1
GH
94#define QERR_DEVICE_NO_HOTPLUG \
95 "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
96
7bc84017
MA
97#define QERR_DUPLICATE_ID \
98 "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
99
c7c338c4 100#define QERR_FD_NOT_FOUND \
bd9d3064 101 "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
c7c338c4 102
41471a23 103#define QERR_FD_NOT_SUPPLIED \
bd9d3064 104 "{ 'class': 'FdNotSupplied', 'data': {} }"
41471a23 105
17901e75
MA
106#define QERR_INVALID_BLOCK_FORMAT \
107 "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
108
7a046f5f 109#define QERR_INVALID_PARAMETER \
bd9d3064 110 "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
7a046f5f 111
4b9d4683 112#define QERR_INVALID_PARAMETER_TYPE \
e16a1812 113 "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
4b9d4683 114
985a3e52
MA
115#define QERR_INVALID_PARAMETER_VALUE \
116 "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
117
f6d855c5 118#define QERR_INVALID_PASSWORD \
e16a1812
MA
119 "{ 'class': 'InvalidPassword', 'data': {} }"
120
121#define QERR_JSON_PARSING \
122 "{ 'class': 'JSONParsing', 'data': {} }"
f6d855c5 123
ef749d07
AL
124#define QERR_JSON_PARSE_ERROR \
125 "{ 'class': 'JSONParseError', 'data': { 'message': %s } }"
126
c40cc0a0
MR
127#define QERR_BUFFER_OVERRUN \
128 "{ 'class': 'BufferOverrun', 'data': {} }"
129
82a60711 130#define QERR_KVM_MISSING_CAP \
e16a1812 131 "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
82a60711 132
8e84865e
AS
133#define QERR_MIGRATION_EXPECTED \
134 "{ 'class': 'MigrationExpected', 'data': {} }"
135
4b9d4683 136#define QERR_MISSING_PARAMETER \
e16a1812 137 "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
4b9d4683 138
fab5767f
MA
139#define QERR_NO_BUS_FOR_DEVICE \
140 "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
141
fc5469d8
MA
142#define QERR_OPEN_FILE_FAILED \
143 "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
144
c58a35f8
MA
145#define QERR_PROPERTY_NOT_FOUND \
146 "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
147
06b4a703
MA
148#define QERR_PROPERTY_VALUE_BAD \
149 "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
150
9c5eff95
MA
151#define QERR_PROPERTY_VALUE_IN_USE \
152 "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
153
84745d68
MA
154#define QERR_PROPERTY_VALUE_NOT_FOUND \
155 "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
156
4b9d4683 157#define QERR_QMP_BAD_INPUT_OBJECT \
e16a1812 158 "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
4b9d4683 159
7dfb6123
LC
160#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
161 "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
162
60d76d7b
LC
163#define QERR_QMP_EXTRA_MEMBER \
164 "{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }"
165
7a84cb23
MA
166#define QERR_SET_PASSWD_FAILED \
167 "{ 'class': 'SetPasswdFailed', 'data': {} }"
168
13661089
DB
169#define QERR_ADD_CLIENT_FAILED \
170 "{ 'class': 'AddClientFailed', 'data': {} }"
171
a488be27 172#define QERR_TOO_MANY_FILES \
bd9d3064 173 "{ 'class': 'TooManyFiles', 'data': {} }"
a488be27 174
fc5469d8
MA
175#define QERR_UNDEFINED_ERROR \
176 "{ 'class': 'UndefinedError', 'data': {} }"
177
4c5a1e4d
LJ
178#define QERR_UNSUPPORTED \
179 "{ 'class': 'Unsupported', 'data': {} }"
180
f54e3641
KW
181#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
182 "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
183
a6906e31
MA
184#define QERR_VNC_SERVER_FAILED \
185 "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
186
821601ea
JS
187#define QERR_FEATURE_DISABLED \
188 "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
189
e3d4d252
MR
190#define QERR_QGA_LOGGING_FAILED \
191 "{ 'class': 'QgaLoggingFailed', 'data': {} }"
192
193#define QERR_QGA_COMMAND_FAILED \
194 "{ 'class': 'QgaCommandFailed', 'data': { 'message': %s } }"
195
9f9daf9a 196#endif /* QERROR_H */