From cc0378d39f4082f51d5ef6e02b3007fe9e78cb31 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 7 May 2014 20:13:43 +0530 Subject: user servicable snapshots Change-Id: Idbf27dbe088e646a8ab81cedc5818413795895ea Signed-off-by: Raghavendra Bhat Signed-off-by: Anand Subramanian Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/7700 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- api/src/glfs-handleops.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'api/src/glfs-handleops.c') diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index f7ad454bf62..247b8aebf8b 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -945,6 +945,57 @@ out: return glfd; } +int +glfs_h_access (struct glfs *fs, struct glfs_object *object, int mask) +{ + int ret = -1; + xlator_t *subvol = NULL; + inode_t *inode = NULL; + loc_t loc = {0, }; + + /* validate in args */ + if ((fs == NULL) || (object == NULL)) { + errno = EINVAL; + goto out; + } + + __glfs_entry_fs (fs); + + /* get the active volume */ + subvol = glfs_active_subvol (fs); + if (!subvol) { + ret = -1; + errno = EIO; + goto out; + } + + /* get/refresh the in arg objects inode in correlation to the xlator */ + inode = glfs_resolve_inode (fs, subvol, object); + if (!inode) { + errno = ESTALE; + goto out; + } + + + GLFS_LOC_FILL_INODE (inode, loc, out); + + /* fop/op */ + + ret = syncop_access (subvol, &loc, mask); + DECODE_SYNCOP_ERR (ret); + +out: + loc_wipe (&loc); + + if (inode) + inode_unref (inode); + + + glfs_subvol_done (fs, subvol); + + return ret; +} + ssize_t glfs_h_extract_handle (struct glfs_object *object, unsigned char *handle, int len) -- cgit