diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-11-07 03:59:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:42 -0500 |
commit | 31d40d74b402a6fa18a006fb3745f64609f35b77 (patch) | |
tree | ee8c61e814fcae687e3ba3f8ed4828d6d34f8ff2 /fs/fuse | |
parent | 5b62073d502a88fedc5c369f8a004bda7c9d1999 (diff) |
[PATCH] FUSE: add access call
Add a new access call, which will only be called if ->permission is invoked
from sys_access(). In all other cases permission checking is delayed until
the actual filesystem operation.
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 35 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 3 |
2 files changed, 38 insertions, 0 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 61b58fdd973e..4bc1afcc476d 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -461,6 +461,38 @@ static int fuse_revalidate(struct dentry *entry) | |||
461 | return fuse_do_getattr(inode); | 461 | return fuse_do_getattr(inode); |
462 | } | 462 | } |
463 | 463 | ||
464 | static int fuse_access(struct inode *inode, int mask) | ||
465 | { | ||
466 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
467 | struct fuse_req *req; | ||
468 | struct fuse_access_in inarg; | ||
469 | int err; | ||
470 | |||
471 | if (fc->no_access) | ||
472 | return 0; | ||
473 | |||
474 | req = fuse_get_request(fc); | ||
475 | if (!req) | ||
476 | return -EINTR; | ||
477 | |||
478 | memset(&inarg, 0, sizeof(inarg)); | ||
479 | inarg.mask = mask; | ||
480 | req->in.h.opcode = FUSE_ACCESS; | ||
481 | req->in.h.nodeid = get_node_id(inode); | ||
482 | req->inode = inode; | ||
483 | req->in.numargs = 1; | ||
484 | req->in.args[0].size = sizeof(inarg); | ||
485 | req->in.args[0].value = &inarg; | ||
486 | request_send(fc, req); | ||
487 | err = req->out.h.error; | ||
488 | fuse_put_request(fc, req); | ||
489 | if (err == -ENOSYS) { | ||
490 | fc->no_access = 1; | ||
491 | err = 0; | ||
492 | } | ||
493 | return err; | ||
494 | } | ||
495 | |||
464 | static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) | 496 | static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) |
465 | { | 497 | { |
466 | struct fuse_conn *fc = get_fuse_conn(inode); | 498 | struct fuse_conn *fc = get_fuse_conn(inode); |
@@ -493,6 +525,9 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) | |||
493 | int mode = inode->i_mode; | 525 | int mode = inode->i_mode; |
494 | if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO)) | 526 | if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO)) |
495 | return -EACCES; | 527 | return -EACCES; |
528 | |||
529 | if (nd && (nd->flags & LOOKUP_ACCESS)) | ||
530 | return fuse_access(inode, mask); | ||
496 | return 0; | 531 | return 0; |
497 | } | 532 | } |
498 | } | 533 | } |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 5cb456f572c1..c4e8c3b47982 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -266,6 +266,9 @@ struct fuse_conn { | |||
266 | /** Is removexattr not implemented by fs? */ | 266 | /** Is removexattr not implemented by fs? */ |
267 | unsigned no_removexattr : 1; | 267 | unsigned no_removexattr : 1; |
268 | 268 | ||
269 | /** Is access not implemented by fs? */ | ||
270 | unsigned no_access : 1; | ||
271 | |||
269 | /** Backing dev info */ | 272 | /** Backing dev info */ |
270 | struct backing_dev_info bdi; | 273 | struct backing_dev_info bdi; |
271 | }; | 274 | }; |