diff options
| author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-20 12:34:02 -0700 | 
|---|---|---|
| committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-21 12:49:43 +0530 | 
| commit | 6cb3159ef38428572b81160e91e7c685ed44acb0 (patch) | |
| tree | 63e35ce5fb255afe4613246c46905cb419ceea87 | |
| parent | de2192ea754883ea6ae643f63c44c2cbeb20f981 (diff) | |
libglusterfsclient: Add VMP-based statfs
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
| -rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 24 | ||||
| -rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.h | 8 | 
2 files changed, 31 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index aab93181f68..520735cf994 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -4536,7 +4536,7 @@ out:  }  int -glusterfs_statfs (glusterfs_handle_t handle, const char *path, +glusterfs_glh_statfs (glusterfs_handle_t handle, const char *path,                          struct statfs *buf)  {          struct statvfs                  stvfs = {0, }; @@ -4595,6 +4595,28 @@ out:  }  int +glusterfs_statfs (const char *path, struct statfs *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_statfs (entry->handle, vpath, buf); +out: +        return op_ret; +} + +int  glusterfs_statvfs (glusterfs_handle_t handle, const char *path,                     struct statvfs *buf)  { diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index 97ab3bc3470..e587fcc8e0d 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -28,6 +28,7 @@ __BEGIN_DECLS  #include <sys/types.h>  #include <sys/stat.h>  #include <dirent.h> +#include <sys/vfs.h>  typedef struct {          struct iovec *vector; @@ -283,6 +284,13 @@ glusterfs_glh_link (glusterfs_handle_t handle, const char *oldpath,  int  glusterfs_link (const char *oldpath, const char *newpath); + +int +glusterfs_glh_statfs (glusterfs_handle_t handle, const char *path, +                        struct statfs *buf); + +int +glusterfs_statfs (const char *path, struct statfs *buf);  /* FIXME: review the need for these apis */  /* added for log related initialization in booster fork implementation */  void  | 
