summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
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 46208a8ee35..9a8ead505d4 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,