summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 16:01:54 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:45:47 +0530
commite4e97f2bdaf6d98c5a133491efdffebb64fae4d6 (patch)
tree729dbf095c2b7da1eda589b850942119805bacb9
parente6f4a6879a6f9bb11e6774182b211b57f1a827fa (diff)
booster: Add fsync API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r--booster/src/booster.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index 4e41e50e1..3e84d5502 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -154,6 +154,7 @@ static int (*real_chmod) (const char *pathname, mode_t mode);
static int (*real_chown) (const char *pathname, uid_t owner, gid_t group);
static int (*real_fchmod) (int fd, mode_t mode);
static int (*real_fchown) (int fd, uid_t, gid_t gid);
+static int (*real_fsync) (int fd);
#define RESOLVE(sym) do { \
if (!real_##sym) \
@@ -1246,6 +1247,27 @@ fchmod (int fd, mode_t mode)
return ret;
}
+int
+fsync (int fd)
+{
+ int ret = -1;
+ glusterfs_file_t fh = NULL;
+
+ fh = booster_get_glfs_fd (booster_glfs_fdtable, fd);
+ if (!fh) {
+ if (real_fsync == NULL) {
+ errno = ENOSYS;
+ ret = -1;
+ } else
+ ret = real_fsync (fd);
+ } else {
+ ret = glusterfs_fsync (fh);
+ booster_put_glfs_fd (fh);
+ }
+
+ return ret;
+}
+
pid_t
fork (void)
{
@@ -1301,6 +1323,7 @@ _init (void)
RESOLVE (chown);
RESOLVE (fchmod);
RESOLVE (fchown);
+ RESOLVE (fsync);
/* This must be called after resolving real functions
* above so that the socket based IO calls in libglusterfsclient