summaryrefslogtreecommitdiffstats
path: root/booster
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-11 18:23:58 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-18 19:13:00 +0530
commite3e7f850eda010ab8c84417e57a4fbace4073022 (patch)
treee8a9477c451480e7916e18a1af39856b0102d17d /booster
parent358f5ba40866545ce240ed8fda77c4d2e57a4262 (diff)
booster: Add seekdir API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster')
-rw-r--r--booster/src/booster.c26
-rw-r--r--booster/src/booster_stat.c10
2 files changed, 36 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index 64a005e..a365595 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -196,6 +196,7 @@ static ssize_t (*real_lgetxattr) (const char *path, const char *name,
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);
#define RESOLVE(sym) do { \
if (!real_##sym) \
@@ -2110,6 +2111,30 @@ out:
return;
}
+void
+booster_seekdir (DIR *dir, off_t offset)
+{
+ struct booster_dir_handle *bh = (struct booster_dir_handle *)dir;
+
+ if (!bh) {
+ errno = EFAULT;
+ goto out;
+ }
+
+ if (bh->type == BOOSTER_GL_DIR)
+ glusterfs_seekdir ((glusterfs_dir_t)bh->dirh, offset);
+ else if (bh->type == BOOSTER_POSIX_DIR) {
+ if (real_seekdir == NULL) {
+ errno = ENOSYS;
+ goto out;
+ }
+
+ real_seekdir ((DIR *)bh->dirh, offset);
+ } else
+ errno = EINVAL;
+out:
+ return;
+}
pid_t
fork (void)
@@ -2202,6 +2227,7 @@ _init (void)
RESOLVE (remove);
RESOLVE (lchown);
RESOLVE (rewinddir);
+ RESOLVE (seekdir);
/* 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 9c58b0c..a16dab8 100644
--- a/booster/src/booster_stat.c
+++ b/booster/src/booster_stat.c
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>.
*/
+#include <sys/types.h>
extern int
booster_stat (const char *path, void *buf);
@@ -65,6 +66,9 @@ booster_readdir (void *dir);
extern void
booster_rewinddir (void *dir);
+extern void
+booster_seekdir (void *dir, off_t offset);
+
int
stat (const char *path, void *buf)
{
@@ -178,3 +182,9 @@ rewinddir (void *dir)
{
return booster_rewinddir (dir);
}
+
+void
+seekdir (void *dir, off_t offset)
+{
+ return booster_seekdir (dir, offset);
+}