From 1279d7398c63bdad448cf0418579f6df1d9f6f34 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 11 May 2009 18:24:08 +0530 Subject: booster: Add telldir API Signed-off-by: Anand V. Avati --- booster/src/booster.c | 29 +++++++++++++++++++++++++++++ booster/src/booster_stat.c | 9 +++++++++ 2 files changed, 38 insertions(+) (limited to 'booster') diff --git a/booster/src/booster.c b/booster/src/booster.c index a36559537..5842058bb 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 a16dab86a..10d2dc2e2 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); +} -- cgit