]> git.proxmox.com Git - qemu.git/blame - qerror.h
error: Link qemu-img, qemu-nbd, qemu-io with qemu-error.o
[qemu.git] / qerror.h
CommitLineData
9f9daf9a
LC
1/*
2 * QError header file.
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,
37 const char *fmt, va_list *va);
77e595e7 38QString *qerror_human(const QError *qerror);
827b0813 39void qerror_print(QError *qerror);
9f9daf9a
LC
40QError *qobject_to_qerror(const QObject *obj);
41
42/*
43 * QError class list
44 */
56e9f563
MA
45#define QERR_BAD_BUS_FOR_DEVICE \
46 "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
47
7bbd8237
MA
48#define QERR_BUS_NOT_FOUND \
49 "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
50
8eae73b5
MA
51#define QERR_BUS_NO_HOTPLUG \
52 "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
53
4b9d4683 54#define QERR_COMMAND_NOT_FOUND \
e16a1812 55 "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
4b9d4683 56
0df37c41 57#define QERR_DEVICE_ENCRYPTED \
e16a1812 58 "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
9f9daf9a 59
25b28f01
SH
60#define QERR_DEVICE_NOT_ENCRYPTED \
61 "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
62
4d9a1a15
MA
63#define QERR_DEVICE_INIT_FAILED \
64 "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
65
fc5469d8 66#define QERR_DEVICE_LOCKED \
b0868380
MA
67 "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
68
1ae78718
MA
69#define QERR_DEVICE_MULTIPLE_BUSSES \
70 "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
71
055f6122 72#define QERR_DEVICE_NOT_ACTIVE \
e16a1812
MA
73 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
74
75#define QERR_DEVICE_NOT_FOUND \
76 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
055f6122 77
5cfe0264
MA
78#define QERR_DEVICE_NOT_REMOVABLE \
79 "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
80
07574baf
MA
81#define QERR_DEVICE_NO_BUS \
82 "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
83
c7c338c4 84#define QERR_FD_NOT_FOUND \
bd9d3064 85 "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
c7c338c4 86
41471a23 87#define QERR_FD_NOT_SUPPLIED \
bd9d3064 88 "{ 'class': 'FdNotSupplied', 'data': {} }"
41471a23 89
17901e75
MA
90#define QERR_INVALID_BLOCK_FORMAT \
91 "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
92
7a046f5f 93#define QERR_INVALID_PARAMETER \
bd9d3064 94 "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
7a046f5f 95
4b9d4683 96#define QERR_INVALID_PARAMETER_TYPE \
e16a1812 97 "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
4b9d4683 98
f6d855c5 99#define QERR_INVALID_PASSWORD \
e16a1812
MA
100 "{ 'class': 'InvalidPassword', 'data': {} }"
101
102#define QERR_JSON_PARSING \
103 "{ 'class': 'JSONParsing', 'data': {} }"
f6d855c5 104
82a60711 105#define QERR_KVM_MISSING_CAP \
e16a1812 106 "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
82a60711 107
4b9d4683 108#define QERR_MISSING_PARAMETER \
e16a1812 109 "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
4b9d4683 110
fab5767f
MA
111#define QERR_NO_BUS_FOR_DEVICE \
112 "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
113
fc5469d8
MA
114#define QERR_OPEN_FILE_FAILED \
115 "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
116
c58a35f8
MA
117#define QERR_PROPERTY_NOT_FOUND \
118 "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
119
06b4a703
MA
120#define QERR_PROPERTY_VALUE_BAD \
121 "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
122
9c5eff95
MA
123#define QERR_PROPERTY_VALUE_IN_USE \
124 "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
125
84745d68
MA
126#define QERR_PROPERTY_VALUE_NOT_FOUND \
127 "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
128
4b9d4683 129#define QERR_QMP_BAD_INPUT_OBJECT \
e16a1812 130 "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
4b9d4683 131
7a84cb23
MA
132#define QERR_SET_PASSWD_FAILED \
133 "{ 'class': 'SetPasswdFailed', 'data': {} }"
134
a488be27 135#define QERR_TOO_MANY_FILES \
bd9d3064 136 "{ 'class': 'TooManyFiles', 'data': {} }"
a488be27 137
fc5469d8
MA
138#define QERR_UNDEFINED_ERROR \
139 "{ 'class': 'UndefinedError', 'data': {} }"
140
a6906e31
MA
141#define QERR_VNC_SERVER_FAILED \
142 "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
143
9f9daf9a 144#endif /* QERROR_H */