summaryrefslogtreecommitdiffstats
path: root/booster/src
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 16:04:23 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:51:02 +0530
commitc803febb9b013e384bcccf37a2c68dc90deea444 (patch)
tree4f4b5a087cf0aac84f60acc6605d673bafd3d11d /booster/src
parentfe6a39da3cd7370e9a7d9f7908e06cbdce64ce6a (diff)
booster: Add statvfs API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster/src')
-rw-r--r--booster/src/booster.c47
-rw-r--r--booster/src/booster_stat.c18
2 files changed, 65 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index 8081a81a153..9c1d81ac4ba 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 2abbdf76e67..85eb2bf72d2 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);
+}
+