From bb2ca0ec0da700f600d1fa30d111c2aa42804f70 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 20 Apr 2009 12:29:57 -0700 Subject: libglusterfsclient: Add VMP-based getxattr Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 35 ++++++++++++++++++++++++----- libglusterfsclient/src/libglusterfsclient.h | 8 +++++-- 2 files changed, 35 insertions(+), 8 deletions(-) (limited to 'libglusterfsclient') diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 809c76da1c8..f9472b68057 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -1554,12 +1554,9 @@ libgf_client_getxattr (libglusterfs_client_ctx_t *ctx, return op_ret; } -ssize_t -glusterfs_getxattr (glusterfs_handle_t handle, - const char *path, - const char *name, - void *value, - size_t size) +ssize_t +glusterfs_glh_getxattr (glusterfs_handle_t handle, const char *path, + const char *name, void *value, size_t size) { int32_t op_ret = -1; loc_t loc = {0, }; @@ -1642,6 +1639,32 @@ out: return op_ret; } +ssize_t +glusterfs_getxattr (const char *path, const char *name, void *value, + size_t size) +{ + int op_ret = -1; + struct vmp_entry *entry = NULL; + char *vpath = NULL; + + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, path, out); + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, name, out); + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, value, 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_getxattr (entry->handle, vpath, name, value, + size); + +out: + return op_ret; +} + static int32_t libgf_client_open_cbk (call_frame_t *frame, void *cookie, diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index 71f70e730c1..e611f056325 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -139,8 +139,12 @@ glusterfs_fsetxattr (glusterfs_file_t fd, const char *name, const void *value, size_t size, int flags); ssize_t -glusterfs_getxattr (glusterfs_handle_t handle, const char *path, - const char *name, void *value, size_t size); +glusterfs_glh_getxattr (glusterfs_handle_t handle, const char *path, + const char *name, void *value, size_t size); + +ssize_t +glusterfs_getxattr (const char *path, const char *name, void *value, + size_t size); ssize_t glusterfs_lgetxattr (glusterfs_handle_t handle, const char *path, -- cgit