From a7205e78bfb962d9e5ff11db2a0b394e6db03256 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 20 Apr 2009 12:34:58 -0700 Subject: libglusterfsclient: Add VMP-based utime Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 26 ++++++++++++++++++++++++-- libglusterfsclient/src/libglusterfsclient.h | 9 +++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index da10c3b1bbf..2ab95d1f565 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -4894,8 +4894,8 @@ out: } int -glusterfs_utime (glusterfs_handle_t handle, const char *path, - const struct utimbuf *buf) +glusterfs_glh_utime (glusterfs_handle_t handle, const char *path, + const struct utimbuf *buf) { int32_t op_ret = -1; loc_t loc = {0, }; @@ -4939,6 +4939,28 @@ out: return op_ret; } +int +glusterfs_utime (const char *path, const struct utimbuf *buf) +{ + 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_utime (entry->handle, vpath, buf); +out: + return op_ret; +} + static int32_t libgf_client_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h index 0381650c342..b4454a37012 100755 --- a/libglusterfsclient/src/libglusterfsclient.h +++ b/libglusterfsclient/src/libglusterfsclient.h @@ -30,6 +30,8 @@ __BEGIN_DECLS #include #include #include +#include +#include typedef struct { struct iovec *vector; @@ -306,6 +308,13 @@ glusterfs_glh_utimes (glusterfs_handle_t handle, const char *path, int glusterfs_utimes (const char *path, const struct timeval times[2]); + +int +glusterfs_glh_utime (glusterfs_handle_t handle, const char *path, + const struct utimbuf *buf); + +int +glusterfs_utime (const char *path, const struct utimbuf *buf); /* FIXME: review the need for these apis */ /* added for log related initialization in booster fork implementation */ void -- cgit