shithub: lwext4

ref: e6435a48f54c9f84eec99bb5f56c327ae59b9c1f
dir: /prefix_patch/ext4_oflags.patch/

View raw version
diff --git a/include/ext4_oflags.h b/include/ext4_oflags.h
index 7f7be7e..87f42ef 100644
--- a/include/ext4_oflags.h
+++ b/include/ext4_oflags.h
@@ -45,51 +45,33 @@ extern "C" {
 
 #if CONFIG_HAVE_OWN_OFLAGS
 
- #ifndef O_RDONLY
- #define O_RDONLY 00
- #endif
-
- #ifndef O_WRONLY
- #define O_WRONLY 01
- #endif
-
- #ifndef O_RDWR
- #define O_RDWR 02
- #endif
-
- #ifndef O_CREAT
- #define O_CREAT 0100
- #endif
-
- #ifndef O_EXCL
- #define O_EXCL 0200
- #endif
-
- #ifndef O_TRUNC
- #define O_TRUNC 01000
- #endif
-
- #ifndef O_APPEND
- #define O_APPEND 02000
- #endif
+ #define LWEXT4_FLAGS(flags) LWEXT4_##flags
+
+ enum ext4_oflags {
+ 	LWEXT4_FLAGS(O_RDONLY) = 00,
+ 	LWEXT4_FLAGS(O_WRONLY) = 01,
+ 	LWEXT4_FLAGS(O_RDWR) = 02,
+ 	LWEXT4_FLAGS(O_CREAT) = 0100,
+ 	LWEXT4_FLAGS(O_EXCL) = 0200,
+ 	LWEXT4_FLAGS(O_TRUNC) = 01000,
+ 	LWEXT4_FLAGS(O_APPEND) = 02000
+ };
 
 /********************************FILE SEEK FLAGS*****************************/
 
- #ifndef SEEK_SET
- #define SEEK_SET 0
- #endif
-
- #ifndef SEEK_CUR
- #define SEEK_CUR 1
- #endif
-
- #ifndef SEEK_END
- #define SEEK_END 2
- #endif
+ enum ext4_seek_flags {
+ 	LWEXT4_FLAGS(SEEK_SET) = 0,
+ 	LWEXT4_FLAGS(SEEK_CUR) = 1,
+ 	LWEXT4_FLAGS(SEEK_END) = 2
+ };
 
 #else
+
  #include <unistd.h>
  #include <fcntl.h>
+
+ #define LWEXT4_FLAGS(flags) (flags)
+
 #endif
 
 #ifdef __cplusplus
@@ -101,3 +83,4 @@ extern "C" {
 /**
  * @}
  */
+