From e4e97f2bdaf6d98c5a133491efdffebb64fae4d6 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 5 May 2009 16:01:54 +0530 Subject: booster: Add fsync API Signed-off-by: Anand V. Avati --- booster/src/booster.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/booster/src/booster.c b/booster/src/booster.c index 4e41e50e134..3e84d550244 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 -- cgit