summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs-handleops.c51
-rw-r--r--api/src/glfs-handles.h3
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 */