summaryrefslogtreecommitdiffstats
path: root/booster/src
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 15:59:25 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:41:25 +0530
commit3364e5eb2d5f5110e86924112dfe3f10597c9c9f (patch)
treec92ff65f5e0d479c68819e0edcd7a898f459b0ca /booster/src
parent313713a254e193623807d019f4c0e17e637ed316 (diff)
booster: Remove fcntl.h from include path
We define the O_CREAT, etc. flags so that we can remove fcntl.h from the include path. fcntl.h has certain defines and other lines of code that redirect application's open and open64 calls to the syscalls defined by libc. For us, thats not a Good Thing (TM). Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster/src')
-rw-r--r--booster/src/booster.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index ef1dcc8e68a..903ad8e8f37 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -33,7 +33,6 @@
#include <libglusterfsclient.h>
#include <list.h>
#include <pthread.h>
-#include <fcntl.h>
#include <sys/xattr.h>
#include <string.h>
#include <assert.h>
@@ -44,6 +43,28 @@
#define GF_UNIT_KB 1024
#endif
+
+/* We define these flags so that we can remove fcntl.h from the include path.
+ * fcntl.h has certain defines and other lines of code that redirect the
+ * application's open and open64 calls to the syscalls defined by
+ * libc, for us, thats not a Good Thing (TM).
+ */
+#ifndef GF_O_CREAT
+#define GF_O_CREAT 0x40
+#endif
+
+#ifndef GF_O_TRUNC
+#define GF_O_TRUNC 0x200
+#endif
+
+#ifndef GF_O_RDWR
+#define GF_O_RDWR 0x2
+#endif
+
+#ifndef GF_O_WRONLY
+#define GF_O_WRONLY 0x1
+#endif
+
#ifndef UNIX_PATH_MAX
#define UNIX_PATH_MAX 108
#endif
@@ -437,7 +458,6 @@ do_open (int fd, int flags, mode_t mode)
return;
}
-#ifndef __USE_FILE_OFFSET64
int
open (const char *pathname, int flags, ...)
{
@@ -445,7 +465,7 @@ open (const char *pathname, int flags, ...)
mode_t mode = 0;
va_list ap;
- if (flags & O_CREAT) {
+ if (flags & GF_O_CREAT) {
va_start (ap, flags);
mode = va_arg (ap, mode_t);
va_end (ap);
@@ -456,13 +476,12 @@ open (const char *pathname, int flags, ...)
}
if (ret != -1) {
- flags &= ~ O_CREAT;
+ flags &= ~ GF_O_CREAT;
do_open (ret, flags, mode);
}
return ret;
}
-#endif
#if defined (__USE_LARGEFILE64) || !defined (__USE_FILE_OFFSET64)
int
@@ -472,7 +491,7 @@ open64 (const char *pathname, int flags, ...)
mode_t mode = 0;
va_list ap;
- if (flags & O_CREAT) {
+ if (flags & GF_O_CREAT) {
va_start (ap, flags);
mode = va_arg (ap, mode_t);
va_end (ap);
@@ -483,7 +502,7 @@ open64 (const char *pathname, int flags, ...)
}
if (ret != -1) {
- flags &= ~O_CREAT;
+ flags &= ~GF_O_CREAT;
do_open (ret, flags, mode);
}
@@ -499,7 +518,7 @@ creat (const char *pathname, mode_t mode)
ret = real_creat (pathname, mode);
if (ret != -1) {
- do_open (ret, O_WRONLY | O_TRUNC, mode);
+ do_open (ret, GF_O_WRONLY | GF_O_TRUNC, mode);
}
return ret;