mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
fa79837d5b
o Raise the maximum error number in IS_ERR_VALUE to 4095. o Make that number available as a new constant MAX_ERRNO. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
35 lines
712 B
C
35 lines
712 B
C
#ifndef _LINUX_ERR_H
|
|
#define _LINUX_ERR_H
|
|
|
|
#include <linux/compiler.h>
|
|
|
|
#include <asm/errno.h>
|
|
|
|
/*
|
|
* Kernel pointers have redundant information, so we can use a
|
|
* scheme where we can return either an error code or a dentry
|
|
* pointer with the same return value.
|
|
*
|
|
* This should be a per-architecture thing, to allow different
|
|
* error and pointer decisions.
|
|
*/
|
|
#define MAX_ERRNO 4095
|
|
|
|
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
|
|
|
|
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 /* _LINUX_ERR_H */
|