]> git.proxmox.com Git - qemu.git/blame - qerror.h
Update for 0.12.4 release
[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"
143d288c 16#include "qstring.h"
9f9daf9a
LC
17#include <stdarg.h>
18
19typedef struct QErrorStringTable {
20 const char *desc;
21 const char *error_fmt;
22} QErrorStringTable;
23
24typedef struct QError {
25 QObject_HEAD;
26 QDict *error;
27 int linenr;
28 const char *file;
29 const char *func;
30 const QErrorStringTable *entry;
31} QError;
32
33QError *qerror_new(void);
34QError *qerror_from_info(const char *file, int linenr, const char *func,
35 const char *fmt, va_list *va);
143d288c 36QString *qerror_human(const QError *qerror);
9f9daf9a
LC
37void qerror_print(const QError *qerror);
38QError *qobject_to_qerror(const QObject *obj);
39
40/*
41 * QError class list
42 */
4b9d4683 43#define QERR_COMMAND_NOT_FOUND \
28acf422 44 "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
4b9d4683 45
bcddbd0f 46#define QERR_DEVICE_ENCRYPTED \
28acf422 47 "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
9f9daf9a 48
a46657d1
MA
49#define QERR_DEVICE_LOCKED \
50 "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
51
055f6122 52#define QERR_DEVICE_NOT_ACTIVE \
28acf422
MA
53 "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
54
55#define QERR_DEVICE_NOT_FOUND \
56 "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
055f6122 57
8cb1cec6
MA
58#define QERR_DEVICE_NOT_REMOVABLE \
59 "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
60
3e4cd634 61#define QERR_FD_NOT_FOUND \
08b2d3ba 62 "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
3e4cd634 63
e3646914 64#define QERR_FD_NOT_SUPPLIED \
08b2d3ba 65 "{ 'class': 'FdNotSupplied', 'data': {} }"
e3646914 66
c756b1e7
MA
67#define QERR_INVALID_BLOCK_FORMAT \
68 "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
69
0b52786c 70#define QERR_INVALID_PARAMETER \
08b2d3ba 71 "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
0b52786c 72
4b9d4683 73#define QERR_INVALID_PARAMETER_TYPE \
28acf422 74 "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
4b9d4683 75
6ccc51fd 76#define QERR_INVALID_PASSWORD \
28acf422
MA
77 "{ 'class': 'InvalidPassword', 'data': {} }"
78
79#define QERR_JSON_PARSING \
80 "{ 'class': 'JSONParsing', 'data': {} }"
6ccc51fd 81
82a60711 82#define QERR_KVM_MISSING_CAP \
28acf422 83 "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
82a60711 84
4b9d4683 85#define QERR_MISSING_PARAMETER \
28acf422 86 "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
4b9d4683
LC
87
88#define QERR_QMP_BAD_INPUT_OBJECT \
28acf422 89 "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
4b9d4683 90
960a4b53
MA
91#define QERR_SET_PASSWD_FAILED \
92 "{ 'class': 'SetPasswdFailed', 'data': {} }"
93
4b9d4683 94#define QERR_UNDEFINED_ERROR \
28acf422 95 "{ 'class': 'UndefinedError', 'data': {} }"
4b9d4683 96
ea2b7d70 97#define QERR_TOO_MANY_FILES \
08b2d3ba 98 "{ 'class': 'TooManyFiles', 'data': {} }"
ea2b7d70 99
fe7c6c90
MA
100#define QERR_VNC_SERVER_FAILED \
101 "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
102
9f9daf9a 103#endif /* QERROR_H */