diff options
author | Christoph Hellwig <hch@lst.de> | 2005-11-09 00:35:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:55:58 -0500 |
commit | e4543eddfd3bf3e0d625841377fa695a519edfd4 (patch) | |
tree | b62546cb0038529bd8cd583333c556ad799f2081 /fs/open.c | |
parent | e4a53cbabc81f04e24a5570b4aa6a6384bdbfc67 (diff) |
[PATCH] add a vfs_permission helper
Most permission() calls have a struct nameidata * available. This helper
takes that as an argument and thus makes sure we pass it down for lookup
intents and prepares for per-mount read-only support where we need a struct
vfsmount for checking whether a file is writeable.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -240,7 +240,7 @@ static inline long do_sys_truncate(const char __user * path, loff_t length) | |||
240 | if (!S_ISREG(inode->i_mode)) | 240 | if (!S_ISREG(inode->i_mode)) |
241 | goto dput_and_out; | 241 | goto dput_and_out; |
242 | 242 | ||
243 | error = permission(inode,MAY_WRITE,&nd); | 243 | error = vfs_permission(&nd, MAY_WRITE); |
244 | if (error) | 244 | if (error) |
245 | goto dput_and_out; | 245 | goto dput_and_out; |
246 | 246 | ||
@@ -394,7 +394,7 @@ asmlinkage long sys_utime(char __user * filename, struct utimbuf __user * times) | |||
394 | goto dput_and_out; | 394 | goto dput_and_out; |
395 | 395 | ||
396 | if (current->fsuid != inode->i_uid && | 396 | if (current->fsuid != inode->i_uid && |
397 | (error = permission(inode,MAY_WRITE,&nd)) != 0) | 397 | (error = vfs_permission(&nd, MAY_WRITE)) != 0) |
398 | goto dput_and_out; | 398 | goto dput_and_out; |
399 | } | 399 | } |
400 | down(&inode->i_sem); | 400 | down(&inode->i_sem); |
@@ -447,7 +447,7 @@ long do_utimes(char __user * filename, struct timeval * times) | |||
447 | goto dput_and_out; | 447 | goto dput_and_out; |
448 | 448 | ||
449 | if (current->fsuid != inode->i_uid && | 449 | if (current->fsuid != inode->i_uid && |
450 | (error = permission(inode,MAY_WRITE,&nd)) != 0) | 450 | (error = vfs_permission(&nd, MAY_WRITE)) != 0) |
451 | goto dput_and_out; | 451 | goto dput_and_out; |
452 | } | 452 | } |
453 | down(&inode->i_sem); | 453 | down(&inode->i_sem); |
@@ -506,7 +506,7 @@ asmlinkage long sys_access(const char __user * filename, int mode) | |||
506 | 506 | ||
507 | res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd); | 507 | res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd); |
508 | if (!res) { | 508 | if (!res) { |
509 | res = permission(nd.dentry->d_inode, mode, &nd); | 509 | res = vfs_permission(&nd, mode); |
510 | /* SuS v2 requires we report a read only fs too */ | 510 | /* SuS v2 requires we report a read only fs too */ |
511 | if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) | 511 | if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) |
512 | && !special_file(nd.dentry->d_inode->i_mode)) | 512 | && !special_file(nd.dentry->d_inode->i_mode)) |
@@ -530,7 +530,7 @@ asmlinkage long sys_chdir(const char __user * filename) | |||
530 | if (error) | 530 | if (error) |
531 | goto out; | 531 | goto out; |
532 | 532 | ||
533 | error = permission(nd.dentry->d_inode,MAY_EXEC,&nd); | 533 | error = vfs_permission(&nd, MAY_EXEC); |
534 | if (error) | 534 | if (error) |
535 | goto dput_and_out; | 535 | goto dput_and_out; |
536 | 536 | ||
@@ -581,7 +581,7 @@ asmlinkage long sys_chroot(const char __user * filename) | |||
581 | if (error) | 581 | if (error) |
582 | goto out; | 582 | goto out; |
583 | 583 | ||
584 | error = permission(nd.dentry->d_inode,MAY_EXEC,&nd); | 584 | error = vfs_permission(&nd, MAY_EXEC); |
585 | if (error) | 585 | if (error) |
586 | goto dput_and_out; | 586 | goto dput_and_out; |
587 | 587 | ||