You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
673 B

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* erofs-utils/include/erofs/err.h
*
* Copyright (C) 2018 HUAWEI, Inc.
* http://www.huawei.com/
* Created by Li Guifu <bluce.liguifu@huawei.com>
*/
#ifndef __EROFS_ERR_H
#define __EROFS_ERR_H
#include <errno.h>
#define MAX_ERRNO (4095)
#define IS_ERR_VALUE(x) \
((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
static inline void *ERR_PTR(long error)
{
return (void *)error;
}
static inline int IS_ERR(const void *ptr)
{
return IS_ERR_VALUE((unsigned long)ptr);
}
static inline long PTR_ERR(const void *ptr)
{
return (long) ptr;
}
#endif