qemu-options: avoid #if in spicevmc texi help
[qemu/ar7.git] / qerror.h
blobd4bfcfd16713e50ac474ed8fec50719c9deec960
1 /*
2 * QError Module
4 * Copyright (C) 2009 Red Hat Inc.
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
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.
12 #ifndef QERROR_H
13 #define QERROR_H
15 #include "qdict.h"
16 #include "qstring.h"
17 #include "qemu-error.h"
18 #include "error.h"
19 #include <stdarg.h>
21 typedef struct QErrorStringTable {
22 const char *desc;
23 const char *error_fmt;
24 } QErrorStringTable;
26 typedef struct QError {
27 QObject_HEAD;
28 QDict *error;
29 Location loc;
30 int linenr;
31 const char *file;
32 const char *func;
33 const QErrorStringTable *entry;
34 } QError;
36 QError *qerror_new(void);
37 QError *qerror_from_info(const char *file, int linenr, const char *func,
38 const char *fmt, va_list *va) GCC_FMT_ATTR(4, 0);
39 QString *qerror_human(const QError *qerror);
40 void qerror_print(QError *qerror);
41 void qerror_report_internal(const char *file, int linenr, const char *func,
42 const char *fmt, ...) GCC_FMT_ATTR(4, 5);
43 void qerror_report_err(Error *err);
44 QString *qerror_format(const char *fmt, QDict *error);
45 #define qerror_report(fmt, ...) \
46 qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
47 QError *qobject_to_qerror(const QObject *obj);
50 * QError class list
51 * Please keep the definitions in alphabetical order.
52 * Use "grep '^#define QERR_' qerror.h | sort -c" to check.
54 #define QERR_BAD_BUS_FOR_DEVICE \
55 "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
57 #define QERR_BUS_NOT_FOUND \
58 "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
60 #define QERR_BUS_NO_HOTPLUG \
61 "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
63 #define QERR_COMMAND_NOT_FOUND \
64 "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
66 #define QERR_DEVICE_ENCRYPTED \
67 "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
69 #define QERR_DEVICE_INIT_FAILED \
70 "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
72 #define QERR_DEVICE_IN_USE \
73 "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
75 #define QERR_DEVICE_LOCKED \
76 "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
78 #define QERR_DEVICE_MULTIPLE_BUSSES \
79 "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
81 #define QERR_DEVICE_NOT_ACTIVE \
82 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
84 #define QERR_DEVICE_NOT_ENCRYPTED \
85 "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
87 #define QERR_DEVICE_NOT_FOUND \
88 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
90 #define QERR_DEVICE_NOT_REMOVABLE \
91 "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
93 #define QERR_DEVICE_NO_BUS \
94 "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
96 #define QERR_DEVICE_NO_HOTPLUG \
97 "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
99 #define QERR_DUPLICATE_ID \
100 "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
102 #define QERR_FD_NOT_FOUND \
103 "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
105 #define QERR_FD_NOT_SUPPLIED \
106 "{ 'class': 'FdNotSupplied', 'data': {} }"
108 #define QERR_INVALID_BLOCK_FORMAT \
109 "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
111 #define QERR_INVALID_PARAMETER \
112 "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
114 #define QERR_INVALID_PARAMETER_TYPE \
115 "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
117 #define QERR_INVALID_PARAMETER_VALUE \
118 "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
120 #define QERR_INVALID_PASSWORD \
121 "{ 'class': 'InvalidPassword', 'data': {} }"
123 #define QERR_JSON_PARSING \
124 "{ 'class': 'JSONParsing', 'data': {} }"
126 #define QERR_JSON_PARSE_ERROR \
127 "{ 'class': 'JSONParseError', 'data': { 'message': %s } }"
129 #define QERR_BUFFER_OVERRUN \
130 "{ 'class': 'BufferOverrun', 'data': {} }"
132 #define QERR_KVM_MISSING_CAP \
133 "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
135 #define QERR_MIGRATION_EXPECTED \
136 "{ 'class': 'MigrationExpected', 'data': {} }"
138 #define QERR_MISSING_PARAMETER \
139 "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
141 #define QERR_NO_BUS_FOR_DEVICE \
142 "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
144 #define QERR_OPEN_FILE_FAILED \
145 "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
147 #define QERR_PROPERTY_NOT_FOUND \
148 "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
150 #define QERR_PROPERTY_VALUE_BAD \
151 "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
153 #define QERR_PROPERTY_VALUE_IN_USE \
154 "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
156 #define QERR_PROPERTY_VALUE_NOT_FOUND \
157 "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
159 #define QERR_QMP_BAD_INPUT_OBJECT \
160 "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
162 #define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
163 "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
165 #define QERR_QMP_EXTRA_MEMBER \
166 "{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }"
168 #define QERR_RESET_REQUIRED \
169 "{ 'class': 'ResetRequired', 'data': {} }"
171 #define QERR_SET_PASSWD_FAILED \
172 "{ 'class': 'SetPasswdFailed', 'data': {} }"
174 #define QERR_ADD_CLIENT_FAILED \
175 "{ 'class': 'AddClientFailed', 'data': {} }"
177 #define QERR_TOO_MANY_FILES \
178 "{ 'class': 'TooManyFiles', 'data': {} }"
180 #define QERR_UNDEFINED_ERROR \
181 "{ 'class': 'UndefinedError', 'data': {} }"
183 #define QERR_UNSUPPORTED \
184 "{ 'class': 'Unsupported', 'data': {} }"
186 #define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
187 "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
189 #define QERR_VNC_SERVER_FAILED \
190 "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
192 #define QERR_FEATURE_DISABLED \
193 "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
195 #define QERR_QGA_LOGGING_FAILED \
196 "{ 'class': 'QgaLoggingFailed', 'data': {} }"
198 #define QERR_QGA_COMMAND_FAILED \
199 "{ 'class': 'QgaCommandFailed', 'data': { 'message': %s } }"
201 #endif /* QERROR_H */