aboutsummaryrefslogtreecommitdiff
path: root/lib/fuse.c
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2005-10-26 12:53:25 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2005-10-26 12:53:25 +0000
commitb0b13d1e5499e20382ad74e202160d49e1792ee8 (patch)
tree77c9dbbceda8149929fed4e66411b49a405808cf /lib/fuse.c
parentc4c12ae295ca6f3fb02e12d3bad8f92fee4dfe3f (diff)
add access operation
Diffstat (limited to 'lib/fuse.c')
-rw-r--r--lib/fuse.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/fuse.c b/lib/fuse.c
index b0cf553..6b3b6ae 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -736,6 +736,29 @@ static void fuse_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
reply_err(req, err);
}
+static void fuse_access(fuse_req_t req, fuse_ino_t ino, int mask)
+{
+ struct fuse *f = req_fuse_prepare(req);
+ char *path;
+ int err;
+
+ err = -ENOENT;
+ pthread_rwlock_rdlock(&f->tree_lock);
+ path = get_path(f, ino);
+ if (path != NULL) {
+ if (f->flags & FUSE_DEBUG) {
+ printf("ACCESS %s 0%o\n", path, mask);
+ fflush(stdout);
+ }
+ err = -ENOSYS;
+ if (f->op.access)
+ err = f->op.access(path, mask);
+ free(path);
+ }
+ pthread_rwlock_unlock(&f->tree_lock);
+ reply_err(req, err);
+}
+
static void fuse_readlink(fuse_req_t req, fuse_ino_t ino)
{
struct fuse *f = req_fuse_prepare(req);
@@ -1622,6 +1645,7 @@ static struct fuse_lowlevel_ops fuse_path_ops = {
.forget = fuse_forget,
.getattr = fuse_getattr,
.setattr = fuse_setattr,
+ .access = fuse_access,
.readlink = fuse_readlink,
.mknod = fuse_mknod,
.mkdir = fuse_mkdir,