diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-05-05 16:04:08 +0530 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-05-05 17:50:55 +0530 |
commit | 4de7dc7151d307021177107fcf8dd636b306bb59 (patch) | |
tree | 9dd4e0e0aa2bef56fc9ace4db6d16ee96fc0b133 /booster/src | |
parent | 13a58f94a781d91ab3d7854996df66c9802d972b (diff) |
booster: Add lstat API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster/src')
-rw-r--r-- | booster/src/booster.c | 94 | ||||
-rw-r--r-- | booster/src/booster_stat.c | 33 |
2 files changed, 127 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index 40a0ca87d83..60213210e9d 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -178,6 +178,10 @@ static int (*real___fxstat) (int ver, int fd, struct stat *buf); static int (*real___fxstat64) (int ver, int fd, struct stat64 *buf); static int (*real_fstat) (int fd, struct stat *buf); static int (*real_fstat64) (int fd , struct stat64 *buf); +static int (*real___lxstat) (int ver, const char *path, struct stat *buf); +static int (*real___lxstat64) (int ver, const char *path, struct stat64 *buf); +static int (*real_lstat) (const char *path, struct stat *buf); +static int (*real_lstat64) (const char *path, struct stat64 *buf); #define RESOLVE(sym) do { \ @@ -1792,6 +1796,92 @@ out: return ret; } +int +booster_lxstat (int ver, const char *path, void *buf) +{ + struct stat *sbuf = (struct stat *)buf; + int ret = -1; + + ret = glusterfs_lstat (path, sbuf); + if (((ret == -1) && (errno != ENODEV)) || (ret == 0)) + goto out; + + if (real___lxstat == NULL) { + ret = -1; + errno = ENOSYS; + goto out; + } + + ret = real___lxstat (ver, path, sbuf); +out: + return ret; +} + +int +booster_lxstat64 (int ver, const char *path, void *buf) +{ + int ret = -1; + struct stat64 *sbuf = (struct stat64 *)buf; + + ret = glusterfs_lstat (path, (struct stat *)sbuf); + if (((ret == -1) && (errno != ENODEV)) || (ret == 0)) + goto out; + + if (real___lxstat64 == NULL) { + errno = ENOSYS; + ret = -1; + goto out; + } + + ret = real___lxstat64 (ver, path, sbuf); +out: + return ret; +} + +int +booster_lstat (const char *path, void *buf) +{ + struct stat *sbuf = (struct stat *)buf; + int ret = -1; + + ret = glusterfs_lstat (path, sbuf); + if (((ret == -1) && (errno != ENODEV)) || (ret == 0)) + goto out; + + if (real_lstat == NULL) { + errno = ENOSYS; + ret = -1; + goto out; + } + + ret = real_lstat (path, sbuf); + +out: + return ret; +} + +int +booster_lstat64 (const char *path, void *buf) +{ + int ret = -1; + struct stat64 *sbuf = (struct stat64 *)buf; + + ret = glusterfs_lstat (path, (struct stat *)sbuf); + if (((ret == -1) && (errno != ENODEV)) || (ret == 0)) + goto out; + + if (real_lstat64 == NULL) { + errno = ENOSYS; + ret = -1; + goto out; + } + + ret = real_lstat64 (path, sbuf); +out: + return ret; +} + + pid_t fork (void) { @@ -1870,6 +1960,10 @@ _init (void) RESOLVE (__fxstat64); RESOLVE (fstat); RESOLVE (fstat64); + RESOLVE (__lxstat); + RESOLVE (__lxstat64); + RESOLVE (lstat); + RESOLVE (lstat64); /* 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 bdbb0f8f43d..0d4e7c41f9a 100644 --- a/booster/src/booster_stat.c +++ b/booster/src/booster_stat.c @@ -39,6 +39,16 @@ booster_fstat (int fd, void *buf); extern int booster_fstat64 (int fd, void *buf); +extern int +booster_lstat (const char *path, void *buf); +extern int +booster_lstat64 (const char *path, void *buf); +extern int +booster_lxstat (int ver, const char *path, void *buf); +extern int +booster_lxstat64 (int ver, const char *path, void *buf); + + int stat (const char *path, void *buf) { @@ -87,3 +97,26 @@ fstat64 (int fd, void *buf) return booster_fstat64 (fd, buf); } +int +lstat (const char *path, void *buf) +{ + return booster_lstat (path, buf); +} + +int +lstat64 (const char *path, void *buf) +{ + return booster_lstat64 (path, buf); +} + +int +__lxstat (int ver, const char *path, void *buf) +{ + return booster_lxstat (ver, path, buf); +} + +int +__lxstat64 (int ver, const char *path, void *buf) +{ + return booster_lxstat64 (ver, path, buf); +} |