diff options
author | Christoph Hellwig <hch@lst.de> | 2008-10-24 03:58:10 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-12-31 18:07:41 -0500 |
commit | 3fb64190aa3c23c10e6e9fd0124ac030115c99bf (patch) | |
tree | 6b7b5452d2abbe7964803d8a95c03e5612c8e607 /fs | |
parent | b4091d5f6fde28ab762e1094a1a26d81f3badfa5 (diff) |
pass a struct path * to may_open
No need for the nameidata in may_open - a struct path is enough.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 14 | ||||
-rw-r--r-- | fs/nfsctl.c | 5 |
2 files changed, 10 insertions, 9 deletions
diff --git a/fs/namei.c b/fs/namei.c index d4d0b59ed2cc..5cc0dc95a7a5 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1487,9 +1487,9 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
1487 | return error; | 1487 | return error; |
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | int may_open(struct nameidata *nd, int acc_mode, int flag) | 1490 | int may_open(struct path *path, int acc_mode, int flag) |
1491 | { | 1491 | { |
1492 | struct dentry *dentry = nd->path.dentry; | 1492 | struct dentry *dentry = path->dentry; |
1493 | struct inode *inode = dentry->d_inode; | 1493 | struct inode *inode = dentry->d_inode; |
1494 | int error; | 1494 | int error; |
1495 | 1495 | ||
@@ -1510,13 +1510,13 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) | |||
1510 | if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { | 1510 | if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { |
1511 | flag &= ~O_TRUNC; | 1511 | flag &= ~O_TRUNC; |
1512 | } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { | 1512 | } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { |
1513 | if (nd->path.mnt->mnt_flags & MNT_NODEV) | 1513 | if (path->mnt->mnt_flags & MNT_NODEV) |
1514 | return -EACCES; | 1514 | return -EACCES; |
1515 | 1515 | ||
1516 | flag &= ~O_TRUNC; | 1516 | flag &= ~O_TRUNC; |
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | error = vfs_permission(nd, acc_mode); | 1519 | error = inode_permission(inode, acc_mode); |
1520 | if (error) | 1520 | if (error) |
1521 | return error; | 1521 | return error; |
1522 | /* | 1522 | /* |
@@ -1551,7 +1551,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) | |||
1551 | */ | 1551 | */ |
1552 | error = locks_verify_locked(inode); | 1552 | error = locks_verify_locked(inode); |
1553 | if (!error) | 1553 | if (!error) |
1554 | error = security_path_truncate(&nd->path, 0, | 1554 | error = security_path_truncate(path, 0, |
1555 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); | 1555 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); |
1556 | if (!error) { | 1556 | if (!error) { |
1557 | DQUOT_INIT(inode); | 1557 | DQUOT_INIT(inode); |
@@ -1594,7 +1594,7 @@ out_unlock: | |||
1594 | if (error) | 1594 | if (error) |
1595 | return error; | 1595 | return error; |
1596 | /* Don't check for write permission, don't truncate */ | 1596 | /* Don't check for write permission, don't truncate */ |
1597 | return may_open(nd, 0, flag & ~O_TRUNC); | 1597 | return may_open(&nd->path, 0, flag & ~O_TRUNC); |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | /* | 1600 | /* |
@@ -1780,7 +1780,7 @@ ok: | |||
1780 | if (error) | 1780 | if (error) |
1781 | goto exit; | 1781 | goto exit; |
1782 | } | 1782 | } |
1783 | error = may_open(&nd, acc_mode, flag); | 1783 | error = may_open(&nd.path, acc_mode, flag); |
1784 | if (error) { | 1784 | if (error) { |
1785 | if (will_write) | 1785 | if (will_write) |
1786 | mnt_drop_write(nd.path.mnt); | 1786 | mnt_drop_write(nd.path.mnt); |
diff --git a/fs/nfsctl.c b/fs/nfsctl.c index b1acbd6ab6fb..b27451909dff 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c | |||
@@ -38,9 +38,10 @@ static struct file *do_open(char *name, int flags) | |||
38 | return ERR_PTR(error); | 38 | return ERR_PTR(error); |
39 | 39 | ||
40 | if (flags == O_RDWR) | 40 | if (flags == O_RDWR) |
41 | error = may_open(&nd,MAY_READ|MAY_WRITE,FMODE_READ|FMODE_WRITE); | 41 | error = may_open(&nd.path, MAY_READ|MAY_WRITE, |
42 | FMODE_READ|FMODE_WRITE); | ||
42 | else | 43 | else |
43 | error = may_open(&nd, MAY_WRITE, FMODE_WRITE); | 44 | error = may_open(&nd.path, MAY_WRITE, FMODE_WRITE); |
44 | 45 | ||
45 | if (!error) | 46 | if (!error) |
46 | return dentry_open(nd.path.dentry, nd.path.mnt, flags, | 47 | return dentry_open(nd.path.dentry, nd.path.mnt, flags, |