initial code repo
[stor4nfv.git] / src / ceph / src / include / err.h
diff --git a/src/ceph/src/include/err.h b/src/ceph/src/include/err.h
new file mode 100644 (file)
index 0000000..ba4b32a
--- /dev/null
@@ -0,0 +1,29 @@
+#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) >= (unsigned long)-MAX_ERRNO)
+
+#include <errno.h>
+
+/* this generates a warning in c++; caller can do the cast manually
+static inline void *ERR_PTR(long error)
+{
+  return (void *) error;
+}
+*/
+
+static inline long PTR_ERR(const void *ptr)
+{
+  return (long) ptr;
+}
+
+static inline long IS_ERR(const void *ptr)
+{
+  return IS_ERR_VALUE((unsigned long)ptr);
+}
+
+#endif