diff options
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 34 | ||||
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.h | 10 |
2 files changed, 35 insertions, 9 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index b5fa10159c0..1b444007b8b 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -2079,12 +2079,9 @@ libgf_client_setxattr (libglusterfs_client_ctx_t *ctx, } int -glusterfs_setxattr (glusterfs_handle_t handle, - const char *path, - const char *name, - const void *value, - size_t size, - int flags) +glusterfs_glh_setxattr (glusterfs_handle_t handle, const char *path, + const char *name, const void *value, + size_t size, int flags) { int32_t op_ret = -1; loc_t loc = {0, }; @@ -2129,6 +2126,31 @@ out: } int +glusterfs_setxattr (const char *path, const char *name, const void *value, + size_t size, int flags) +{ + struct vmp_entry *entry = NULL; + int op_ret = -1; + 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_setxattr (entry->handle, vpath, name, value, + size, flags); +out: + return op_ret; +} + +int glusterfs_lsetxattr (glusterfs_handle_t handle, const char *path, const char *name, diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index d7ce4318e8d..d46156e28db 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -131,9 +131,13 @@ int glusterfs_fstat (glusterfs_file_t fd, struct stat *stbuf); int -glusterfs_setxattr (glusterfs_handle_t handle, const char *path, - const char *name, const void *value, size_t size, - int flags); +glusterfs_glh_setxattr (glusterfs_handle_t handle, const char *path, + const char *name, const void *value, + size_t size, int flags); + +int +glusterfs_setxattr (const char *path, const char *name, const void *value, + size_t size, int flags); int glusterfs_lsetxattr (glusterfs_handle_t handle, const char *path, |