summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-20 12:36:21 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-21 12:50:17 +0530
commitcf22fd1d0430705e226d61ff8d9492925ce95d46 (patch)
tree746716b3e6a25fb7f850d9f444b35c599d985218 /libglusterfsclient/src/libglusterfsclient.c
parenta9febb4bd30f41681755a0ee925ae3de6f0fa292 (diff)
libglusterfsclient: Add VMP-based readlink
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient/src/libglusterfsclient.c')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c31
1 files changed, 27 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,