From b4259400090a28a5dbe27922ad8bc309db2a7c4a Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 20 Apr 2009 12:34:20 -0700 Subject: libglusterfsclient: Add VMP-based statvfs Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 27 +++++++++++++++++++++++++-- libglusterfsclient/src/libglusterfsclient.h | 8 ++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 520735cf994..9b94484be39 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -45,6 +45,7 @@ #include #include #include +#include #define LIBGF_XL_NAME "libglusterfsclient" #define LIBGLUSTERFS_INODE_TABLE_LRU_LIMIT 1000 //14057 @@ -4617,8 +4618,8 @@ out: } int -glusterfs_statvfs (glusterfs_handle_t handle, const char *path, - struct statvfs *buf) +glusterfs_glh_statvfs (glusterfs_handle_t handle, const char *path, + struct statvfs *buf) { int32_t op_ret = -1; loc_t loc = {0, }; @@ -4655,6 +4656,28 @@ out: return op_ret; } +int +glusterfs_statvfs (const char *path, struct statvfs *buf) +{ + struct vmp_entry *entry = NULL; + char *vpath = NULL; + int op_ret = -1; + + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, path, out); + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, buf, out); + + entry = libgf_vmp_search_entry ((char *)path); + if (!entry) { + errno = ENODEV; + goto out; + } + + vpath = libgf_vmp_virtual_path (entry, path); + op_ret = glusterfs_glh_statvfs (entry->handle, vpath, buf); +out: + return op_ret; +} + int32_t libgf_client_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index e587fcc8e0d..0d79fa5044a 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -29,6 +29,7 @@ __BEGIN_DECLS #include #include #include +#include typedef struct { struct iovec *vector; @@ -291,6 +292,13 @@ glusterfs_glh_statfs (glusterfs_handle_t handle, const char *path, int glusterfs_statfs (const char *path, struct statfs *buf); + +int +glusterfs_glh_statvfs (glusterfs_handle_t handle, const char *path, + struct statvfs *buf); + +int +glusterfs_statvfs (const char *path, struct statvfs *buf); /* FIXME: review the need for these apis */ /* added for log related initialization in booster fork implementation */ void -- cgit