summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 15:57:27 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:02:00 +0530
commitb12fde2b06c4701970201aaebc7f45a8b964812c (patch)
tree4557c31e801cb2bc27f0e2b42e063ea3f323e978 /libglusterfsclient/src/libglusterfsclient.c
parent6fdf8f4c7d5cced776c925052eb8a81c332a3573 (diff)
libglusterfsclient: Add VMP-based rename
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient/src/libglusterfsclient.c')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 46208a8ee..9a8ead505 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -4759,8 +4759,8 @@ out:
}
int
-glusterfs_rename (glusterfs_handle_t handle, const char *oldpath,
- const char *newpath)
+glusterfs_glh_rename (glusterfs_handle_t handle, const char *oldpath,
+ const char *newpath)
{
int32_t op_ret = -1;
loc_t oldloc = {0, }, newloc = {0, };
@@ -4825,6 +4825,44 @@ out:
return op_ret;
}
+
+int
+glusterfs_rename (const char *oldpath, const char *newpath)
+{
+ int op_ret = -1;
+ struct vmp_entry *new = NULL;
+ struct vmp_entry *old = NULL;
+ char *oldvpath = NULL;
+ char *newvpath = NULL;
+
+ GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, oldpath, out);
+ GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, newpath, out);
+
+ old = libgf_vmp_search_entry ((char *)oldpath);
+ if (!old) {
+ errno = ENODEV;
+ goto out;
+ }
+
+ new = libgf_vmp_search_entry ((char *)newpath);
+ if (!new) {
+ errno = ENODEV;
+ goto out;
+ }
+
+ if (old != new) {
+ errno = EXDEV;
+ goto out;
+ }
+
+ oldvpath = libgf_vmp_virtual_path (old, oldpath);
+ newvpath = libgf_vmp_virtual_path (new, newpath);
+ op_ret = glusterfs_glh_rename (old->handle, oldvpath, newvpath);
+
+out:
+ return op_ret;
+}
+
int32_t
libgf_client_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno,