Annotation of qemu/qerror.h, revision 1.1.1.6

1.1       root        1: /*
1.1.1.2   root        2:  * QError Module
1.1       root        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"
                     16: #include "qstring.h"
1.1.1.2   root       17: #include "qemu-error.h"
1.1.1.5   root       18: #include "error.h"
1.1       root       19: #include <stdarg.h>
                     20: 
                     21: typedef struct QErrorStringTable {
                     22:     const char *desc;
                     23:     const char *error_fmt;
                     24: } QErrorStringTable;
                     25: 
                     26: typedef struct QError {
                     27:     QObject_HEAD;
                     28:     QDict *error;
1.1.1.2   root       29:     Location loc;
1.1       root       30:     int linenr;
                     31:     const char *file;
                     32:     const char *func;
                     33:     const QErrorStringTable *entry;
                     34: } QError;
                     35: 
                     36: QError *qerror_new(void);
                     37: QError *qerror_from_info(const char *file, int linenr, const char *func,
1.1.1.3   root       38:                          const char *fmt, va_list *va) GCC_FMT_ATTR(4, 0);
1.1       root       39: QString *qerror_human(const QError *qerror);
1.1.1.2   root       40: void qerror_print(QError *qerror);
                     41: void qerror_report_internal(const char *file, int linenr, const char *func,
1.1.1.3   root       42:                             const char *fmt, ...) GCC_FMT_ATTR(4, 5);
1.1.1.5   root       43: void qerror_report_err(Error *err);
1.1.1.6 ! root       44: void assert_no_error(Error *err);
1.1.1.4   root       45: QString *qerror_format(const char *fmt, QDict *error);
1.1.1.2   root       46: #define qerror_report(fmt, ...) \
                     47:     qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
1.1       root       48: QError *qobject_to_qerror(const QObject *obj);
                     49: 
                     50: /*
                     51:  * QError class list
1.1.1.2   root       52:  * Please keep the definitions in alphabetical order.
1.1.1.6 ! root       53:  * Use scripts/check-qerror.sh to check.
1.1       root       54:  */
1.1.1.6 ! root       55: #define QERR_ADD_CLIENT_FAILED \
        !            56:     "{ 'class': 'AddClientFailed', 'data': {} }"
        !            57: 
        !            58: #define QERR_AMBIGUOUS_PATH \
        !            59:     "{ 'class': 'AmbiguousPath', 'data': { 'path': %s } }"
        !            60: 
1.1.1.2   root       61: #define QERR_BAD_BUS_FOR_DEVICE \
                     62:     "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
                     63: 
1.1.1.6 ! root       64: #define QERR_BASE_NOT_FOUND \
        !            65:     "{ 'class': 'BaseNotFound', 'data': { 'base': %s } }"
        !            66: 
1.1.1.5   root       67: #define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
                     68:     "{ 'class': 'BlockFormatFeatureNotSupported', 'data': { 'format': %s, 'name': %s, 'feature': %s } }"
                     69: 
1.1.1.6 ! root       70: #define QERR_BUFFER_OVERRUN \
        !            71:     "{ 'class': 'BufferOverrun', 'data': {} }"
1.1.1.2   root       72: 
                     73: #define QERR_BUS_NO_HOTPLUG \
                     74:     "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
                     75: 
1.1.1.6 ! root       76: #define QERR_BUS_NOT_FOUND \
        !            77:     "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
        !            78: 
        !            79: #define QERR_COMMAND_DISABLED \
        !            80:     "{ 'class': 'CommandDisabled', 'data': { 'name': %s } }"
        !            81: 
1.1       root       82: #define QERR_COMMAND_NOT_FOUND \
                     83:     "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
                     84: 
                     85: #define QERR_DEVICE_ENCRYPTED \
1.1.1.6 ! root       86:     "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s, 'filename': %s } }"
        !            87: 
        !            88: #define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \
        !            89:     "{ 'class': 'DeviceFeatureBlocksMigration', 'data': { 'device': %s, 'feature': %s } }"
        !            90: 
        !            91: #define QERR_DEVICE_HAS_NO_MEDIUM \
        !            92:     "{ 'class': 'DeviceHasNoMedium', 'data': { 'device': %s } }"
1.1       root       93: 
1.1.1.2   root       94: #define QERR_DEVICE_INIT_FAILED \
                     95:     "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
                     96: 
                     97: #define QERR_DEVICE_IN_USE \
                     98:     "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
                     99: 
1.1.1.6 ! root      100: #define QERR_DEVICE_IS_READ_ONLY \
        !           101:     "{ 'class': 'DeviceIsReadOnly', 'data': { 'device': %s } }"
1.1.1.5   root      102: 
1.1.1.2   root      103: #define QERR_DEVICE_LOCKED \
1.1       root      104:     "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
                    105: 
1.1.1.2   root      106: #define QERR_DEVICE_MULTIPLE_BUSSES \
                    107:     "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
                    108: 
1.1.1.6 ! root      109: #define QERR_DEVICE_NO_BUS \
        !           110:     "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
        !           111: 
        !           112: #define QERR_DEVICE_NO_HOTPLUG \
        !           113:     "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
        !           114: 
1.1       root      115: #define QERR_DEVICE_NOT_ACTIVE \
                    116:     "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
                    117: 
1.1.1.2   root      118: #define QERR_DEVICE_NOT_ENCRYPTED \
                    119:     "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
                    120: 
1.1       root      121: #define QERR_DEVICE_NOT_FOUND \
                    122:     "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
                    123: 
                    124: #define QERR_DEVICE_NOT_REMOVABLE \
                    125:     "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
                    126: 
1.1.1.2   root      127: #define QERR_DUPLICATE_ID \
                    128:     "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
                    129: 
1.1       root      130: #define QERR_FD_NOT_FOUND \
                    131:     "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
                    132: 
                    133: #define QERR_FD_NOT_SUPPLIED \
                    134:     "{ 'class': 'FdNotSupplied', 'data': {} }"
                    135: 
1.1.1.6 ! root      136: #define QERR_FEATURE_DISABLED \
        !           137:     "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
        !           138: 
1.1       root      139: #define QERR_INVALID_BLOCK_FORMAT \
                    140:     "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
                    141: 
                    142: #define QERR_INVALID_PARAMETER \
                    143:     "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
                    144: 
1.1.1.6 ! root      145: #define QERR_INVALID_PARAMETER_COMBINATION \
        !           146:     "{ 'class': 'InvalidParameterCombination', 'data': {} }"
        !           147: 
1.1       root      148: #define QERR_INVALID_PARAMETER_TYPE \
                    149:     "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
                    150: 
1.1.1.2   root      151: #define QERR_INVALID_PARAMETER_VALUE \
                    152:     "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
                    153: 
1.1       root      154: #define QERR_INVALID_PASSWORD \
                    155:     "{ 'class': 'InvalidPassword', 'data': {} }"
                    156: 
1.1.1.6 ! root      157: #define QERR_IO_ERROR \
        !           158:     "{ 'class': 'IOError', 'data': {} }"
1.1       root      159: 
1.1.1.4   root      160: #define QERR_JSON_PARSE_ERROR \
                    161:     "{ 'class': 'JSONParseError', 'data': { 'message': %s } }"
                    162: 
1.1.1.6 ! root      163: #define QERR_JSON_PARSING \
        !           164:     "{ 'class': 'JSONParsing', 'data': {} }"
1.1.1.4   root      165: 
1.1       root      166: #define QERR_KVM_MISSING_CAP \
                    167:     "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
                    168: 
1.1.1.6 ! root      169: #define QERR_MIGRATION_ACTIVE \
        !           170:     "{ 'class': 'MigrationActive', 'data': {} }"
        !           171: 
        !           172: #define QERR_MIGRATION_NOT_SUPPORTED \
        !           173:     "{ 'class': 'MigrationNotSupported', 'data': {'device': %s} }"
        !           174: 
1.1.1.2   root      175: #define QERR_MIGRATION_EXPECTED \
                    176:     "{ 'class': 'MigrationExpected', 'data': {} }"
                    177: 
1.1       root      178: #define QERR_MISSING_PARAMETER \
                    179:     "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
                    180: 
1.1.1.2   root      181: #define QERR_NO_BUS_FOR_DEVICE \
                    182:     "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
                    183: 
1.1.1.6 ! root      184: #define QERR_NOT_SUPPORTED \
        !           185:     "{ 'class': 'NotSupported', 'data': {} }"
        !           186: 
1.1.1.2   root      187: #define QERR_OPEN_FILE_FAILED \
                    188:     "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
                    189: 
1.1.1.6 ! root      190: #define QERR_PERMISSION_DENIED \
        !           191:     "{ 'class': 'PermissionDenied', 'data': {} }"
        !           192: 
1.1.1.2   root      193: #define QERR_PROPERTY_NOT_FOUND \
                    194:     "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
                    195: 
                    196: #define QERR_PROPERTY_VALUE_BAD \
                    197:     "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
                    198: 
                    199: #define QERR_PROPERTY_VALUE_IN_USE \
                    200:     "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
                    201: 
                    202: #define QERR_PROPERTY_VALUE_NOT_FOUND \
                    203:     "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
                    204: 
1.1.1.6 ! root      205: #define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \
        !           206:     "{ 'class': 'PropertyValueNotPowerOf2', 'data': { " \
        !           207:     "'device': %s, 'property': %s, 'value': %"PRId64" } }"
        !           208: 
        !           209: #define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
        !           210:     "{ 'class': 'PropertyValueOutOfRange', 'data': { 'device': %s, 'property': %s, 'value': %"PRId64", 'min': %"PRId64", 'max': %"PRId64" } }"
        !           211: 
        !           212: #define QERR_QGA_COMMAND_FAILED \
        !           213:     "{ 'class': 'QgaCommandFailed', 'data': { 'message': %s } }"
        !           214: 
        !           215: #define QERR_QGA_LOGGING_FAILED \
        !           216:     "{ 'class': 'QgaLoggingFailed', 'data': {} }"
        !           217: 
1.1       root      218: #define QERR_QMP_BAD_INPUT_OBJECT \
                    219:     "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
                    220: 
1.1.1.2   root      221: #define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
                    222:     "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
                    223: 
                    224: #define QERR_QMP_EXTRA_MEMBER \
                    225:     "{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }"
                    226: 
1.1.1.5   root      227: #define QERR_RESET_REQUIRED \
                    228:     "{ 'class': 'ResetRequired', 'data': {} }"
                    229: 
1.1       root      230: #define QERR_SET_PASSWD_FAILED \
                    231:     "{ 'class': 'SetPasswdFailed', 'data': {} }"
                    232: 
                    233: #define QERR_TOO_MANY_FILES \
                    234:     "{ 'class': 'TooManyFiles', 'data': {} }"
                    235: 
1.1.1.2   root      236: #define QERR_UNDEFINED_ERROR \
                    237:     "{ 'class': 'UndefinedError', 'data': {} }"
                    238: 
1.1.1.3   root      239: #define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
                    240:     "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
                    241: 
1.1.1.6 ! root      242: #define QERR_UNSUPPORTED \
        !           243:     "{ 'class': 'Unsupported', 'data': {} }"
        !           244: 
1.1.1.5   root      245: #define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \
                    246:     "{ 'class': 'VirtFSFeatureBlocksMigration', 'data': { 'path': %s, 'tag': %s } }"
                    247: 
1.1       root      248: #define QERR_VNC_SERVER_FAILED \
                    249:     "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
                    250: 
1.1.1.6 ! root      251: #define QERR_SOCKET_CONNECT_IN_PROGRESS \
        !           252:     "{ 'class': 'SockConnectInprogress', 'data': {} }"
1.1.1.4   root      253: 
1.1.1.6 ! root      254: #define QERR_SOCKET_CONNECT_FAILED \
        !           255:     "{ 'class': 'SockConnectFailed', 'data': {} }"
1.1.1.4   root      256: 
1.1.1.6 ! root      257: #define QERR_SOCKET_LISTEN_FAILED \
        !           258:     "{ 'class': 'SockListenFailed', 'data': {} }"
        !           259: 
        !           260: #define QERR_SOCKET_BIND_FAILED \
        !           261:     "{ 'class': 'SockBindFailed', 'data': {} }"
        !           262: 
        !           263: #define QERR_SOCKET_CREATE_FAILED \
        !           264:     "{ 'class': 'SockCreateFailed', 'data': {} }"
1.1.1.4   root      265: 
1.1       root      266: #endif /* QERROR_H */

unix.superglobalmegacorp.com