From 6bff99a8f92befa78ddea62519a05f945db5cdfa Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 20 Apr 2009 12:36:44 -0700 Subject: libglusterfsclient: Add VMP-based realpath Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 25 +++++++++++++++++++++++-- libglusterfsclient/src/libglusterfsclient.h | 5 ++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index f8fa1492e63..160df1cb337 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -5480,8 +5480,8 @@ out: } char * -glusterfs_realpath (glusterfs_handle_t handle, const char *path, - char *resolved_path) +glusterfs_glh_realpath (glusterfs_handle_t handle, const char *path, + char *resolved_path) { char *buf = NULL, *extra_buf = NULL; char *rpath = NULL; @@ -5664,6 +5664,27 @@ err: return NULL; } +char * +glusterfs_realpath (const char *path, char *resolved_path) +{ + struct vmp_entry *entry = NULL; + char *vpath = NULL; + char *res = NULL; + + GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, path, out); + + entry = libgf_vmp_search_entry ((char *)path); + if (!entry) { + errno = ENODEV; + goto out; + } + + vpath = libgf_vmp_virtual_path (entry, path); + res = glusterfs_glh_realpath (entry->handle, vpath, resolved_path); +out: + return res; +} + static struct xlator_fops libgf_client_fops = { }; diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index e4187d82afc..93476a6a29f 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -259,9 +259,12 @@ int glusterfs_mknod(const char *pathname, mode_t mode, dev_t dev); char * -glusterfs_realpath (glusterfs_handle_t handle, const char *path, +glusterfs_glh_realpath (glusterfs_handle_t handle, const char *path, char *resolved_path); +char * +glusterfs_realpath (const char *path, char *resolved_path); + int glusterfs_mount (char *vmp, glusterfs_init_params_t *ipars); -- cgit