summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--booster/src/booster.c46
-rw-r--r--booster/src/booster_stat.c18
2 files changed, 64 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index 60213210e..8081a81a1 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -40,6 +40,7 @@
#include <logging.h>
#include <utime.h>
#include <dirent.h>
+#include <sys/statfs.h>
#ifndef GF_UNIT_KB
#define GF_UNIT_KB 1024
@@ -182,6 +183,8 @@ 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);
+static int (*real_statfs) (const char *path, struct statfs *buf);
+static int (*real_statfs64) (const char *path, struct statfs64 *buf);
#define RESOLVE(sym) do { \
@@ -1881,6 +1884,47 @@ out:
return ret;
}
+int
+booster_statfs (const char *pathname, struct statfs *buf)
+{
+ int ret = -1;
+
+ ret = glusterfs_statfs (pathname, buf);
+ if (((ret == -1) && (errno != ENODEV)) || (ret == 0))
+ goto out;
+
+ if (real_statfs == NULL) {
+ ret = -1;
+ errno = ENOSYS;
+ goto out;
+ }
+
+ ret = real_statfs (pathname, buf);
+
+out:
+ return ret;
+}
+
+int
+booster_statfs64 (const char *pathname, struct statfs64 *buf)
+{
+ int ret = -1;
+
+ ret = glusterfs_statfs (pathname, (struct statfs *)buf);
+ if (((ret == -1) && (errno != ENODEV)) || (ret == 0))
+ goto out;
+
+ if (real_statfs64 == NULL) {
+ ret = -1;
+ errno = ENOSYS;
+ goto out;
+ }
+
+ ret = real_statfs64 (pathname, buf);
+
+out:
+ return ret;
+}
pid_t
fork (void)
@@ -1964,6 +2008,8 @@ _init (void)
RESOLVE (__lxstat64);
RESOLVE (lstat);
RESOLVE (lstat64);
+ RESOLVE (statfs);
+ RESOLVE (statfs64);
/* 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 0d4e7c41f..2abbdf76e 100644
--- a/booster/src/booster_stat.c
+++ b/booster/src/booster_stat.c
@@ -49,6 +49,11 @@ extern int
booster_lxstat64 (int ver, const char *path, void *buf);
+extern int
+booster_statfs (const char *path, void *buf);
+extern int
+booster_statfs64 (const char *path, void *buf);
+
int
stat (const char *path, void *buf)
{
@@ -120,3 +125,16 @@ __lxstat64 (int ver, const char *path, void *buf)
{
return booster_lxstat64 (ver, path, buf);
}
+
+int
+statfs (const char *pathname, void *buf)
+{
+ return booster_statfs (pathname, buf);
+}
+
+int
+statfs64 (const char *pathname, void *buf)
+{
+ return booster_statfs64 (pathname, buf);
+}
+