From acac22c87374310544b3a4bb301e9bfa3ea26001 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 5 May 2009 16:02:17 +0530 Subject: booster: Add rename API Signed-off-by: Anand V. Avati --- booster/src/booster.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'booster') diff --git a/booster/src/booster.c b/booster/src/booster.c index 46305a502..681423277 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -157,6 +157,7 @@ static int (*real_fchown) (int fd, uid_t, gid_t gid); static int (*real_fsync) (int fd); static int (*real_ftruncate) (int fd, off_t length); static int (*real_link) (const char *oldpath, const char *newname); +static int (*real_rename) (const char *oldpath, const char *newpath); #define RESOLVE(sym) do { \ if (!real_##sym) \ @@ -1310,6 +1311,25 @@ link (const char *old, const char *new) return ret; } +int +rename (const char *old, const char *new) +{ + int ret = -1; + + ret = glusterfs_rename (old, new); + + if (((ret == -1) && (errno != ENODEV)) || (ret == 0)) + return ret; + + if (real_rename == NULL) { + errno = ENOSYS; + ret = -1; + } else + ret = real_rename (old, new); + + return ret; +} + pid_t fork (void) { @@ -1368,6 +1388,7 @@ _init (void) RESOLVE (fsync); RESOLVE (ftruncate); RESOLVE (link); + RESOLVE (rename); /* This must be called after resolving real functions * above so that the socket based IO calls in libglusterfsclient -- cgit