summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfsclient/src/libglusterfsclient.c')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 676fd8a6463..aab93181f68 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -4399,7 +4399,7 @@ out:
}
int
-glusterfs_link (glusterfs_handle_t handle, const char *oldpath,
+glusterfs_glh_link (glusterfs_handle_t handle, const char *oldpath,
const char *newpath)
{
libglusterfs_client_ctx_t *ctx = handle;
@@ -4458,6 +4458,43 @@ out:
return op_ret;
}
+int
+glusterfs_link (const char *oldpath, const char *newpath)
+{
+ struct vmp_entry *oldentry = NULL;
+ struct vmp_entry *newentry = NULL;
+ char *oldvpath = NULL;
+ char *newvpath = NULL;
+ int op_ret = -1;
+
+ GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, oldpath, out);
+ GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, newpath, out);
+
+ oldentry = libgf_vmp_search_entry ((char *)oldpath);
+ if (!oldentry) {
+ errno = ENODEV;
+ goto out;
+ }
+
+ newentry = libgf_vmp_search_entry ((char *)newpath);
+ if (!newentry) {
+ errno = ENODEV;
+ goto out;
+ }
+
+ /* Cannot hard link across glusterfs mounts. */
+ if (newentry != oldentry) {
+ errno = EXDEV;
+ goto out;
+ }
+
+ newvpath = libgf_vmp_virtual_path (newentry, newpath);
+ oldvpath = libgf_vmp_virtual_path (oldentry, oldpath);
+ op_ret = glusterfs_glh_link (newentry->handle, oldvpath, newvpath);
+out:
+ return op_ret;
+}
+
int32_t
libgf_client_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct statvfs *buf)