Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / 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) >= (unsigned long)-MAX_ERRNO)
9
10 #include <errno.h>
11
12 /* this generates a warning in c++; caller can do the cast manually
13 static inline void *ERR_PTR(long error)
14 {
15   return (void *) error;
16 }
17 */
18
19 static inline long PTR_ERR(const void *ptr)
20 {
21   return (long) ptr;
22 }
23
24 static inline long IS_ERR(const void *ptr)
25 {
26   return IS_ERR_VALUE((unsigned long)ptr);
27 }
28
29 #endif