ext4_errno.patch 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. diff --git a/include/ext4_errno.h b/include/ext4_errno.h
  2. index edf89a9..a4408c7 100644
  3. --- a/include/ext4_errno.h
  4. +++ b/include/ext4_errno.h
  5. @@ -43,46 +43,74 @@ extern "C" {
  6. #include "ext4_config.h"
  7. #if !CONFIG_HAVE_OWN_ERRNO
  8. -#include <errno.h>
  9. -#else
  10. -#define EPERM 1 /* Operation not permitted */
  11. -#define ENOENT 2 /* No such file or directory */
  12. -#define EIO 5 /* I/O error */
  13. -#define ENXIO 6 /* No such device or address */
  14. -#define E2BIG 7 /* Argument list too long */
  15. -#define ENOMEM 12 /* Out of memory */
  16. -#define EACCES 13 /* Permission denied */
  17. -#define EFAULT 14 /* Bad address */
  18. -#define EEXIST 17 /* File exists */
  19. -#define ENODEV 19 /* No such device */
  20. -#define ENOTDIR 20 /* Not a directory */
  21. -#define EISDIR 21 /* Is a directory */
  22. -#define EINVAL 22 /* Invalid argument */
  23. -#define EFBIG 27 /* File too large */
  24. -#define ENOSPC 28 /* No space left on device */
  25. -#define EROFS 30 /* Read-only file system */
  26. -#define EMLINK 31 /* Too many links */
  27. -#define ERANGE 34 /* Math result not representable */
  28. -#define ENOTEMPTY 39 /* Directory not empty */
  29. -#define ENODATA 61 /* No data available */
  30. -#define ENOTSUP 95 /* Not supported */
  31. -#endif
  32. -#ifndef ENODATA
  33. - #ifdef ENOATTR
  34. - #define ENODATA ENOATTR
  35. - #else
  36. - #define ENODATA 61
  37. + #include <errno.h>
  38. +
  39. + #define LWEXT4_ERRNO(errno) (errno)
  40. +
  41. + #ifndef ENODATA
  42. + #ifdef ENOATTR
  43. + #define ENOATTR ENOATTR
  44. + #else
  45. + #define ENODATA 61
  46. + #endif
  47. #endif
  48. -#endif
  49. -#ifndef ENOTSUP
  50. -#define ENOTSUP 95
  51. -#endif
  52. + #ifndef ENOTSUP
  53. + #define ENOTSUP 95
  54. + #endif
  55. +
  56. + #ifndef EOK
  57. + #define EOK 0
  58. + #endif
  59. +
  60. +#else /* CONFIG_HAVE_OWN_ERRNO */
  61. +
  62. + #define LWEXT4_ERRNO(errno) LWEXT4_##errno
  63. +
  64. + enum ext4_errno {
  65. + LWEXT4_ERRNO(EOK) = 0,
  66. + LWEXT4_ERRNO(EPERM) = 1, /* Operation not permitted */
  67. + LWEXT4_ERRNO(ENOENT) = 2, /* No such file or directory */
  68. + LWEXT4_ERRNO(ESRCH) = 3, /* No such process */
  69. + LWEXT4_ERRNO(EINTR) = 4, /* Interrupted system call */
  70. + LWEXT4_ERRNO(EIO) = 5, /* I/O error */
  71. + LWEXT4_ERRNO(ENXIO) = 6, /* No such device or address */
  72. + LWEXT4_ERRNO(E2BIG) = 7, /* Argument list too long */
  73. + LWEXT4_ERRNO(ENOEXEC) = 8, /* Exec format error */
  74. + LWEXT4_ERRNO(EBADF) = 9, /* Bad file number */
  75. + LWEXT4_ERRNO(ECHILD) = 10, /* No child processes */
  76. + LWEXT4_ERRNO(EAGAIN) = 11, /* Try again */
  77. + LWEXT4_ERRNO(ENOMEM) = 12, /* Out of memory */
  78. + LWEXT4_ERRNO(EACCES) = 13, /* Permission denied */
  79. + LWEXT4_ERRNO(EFAULT) = 14, /* Bad address */
  80. + LWEXT4_ERRNO(ENOTBLK) = 15, /* Block device required */
  81. + LWEXT4_ERRNO(EBUSY) = 16, /* Device or resource busy */
  82. + LWEXT4_ERRNO(EEXIST) = 17, /* File exists */
  83. + LWEXT4_ERRNO(EXDEV) = 18, /* Cross-device link */
  84. + LWEXT4_ERRNO(ENODEV) = 19, /* No such device */
  85. + LWEXT4_ERRNO(ENOTDIR) = 20, /* Not a directory */
  86. + LWEXT4_ERRNO(EISDIR) = 21, /* Is a directory */
  87. + LWEXT4_ERRNO(EINVAL) = 22, /* Invalid argument */
  88. + LWEXT4_ERRNO(ENFILE) = 23, /* File table overflow */
  89. + LWEXT4_ERRNO(EMFILE) = 24, /* Too many open files */
  90. + LWEXT4_ERRNO(ENOTTY) = 25, /* Not a typewriter */
  91. + LWEXT4_ERRNO(ETXTBSY) = 26, /* Text file busy */
  92. + LWEXT4_ERRNO(EFBIG) = 27, /* File too large */
  93. + LWEXT4_ERRNO(ENOSPC) = 28, /* No space left on device */
  94. + LWEXT4_ERRNO(ESPIPE) = 29, /* Illegal seek */
  95. + LWEXT4_ERRNO(EROFS) = 30, /* Read-only file system */
  96. + LWEXT4_ERRNO(EMLINK) = 31, /* Too many links */
  97. + LWEXT4_ERRNO(EPIPE) = 32, /* Broken pipe */
  98. + LWEXT4_ERRNO(EDOM) = 33, /* Math argument out of domain of func */
  99. + LWEXT4_ERRNO(ERANGE) = 34, /* Math result not representable */
  100. + LWEXT4_ERRNO(ENOTEMPTY) = 39, /* Directory not empty */
  101. + LWEXT4_ERRNO(ENODATA) = 61, /* No data available */
  102. + LWEXT4_ERRNO(ENOTSUP) = 95 /* Not supported */
  103. + };
  104. +
  105. +#endif /* CONFIG_HAVE_OWN_ERRNO */
  106. -#ifndef EOK
  107. -#define EOK 0
  108. -#endif
  109. #ifdef __cplusplus
  110. }