diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-04-20 12:36:21 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-21 12:50:17 +0530 |
commit | cf22fd1d0430705e226d61ff8d9492925ce95d46 (patch) | |
tree | 746716b3e6a25fb7f850d9f444b35c599d985218 | |
parent | a9febb4bd30f41681755a0ee925ae3de6f0fa292 (diff) |
libglusterfsclient: Add VMP-based readlink
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 31 | ||||
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.h | 7 |
2 files changed, 34 insertions, 4 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 707a4f72dd9..f8fa1492e63 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -5417,8 +5417,8 @@ libgf_client_readlink (libglusterfs_client_ctx_t *ctx, loc_t *loc, char *buf, } ssize_t -glusterfs_readlink (glusterfs_handle_t handle, const char *path, char *buf, - size_t bufsize) +glusterfs_glh_readlink (glusterfs_handle_t handle, const char *path, char *buf, + size_t bufsize) { int32_t op_ret = -1; loc_t loc = {0, }; @@ -5457,6 +5457,28 @@ out: return op_ret; } +ssize_t +glusterfs_readlink (const char *path, char *buf, size_t bufsize) +{ + struct vmp_entry *entry = NULL; + char *vpath = NULL; + int op_ret = -1; + + 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_readlink (entry->handle, vpath, buf, bufsize); +out: + return op_ret; +} + char * glusterfs_realpath (glusterfs_handle_t handle, const char *path, char *resolved_path) @@ -5590,8 +5612,9 @@ glusterfs_realpath (glusterfs_handle_t handle, const char *path, goto err; } - ret = glusterfs_readlink (handle, rpath, buf, - path_max - 1); + ret = glusterfs_glh_readlink (handle, rpath, + buf, + path_max - 1); if (ret < 0) { gf_log ("libglusterfsclient", GF_LOG_ERROR, diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index 3a92461fead..e4187d82afc 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -338,6 +338,13 @@ glusterfs_glh_symlink (glusterfs_handle_t handle, const char *oldpath, int glusterfs_symlink (const char *oldpath, const char *newpath); + +ssize_t +glusterfs_glh_readlink (glusterfs_handle_t handle, const char *path, char *buf, + size_t bufsize); + +ssize_t +glusterfs_readlink (const char *path, char *buf, size_t bufsize); /* FIXME: review the need for these apis */ /* added for log related initialization in booster fork implementation */ void |