linux/tools/virtio/linux/err.h
<<
>>
Prefs
   1#ifndef ERR_H
   2#define ERR_H
   3#define MAX_ERRNO       4095
   4
   5#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
   6
   7static inline void * __must_check ERR_PTR(long error)
   8{
   9        return (void *) error;
  10}
  11
  12static inline long __must_check PTR_ERR(const void *ptr)
  13{
  14        return (long) ptr;
  15}
  16
  17static inline long __must_check IS_ERR(const void *ptr)
  18{
  19        return IS_ERR_VALUE((unsigned long)ptr);
  20}
  21
  22static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
  23{
  24        return !ptr || IS_ERR_VALUE((unsigned long)ptr);
  25}
  26#endif /* ERR_H */
  27