summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c31
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.h7
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