summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-16 23:56:40 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-17 13:43:54 +0530
commit5feab82f0c228410d94f3dfa53025f85d6eac8b1 (patch)
tree048496021e953dddd7002f49ba405d13d62cb2d1 /libglusterfsclient
parentff2bacf3466ddd4473ae3774e1f822981f4d8198 (diff)
libglusterfsclient: Add statvfs API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index d2075177b96..30134c1ad13 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -4057,6 +4057,45 @@ out:
return op_ret;
}
+int
+glusterfs_statvfs (glusterfs_handle_t handle, const char *path,
+ struct statvfs *buf)
+{
+ int32_t op_ret = -1;
+ loc_t loc = {0, };
+ libglusterfs_client_ctx_t *ctx = handle;
+ char *name = NULL;
+
+ GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, ctx, out);
+ GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO (LIBGF_XL_NAME, path, out);
+
+ loc.path = strdup (path);
+ op_ret = libgf_client_path_lookup (&loc, ctx, 1);
+ if (op_ret == -1) {
+ gf_log ("libglusterfsclient", GF_LOG_ERROR,
+ "path lookup failed for (%s)", path);
+ goto out;
+ }
+
+ name = strdup (path);
+ op_ret = libgf_client_loc_fill (&loc, ctx, 0, loc.parent->ino,
+ basename (name));
+ if (op_ret == -1) {
+ gf_log ("libglusterfsclient", GF_LOG_ERROR,
+ "libgf_client_loc_fill returned -1, returning"
+ " EINVAL");
+ errno = EINVAL;
+ goto out;
+ }
+
+ op_ret = libgf_client_statvfs (ctx, &loc, buf);
+out:
+ if (name)
+ FREE (name);
+ libgf_client_loc_wipe (&loc);
+ return op_ret;
+}
+
static struct xlator_fops libgf_client_fops = {
};