libglusterfsclient: Add statvfs API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
This commit is contained in:
parent
ff2bacf346
commit
5feab82f0c
@ -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 = {
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user