summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-resolve.c
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2015-06-25 15:04:18 +0530
committerNiels de Vos <ndevos@redhat.com>2015-06-28 00:53:13 -0700
commit049c8eec304d9548fccb127ee8ce82f179bc41b0 (patch)
tree79b02905a18f25407d885c15a7e2a262879868bc /api/src/glfs-resolve.c
parentb68f671b2b8a0aafef8f98145aee7044edaa907d (diff)
gfapi : symlink resolution for glfs_object
Generally posix expects symlink should be resolved, before performing an acl related operation. This patch introduces a new api glfs_h_resolve_symlink() which will do the same. Change-Id: Ieee645154455a732edfb2c28834021bab4248810 BUG: 1209735 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/11410 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'api/src/glfs-resolve.c')
-rw-r--r--api/src/glfs-resolve.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index 287c48a13ad..c185e211a53 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -1021,3 +1021,40 @@ glfs_create_object (loc_t *loc, struct glfs_object **retobject)
return 0;
}
+
+struct glfs_object *
+glfs_h_resolve_symlink (struct glfs *fs, struct glfs_object *object)
+{
+
+ xlator_t *subvol = NULL;
+ loc_t sym_loc = {0,};
+ struct iatt iatt = {0,};
+ char *lpath = NULL;
+ int ret = 0;
+ struct glfs_object *target_object = NULL;
+
+ subvol = glfs_active_subvol (fs);
+ if (!subvol) {
+ ret = -1;
+ errno = EIO;
+ goto out;
+ }
+
+ ret = glfs_resolve_symlink (fs, subvol, object->inode, &lpath);
+ if (ret < 0)
+ goto out;
+
+ ret = glfs_resolve_at (fs, subvol, NULL, lpath,
+ &sym_loc, &iatt,
+ /* always recurisvely follow while
+ following symlink
+ */
+ 1, 0);
+ if (ret == 0)
+ ret = glfs_create_object (&sym_loc, &target_object);
+
+out:
+ loc_wipe (&sym_loc);
+ GF_FREE (lpath);
+ return target_object;
+}