summaryrefslogtreecommitdiffstats
path: root/booster/src/booster.c
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/src/booster.c
parent4de7dc7151d307021177107fcf8dd636b306bb59 (diff)
booster: Add statfs API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster/src/booster.c')
-rw-r--r--booster/src/booster.c46
1 files changed, 46 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