diff options
Diffstat (limited to 'booster')
-rw-r--r-- | booster/src/booster.c | 47 | ||||
-rw-r--r-- | booster/src/booster_stat.c | 18 |
2 files changed, 65 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index 8081a81a1..9c1d81ac4 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -41,6 +41,7 @@ #include <utime.h> #include <dirent.h> #include <sys/statfs.h> +#include <sys/statvfs.h> #ifndef GF_UNIT_KB #define GF_UNIT_KB 1024 @@ -185,6 +186,8 @@ static int (*real_lstat) (const char *path, struct stat *buf); static int (*real_lstat64) (const char *path, struct stat64 *buf); static int (*real_statfs) (const char *path, struct statfs *buf); static int (*real_statfs64) (const char *path, struct statfs64 *buf); +static int (*real_statvfs) (const char *path, struct statvfs *buf); +static int (*real_statvfs64) (const char *path, struct statvfs64 *buf); #define RESOLVE(sym) do { \ @@ -1926,6 +1929,48 @@ out: return ret; } +int +booster_statvfs (const char *pathname, struct statvfs *buf) +{ + int ret = -1; + + ret = glusterfs_statvfs (pathname, buf); + if (((ret == -1) && (errno != ENODEV)) || (ret == 0)) + goto out; + + if (real_statvfs == NULL) { + ret = -1; + errno = ENOSYS; + goto out; + } + + ret = real_statvfs (pathname, buf); + +out: + return ret; +} + +int +booster_statvfs64 (const char *pathname, struct statvfs64 *buf) +{ + int ret = -1; + + ret = glusterfs_statvfs (pathname, (struct statvfs *)buf); + if (((ret == -1) && (errno != ENODEV)) || (ret == 0)) + goto out; + + if (real_statvfs64 == NULL) { + ret = -1; + errno = ENOSYS; + goto out; + } + + ret = real_statvfs64 (pathname, buf); + +out: + return ret; +} + pid_t fork (void) { @@ -2010,6 +2055,8 @@ _init (void) RESOLVE (lstat64); RESOLVE (statfs); RESOLVE (statfs64); + RESOLVE (statvfs); + RESOLVE (statvfs64); /* 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 2abbdf76e..85eb2bf72 100644 --- a/booster/src/booster_stat.c +++ b/booster/src/booster_stat.c @@ -54,6 +54,12 @@ booster_statfs (const char *path, void *buf); extern int booster_statfs64 (const char *path, void *buf); +extern int +booster_statvfs (const char *path, void *buf); +extern int +booster_statvfs64 (const char *path, void *buf); + + int stat (const char *path, void *buf) { @@ -138,3 +144,15 @@ statfs64 (const char *pathname, void *buf) return booster_statfs64 (pathname, buf); } +int +statvfs (const char *pathname, void *buf) +{ + return booster_statvfs (pathname, buf); +} + +int +statvfs64 (const char *pathname, void *buf) +{ + return booster_statvfs64 (pathname, buf); +} + |