diff options
| author | Raghavendra Bhat <raghavendra@redhat.com> | 2014-05-07 20:13:43 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-05-29 09:25:46 -0700 | 
| commit | cc0378d39f4082f51d5ef6e02b3007fe9e78cb31 (patch) | |
| tree | f5c82bece9cf1a2fd79685ef2d89bcd2a5b8428f /api | |
| parent | 58b9edee87bba3ffe812cf15f171926be017575b (diff) | |
user servicable snapshots
Change-Id: Idbf27dbe088e646a8ab81cedc5818413795895ea
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Signed-off-by: Anand Subramanian <anands@redhat.com>
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/7700
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api')
| -rw-r--r-- | api/src/glfs-handleops.c | 51 | ||||
| -rw-r--r-- | api/src/glfs-handles.h | 3 | 
2 files changed, 54 insertions, 0 deletions
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) diff --git a/api/src/glfs-handles.h b/api/src/glfs-handles.h index a6c6c0a3443..ad963455e85 100644 --- a/api/src/glfs-handles.h +++ b/api/src/glfs-handles.h @@ -162,6 +162,9 @@ struct glfs_fd *glfs_h_opendir (struct glfs *fs,  struct glfs_fd *glfs_h_open (struct glfs *fs, struct glfs_object *object,  			     int flags) __THROW; +int +glfs_h_access (struct glfs *fs, struct glfs_object *object, int mask) __THROW; +  __END_DECLS  #endif /* !_GLFS_HANDLES_H */  | 
