diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-20 12:29:57 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-21 12:48:23 +0530 |
commit | bb2ca0ec0da700f600d1fa30d111c2aa42804f70 (patch) | |
tree | d136b8a0a7d4398d1b7c798c3d75bd5b5a0d3af8 /libglusterfsclient | |
parent | 6cd656152901ba19ef52f762d000e329e3f7dbc6 (diff) |
libglusterfsclient: Add VMP-based getxattr
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 35 | ||||
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.h | 8 |
2 files changed, 35 insertions, 8 deletions
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, |