diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-20 12:31:49 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-21 12:49:08 +0530 |
commit | dc53183708d6d9ff998487427312000f30dcb7ee (patch) | |
tree | 1afcf57e42b22d4dac0915a35136bd23e20a3ae4 | |
parent | 84eb262529ea5389df2296d182ecd5e0582602a7 (diff) |
libglusterfsclient: Add VMP-based lstat
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 24 | ||||
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.h | 7 |
2 files changed, 30 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 643add84e..2d940ca16 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -3480,11 +3480,33 @@ out: } int -glusterfs_lstat (glusterfs_handle_t handle, const char *path, struct stat *buf) +glusterfs_glh_lstat (glusterfs_handle_t handle, const char *path, struct stat *buf) { return __glusterfs_stat (handle, path, buf, LIBGF_DO_LSTAT); } +int +glusterfs_lstat (const char *path, struct stat *buf) +{ + 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, buf, 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_lstat (entry->handle, vpath, buf); +out: + return op_ret; +} + static int32_t libgf_client_fstat_cbk (call_frame_t *frame, void *cookie, diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index ec707ad92..5d422b907 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -131,6 +131,13 @@ int glusterfs_stat (const char *path, struct stat *buf); int +glusterfs_glh_lstat (glusterfs_handle_t handle, const char *path, + struct stat *buf); + +int +glusterfs_lstat (const char *path, struct stat *buf); + +int glusterfs_fstat (glusterfs_file_t fd, struct stat *stbuf); int |