summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 16:01:47 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:45:43 +0530
commite6f4a6879a6f9bb11e6774182b211b57f1a827fa (patch)
tree46d550e9540da6941d57ed70226e9f9389d0d466
parent8fa2a984c315418b940c481ea7729c00ed0b033a (diff)
booster: Add fchown API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r--booster/src/booster.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index 680d456684f..4e41e50e134 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -153,6 +153,8 @@ static int (*real_rmdir) (const char *pathname);
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);
+
#define RESOLVE(sym) do { \
if (!real_##sym) \
real_##sym = dlsym (RTLD_NEXT, #sym); \
@@ -1083,6 +1085,28 @@ chown (const char *pathname, uid_t owner, gid_t group)
return ret;
}
+int
+fchown (int fd, uid_t owner, gid_t group)
+{
+ int ret = -1;
+ glusterfs_file_t fh = NULL;
+
+ fh = booster_get_glfs_fd (booster_glfs_fdtable, fd);
+ if (!fh) {
+ if (real_fchown == NULL) {
+ errno = ENOSYS;
+ ret = -1;
+ } else
+ ret = real_fchown (fd, owner, group);
+ } else {
+ ret = glusterfs_fchown (fh, owner, group);
+ booster_put_glfs_fd (fh);
+ }
+
+ return ret;
+}
+
+
#define MOUNT_TABLE_HASH_SIZE 256
@@ -1276,6 +1300,7 @@ _init (void)
RESOLVE (chmod);
RESOLVE (chown);
RESOLVE (fchmod);
+ RESOLVE (fchown);
/* This must be called after resolving real functions
* above so that the socket based IO calls in libglusterfsclient