Annotation of qemu/qerror.h, revision 1.1.1.5

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.4   root       44: QString *qerror_format(const char *fmt, QDict *error);
1.1.1.2   root       45: #define qerror_report(fmt, ...) \
                     46:     qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
1.1       root       47: QError *qobject_to_qerror(const QObject *obj);
                     48: 
                     49: /*
                     50:  * QError class list
1.1.1.2   root       51:  * Please keep the definitions in alphabetical order.
                     52:  * Use "grep '^#define QERR_' qerror.h | sort -c" to check.
1.1       root       53:  */
1.1.1.2   root       54: #define QERR_BAD_BUS_FOR_DEVICE \
                     55:     "{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
                     56: 
1.1.1.5 ! root       57: #define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
        !            58:     "{ 'class': 'BlockFormatFeatureNotSupported', 'data': { 'format': %s, 'name': %s, 'feature': %s } }"
        !            59: 
1.1.1.2   root       60: #define QERR_BUS_NOT_FOUND \
                     61:     "{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
                     62: 
                     63: #define QERR_BUS_NO_HOTPLUG \
                     64:     "{ 'class': 'BusNoHotplug', 'data': { 'bus': %s } }"
                     65: 
1.1       root       66: #define QERR_COMMAND_NOT_FOUND \
                     67:     "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
                     68: 
                     69: #define QERR_DEVICE_ENCRYPTED \
                     70:     "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s } }"
                     71: 
1.1.1.2   root       72: #define QERR_DEVICE_INIT_FAILED \
                     73:     "{ 'class': 'DeviceInitFailed', 'data': { 'device': %s } }"
                     74: 
                     75: #define QERR_DEVICE_IN_USE \
                     76:     "{ 'class': 'DeviceInUse', 'data': { 'device': %s } }"
                     77: 
1.1.1.5 ! root       78: #define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \
        !            79:     "{ 'class': 'DeviceFeatureBlocksMigration', 'data': { 'device': %s, 'feature': %s } }"
        !            80: 
1.1.1.2   root       81: #define QERR_DEVICE_LOCKED \
1.1       root       82:     "{ 'class': 'DeviceLocked', 'data': { 'device': %s } }"
                     83: 
1.1.1.2   root       84: #define QERR_DEVICE_MULTIPLE_BUSSES \
                     85:     "{ 'class': 'DeviceMultipleBusses', 'data': { 'device': %s } }"
                     86: 
1.1       root       87: #define QERR_DEVICE_NOT_ACTIVE \
                     88:     "{ 'class': 'DeviceNotActive', 'data': { 'device': %s } }"
                     89: 
1.1.1.2   root       90: #define QERR_DEVICE_NOT_ENCRYPTED \
                     91:     "{ 'class': 'DeviceNotEncrypted', 'data': { 'device': %s } }"
                     92: 
1.1       root       93: #define QERR_DEVICE_NOT_FOUND \
                     94:     "{ 'class': 'DeviceNotFound', 'data': { 'device': %s } }"
                     95: 
                     96: #define QERR_DEVICE_NOT_REMOVABLE \
                     97:     "{ 'class': 'DeviceNotRemovable', 'data': { 'device': %s } }"
                     98: 
1.1.1.2   root       99: #define QERR_DEVICE_NO_BUS \
                    100:     "{ 'class': 'DeviceNoBus', 'data': { 'device': %s } }"
                    101: 
1.1.1.3   root      102: #define QERR_DEVICE_NO_HOTPLUG \
                    103:     "{ 'class': 'DeviceNoHotplug', 'data': { 'device': %s } }"
                    104: 
1.1.1.2   root      105: #define QERR_DUPLICATE_ID \
                    106:     "{ 'class': 'DuplicateId', 'data': { 'id': %s, 'object': %s } }"
                    107: 
1.1       root      108: #define QERR_FD_NOT_FOUND \
                    109:     "{ 'class': 'FdNotFound', 'data': { 'name': %s } }"
                    110: 
                    111: #define QERR_FD_NOT_SUPPLIED \
                    112:     "{ 'class': 'FdNotSupplied', 'data': {} }"
                    113: 
                    114: #define QERR_INVALID_BLOCK_FORMAT \
                    115:     "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
                    116: 
                    117: #define QERR_INVALID_PARAMETER \
                    118:     "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"
                    119: 
                    120: #define QERR_INVALID_PARAMETER_TYPE \
                    121:     "{ 'class': 'InvalidParameterType', 'data': { 'name': %s,'expected': %s } }"
                    122: 
1.1.1.2   root      123: #define QERR_INVALID_PARAMETER_VALUE \
                    124:     "{ 'class': 'InvalidParameterValue', 'data': { 'name': %s, 'expected': %s } }"
                    125: 
1.1       root      126: #define QERR_INVALID_PASSWORD \
                    127:     "{ 'class': 'InvalidPassword', 'data': {} }"
                    128: 
                    129: #define QERR_JSON_PARSING \
                    130:     "{ 'class': 'JSONParsing', 'data': {} }"
                    131: 
1.1.1.4   root      132: #define QERR_JSON_PARSE_ERROR \
                    133:     "{ 'class': 'JSONParseError', 'data': { 'message': %s } }"
                    134: 
                    135: #define QERR_BUFFER_OVERRUN \
                    136:     "{ 'class': 'BufferOverrun', 'data': {} }"
                    137: 
1.1       root      138: #define QERR_KVM_MISSING_CAP \
                    139:     "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }"
                    140: 
1.1.1.2   root      141: #define QERR_MIGRATION_EXPECTED \
                    142:     "{ 'class': 'MigrationExpected', 'data': {} }"
                    143: 
1.1       root      144: #define QERR_MISSING_PARAMETER \
                    145:     "{ 'class': 'MissingParameter', 'data': { 'name': %s } }"
                    146: 
1.1.1.2   root      147: #define QERR_NO_BUS_FOR_DEVICE \
                    148:     "{ 'class': 'NoBusForDevice', 'data': { 'device': %s, 'bus': %s } }"
                    149: 
                    150: #define QERR_OPEN_FILE_FAILED \
                    151:     "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }"
                    152: 
                    153: #define QERR_PROPERTY_NOT_FOUND \
                    154:     "{ 'class': 'PropertyNotFound', 'data': { 'device': %s, 'property': %s } }"
                    155: 
                    156: #define QERR_PROPERTY_VALUE_BAD \
                    157:     "{ 'class': 'PropertyValueBad', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
                    158: 
                    159: #define QERR_PROPERTY_VALUE_IN_USE \
                    160:     "{ 'class': 'PropertyValueInUse', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
                    161: 
                    162: #define QERR_PROPERTY_VALUE_NOT_FOUND \
                    163:     "{ 'class': 'PropertyValueNotFound', 'data': { 'device': %s, 'property': %s, 'value': %s } }"
                    164: 
1.1       root      165: #define QERR_QMP_BAD_INPUT_OBJECT \
                    166:     "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
                    167: 
1.1.1.2   root      168: #define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
                    169:     "{ 'class': 'QMPBadInputObjectMember', 'data': { 'member': %s, 'expected': %s } }"
                    170: 
                    171: #define QERR_QMP_EXTRA_MEMBER \
                    172:     "{ 'class': 'QMPExtraInputObjectMember', 'data': { 'member': %s } }"
                    173: 
1.1.1.5 ! root      174: #define QERR_RESET_REQUIRED \
        !           175:     "{ 'class': 'ResetRequired', 'data': {} }"
        !           176: 
1.1       root      177: #define QERR_SET_PASSWD_FAILED \
                    178:     "{ 'class': 'SetPasswdFailed', 'data': {} }"
                    179: 
1.1.1.4   root      180: #define QERR_ADD_CLIENT_FAILED \
                    181:     "{ 'class': 'AddClientFailed', 'data': {} }"
                    182: 
1.1       root      183: #define QERR_TOO_MANY_FILES \
                    184:     "{ 'class': 'TooManyFiles', 'data': {} }"
                    185: 
1.1.1.2   root      186: #define QERR_UNDEFINED_ERROR \
                    187:     "{ 'class': 'UndefinedError', 'data': {} }"
                    188: 
1.1.1.4   root      189: #define QERR_UNSUPPORTED \
                    190:     "{ 'class': 'Unsupported', 'data': {} }"
                    191: 
1.1.1.3   root      192: #define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
                    193:     "{ 'class': 'UnknownBlockFormatFeature', 'data': { 'device': %s, 'format': %s, 'feature': %s } }"
                    194: 
1.1.1.5 ! root      195: #define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \
        !           196:     "{ 'class': 'VirtFSFeatureBlocksMigration', 'data': { 'path': %s, 'tag': %s } }"
        !           197: 
1.1       root      198: #define QERR_VNC_SERVER_FAILED \
                    199:     "{ 'class': 'VNCServerFailed', 'data': { 'target': %s } }"
                    200: 
1.1.1.4   root      201: #define QERR_FEATURE_DISABLED \
                    202:     "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
                    203: 
                    204: #define QERR_QGA_LOGGING_FAILED \
                    205:     "{ 'class': 'QgaLoggingFailed', 'data': {} }"
                    206: 
                    207: #define QERR_QGA_COMMAND_FAILED \
                    208:     "{ 'class': 'QgaCommandFailed', 'data': { 'message': %s } }"
                    209: 
1.1       root      210: #endif /* QERROR_H */

unix.superglobalmegacorp.com