VSF Documented
err.h
Go to the documentation of this file.
1#include <linux/errno.h>
2
3#define MAX_ERRNO 4095
4
5#define IS_ERR_VALUE(__X) ((unsigned long)(uintptr_t)(__X) >= (unsigned long)-MAX_ERRNO)
6
7static inline void * ERR_PTR(long error)
8{
9 return (void *)(uintptr_t)error;
10}
11
12static inline long PTR_ERR(const void *ptr)
13{
14 return (long)(uintptr_t)ptr;
15}
16
17static inline bool IS_ERR(const void *ptr)
18{
19 return IS_ERR_VALUE(ptr);
20}
21
22static inline bool IS_ERR_OR_NULL(const void *ptr)
23{
24 return !ptr || IS_ERR_VALUE(ptr);
25}
26
27static inline void * ERR_CAST(const void *ptr)
28{
29 return (void *)ptr;
30}
31
32static inline int PTR_ERR_OR_ZERO(const void *ptr)
33{
34 if (IS_ERR(ptr)) {
35 return PTR_ERR(ptr);
36 } else {
37 return 0;
38 }
39}
#define IS_ERR_VALUE(__X)
Definition err.h:5
uint32_t uintptr_t
Definition stdint.h:38