From e2ba80403c3e73220a2b48b813df1561a9081e09 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 20 Apr 2009 12:33:06 -0700 Subject: libglusterfsclient: Add VMP-based chown Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 25 +++++++++++++++++++++++-- libglusterfsclient/src/libglusterfsclient.h | 7 +++++++ 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'libglusterfsclient') diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 0914cbaa4a3..eca466fffdc 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -3962,8 +3962,8 @@ out: } int -glusterfs_chown (glusterfs_handle_t handle, const char *path, uid_t owner, - gid_t group) +glusterfs_glh_chown (glusterfs_handle_t handle, const char *path, uid_t owner, + gid_t group) { int op_ret = -1; libglusterfs_client_ctx_t *ctx = handle; @@ -3994,6 +3994,27 @@ out: return op_ret; } +int +glusterfs_chown (const char *path, uid_t owner, gid_t group) +{ + struct vmp_entry *entry = NULL; + int op_ret = -1; + char *vpath = NULL; + + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, path, 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_chown (entry->handle, vpath, owner, group); +out: + return op_ret; +} + glusterfs_dir_t glusterfs_opendir (glusterfs_handle_t handle, const char *path) { diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index 6cec3fcea64..c9fc15a1157 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -263,6 +263,13 @@ glusterfs_glh_chmod (glusterfs_handle_t handle, const char *path, mode_t mode); int glusterfs_chmod (const char *path, mode_t mode); + +int +glusterfs_glh_chown (glusterfs_handle_t handle, const char *path, uid_t owner, + gid_t group); + +int +glusterfs_chown (const char *path, uid_t owner, gid_t group); /* FIXME: review the need for these apis */ /* added for log related initialization in booster fork implementation */ void -- cgit