dmlite
0.6
|
00001 /** @file include/dmlite/common/errno.h 00002 * @brief Error codes. 00003 * @author Alejandro Álvarez Ayllon <aalvarez@cern.ch> 00004 */ 00005 #ifndef DMLITE_COMMON_ERRNO_H 00006 #define DMLITE_COMMON_ERRNO_H 00007 00008 /* For easy of use, some error codes are reused for lower bytes. 00009 * Plugins may use error codes from these headers ORing the type byte 00010 * (i.e. DMLITE_SYSTEM_ERROR | EDQUOT), even though there are no macros 00011 * for all of them. 00012 */ 00013 #include <errno.h> 00014 00015 #define DMLITE_SUCCESS 0 00016 00017 /* Error codes need to be stored in an integer type 00018 * of at least 4 bytes. 00019 * Highest byte categorizes the error type */ 00020 #define DMLITE_USER_ERROR 0x00000000 00021 #define DMLITE_SYSTEM_ERROR 0x01000000 00022 #define DMLITE_CONFIGURATION_ERROR 0x02000000 00023 #define DMLITE_DATABASE_ERROR 0x03000000 00024 00025 /* Macros to extract error type and errno*/ 00026 #define DMLITE_ETYPE(e) (e & 0xFF000000) 00027 #define DMLITE_ERRNO(e) (e & 0x00FFFFFF) 00028 00029 /* Macros to generate a dmlite-like error code from POSIX error code 00030 * Pass user errors directly as the POSIX value (or dmlite additional error codes) 00031 */ 00032 #define DMLITE_SYSERR(e) (e | DMLITE_SYSTEM_ERROR) 00033 #define DMLITE_CFGERR(e) (e | DMLITE_CONFIGURATION_ERROR) 00034 #define DMLITE_FCTERR(e) (e | DMLITE_FACTORY_ERROR) 00035 #define DMLITE_DBERR(e) (e | DMLITE_DATABASE_ERROR) 00036 00037 /* Aditional error codes */ 00038 00039 #define DMLITE_UNKNOWN_ERROR 256 00040 #define DMLITE_UNEXPECTED_EXCEPTION 257 00041 #define DMLITE_INTERNAL_ERROR 258 00042 /* 259 - 269 reserved for future use */ 00043 #define DMLITE_NO_SUCH_SYMBOL 270 00044 #define DMLITE_API_VERSION_MISMATCH 271 00045 #define DMLITE_NO_POOL_MANAGER 272 00046 #define DMLITE_NO_CATALOG 273 00047 #define DMLITE_NO_INODE 274 00048 #define DMLITE_NO_AUTHN 275 00049 #define DMLITE_NO_IO 276 00050 /* 278 - 299 reserved for future use */ 00051 #define DMLITE_NO_SECURITY_CONTEXT 300 00052 #define DMLITE_EMPTY_SECURITY_CONTEXT 301 00053 /* 302 - 349 reserved for future use */ 00054 #define DMLITE_MALFORMED 350 00055 #define DMLITE_UNKNOWN_KEY 351 00056 /* 353 - 399 reserved for future use */ 00057 #define DMLITE_NO_COMMENT 400 00058 #define DMLITE_NO_REPLICAS 401 00059 #define DMLITE_NO_SUCH_REPLICA 402 00060 /* 403 - 499 reserved for future use */ 00061 #define DMLITE_NO_USER_MAPPING 500 00062 #define DMLITE_NO_SUCH_USER 501 00063 #define DMLITE_NO_SUCH_GROUP 502 00064 #define DMLITE_INVALID_ACL 504 00065 /* 505 - 599 reserved for future use */ 00066 #define DMLITE_UNKNOWN_POOL_TYPE 600 00067 #define DMLITE_NO_SUCH_POOL 601 00068 00069 #endif /* DMLITE_COMMON_ERRNO_H */