2009-11-19 01:05:30 +00:00
|
|
|
/*
|
2010-05-12 19:34:42 +00:00
|
|
|
* QError Module
|
2009-11-19 01:05:30 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
|
|
|
* See the COPYING.LIB file in the top-level directory.
|
|
|
|
*/
|
|
|
|
#ifndef QERROR_H
|
|
|
|
#define QERROR_H
|
|
|
|
|
|
|
|
#include "qdict.h"
|
2009-12-07 20:37:16 +00:00
|
|
|
#include "qstring.h"
|
2010-02-18 18:46:49 +00:00
|
|
|
#include "qemu-error.h"
|
2011-09-02 17:34:45 +00:00
|
|
|
#include "error.h"
|
2009-11-19 01:05:30 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
typedef struct QErrorStringTable {
|
|
|
|
const char *desc;
|
|
|
|
const char *error_fmt;
|
|
|
|
} QErrorStringTable;
|
|
|
|
|
|
|
|
typedef struct QError {
|
|
|
|
QObject_HEAD;
|
|
|
|
QDict *error;
|
2010-02-18 18:46:49 +00:00
|
|
|
Location loc;
|
2009-11-19 01:05:30 +00:00
|
|
|
int linenr;
|
|
|
|
const char *file;
|
|
|
|
const char *func;
|
|
|
|
const QErrorStringTable *entry;
|
|
|
|
} QError;
|
|
|
|
|
|
|
|
QError *qerror_new(void);
|
|
|
|
QError *qerror_from_info(const char *file, int linenr, const char *func,
|
2010-09-23 19:28:05 +00:00
|
|
|
const char *fmt, va_list *va) GCC_FMT_ATTR(4, 0);
|
2009-12-07 20:37:16 +00:00
|
|
|
QString *qerror_human(const QError *qerror);
|
2010-02-18 18:46:49 +00:00
|
|
|
void qerror_print(QError *qerror);
|
2010-03-22 09:29:05 +00:00
|
|
|
void qerror_report_internal(const char *file, int linenr, const char *func,
|
2010-09-23 19:28:03 +00:00
|
|
|
const char *fmt, ...) GCC_FMT_ATTR(4, 5);
|
2011-09-02 17:34:45 +00:00
|
|
|
void qerror_report_err(Error *err);
|
2012-02-14 09:19:53 +00:00
|
|
|
void assert_no_error(Error *err);
|
2011-06-01 17:14:48 +00:00
|
|
|
QString *qerror_format(const char *fmt, QDict *error);
|
2010-03-22 09:29:05 +00:00
|
|
|
#define qerror_report(fmt, ...) \
|
|
|
|
qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
|
2009-11-19 01:05:30 +00:00
|
|
|
QError *qobject_to_qerror(const QObject *obj);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* QError class list
|
2010-03-25 16:22:30 +00:00
|
|
|
* Please keep the definitions in alphabetical order.
|
2012-01-04 22:23:32 +00:00
|
|
|
* Use scripts/check-qerror.sh to check.
|
2009-11-19 01:05:30 +00:00
|
|
|
*/
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_ADD_CLIENT_FAILED \
|
|
|
|
"{ 'class': 'AddClientFailed', 'data': {} }"
|
|
|
|
|
2012-02-02 11:37:53 +00:00
|
|
|
#define QERR_AMBIGUOUS_PATH \
|
|
|
|
"{ 'class': 'AmbiguousPath', 'data': { 'path': %s } }"
|
|
|
|
|
2010-02-19 18:52:45 +00:00
|
|
|
#define QERR_BAD_BUS_FOR_DEVICE \
|
|
|
|
"{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
|
|
|
|
|
2012-01-18 14:40:52 +00:00
|
|
|
#define QERR_BASE_NOT_FOUND \
|
|
|
|
"{ 'class': 'BaseNotFound', 'data': { 'base': %s } }"
|
|
|
|
|
2011-11-14 21:09:47 +00:00
|
|
|
#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
|
|
|
|
"{ 'class': 'BlockFormatFeatureNotSupported', 'data': { 'format': %s, 'name': %s, 'feature': %s } }"
|
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_BUFFER_OVERRUN \
|
|
|
|
"{ 'class': 'BufferOverrun', 'data': {} }"
|
2010-02-19 17:05:39 +00:00
|
|
|
|
2010-02-19 18:53:36 +00:00
|
|
|
#define QERR_BUS_NO_HOTPLUG \
|
|
|
|
"{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
|
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_BUS_NOT_FOUND \
|
|
|
|
"{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
|
2009-11-27 00:58:57 +00:00
|
|
|
|
2011-12-07 04:03:42 +00:00
|
|
|
#define QERR_COMMAND_DISABLED \
|
|
|
|
"{ 'class': 'CommandDisabled', 'data': { 'name': %s } }"
|
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_COMMAND_NOT_FOUND \
|
|
|
|
"{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
|
|
|
|
|
2009-12-07 20:36:59 +00:00
|
|
|
#define QERR_DEVICE_ENCRYPTED \
|
2011-12-13 19:18:30 +00:00
|
|
|
"{ 'class': 'DeviceEncrypted', 'data': { 'device': %s, 'filename': %s } }"
|
2009-11-19 01:05:30 +00:00
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \
|
|
|
|
"{ 'class': 'DeviceFeatureBlocksMigration', 'data': { 'device': %s, 'feature': %s } }"
|
|
|
|
|
2012-01-04 22:23:34 +00:00
|
|
|
#define QERR_DEVICE_HAS_NO_MEDIUM \
|
|
|
|
"{ 'class': 'DeviceHasNoMedium', 'data': { 'device': %s } }"
|
|
|
|
|
2010-02-19 18:53:54 +00:00
|
|
|
#define QERR_DEVICE_INIT_FAILED \
|
|
|
|
"{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
|
|
|
|
|
2010-03-25 16:22:39 +00:00
|
|
|
#define QERR_DEVICE_IN_USE \
|
|
|
|
"{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
|
|
|
|
|
2012-01-04 22:23:34 +00:00
|
|
|
#define QERR_DEVICE_IS_READ_ONLY \
|
|
|
|
"{ 'class': 'DeviceIsReadOnly', 'data': { 'device': %s } }"
|
|
|
|
|
2010-02-19 16:42:46 +00:00
|
|
|
#define QERR_DEVICE_LOCKED \
|
2009-12-07 20:37:03 +00:00
|
|
|
"{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
|
|
|
|
|
2010-02-19 17:05:59 +00:00
|
|
|
#define QERR_DEVICE_MULTIPLE_BUSSES \
|
|
|
|
"{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
|
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_DEVICE_NO_BUS \
|
|
|
|
"{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
|
|
|
|
|
|
|
|
#define QERR_DEVICE_NO_HOTPLUG \
|
|
|
|
"{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
|
|
|
|
|
2009-11-19 01:05:34 +00:00
|
|
|
#define QERR_DEVICE_NOT_ACTIVE \
|
2009-12-07 20:37:02 +00:00
|
|
|
"{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
|
|
|
|
|
2010-03-25 16:22:30 +00:00
|
|
|
#define QERR_DEVICE_NOT_ENCRYPTED \
|
|
|
|
"{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
|
|
|
|
|
2009-12-07 20:37:02 +00:00
|
|
|
#define QERR_DEVICE_NOT_FOUND \
|
|
|
|
"{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
|
2009-11-19 01:05:34 +00:00
|
|
|
|
2009-12-07 20:37:04 +00:00
|
|
|
#define QERR_DEVICE_NOT_REMOVABLE \
|
|
|
|
"{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
|
|
|
|
|
2010-03-25 16:22:31 +00:00
|
|
|
#define QERR_DUPLICATE_ID \
|
|
|
|
"{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
|
|
|
|
|
2009-12-07 20:37:10 +00:00
|
|
|
#define QERR_FD_NOT_FOUND \
|
2009-12-08 12:33:54 +00:00
|
|
|
"{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
|
2009-12-07 20:37:10 +00:00
|
|
|
|
2009-12-07 20:37:12 +00:00
|
|
|
#define QERR_FD_NOT_SUPPLIED \
|
2009-12-08 12:33:54 +00:00
|
|
|
"{ 'class': 'FdNotSupplied', 'data': {} }"
|
2009-12-07 20:37:12 +00:00
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_FEATURE_DISABLED \
|
|
|
|
"{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
|
|
|
|
|
2009-12-07 20:37:06 +00:00
|
|
|
#define QERR_INVALID_BLOCK_FORMAT \
|
|
|
|
"{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
|
|
|
|
|
2012-03-28 17:01:15 +00:00
|
|
|
#define QERR_INVALID_OPTION_GROUP \
|
|
|
|
"{ 'class': 'InvalidOptionGroup', 'data': { 'group': %s } }"
|
|
|
|
|
2009-12-07 20:37:13 +00:00
|
|
|
#define QERR_INVALID_PARAMETER \
|
2009-12-08 12:33:54 +00:00
|
|
|
"{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
|
2009-12-07 20:37:13 +00:00
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_INVALID_PARAMETER_COMBINATION \
|
|
|
|
"{ 'class': 'InvalidParameterCombination', 'data': {} }"
|
|
|
|
|
2009-11-27 00:58:57 +00:00
|
|
|
#define QERR_INVALID_PARAMETER_TYPE \
|
2009-12-07 20:37:02 +00:00
|
|
|
"{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
|
2009-11-27 00:58:57 +00:00
|
|
|
|
2010-03-25 16:22:33 +00:00
|
|
|
#define QERR_INVALID_PARAMETER_VALUE \
|
|
|
|
"{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
|
|
|
|
|
2009-12-04 17:24:08 +00:00
|
|
|
#define QERR_INVALID_PASSWORD \
|
2009-12-07 20:37:02 +00:00
|
|
|
"{ 'class': 'InvalidPassword', 'data': {} }"
|
|
|
|
|
2011-11-22 18:29:52 +00:00
|
|
|
#define QERR_IO_ERROR \
|
|
|
|
"{ 'class': 'IOError', 'data': {} }"
|
|
|
|
|
2011-06-01 17:14:50 +00:00
|
|
|
#define QERR_JSON_PARSE_ERROR \
|
|
|
|
"{ 'class': 'JSONParseError', 'data': { 'message': %s } }"
|
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_JSON_PARSING \
|
|
|
|
"{ 'class': 'JSONParsing', 'data': {} }"
|
2011-07-19 19:50:33 +00:00
|
|
|
|
2009-11-19 01:05:35 +00:00
|
|
|
#define QERR_KVM_MISSING_CAP \
|
2009-12-07 20:37:02 +00:00
|
|
|
"{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
|
2009-11-19 01:05:35 +00:00
|
|
|
|
2011-12-02 16:58:12 +00:00
|
|
|
#define QERR_MIGRATION_ACTIVE \
|
|
|
|
"{ 'class': 'MigrationActive', 'data': {} }"
|
|
|
|
|
|
|
|
#define QERR_MIGRATION_NOT_SUPPORTED \
|
|
|
|
"{ 'class': 'MigrationNotSupported', 'data': {'device': %s} }"
|
|
|
|
|
2010-07-27 10:19:19 +00:00
|
|
|
#define QERR_MIGRATION_EXPECTED \
|
|
|
|
"{ 'class': 'MigrationExpected', 'data': {} }"
|
|
|
|
|
2009-11-27 00:58:57 +00:00
|
|
|
#define QERR_MISSING_PARAMETER \
|
2009-12-07 20:37:02 +00:00
|
|
|
"{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
|
2009-11-27 00:58:57 +00:00
|
|
|
|
2010-02-19 18:54:06 +00:00
|
|
|
#define QERR_NO_BUS_FOR_DEVICE \
|
|
|
|
"{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
|
|
|
|
|
2012-01-18 14:40:46 +00:00
|
|
|
#define QERR_NOT_SUPPORTED \
|
|
|
|
"{ 'class': 'NotSupported', 'data': {} }"
|
|
|
|
|
2010-02-19 16:42:46 +00:00
|
|
|
#define QERR_OPEN_FILE_FAILED \
|
|
|
|
"{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
|
|
|
|
|
2011-12-12 20:29:26 +00:00
|
|
|
#define QERR_PERMISSION_DENIED \
|
|
|
|
"{ 'class': 'PermissionDenied', 'data': {} }"
|
|
|
|
|
2010-02-19 12:11:41 +00:00
|
|
|
#define QERR_PROPERTY_NOT_FOUND \
|
|
|
|
"{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
|
|
|
|
|
2010-02-19 12:17:58 +00:00
|
|
|
#define QERR_PROPERTY_VALUE_BAD \
|
|
|
|
"{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
|
|
|
|
2010-03-16 16:40:48 +00:00
|
|
|
#define QERR_PROPERTY_VALUE_IN_USE \
|
|
|
|
"{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
|
|
|
|
2010-03-16 16:44:38 +00:00
|
|
|
#define QERR_PROPERTY_VALUE_NOT_FOUND \
|
|
|
|
"{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
|
|
|
|
|
2012-03-14 15:57:05 +00:00
|
|
|
#define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \
|
|
|
|
"{ 'class': 'PropertyValueNotPowerOf2', 'data': { " \
|
|
|
|
"'device': %s, 'property': %s, 'value': %"PRId64" } }"
|
|
|
|
|
2011-12-18 16:05:08 +00:00
|
|
|
#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
|
|
|
|
"{ 'class': 'PropertyValueOutOfRange', 'data': { 'device': %s, 'property': %s, 'value': %"PRId64", 'min': %"PRId64", 'max': %"PRId64" } }"
|
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_QGA_COMMAND_FAILED \
|
|
|
|
"{ 'class': 'QgaCommandFailed', 'data': { 'message': %s } }"
|
|
|
|
|
|
|
|
#define QERR_QGA_LOGGING_FAILED \
|
|
|
|
"{ 'class': 'QgaLoggingFailed', 'data': {} }"
|
|
|
|
|
2009-11-27 00:58:57 +00:00
|
|
|
#define QERR_QMP_BAD_INPUT_OBJECT \
|
2009-12-07 20:37:02 +00:00
|
|
|
"{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
|
2009-11-27 00:58:57 +00:00
|
|
|
|
2010-04-07 17:46:33 +00:00
|
|
|
#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
|
|
|
|
"{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
|
|
|
|
|
2010-06-01 19:15:23 +00:00
|
|
|
#define QERR_QMP_EXTRA_MEMBER \
|
|
|
|
"{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }"
|
|
|
|
|
2011-07-29 18:57:54 +00:00
|
|
|
#define QERR_RESET_REQUIRED \
|
|
|
|
"{ 'class': 'ResetRequired', 'data': {} }"
|
|
|
|
|
2009-12-07 20:37:07 +00:00
|
|
|
#define QERR_SET_PASSWD_FAILED \
|
|
|
|
"{ 'class': 'SetPasswdFailed', 'data': {} }"
|
|
|
|
|
2009-12-07 20:37:14 +00:00
|
|
|
#define QERR_TOO_MANY_FILES \
|
2009-12-08 12:33:54 +00:00
|
|
|
"{ 'class': 'TooManyFiles', 'data': {} }"
|
2009-12-07 20:37:14 +00:00
|
|
|
|
2010-02-19 16:42:46 +00:00
|
|
|
#define QERR_UNDEFINED_ERROR \
|
|
|
|
"{ 'class': 'UndefinedError', 'data': {} }"
|
|
|
|
|
2011-02-09 10:09:38 +00:00
|
|
|
#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
|
|
|
|
"{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
|
|
|
|
|
2012-01-04 17:38:22 +00:00
|
|
|
#define QERR_UNSUPPORTED \
|
|
|
|
"{ 'class': 'Unsupported', 'data': {} }"
|
|
|
|
|
2011-12-04 17:05:28 +00:00
|
|
|
#define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \
|
|
|
|
"{ 'class': 'VirtFSFeatureBlocksMigration', 'data': { 'path': %s, 'tag': %s } }"
|
|
|
|
|
2009-12-07 20:37:08 +00:00
|
|
|
#define QERR_VNC_SERVER_FAILED \
|
|
|
|
"{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
|
|
|
|
|
2012-05-10 16:28:08 +00:00
|
|
|
#define QERR_SOCKET_CONNECT_IN_PROGRESS \
|
|
|
|
"{ 'class': 'SockConnectInprogress', 'data': {} }"
|
|
|
|
|
|
|
|
#define QERR_SOCKET_CONNECT_FAILED \
|
|
|
|
"{ 'class': 'SockConnectFailed', 'data': {} }"
|
|
|
|
|
|
|
|
#define QERR_SOCKET_LISTEN_FAILED \
|
|
|
|
"{ 'class': 'SockListenFailed', 'data': {} }"
|
|
|
|
|
|
|
|
#define QERR_SOCKET_BIND_FAILED \
|
|
|
|
"{ 'class': 'SockBindFailed', 'data': {} }"
|
|
|
|
|
|
|
|
#define QERR_SOCKET_CREATE_FAILED \
|
|
|
|
"{ 'class': 'SockCreateFailed', 'data': {} }"
|
|
|
|
|
2009-11-19 01:05:30 +00:00
|
|
|
#endif /* QERROR_H */
|