aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-07-22 00:07:17 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-07-26 20:53:31 -0400
commitf419a2e3b64def707e1384ee38abb77f99af5f6d (patch)
treeadbe12c510f04cf25ca6f822ee8004c8679a3a63 /fs/namei.c
parent30524472c2f728c20d6bf35191042a5d455c0a64 (diff)
[PATCH] kill nameidata passing to permission(), rename to inode_permission()
Incidentally, the name that gives hundreds of false positives on grep is not a good idea... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 396cb3e5c364..5029b93ebbd5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -227,13 +227,9 @@ int generic_permission(struct inode *inode, int mask,
227 return -EACCES; 227 return -EACCES;
228} 228}
229 229
230int permission(struct inode *inode, int mask, struct nameidata *nd) 230int inode_permission(struct inode *inode, int mask)
231{ 231{
232 int retval; 232 int retval;
233 struct vfsmount *mnt = NULL;
234
235 if (nd)
236 mnt = nd->path.mnt;
237 233
238 if (mask & MAY_WRITE) { 234 if (mask & MAY_WRITE) {
239 umode_t mode = inode->i_mode; 235 umode_t mode = inode->i_mode;
@@ -293,7 +289,7 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
293 */ 289 */
294int vfs_permission(struct nameidata *nd, int mask) 290int vfs_permission(struct nameidata *nd, int mask)
295{ 291{
296 return permission(nd->path.dentry->d_inode, mask, nd); 292 return inode_permission(nd->path.dentry->d_inode, mask);
297} 293}
298 294
299/** 295/**
@@ -310,7 +306,7 @@ int vfs_permission(struct nameidata *nd, int mask)
310 */ 306 */
311int file_permission(struct file *file, int mask) 307int file_permission(struct file *file, int mask)
312{ 308{
313 return permission(file->f_path.dentry->d_inode, mask, NULL); 309 return inode_permission(file->f_path.dentry->d_inode, mask);
314} 310}
315 311
316/* 312/*
@@ -1262,7 +1258,7 @@ static struct dentry *lookup_hash(struct nameidata *nd)
1262{ 1258{
1263 int err; 1259 int err;
1264 1260
1265 err = permission(nd->path.dentry->d_inode, MAY_EXEC, nd); 1261 err = inode_permission(nd->path.dentry->d_inode, MAY_EXEC);
1266 if (err) 1262 if (err)
1267 return ERR_PTR(err); 1263 return ERR_PTR(err);
1268 return __lookup_hash(&nd->last, nd->path.dentry, nd); 1264 return __lookup_hash(&nd->last, nd->path.dentry, nd);
@@ -1310,7 +1306,7 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
1310 if (err) 1306 if (err)
1311 return ERR_PTR(err); 1307 return ERR_PTR(err);
1312 1308
1313 err = permission(base->d_inode, MAY_EXEC, NULL); 1309 err = inode_permission(base->d_inode, MAY_EXEC);
1314 if (err) 1310 if (err)
1315 return ERR_PTR(err); 1311 return ERR_PTR(err);
1316 return __lookup_hash(&this, base, NULL); 1312 return __lookup_hash(&this, base, NULL);
@@ -1400,7 +1396,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
1400 BUG_ON(victim->d_parent->d_inode != dir); 1396 BUG_ON(victim->d_parent->d_inode != dir);
1401 audit_inode_child(victim->d_name.name, victim, dir); 1397 audit_inode_child(victim->d_name.name, victim, dir);
1402 1398
1403 error = permission(dir,MAY_WRITE | MAY_EXEC, NULL); 1399 error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
1404 if (error) 1400 if (error)
1405 return error; 1401 return error;
1406 if (IS_APPEND(dir)) 1402 if (IS_APPEND(dir))
@@ -1437,7 +1433,7 @@ static inline int may_create(struct inode *dir, struct dentry *child,
1437 return -EEXIST; 1433 return -EEXIST;
1438 if (IS_DEADDIR(dir)) 1434 if (IS_DEADDIR(dir))
1439 return -ENOENT; 1435 return -ENOENT;
1440 return permission(dir,MAY_WRITE | MAY_EXEC, nd); 1436 return inode_permission(dir, MAY_WRITE | MAY_EXEC);
1441} 1437}
1442 1438
1443/* 1439/*
@@ -2543,7 +2539,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
2543 * we'll need to flip '..'. 2539 * we'll need to flip '..'.
2544 */ 2540 */
2545 if (new_dir != old_dir) { 2541 if (new_dir != old_dir) {
2546 error = permission(old_dentry->d_inode, MAY_WRITE, NULL); 2542 error = inode_permission(old_dentry->d_inode, MAY_WRITE);
2547 if (error) 2543 if (error)
2548 return error; 2544 return error;
2549 } 2545 }
@@ -2897,7 +2893,7 @@ EXPORT_SYMBOL(page_symlink);
2897EXPORT_SYMBOL(page_symlink_inode_operations); 2893EXPORT_SYMBOL(page_symlink_inode_operations);
2898EXPORT_SYMBOL(path_lookup); 2894EXPORT_SYMBOL(path_lookup);
2899EXPORT_SYMBOL(vfs_path_lookup); 2895EXPORT_SYMBOL(vfs_path_lookup);
2900EXPORT_SYMBOL(permission); 2896EXPORT_SYMBOL(inode_permission);
2901EXPORT_SYMBOL(vfs_permission); 2897EXPORT_SYMBOL(vfs_permission);
2902EXPORT_SYMBOL(file_permission); 2898EXPORT_SYMBOL(file_permission);
2903EXPORT_SYMBOL(unlock_rename); 2899EXPORT_SYMBOL(unlock_rename);