summaryrefslogtreecommitdiffstats
path: root/booster/src
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-11 18:24:08 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-18 19:13:05 +0530
commit1279d7398c63bdad448cf0418579f6df1d9f6f34 (patch)
tree957225c782d33cd614b5e612fcfbda805f56843d /booster/src
parente3e7f850eda010ab8c84417e57a4fbace4073022 (diff)
booster: Add telldir API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster/src')
-rw-r--r--booster/src/booster.c29
-rw-r--r--booster/src/booster_stat.c9
2 files changed, 38 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index a365595373e..5842058bbb3 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -197,6 +197,7 @@ static int (*real_remove) (const char* path);
static int (*real_lchown) (const char *path, uid_t owner, gid_t group);
static void (*real_rewinddir) (DIR *dirp);
static void (*real_seekdir) (DIR *dirp, off_t offset);
+static off_t (*real_telldir) (DIR *dirp);
#define RESOLVE(sym) do { \
if (!real_##sym) \
@@ -2136,6 +2137,33 @@ out:
return;
}
+off_t
+booster_telldir (DIR *dir)
+{
+ struct booster_dir_handle *bh = (struct booster_dir_handle *)dir;
+ off_t offset = -1;
+
+ if (!bh) {
+ errno = EFAULT;
+ goto out;
+ }
+
+ if (bh->type == BOOSTER_GL_DIR)
+ offset = glusterfs_telldir ((glusterfs_dir_t)bh->dirh);
+ else if (bh->type == BOOSTER_POSIX_DIR) {
+ if (real_telldir == NULL) {
+ errno = ENOSYS;
+ goto out;
+ }
+
+ offset = real_telldir ((DIR *)bh->dirh);
+ } else
+ errno = EINVAL;
+out:
+ return offset;
+}
+
+
pid_t
fork (void)
{
@@ -2228,6 +2256,7 @@ _init (void)
RESOLVE (lchown);
RESOLVE (rewinddir);
RESOLVE (seekdir);
+ RESOLVE (telldir);
/* This must be called after resolving real functions
* above so that the socket based IO calls in libglusterfsclient
diff --git a/booster/src/booster_stat.c b/booster/src/booster_stat.c
index a16dab86a64..10d2dc2e28b 100644
--- a/booster/src/booster_stat.c
+++ b/booster/src/booster_stat.c
@@ -69,6 +69,9 @@ booster_rewinddir (void *dir);
extern void
booster_seekdir (void *dir, off_t offset);
+extern off_t
+booster_telldir (void *dir);
+
int
stat (const char *path, void *buf)
{
@@ -188,3 +191,9 @@ seekdir (void *dir, off_t offset)
{
return booster_seekdir (dir, offset);
}
+
+off_t
+telldir (void *dir)
+{
+ return booster_telldir (dir);
+}