dmlite  0.6
errno.h
Go to the documentation of this file.
1 /** @file include/dmlite/common/errno.h
2  * @brief Error codes.
3  * @author Alejandro Álvarez Ayllon <aalvarez@cern.ch>
4  */
5 #ifndef DMLITE_COMMON_ERRNO_H
6 #define DMLITE_COMMON_ERRNO_H
7 
8 /* For easy of use, some error codes are reused for lower bytes.
9  * Plugins may use error codes from these headers ORing the type byte
10  * (i.e. DMLITE_SYSTEM_ERROR | EDQUOT), even though there are no macros
11  * for all of them.
12  */
13 #include <errno.h>
14 
15 #define DMLITE_SUCCESS 0
16 
17 /* Error codes need to be stored in an integer type
18  * of at least 4 bytes.
19  * Highest byte categorizes the error type */
20 #define DMLITE_USER_ERROR 0x00000000
21 #define DMLITE_SYSTEM_ERROR 0x01000000
22 #define DMLITE_CONFIGURATION_ERROR 0x02000000
23 #define DMLITE_DATABASE_ERROR 0x03000000
24 
25 /* Macros to extract error type and errno*/
26 #define DMLITE_ETYPE(e) ((e) & 0xFF000000)
27 #define DMLITE_ERRNO(e) ((e) & 0x00FFFFFF)
28 
29 /* Macros to generate a dmlite-like error code from POSIX error code
30  * Pass user errors directly as the POSIX value (or dmlite additional error codes)
31  */
32 #define DMLITE_SYSERR(e) ((e) | DMLITE_SYSTEM_ERROR)
33 #define DMLITE_CFGERR(e) ((e) | DMLITE_CONFIGURATION_ERROR)
34 #define DMLITE_FCTERR(e) ((e) | DMLITE_FACTORY_ERROR)
35 #define DMLITE_DBERR(e) ((e) | DMLITE_DATABASE_ERROR)
36 
37 /* Aditional error codes */
38 
39 #define DMLITE_UNKNOWN_ERROR 256
40 #define DMLITE_UNEXPECTED_EXCEPTION 257
41 #define DMLITE_INTERNAL_ERROR 258
42 /* 259 - 269 reserved for future use */
43 #define DMLITE_NO_SUCH_SYMBOL 270
44 #define DMLITE_API_VERSION_MISMATCH 271
45 #define DMLITE_NO_POOL_MANAGER 272
46 #define DMLITE_NO_CATALOG 273
47 #define DMLITE_NO_INODE 274
48 #define DMLITE_NO_AUTHN 275
49 #define DMLITE_NO_IO 276
50 /* 278 - 299 reserved for future use */
51 #define DMLITE_NO_SECURITY_CONTEXT 300
52 #define DMLITE_EMPTY_SECURITY_CONTEXT 301
53 #define DMLITE_RDR_ON_CHECKSUM 302
54 
55 /* 302 - 349 reserved for future use */
56 #define DMLITE_MALFORMED 350
57 #define DMLITE_UNKNOWN_KEY 351
58 /* 353 - 399 reserved for future use */
59 #define DMLITE_NO_COMMENT 400
60 #define DMLITE_NO_REPLICAS 401
61 #define DMLITE_NO_SUCH_REPLICA 402
62 /* 403 - 499 reserved for future use */
63 #define DMLITE_NO_USER_MAPPING 500
64 #define DMLITE_NO_SUCH_USER 501
65 #define DMLITE_NO_SUCH_GROUP 502
66 #define DMLITE_INVALID_ACL 504
67 /* 505 - 599 reserved for future use */
68 #define DMLITE_UNKNOWN_POOL_TYPE 600
69 #define DMLITE_NO_SUCH_POOL 601
70 
71 #endif /* DMLITE_COMMON_ERRNO_H */
Error codes.