From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/include/err.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/include/err.h (limited to 'src/include/err.h') diff --git a/src/include/err.h b/src/include/err.h new file mode 100644 index 000000000..c188e9753 --- /dev/null +++ b/src/include/err.h @@ -0,0 +1,31 @@ +#ifndef CEPH_ERR_H +#define CEPH_ERR_H + +/* + * adapted from linux 2.6.24 include/linux/err.h + */ +#define MAX_ERRNO 4095 +#define IS_ERR_VALUE(x) ((x) >= (uintptr_t)-MAX_ERRNO) + +#include +#include +#include + +/* this generates a warning in c++; caller can do the cast manually +static inline void *ERR_PTR(long error) +{ + return (void *) error; +} +*/ + +static inline intptr_t PTR_ERR(const void *ptr) +{ + return (intptr_t) ptr; +} + +static inline bool IS_ERR(const void *ptr) +{ + return IS_ERR_VALUE((uintptr_t)ptr); +} + +#endif -- cgit v1.2.3