summaryrefslogtreecommitdiffstats
path: root/booster/src
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 16:02:02 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:45:52 +0530
commit9b012b098915c8bdbdcb8a4c38fb353fa39e82d4 (patch)
tree52a00afcbfde50227e1760b8d6245445c2840edd /booster/src
parente4e97f2bdaf6d98c5a133491efdffebb64fae4d6 (diff)
booster: Add ftruncate API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster/src')
-rw-r--r--booster/src/booster.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index 3e84d5502..a7a11edff 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -155,6 +155,7 @@ 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);
+static int (*real_ftruncate) (int fd, off_t length);
#define RESOLVE(sym) do { \
if (!real_##sym) \
@@ -1268,6 +1269,27 @@ fsync (int fd)
return ret;
}
+int
+ftruncate (int fd, off_t length)
+{
+ int ret = -1;
+ glusterfs_file_t fh = NULL;
+
+ fh = booster_get_glfs_fd (booster_glfs_fdtable, fd);
+ if (!fh) {
+ if (real_ftruncate == NULL) {
+ errno = ENOSYS;
+ ret = -1;
+ } else
+ ret = real_ftruncate (fd, length);
+ } else {
+ ret = glusterfs_ftruncate (fh, length);
+ booster_put_glfs_fd (fh);
+ }
+
+ return ret;
+}
+
pid_t
fork (void)
{
@@ -1324,6 +1346,7 @@ _init (void)
RESOLVE (fchmod);
RESOLVE (fchown);
RESOLVE (fsync);
+ RESOLVE (ftruncate);
/* This must be called after resolving real functions
* above so that the socket based IO calls in libglusterfsclient