summaryrefslogtreecommitdiffstats
path: root/booster
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 16:02:17 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:46:02 +0530
commitacac22c87374310544b3a4bb301e9bfa3ea26001 (patch)
treeb2a3f9ca9fc6e8e0b36f754220f23e1f8f078b73 /booster
parent11cdc6e5282d4c7d906da3e20b50df78ddba2efd (diff)
booster: Add rename API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster')
-rw-r--r--booster/src/booster.c21
1 files changed, 21 insertions, 0 deletions
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