diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-20 12:30:51 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-21 12:48:35 +0530 |
commit | f29383ef35d210f2a72883cb6157e915200f7c7c (patch) | |
tree | 683196a0b24dddc576485a2ec16a5d1f662eecc4 /libglusterfsclient/src | |
parent | 4074769dd2435ab3521ab39eb2775c3e80fc32b4 (diff) |
libglusterfsclient: Add VMP-based setxattr
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient/src')
-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 b5fa10159..1b444007b 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 d7ce4318e..d46156e28 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, |