]> git.proxmox.com Git - qemu.git/blame - qerror.h
CPUPhysMemoryClient: batch addresses in catchup
[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);
0167f772
MA
42#define qerror_report(fmt, ...) \
43 qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
9f9daf9a
LC
44QError *qobject_to_qerror(const QObject *obj);
45
46/*
47 * QError class list
9d494c4b
MA
48 * Please keep the definitions in alphabetical order.
49 * Use "grep '^#define QERR_' qerror.h | sort -c" to check.
9f9daf9a 50 */
56e9f563
MA
51#define QERR_BAD_BUS_FOR_DEVICE \
52 "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
53
7bbd8237
MA
54#define QERR_BUS_NOT_FOUND \
55 "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
56
8eae73b5
MA
57#define QERR_BUS_NO_HOTPLUG \
58 "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
59
4b9d4683 60#define QERR_COMMAND_NOT_FOUND \
e16a1812 61 "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
4b9d4683 62
0df37c41 63#define QERR_DEVICE_ENCRYPTED \
e16a1812 64 "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
9f9daf9a 65
4d9a1a15
MA
66#define QERR_DEVICE_INIT_FAILED \
67 "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
68
5124eb59
MA
69#define QERR_DEVICE_IN_USE \
70 "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
71
fc5469d8 72#define QERR_DEVICE_LOCKED \
b0868380
MA
73 "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
74
1ae78718
MA
75#define QERR_DEVICE_MULTIPLE_BUSSES \
76 "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
77
055f6122 78#define QERR_DEVICE_NOT_ACTIVE \
e16a1812
MA
79 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
80
9d494c4b
MA
81#define QERR_DEVICE_NOT_ENCRYPTED \
82 "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
83
e16a1812
MA
84#define QERR_DEVICE_NOT_FOUND \
85 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
055f6122 86
5cfe0264
MA
87#define QERR_DEVICE_NOT_REMOVABLE \
88 "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
89
07574baf
MA
90#define QERR_DEVICE_NO_BUS \
91 "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
92
180c22e1
GH
93#define QERR_DEVICE_NO_HOTPLUG \
94 "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
95
7bc84017
MA
96#define QERR_DUPLICATE_ID \
97 "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
98
c7c338c4 99#define QERR_FD_NOT_FOUND \
bd9d3064 100 "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
c7c338c4 101
41471a23 102#define QERR_FD_NOT_SUPPLIED \
bd9d3064 103 "{ 'class': 'FdNotSupplied', 'data': {} }"
41471a23 104
17901e75
MA
105#define QERR_INVALID_BLOCK_FORMAT \
106 "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
107
7a046f5f 108#define QERR_INVALID_PARAMETER \
bd9d3064 109 "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
7a046f5f 110
4b9d4683 111#define QERR_INVALID_PARAMETER_TYPE \
e16a1812 112 "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
4b9d4683 113
985a3e52
MA
114#define QERR_INVALID_PARAMETER_VALUE \
115 "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
116
f6d855c5 117#define QERR_INVALID_PASSWORD \
e16a1812
MA
118 "{ 'class': 'InvalidPassword', 'data': {} }"
119
120#define QERR_JSON_PARSING \
121 "{ 'class': 'JSONParsing', 'data': {} }"
f6d855c5 122
82a60711 123#define QERR_KVM_MISSING_CAP \
e16a1812 124 "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
82a60711 125
8e84865e
AS
126#define QERR_MIGRATION_EXPECTED \
127 "{ 'class': 'MigrationExpected', 'data': {} }"
128
4b9d4683 129#define QERR_MISSING_PARAMETER \
e16a1812 130 "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
4b9d4683 131
fab5767f
MA
132#define QERR_NO_BUS_FOR_DEVICE \
133 "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
134
fc5469d8
MA
135#define QERR_OPEN_FILE_FAILED \
136 "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
137
c58a35f8
MA
138#define QERR_PROPERTY_NOT_FOUND \
139 "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
140
06b4a703
MA
141#define QERR_PROPERTY_VALUE_BAD \
142 "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
143
9c5eff95
MA
144#define QERR_PROPERTY_VALUE_IN_USE \
145 "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
146
84745d68
MA
147#define QERR_PROPERTY_VALUE_NOT_FOUND \
148 "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
149
4b9d4683 150#define QERR_QMP_BAD_INPUT_OBJECT \
e16a1812 151 "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
4b9d4683 152
7dfb6123
LC
153#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
154 "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
155
60d76d7b
LC
156#define QERR_QMP_EXTRA_MEMBER \
157 "{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }"
158
7a84cb23
MA
159#define QERR_SET_PASSWD_FAILED \
160 "{ 'class': 'SetPasswdFailed', 'data': {} }"
161
a488be27 162#define QERR_TOO_MANY_FILES \
bd9d3064 163 "{ 'class': 'TooManyFiles', 'data': {} }"
a488be27 164
fc5469d8
MA
165#define QERR_UNDEFINED_ERROR \
166 "{ 'class': 'UndefinedError', 'data': {} }"
167
f54e3641
KW
168#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
169 "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
170
a6906e31
MA
171#define QERR_VNC_SERVER_FAILED \
172 "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
173
821601ea
JS
174#define QERR_FEATURE_DISABLED \
175 "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
176
9f9daf9a 177#endif /* QERROR_H */