]> git.proxmox.com Git - qemu.git/blame - qerror.h
qdev: Relax parsing of bus option
[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 */
4b9d4683 45#define QERR_COMMAND_NOT_FOUND \
e16a1812 46 "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
4b9d4683 47
0df37c41 48#define QERR_DEVICE_ENCRYPTED \
e16a1812 49 "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
9f9daf9a 50
fc5469d8 51#define QERR_DEVICE_LOCKED \
b0868380
MA
52 "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
53
055f6122 54#define QERR_DEVICE_NOT_ACTIVE \
e16a1812
MA
55 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
56
57#define QERR_DEVICE_NOT_FOUND \
58 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
055f6122 59
5cfe0264
MA
60#define QERR_DEVICE_NOT_REMOVABLE \
61 "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
62
c7c338c4 63#define QERR_FD_NOT_FOUND \
bd9d3064 64 "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
c7c338c4 65
41471a23 66#define QERR_FD_NOT_SUPPLIED \
bd9d3064 67 "{ 'class': 'FdNotSupplied', 'data': {} }"
41471a23 68
17901e75
MA
69#define QERR_INVALID_BLOCK_FORMAT \
70 "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
71
7a046f5f 72#define QERR_INVALID_PARAMETER \
bd9d3064 73 "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
7a046f5f 74
4b9d4683 75#define QERR_INVALID_PARAMETER_TYPE \
e16a1812 76 "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
4b9d4683 77
f6d855c5 78#define QERR_INVALID_PASSWORD \
e16a1812
MA
79 "{ 'class': 'InvalidPassword', 'data': {} }"
80
81#define QERR_JSON_PARSING \
82 "{ 'class': 'JSONParsing', 'data': {} }"
f6d855c5 83
82a60711 84#define QERR_KVM_MISSING_CAP \
e16a1812 85 "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
82a60711 86
4b9d4683 87#define QERR_MISSING_PARAMETER \
e16a1812 88 "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
4b9d4683 89
fc5469d8
MA
90#define QERR_OPEN_FILE_FAILED \
91 "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
92
c58a35f8
MA
93#define QERR_PROPERTY_NOT_FOUND \
94 "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
95
06b4a703
MA
96#define QERR_PROPERTY_VALUE_BAD \
97 "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
98
9c5eff95
MA
99#define QERR_PROPERTY_VALUE_IN_USE \
100 "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
101
84745d68
MA
102#define QERR_PROPERTY_VALUE_NOT_FOUND \
103 "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
104
4b9d4683 105#define QERR_QMP_BAD_INPUT_OBJECT \
e16a1812 106 "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
4b9d4683 107
7a84cb23
MA
108#define QERR_SET_PASSWD_FAILED \
109 "{ 'class': 'SetPasswdFailed', 'data': {} }"
110
a488be27 111#define QERR_TOO_MANY_FILES \
bd9d3064 112 "{ 'class': 'TooManyFiles', 'data': {} }"
a488be27 113
fc5469d8
MA
114#define QERR_UNDEFINED_ERROR \
115 "{ 'class': 'UndefinedError', 'data': {} }"
116
a6906e31
MA
117#define QERR_VNC_SERVER_FAILED \
118 "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
119
9f9daf9a 120#endif /* QERROR_H */