summaryrefslogtreecommitdiffstats
path: root/booster
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-11-18 01:16:12 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-18 21:14:16 -0800
commita0c05848d2ed0b0600d73214594a161cbb42302c (patch)
tree68c8502f64ee8bbd435d344c7630e3012add686d /booster
parenta33380068a9ab9eea80a6d0b6207d9e3cc9bdff4 (diff)
booster: implement ftruncate64.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 369 (Samba does not work with booster.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=369
Diffstat (limited to 'booster')
-rw-r--r--booster/src/booster.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index c8414ec..98f9104 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -141,6 +141,7 @@ 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);
static int (*real_ftruncate) (int fd, off_t length);
+static int (*real_ftruncate64) (int fd, loff_t length);
static int (*real_link) (const char *oldpath, const char *newname);
static int (*real_rename) (const char *oldpath, const char *newpath);
static int (*real_utimes) (const char *path, const struct timeval times[2]);
@@ -1266,8 +1267,13 @@ fsync (int fd)
return ret;
}
+int __REDIRECT (booster_false_ftruncate, (int fd, off_t length),
+ ftruncate);
+int __REDIRECT (booster_false_ftruncate64, (int fd, loff_t length),
+ ftruncate64);
+
int
-ftruncate (int fd, off_t length)
+booster_false_ftruncate (int fd, off_t length)
{
int ret = -1;
glusterfs_file_t fh = NULL;
@@ -1292,6 +1298,31 @@ ftruncate (int fd, off_t length)
}
int
+booster_false_ftruncate64 (int fd, loff_t length)
+{
+ int ret = -1;
+ glusterfs_file_t fh = NULL;
+
+ gf_log ("booster", GF_LOG_TRACE, "ftruncate: fd %d, length: %"PRIu64,fd
+ , length);
+ fh = booster_fdptr_get (booster_fdtable, fd);
+ if (!fh) {
+ gf_log ("booster", GF_LOG_TRACE, "Not a booster fd");
+ if (real_ftruncate == NULL) {
+ errno = ENOSYS;
+ ret = -1;
+ } else
+ ret = real_ftruncate64 (fd, length);
+ } else {
+ gf_log ("booster", GF_LOG_TRACE, "Is a booster fd");
+ ret = glusterfs_ftruncate (fh, length);
+ booster_fdptr_put (fh);
+ }
+
+ return ret;
+}
+
+int
link (const char *old, const char *new)
{
int ret = -1;
@@ -2830,6 +2861,7 @@ booster_lib_init (void)
RESOLVE (fchown);
RESOLVE (fsync);
RESOLVE (ftruncate);
+ RESOLVE (ftruncate64);
RESOLVE (link);
RESOLVE (rename);
RESOLVE (utimes);