]> git.proxmox.com Git - ceph.git/blob - ceph/src/include/err.h
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / include / err.h
1 #ifndef CEPH_ERR_H
2 #define CEPH_ERR_H
3
4 /*
5 * adapted from linux 2.6.24 include/linux/err.h
6 */
7 #define MAX_ERRNO 4095
8 #define IS_ERR_VALUE(x) ((x) >= (uintptr_t)-MAX_ERRNO)
9
10 #include <errno.h>
11 #include <stdint.h>
12 #include <stdbool.h>
13
14 /* this generates a warning in c++; caller can do the cast manually
15 static inline void *ERR_PTR(long error)
16 {
17 return (void *) error;
18 }
19 */
20
21 static inline intptr_t PTR_ERR(const void *ptr)
22 {
23 return (intptr_t) ptr;
24 }
25
26 static inline bool IS_ERR(const void *ptr)
27 {
28 return IS_ERR_VALUE((uintptr_t)ptr);
29 }
30
31 #endif