DAOS API: src/include/daos_errno.h Source File

| DAOS API (v2.1 - dev)

Loading...
Searching...
No Matches
daos_errno.h
1
9
10#ifndef __DAOS_ERRNO_H__
11#define __DAOS_ERRNO_H__
12
13#if defined(__cplusplus)
14extern "C" {
15#endif
16
20
21/*
22 * This preprocessor machinery defines the errno values but also
23 * enables the internal definition of d_errstr. A new macro should
24 * be defined for each non-contiguous range
25 */
26
28#define D_FOREACH_GURT_ERR(ACTION) \
29 \
30 ACTION(DER_NO_PERM, (DER_ERR_GURT_BASE + 1), \
31 Operation not permitted) \
32 \
33 ACTION(DER_NO_HDL, (DER_ERR_GURT_BASE + 2), \
34 Invalid handle) \
35 \
36 ACTION(DER_INVAL, (DER_ERR_GURT_BASE + 3), \
37 Invalid parameters) \
38 \
39 ACTION(DER_EXIST, (DER_ERR_GURT_BASE + 4), \
40 Entity already exists) \
41 \
42 ACTION(DER_NONEXIST, (DER_ERR_GURT_BASE + 5), \
43 The specified entity does not exist) \
44 \
45 ACTION(DER_UNREACH, (DER_ERR_GURT_BASE + 6), \
46 Unreachable node) \
47 \
48 ACTION(DER_NOSPACE, (DER_ERR_GURT_BASE + 7), \
49 No space on storage target) \
50 \
51 ACTION(DER_ALREADY, (DER_ERR_GURT_BASE + 8), \
52 Operation already performed) \
53 \
54 ACTION(DER_NOMEM, (DER_ERR_GURT_BASE + 9), \
55 Out of memory) \
56 \
57 ACTION(DER_NOSYS, (DER_ERR_GURT_BASE + 10), \
58 Function not implemented) \
59 \
60 ACTION(DER_TIMEDOUT, (DER_ERR_GURT_BASE + 11), \
61 Time out) \
62 \
63 ACTION(DER_BUSY, (DER_ERR_GURT_BASE + 12), \
64 Device or resource busy) \
65 \
66 ACTION(DER_AGAIN, (DER_ERR_GURT_BASE + 13), \
67 Try again) \
68 \
69 ACTION(DER_PROTO, (DER_ERR_GURT_BASE + 14), \
70 Incompatible protocol) \
71 \
72 ACTION(DER_UNINIT, (DER_ERR_GURT_BASE + 15), \
73 Device or resource not initialized) \
74 \
75 ACTION(DER_TRUNC, (DER_ERR_GURT_BASE + 16), \
76 Buffer too short) \
77 \
78 ACTION(DER_OVERFLOW, (DER_ERR_GURT_BASE + 17), \
79 Data too long for defined data type or buffer size) \
80 \
81 ACTION(DER_CANCELED, (DER_ERR_GURT_BASE + 18), \
82 Operation canceled) \
83 \
84 ACTION(DER_OOG, (DER_ERR_GURT_BASE + 19), \
85 Out of group or member list) \
86 \
87 ACTION(DER_HG, (DER_ERR_GURT_BASE + 20), \
88 Transport layer mercury error) \
89 \
90 ACTION(DER_UNREG, (DER_ERR_GURT_BASE + 21), \
91 RPC or protocol version not registered) \
92 \
93 ACTION(DER_ADDRSTR_GEN, (DER_ERR_GURT_BASE + 22), \
94 Failed to generate an address string) \
95 \
96 ACTION(DER_PMIX, (DER_ERR_GURT_BASE + 23), \
97 PMIx layer error) \
98 \
99 ACTION(DER_IVCB_FORWARD, (DER_ERR_GURT_BASE + 24), \
100 Incast variable unavailable locally. Must forward) \
101 \
102 ACTION(DER_MISC, (DER_ERR_GURT_BASE + 25), \
103 Miscellaneous error) \
104 \
105 ACTION(DER_BADPATH, (DER_ERR_GURT_BASE + 26), \
106 Bad path name) \
107 \
108 ACTION(DER_NOTDIR, (DER_ERR_GURT_BASE + 27), \
109 Not a directory) \
110 \
111 ACTION(DER_CORPC_INCOMPLETE, (DER_ERR_GURT_BASE + 28), \
112 Collective RPC failed) \
113 \
114 ACTION(DER_NO_RAS_RANK, (DER_ERR_GURT_BASE + 29), \
115 No rank is subscribed to RAS) \
116 \
117 ACTION(DER_NOTATTACH, (DER_ERR_GURT_BASE + 30), \
118 Service group not attached) \
119 \
120 ACTION(DER_MISMATCH, (DER_ERR_GURT_BASE + 31), \
121 Version mismatch) \
122 \
123 ACTION(DER_EXCLUDED, (DER_ERR_GURT_BASE + 32), \
124 Rank has been excluded) \
125 \
126 ACTION(DER_NOREPLY, (DER_ERR_GURT_BASE + 33), \
127 User provided RPC handler did not send reply back) \
128 \
129 ACTION(DER_DOS, (DER_ERR_GURT_BASE + 34), \
130 Denial of service) \
131 \
132 ACTION(DER_BAD_TARGET, (DER_ERR_GURT_BASE + 35), \
133 Incorrect target for the RPC) \
134 \
135 ACTION(DER_GRPVER, (DER_ERR_GURT_BASE + 36), \
136 Group versioning mismatch) \
137 \
138 ACTION(DER_HLC_SYNC, (DER_ERR_GURT_BASE + 37), \
139 HLC synchronization error) \
140 \
141 ACTION(DER_NO_SHMEM, (DER_ERR_GURT_BASE + 38), \
142 Not enough shared memory free) \
143 \
144 ACTION(DER_ADD_METRIC_FAILED, (DER_ERR_GURT_BASE + 39), \
145 Failed to add the specified metric) \
146 \
147 ACTION(DER_DURATION_MISMATCH, (DER_ERR_GURT_BASE + 40), \
148 Duration end not paired with duration start) \
149 \
150 ACTION(DER_OP_NOT_PERMITTED, (DER_ERR_GURT_BASE + 41), \
151 Operation not permitted for metric type provided) \
152 \
153 ACTION(DER_EXCEEDS_PATH_LEN, (DER_ERR_GURT_BASE + 42), \
154 Path name exceeds permitted length) \
155 \
156 ACTION(DER_METRIC_NOT_FOUND, (DER_ERR_GURT_BASE + 43), \
157 Read failed because metric not found) \
158 \
159 ACTION(DER_SHMEM_PERMS, (DER_ERR_GURT_BASE + 44), \
160 Unable to access shared memory segment due to \
161 incompatible user or group permissions) \
162 \
163 ACTION(DER_HG_FATAL, (DER_ERR_GURT_BASE + 45), \
164 Fatal transport layer mercury error)
165
166
168#define D_FOREACH_DAOS_ERR(ACTION) \
169 \
170 ACTION(DER_IO, (DER_ERR_DAOS_BASE + 1), I / O error) \
171 \
172 ACTION(DER_FREE_MEM, (DER_ERR_DAOS_BASE + 2), Memory free error) \
173 \
174 ACTION(DER_ENOENT, (DER_ERR_DAOS_BASE + 3), Entity not found) \
175 \
176 ACTION(DER_NOTYPE, (DER_ERR_DAOS_BASE + 4), Unknown object type) \
177 \
178 ACTION(DER_NOSCHEMA, (DER_ERR_DAOS_BASE + 5), Unknown object schema) \
179 \
180 ACTION(DER_NOLOCAL, (DER_ERR_DAOS_BASE + 6), Object is not local) \
181 \
182 ACTION(DER_STALE, (DER_ERR_DAOS_BASE + 7), Stale pool map version) \
183 \
184 ACTION(DER_NOTLEADER, (DER_ERR_DAOS_BASE + 8), Not service leader) \
185 \
186 ACTION(DER_TGT_CREATE, (DER_ERR_DAOS_BASE + 9), Target create error) \
187 \
188 ACTION(DER_EP_RO, (DER_ERR_DAOS_BASE + 10), Epoch is read only) \
189 \
190 ACTION(DER_EP_OLD, (DER_ERR_DAOS_BASE + 11), Epoch is too old.All data have been recycled) \
191 \
192 ACTION(DER_KEY2BIG, (DER_ERR_DAOS_BASE + 12), Key is too large) \
193 \
194 ACTION(DER_REC2BIG, (DER_ERR_DAOS_BASE + 13), Record is too large) \
195 \
196 ACTION(DER_IO_INVAL, (DER_ERR_DAOS_BASE + 14), I / O buffers do not match object extents) \
197 \
198 ACTION(DER_EQ_BUSY, (DER_ERR_DAOS_BASE + 15), Event queue is busy) \
199 \
200 ACTION(DER_DOMAIN, (DER_ERR_DAOS_BASE + 16), Domain of cluster component do not match) \
201 \
202 ACTION(DER_SHUTDOWN, (DER_ERR_DAOS_BASE + 17), Service should shut down) \
203 \
204 ACTION(DER_INPROGRESS, (DER_ERR_DAOS_BASE + 18), Operation now in progress) \
205 \
206 ACTION(DER_NOTAPPLICABLE, (DER_ERR_DAOS_BASE + 19), Not applicable) \
207 \
208 ACTION(DER_NOTREPLICA, (DER_ERR_DAOS_BASE + 20), Not a service replica) \
209 \
210 ACTION(DER_CSUM, (DER_ERR_DAOS_BASE + 21), Checksum error) \
211 \
212 ACTION(DER_DF_INVAL, (DER_ERR_DAOS_BASE + 22), Unsupported durable format) \
213 \
214 ACTION(DER_DF_INCOMPT, (DER_ERR_DAOS_BASE + 23), Incompatible durable format version) \
215 \
216 ACTION(DER_REC_SIZE, (DER_ERR_DAOS_BASE + 24), Record size error) \
217 \
218 ACTION(DER_TX_RESTART, (DER_ERR_DAOS_BASE + 25), Transaction should restart) \
219 \
220 ACTION(DER_DATA_LOSS, (DER_ERR_DAOS_BASE + 26), Data lost or not recoverable) \
221 \
222 ACTION(DER_OP_CANCELED, (DER_ERR_DAOS_BASE + 27), Operation canceled) \
223 \
224 ACTION(DER_TX_BUSY, (DER_ERR_DAOS_BASE + 28), TX is not committed) \
225 \
226 ACTION(DER_AGENT_INCOMPAT, (DER_ERR_DAOS_BASE + 29), Agent is incompatible with libdaos) \
227 \
228 ACTION(DER_NEED_TX, (DER_ERR_DAOS_BASE + 30), To be handled via distributed transaction) \
229 \
230 ACTION(DER_RF, (DER_ERR_DAOS_BASE + 31), Failures exceed RF) \
231 \
232 ACTION(DER_FETCH_AGAIN, (DER_ERR_DAOS_BASE + 32), Fetch again) \
233 \
234 ACTION(DER_TX_UNCERTAIN, (DER_ERR_DAOS_BASE + 33), TX status is uncertain) \
235 \
236 ACTION(DER_AGENT_COMM, (DER_ERR_DAOS_BASE + 34), Agent communication error) \
237 \
238 ACTION(DER_ID_MISMATCH, (DER_ERR_DAOS_BASE + 35), ID mismatch) \
239 \
240 ACTION(DER_TGT_RETRY, (DER_ERR_DAOS_BASE + 36), Retry with other target) \
241 ACTION(DER_NOTSUPPORTED, (DER_ERR_DAOS_BASE + 37), Operation not supported) \
242 ACTION(DER_CONTROL_INCOMPAT, (DER_ERR_DAOS_BASE + 38), \
243 One or more control plane components are incompatible) \
244 \
245 ACTION(DER_NO_SERVICE, (DER_ERR_DAOS_BASE + 39), No service available) \
246 \
247 ACTION(DER_TX_ID_REUSED, (DER_ERR_DAOS_BASE + 40), TX ID may be reused) \
248 \
249 ACTION(DER_UPDATE_AGAIN, (DER_ERR_DAOS_BASE + 41), update again) \
250 ACTION(DER_NVME_IO, (DER_ERR_DAOS_BASE + 42), NVMe I / O error) \
251 ACTION(DER_NO_CERT, (DER_ERR_DAOS_BASE + 43), Unable to access one or more certificates) \
252 ACTION(DER_BAD_CERT, (DER_ERR_DAOS_BASE + 44), Invalid x509 certificate) \
253 ACTION(DER_VOS_PARTIAL_UPDATE, (DER_ERR_DAOS_BASE + 45), \
254 Same epoch partial overwrite of VOS array value disallowed) \
255 ACTION(DER_CHKPT_BUSY, (DER_ERR_DAOS_BASE + 46), \
256 Page is temporarily read only due to checkpointing) \
257 ACTION(DER_DIV_BY_ZERO, (DER_ERR_DAOS_BASE + 47), Division by zero)
258
260#define D_FOREACH_ERR_RANGE(ACTION) \
261 ACTION(GURT, 1000) \
262 ACTION(DAOS, 2000)
263
265#define D_DEFINE_ERRNO(name, value, desc) name = value,
267#define D_DEFINE_ERRSTR(name, value, desc) #name,
269#define D_DEFINE_ERRDESC(name, value, desc) #desc,
270
272#define D_DEFINE_RANGE_ERRNO(name, base) \
273 enum { \
274 DER_ERR_##name##_BASE = (base), \
275 D_FOREACH_##name##_ERR(D_DEFINE_ERRNO) \
276 DER_ERR_##name##_LIMIT, \
277 };
278
280#define D_DEFINE_RANGE_ERRSTR(name) \
281 static const char * const g_##name##_error_strings[] = {\
282 D_FOREACH_##name##_ERR(D_DEFINE_ERRSTR) \
283 }; \
284 static const char * const g_##name##_strerror[] = { \
285 D_FOREACH_##name##_ERR(D_DEFINE_ERRDESC) \
286 };
287
288 D_FOREACH_ERR_RANGE(D_DEFINE_RANGE_ERRNO)
289
290
291#define D_REGISTER_RANGE(name) \
292 d_errno_register_range(DER_ERR_##name##_BASE, \
293 DER_ERR_##name##_LIMIT, \
294 g_##name##_error_strings,\
295 g_##name##_strerror)
296
298#define D_DEREGISTER_RANGE(name) \
299 d_errno_deregister_range(DER_ERR_##name##_BASE)
300
302#define DER_SUCCESS 0
304#define DER_UNKNOWN (DER_ERR_GURT_BASE + 500000)
305
312 const char *d_errstr(int rc);
313
327 int d_errno_register_range(int start, int end,
328 const char * const *error_strings,
329 const char * const *strerror);
330
335 void d_errno_deregister_range(int start);
336
344 const char *d_errdesc(int errnum);
345
348
349#define DO_PRAGMA(str) _Pragma(#str)
350#define DEPRECATE_ERROR(olde, newe) \
351({ \
352 DO_PRAGMA(message(#olde " is deprecated, use " #newe)); \
353 newe; \
354})
355#define DER_EVICTED DEPRECATE_ERROR(DER_EVICTED, DER_EXCLUDED)
356
357#ifndef DF_RC
358#define DF_RC "%s(%d): '%s'"
359#define DP_RC(rc) d_errstr(rc), rc, d_errdesc(rc)
360#endif /* DF_RC */
361
362#if defined(__cplusplus)
363}
364#endif
365
366#endif /* __DAOS_ERRNO_H__ */
d_errstr
const char * d_errstr(int rc)
d_errdesc
const char * d_errdesc(int errnum)
d_errno_deregister_range
void d_errno_deregister_range(int start)
d_errno_register_range
int d_errno_register_range(int start, int end, const char *const *error_strings, const char *const *strerror)
D_FOREACH_ERR_RANGE
#define D_FOREACH_ERR_RANGE(ACTION)
Definition daos_errno.h:260
D_DEFINE_RANGE_ERRNO
#define D_DEFINE_RANGE_ERRNO(name, base)
Definition daos_errno.h:272