summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-20 12:31:31 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-21 12:48:54 +0530
commit84eb262529ea5389df2296d182ecd5e0582602a7 (patch)
tree1a53b35f781ff3fd01f67033e9bd0830de337a1b /libglusterfsclient
parentaa1e2fd37ab93b194308f94edd8ab0a342c7830e (diff)
libglusterfsclient: Add VMP-based stat
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c32
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.h7
2 files changed, 33 insertions, 6 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 449f38d1706..643add84e1b 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -3451,12 +3451,35 @@ out:
}
int
-glusterfs_stat (glusterfs_handle_t handle, const char *path, struct stat *buf)
+glusterfs_glh_stat (glusterfs_handle_t handle, const char *path,
+ struct stat *buf)
{
return __glusterfs_stat (handle, path, buf, LIBGF_DO_STAT);
}
int
+glusterfs_stat (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_stat (entry->handle, vpath, buf);
+out:
+ return op_ret;
+}
+
+int
glusterfs_lstat (glusterfs_handle_t handle, const char *path, struct stat *buf)
{
return __glusterfs_stat (handle, path, buf, LIBGF_DO_LSTAT);
@@ -5214,11 +5237,12 @@ glusterfs_realpath (glusterfs_handle_t handle, const char *path,
*dest = '\0';
/* posix_stat is implemented using lstat */
- ret = glusterfs_stat (handle, rpath, &stbuf);
+ ret = glusterfs_glh_stat (handle, rpath, &stbuf);
if (ret == -1) {
gf_log ("libglusterfsclient", GF_LOG_ERROR,
- "glusterfs_stat returned -1 for path"
- " (%s):(%s)", rpath, strerror (errno));
+ "glusterfs_glh_stat returned -1 for"
+ " path (%s):(%s)", rpath,
+ strerror (errno));
goto err;
}
diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h
index d46156e28db..ec707ad92fc 100755
--- a/libglusterfsclient/src/libglusterfsclient.h
+++ b/libglusterfsclient/src/libglusterfsclient.h
@@ -124,8 +124,11 @@ int
glusterfs_close (glusterfs_file_t fd);
int
-glusterfs_stat (glusterfs_handle_t handle, const char *path,
- struct stat *stbuf);
+glusterfs_glh_stat (glusterfs_handle_t handle, const char *path,
+ struct stat *stbuf);
+
+int
+glusterfs_stat (const char *path, struct stat *buf);
int
glusterfs_fstat (glusterfs_file_t fd, struct stat *stbuf);