diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-16 17:20:23 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-18 01:21:27 -0500 |
commit | 09f12c03fa699ce7d030c47add60577138927d4f (patch) | |
tree | b9ef52e197a38579799ba9b62f78bf0c35efa4cc /fs/autofs4 | |
parent | 14a2f00bde7668fe18d1c8355d26c7c96961e1f7 (diff) |
autofs4: pass mode to autofs4_get_inode() explicitly
In all cases we'd set inf->mode to know value just before
passing it to autofs4_get_inode(). That kills the need
to store it in autofs_info and pass it to autofs_init_ino()
Acked-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs4')
-rw-r--r-- | fs/autofs4/autofs_i.h | 5 | ||||
-rw-r--r-- | fs/autofs4/inode.c | 16 | ||||
-rw-r--r-- | fs/autofs4/root.c | 10 |
3 files changed, 15 insertions, 16 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 99a4af8d9c83..c6d66db67ff1 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -89,7 +89,6 @@ struct autofs_info { | |||
89 | uid_t uid; | 89 | uid_t uid; |
90 | gid_t gid; | 90 | gid_t gid; |
91 | 91 | ||
92 | mode_t mode; | ||
93 | size_t size; | 92 | size_t size; |
94 | }; | 93 | }; |
95 | 94 | ||
@@ -170,7 +169,7 @@ static inline int autofs4_ispending(struct dentry *dentry) | |||
170 | return 0; | 169 | return 0; |
171 | } | 170 | } |
172 | 171 | ||
173 | struct inode *autofs4_get_inode(struct super_block *, struct autofs_info *); | 172 | struct inode *autofs4_get_inode(struct super_block *, struct autofs_info *, mode_t); |
174 | void autofs4_free_ino(struct autofs_info *); | 173 | void autofs4_free_ino(struct autofs_info *); |
175 | 174 | ||
176 | /* Expiration */ | 175 | /* Expiration */ |
@@ -280,7 +279,7 @@ static inline void managed_dentry_clear_managed(struct dentry *dentry) | |||
280 | /* Initializing function */ | 279 | /* Initializing function */ |
281 | 280 | ||
282 | int autofs4_fill_super(struct super_block *, void *, int); | 281 | int autofs4_fill_super(struct super_block *, void *, int); |
283 | struct autofs_info *autofs4_init_ino(struct autofs_info *, struct autofs_sb_info *sbi, mode_t mode); | 282 | struct autofs_info *autofs4_init_ino(struct autofs_info *, struct autofs_sb_info *sbi); |
284 | 283 | ||
285 | /* Queue management functions */ | 284 | /* Queue management functions */ |
286 | 285 | ||
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 7421b47b1bb9..6b6f43f00c46 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | 24 | ||
25 | struct autofs_info *autofs4_init_ino(struct autofs_info *ino, | 25 | struct autofs_info *autofs4_init_ino(struct autofs_info *ino, |
26 | struct autofs_sb_info *sbi, mode_t mode) | 26 | struct autofs_sb_info *sbi) |
27 | { | 27 | { |
28 | int reinit = 1; | 28 | int reinit = 1; |
29 | 29 | ||
@@ -47,7 +47,6 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino, | |||
47 | 47 | ||
48 | ino->uid = 0; | 48 | ino->uid = 0; |
49 | ino->gid = 0; | 49 | ino->gid = 0; |
50 | ino->mode = mode; | ||
51 | ino->last_used = jiffies; | 50 | ino->last_used = jiffies; |
52 | 51 | ||
53 | ino->sbi = sbi; | 52 | ino->sbi = sbi; |
@@ -258,10 +257,10 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
258 | /* | 257 | /* |
259 | * Get the root inode and dentry, but defer checking for errors. | 258 | * Get the root inode and dentry, but defer checking for errors. |
260 | */ | 259 | */ |
261 | ino = autofs4_init_ino(NULL, sbi, S_IFDIR | 0755); | 260 | ino = autofs4_init_ino(NULL, sbi); |
262 | if (!ino) | 261 | if (!ino) |
263 | goto fail_free; | 262 | goto fail_free; |
264 | root_inode = autofs4_get_inode(s, ino); | 263 | root_inode = autofs4_get_inode(s, ino, S_IFDIR | 0755); |
265 | if (!root_inode) | 264 | if (!root_inode) |
266 | goto fail_ino; | 265 | goto fail_ino; |
267 | 266 | ||
@@ -345,14 +344,15 @@ fail_unlock: | |||
345 | } | 344 | } |
346 | 345 | ||
347 | struct inode *autofs4_get_inode(struct super_block *sb, | 346 | struct inode *autofs4_get_inode(struct super_block *sb, |
348 | struct autofs_info *inf) | 347 | struct autofs_info *inf, |
348 | mode_t mode) | ||
349 | { | 349 | { |
350 | struct inode *inode = new_inode(sb); | 350 | struct inode *inode = new_inode(sb); |
351 | 351 | ||
352 | if (inode == NULL) | 352 | if (inode == NULL) |
353 | return NULL; | 353 | return NULL; |
354 | 354 | ||
355 | inode->i_mode = inf->mode; | 355 | inode->i_mode = mode; |
356 | if (sb->s_root) { | 356 | if (sb->s_root) { |
357 | inode->i_uid = sb->s_root->d_inode->i_uid; | 357 | inode->i_uid = sb->s_root->d_inode->i_uid; |
358 | inode->i_gid = sb->s_root->d_inode->i_gid; | 358 | inode->i_gid = sb->s_root->d_inode->i_gid; |
@@ -360,11 +360,11 @@ struct inode *autofs4_get_inode(struct super_block *sb, | |||
360 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 360 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
361 | inode->i_ino = get_next_ino(); | 361 | inode->i_ino = get_next_ino(); |
362 | 362 | ||
363 | if (S_ISDIR(inf->mode)) { | 363 | if (S_ISDIR(mode)) { |
364 | inode->i_nlink = 2; | 364 | inode->i_nlink = 2; |
365 | inode->i_op = &autofs4_dir_inode_operations; | 365 | inode->i_op = &autofs4_dir_inode_operations; |
366 | inode->i_fop = &autofs4_dir_operations; | 366 | inode->i_fop = &autofs4_dir_operations; |
367 | } else if (S_ISLNK(inf->mode)) { | 367 | } else if (S_ISLNK(mode)) { |
368 | inode->i_size = inf->size; | 368 | inode->i_size = inf->size; |
369 | inode->i_op = &autofs4_symlink_inode_operations; | 369 | inode->i_op = &autofs4_symlink_inode_operations; |
370 | } | 370 | } |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index f47aceabf58f..e55dcdbeb450 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -508,7 +508,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
508 | if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) | 508 | if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) |
509 | __managed_dentry_set_managed(dentry); | 509 | __managed_dentry_set_managed(dentry); |
510 | 510 | ||
511 | ino = autofs4_init_ino(NULL, sbi, 0555); | 511 | ino = autofs4_init_ino(NULL, sbi); |
512 | if (!ino) | 512 | if (!ino) |
513 | return ERR_PTR(-ENOMEM); | 513 | return ERR_PTR(-ENOMEM); |
514 | 514 | ||
@@ -538,7 +538,7 @@ static int autofs4_dir_symlink(struct inode *dir, | |||
538 | if (!autofs4_oz_mode(sbi)) | 538 | if (!autofs4_oz_mode(sbi)) |
539 | return -EACCES; | 539 | return -EACCES; |
540 | 540 | ||
541 | ino = autofs4_init_ino(ino, sbi, S_IFLNK | 0555); | 541 | ino = autofs4_init_ino(ino, sbi); |
542 | if (!ino) | 542 | if (!ino) |
543 | return -ENOMEM; | 543 | return -ENOMEM; |
544 | 544 | ||
@@ -554,7 +554,7 @@ static int autofs4_dir_symlink(struct inode *dir, | |||
554 | 554 | ||
555 | strcpy(cp, symname); | 555 | strcpy(cp, symname); |
556 | 556 | ||
557 | inode = autofs4_get_inode(dir->i_sb, ino); | 557 | inode = autofs4_get_inode(dir->i_sb, ino, S_IFLNK | 0555); |
558 | if (!inode) { | 558 | if (!inode) { |
559 | kfree(cp); | 559 | kfree(cp); |
560 | if (!dentry->d_fsdata) | 560 | if (!dentry->d_fsdata) |
@@ -733,13 +733,13 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
733 | DPRINTK("dentry %p, creating %.*s", | 733 | DPRINTK("dentry %p, creating %.*s", |
734 | dentry, dentry->d_name.len, dentry->d_name.name); | 734 | dentry, dentry->d_name.len, dentry->d_name.name); |
735 | 735 | ||
736 | ino = autofs4_init_ino(ino, sbi, S_IFDIR | 0555); | 736 | ino = autofs4_init_ino(ino, sbi); |
737 | if (!ino) | 737 | if (!ino) |
738 | return -ENOMEM; | 738 | return -ENOMEM; |
739 | 739 | ||
740 | autofs4_del_active(dentry); | 740 | autofs4_del_active(dentry); |
741 | 741 | ||
742 | inode = autofs4_get_inode(dir->i_sb, ino); | 742 | inode = autofs4_get_inode(dir->i_sb, ino, S_IFDIR | 0555); |
743 | if (!inode) { | 743 | if (!inode) { |
744 | if (!dentry->d_fsdata) | 744 | if (!dentry->d_fsdata) |
745 | kfree(ino); | 745 | kfree(ino); |