ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / err.h
1 #ifndef _LINUX_ERR_H
2 #define _LINUX_ERR_H
3
4 #include <asm/errno.h>
5
6 /*
7  * Kernel pointers have redundant information, so we can use a
8  * scheme where we can return either an error code or a dentry
9  * pointer with the same return value.
10  *
11  * This should be a per-architecture thing, to allow different
12  * error and pointer decisions.
13  */
14 static inline void *ERR_PTR(long error)
15 {
16         return (void *) error;
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 (unsigned long)ptr > (unsigned long)-1000L;
27 }
28
29 #endif /* _LINUX_ERR_H */