summaryrefslogtreecommitdiffstats
path: root/booster
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 16:04:15 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:50:58 +0530
commitfe6a39da3cd7370e9a7d9f7908e06cbdce64ce6a (patch)
tree7e52bff0d4723e91e7c5c0e1db6974b37b437891 /booster
parent4de7dc7151d307021177107fcf8dd636b306bb59 (diff)
booster: Add statfs API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster')
-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 60213210e9d..8081a81a153 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 0d4e7c41f9a..2abbdf76e67 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);
+}
+