mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
Merge pull request #47818 from petrutlucian94/fix_is_err
include: fix IS_ERR on Windows
This commit is contained in:
commit
af4906e084
@ -5,10 +5,11 @@
|
||||
* adapted from linux 2.6.24 include/linux/err.h
|
||||
*/
|
||||
#define MAX_ERRNO 4095
|
||||
#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
|
||||
#define IS_ERR_VALUE(x) ((x) >= (uintptr_t)-MAX_ERRNO)
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* this generates a warning in c++; caller can do the cast manually
|
||||
static inline void *ERR_PTR(long error)
|
||||
@ -17,12 +18,12 @@ static inline void *ERR_PTR(long error)
|
||||
}
|
||||
*/
|
||||
|
||||
static inline long PTR_ERR(const void *ptr)
|
||||
static inline intptr_t PTR_ERR(const void *ptr)
|
||||
{
|
||||
return (uintptr_t) ptr;
|
||||
return (intptr_t) ptr;
|
||||
}
|
||||
|
||||
static inline long IS_ERR(const void *ptr)
|
||||
static inline bool IS_ERR(const void *ptr)
|
||||
{
|
||||
return IS_ERR_VALUE((uintptr_t)ptr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user