ext4_oflags.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. diff --git a/include/ext4_oflags.h b/include/ext4_oflags.h
  2. index 7f7be7e..87f42ef 100644
  3. --- a/include/ext4_oflags.h
  4. +++ b/include/ext4_oflags.h
  5. @@ -45,51 +45,33 @@ extern "C" {
  6. #if CONFIG_HAVE_OWN_OFLAGS
  7. - #ifndef O_RDONLY
  8. - #define O_RDONLY 00
  9. - #endif
  10. -
  11. - #ifndef O_WRONLY
  12. - #define O_WRONLY 01
  13. - #endif
  14. -
  15. - #ifndef O_RDWR
  16. - #define O_RDWR 02
  17. - #endif
  18. -
  19. - #ifndef O_CREAT
  20. - #define O_CREAT 0100
  21. - #endif
  22. -
  23. - #ifndef O_EXCL
  24. - #define O_EXCL 0200
  25. - #endif
  26. -
  27. - #ifndef O_TRUNC
  28. - #define O_TRUNC 01000
  29. - #endif
  30. -
  31. - #ifndef O_APPEND
  32. - #define O_APPEND 02000
  33. - #endif
  34. + #define LWEXT4_FLAGS(flags) LWEXT4_##flags
  35. +
  36. + enum ext4_oflags {
  37. + LWEXT4_FLAGS(O_RDONLY) = 00,
  38. + LWEXT4_FLAGS(O_WRONLY) = 01,
  39. + LWEXT4_FLAGS(O_RDWR) = 02,
  40. + LWEXT4_FLAGS(O_CREAT) = 0100,
  41. + LWEXT4_FLAGS(O_EXCL) = 0200,
  42. + LWEXT4_FLAGS(O_TRUNC) = 01000,
  43. + LWEXT4_FLAGS(O_APPEND) = 02000
  44. + };
  45. /********************************FILE SEEK FLAGS*****************************/
  46. - #ifndef SEEK_SET
  47. - #define SEEK_SET 0
  48. - #endif
  49. -
  50. - #ifndef SEEK_CUR
  51. - #define SEEK_CUR 1
  52. - #endif
  53. -
  54. - #ifndef SEEK_END
  55. - #define SEEK_END 2
  56. - #endif
  57. + enum ext4_seek_flags {
  58. + LWEXT4_FLAGS(SEEK_SET) = 0,
  59. + LWEXT4_FLAGS(SEEK_CUR) = 1,
  60. + LWEXT4_FLAGS(SEEK_END) = 2
  61. + };
  62. #else
  63. +
  64. #include <unistd.h>
  65. #include <fcntl.h>
  66. +
  67. + #define LWEXT4_FLAGS(flags) (flags)
  68. +
  69. #endif
  70. #ifdef __cplusplus
  71. @@ -101,3 +83,4 @@ extern "C" {
  72. /**
  73. * @}
  74. */
  75. +