summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-20 12:33:43 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-21 12:49:39 +0530
commitde2192ea754883ea6ae643f63c44c2cbeb20f981 (patch)
treeb7125b83bd2a6c6bfdf9e072c0c9fa5505601ffc /libglusterfsclient
parent12d9b4cccd559776f125440a232ff5b944ab3442 (diff)
libglusterfsclient: Add VMP-based link
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c39
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.h6
2 files changed, 44 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)
diff --git a/libglusterfsclient/src/libglusterfsclient.h b/libglusterfsclient/src/libglusterfsclient.h
index 377459c4d61..97ab3bc3470 100755
--- a/libglusterfsclient/src/libglusterfsclient.h
+++ b/libglusterfsclient/src/libglusterfsclient.h
@@ -277,6 +277,12 @@ glusterfs_glh_opendir (glusterfs_handle_t handle, const char *path);
glusterfs_dir_t
glusterfs_opendir (const char *path);
+int
+glusterfs_glh_link (glusterfs_handle_t handle, const char *oldpath,
+ const char *newpath);
+
+int
+glusterfs_link (const char *oldpath, const char *newpath);
/* FIXME: review the need for these apis */
/* added for log related initialization in booster fork implementation */
void