summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2016-03-15 17:58:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-15 19:55:16 -0400
commite9a7c2f1a548f34bcaa7640094201e8b29247940 (patch)
tree48907feeb591ddfcddfd170ecccf6c726f12624c
parentc83aa55d0bb7ec5b07fdf2346af66bc33ba3cb3d (diff)
autofs4: coding style fixes
Try and make the coding style completely consistent throughtout the autofs module and inline with kernel coding style recommendations. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/autofs4/autofs_i.h55
-rw-r--r--fs/autofs4/dev-ioctl.c28
-rw-r--r--fs/autofs4/expire.c60
-rw-r--r--fs/autofs4/init.c10
-rw-r--r--fs/autofs4/inode.c25
-rw-r--r--fs/autofs4/root.c95
-rw-r--r--fs/autofs4/symlink.c11
-rw-r--r--fs/autofs4/waitq.c49
-rw-r--r--include/linux/auto_dev-ioctl.h1
-rw-r--r--include/linux/auto_fs.h10
-rw-r--r--include/uapi/linux/auto_fs.h19
-rw-r--r--include/uapi/linux/auto_fs4.h15
12 files changed, 190 insertions, 188 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index c37149b929be..e50cfae487b2 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -1,15 +1,11 @@
1/* -*- c -*- ------------------------------------------------------------- * 1/*
2 * 2 * Copyright 1997-1998 Transmeta Corporation - All Rights Reserved
3 * linux/fs/autofs/autofs_i.h 3 * Copyright 2005-2006 Ian Kent <raven@themaw.net>
4 *
5 * Copyright 1997-1998 Transmeta Corporation - All Rights Reserved
6 * Copyright 2005-2006 Ian Kent <raven@themaw.net>
7 * 4 *
8 * This file is part of the Linux kernel and is made available under 5 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your 6 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference. 7 * option, any later version, incorporated herein by reference.
11 * 8 */
12 * ----------------------------------------------------------------------- */
13 9
14/* Internal header file for autofs */ 10/* Internal header file for autofs */
15 11
@@ -35,7 +31,7 @@
35#include <linux/mount.h> 31#include <linux/mount.h>
36#include <linux/namei.h> 32#include <linux/namei.h>
37#include <asm/current.h> 33#include <asm/current.h>
38#include <asm/uaccess.h> 34#include <linux/uaccess.h>
39 35
40/* #define DEBUG */ 36/* #define DEBUG */
41 37
@@ -51,12 +47,14 @@
51 printk(KERN_ERR "pid %d: %s: " fmt "\n", \ 47 printk(KERN_ERR "pid %d: %s: " fmt "\n", \
52 current->pid, __func__, ##__VA_ARGS__) 48 current->pid, __func__, ##__VA_ARGS__)
53 49
54/* Unified info structure. This is pointed to by both the dentry and 50/*
55 inode structures. Each file in the filesystem has an instance of this 51 * Unified info structure. This is pointed to by both the dentry and
56 structure. It holds a reference to the dentry, so dentries are never 52 * inode structures. Each file in the filesystem has an instance of this
57 flushed while the file exists. All name lookups are dealt with at the 53 * structure. It holds a reference to the dentry, so dentries are never
58 dentry level, although the filesystem can interfere in the validation 54 * flushed while the file exists. All name lookups are dealt with at the
59 process. Readdir is implemented by traversing the dentry lists. */ 55 * dentry level, although the filesystem can interfere in the validation
56 * process. Readdir is implemented by traversing the dentry lists.
57 */
60struct autofs_info { 58struct autofs_info {
61 struct dentry *dentry; 59 struct dentry *dentry;
62 struct inode *inode; 60 struct inode *inode;
@@ -78,7 +76,7 @@ struct autofs_info {
78 kgid_t gid; 76 kgid_t gid;
79}; 77};
80 78
81#define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */ 79#define AUTOFS_INF_EXPIRING (1<<0) /* dentry in the process of expiring */
82#define AUTOFS_INF_NO_RCU (1<<1) /* the dentry is being considered 80#define AUTOFS_INF_NO_RCU (1<<1) /* the dentry is being considered
83 * for expiry, so RCU_walk is 81 * for expiry, so RCU_walk is
84 * not permitted 82 * not permitted
@@ -140,10 +138,11 @@ static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry)
140} 138}
141 139
142/* autofs4_oz_mode(): do we see the man behind the curtain? (The 140/* autofs4_oz_mode(): do we see the man behind the curtain? (The
143 processes which do manipulations for us in user space sees the raw 141 * processes which do manipulations for us in user space sees the raw
144 filesystem without "magic".) */ 142 * filesystem without "magic".)
145 143 */
146static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) { 144static inline int autofs4_oz_mode(struct autofs_sb_info *sbi)
145{
147 return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp; 146 return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp;
148} 147}
149 148
@@ -154,12 +153,12 @@ void autofs4_free_ino(struct autofs_info *);
154int is_autofs4_dentry(struct dentry *); 153int is_autofs4_dentry(struct dentry *);
155int autofs4_expire_wait(struct dentry *dentry, int rcu_walk); 154int autofs4_expire_wait(struct dentry *dentry, int rcu_walk);
156int autofs4_expire_run(struct super_block *, struct vfsmount *, 155int autofs4_expire_run(struct super_block *, struct vfsmount *,
157 struct autofs_sb_info *, 156 struct autofs_sb_info *,
158 struct autofs_packet_expire __user *); 157 struct autofs_packet_expire __user *);
159int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, 158int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt,
160 struct autofs_sb_info *sbi, int when); 159 struct autofs_sb_info *sbi, int when);
161int autofs4_expire_multi(struct super_block *, struct vfsmount *, 160int autofs4_expire_multi(struct super_block *, struct vfsmount *,
162 struct autofs_sb_info *, int __user *); 161 struct autofs_sb_info *, int __user *);
163struct dentry *autofs4_expire_direct(struct super_block *sb, 162struct dentry *autofs4_expire_direct(struct super_block *sb,
164 struct vfsmount *mnt, 163 struct vfsmount *mnt,
165 struct autofs_sb_info *sbi, int how); 164 struct autofs_sb_info *sbi, int how);
@@ -224,8 +223,8 @@ static inline int autofs_prepare_pipe(struct file *pipe)
224 223
225/* Queue management functions */ 224/* Queue management functions */
226 225
227int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); 226int autofs4_wait(struct autofs_sb_info *, struct dentry *, enum autofs_notify);
228int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int); 227int autofs4_wait_release(struct autofs_sb_info *, autofs_wqt_t, int);
229void autofs4_catatonic_mode(struct autofs_sb_info *); 228void autofs4_catatonic_mode(struct autofs_sb_info *);
230 229
231static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi) 230static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi)
@@ -242,37 +241,37 @@ static inline void __autofs4_add_expiring(struct dentry *dentry)
242{ 241{
243 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 242 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
244 struct autofs_info *ino = autofs4_dentry_ino(dentry); 243 struct autofs_info *ino = autofs4_dentry_ino(dentry);
244
245 if (ino) { 245 if (ino) {
246 if (list_empty(&ino->expiring)) 246 if (list_empty(&ino->expiring))
247 list_add(&ino->expiring, &sbi->expiring_list); 247 list_add(&ino->expiring, &sbi->expiring_list);
248 } 248 }
249 return;
250} 249}
251 250
252static inline void autofs4_add_expiring(struct dentry *dentry) 251static inline void autofs4_add_expiring(struct dentry *dentry)
253{ 252{
254 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 253 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
255 struct autofs_info *ino = autofs4_dentry_ino(dentry); 254 struct autofs_info *ino = autofs4_dentry_ino(dentry);
255
256 if (ino) { 256 if (ino) {
257 spin_lock(&sbi->lookup_lock); 257 spin_lock(&sbi->lookup_lock);
258 if (list_empty(&ino->expiring)) 258 if (list_empty(&ino->expiring))
259 list_add(&ino->expiring, &sbi->expiring_list); 259 list_add(&ino->expiring, &sbi->expiring_list);
260 spin_unlock(&sbi->lookup_lock); 260 spin_unlock(&sbi->lookup_lock);
261 } 261 }
262 return;
263} 262}
264 263
265static inline void autofs4_del_expiring(struct dentry *dentry) 264static inline void autofs4_del_expiring(struct dentry *dentry)
266{ 265{
267 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 266 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
268 struct autofs_info *ino = autofs4_dentry_ino(dentry); 267 struct autofs_info *ino = autofs4_dentry_ino(dentry);
268
269 if (ino) { 269 if (ino) {
270 spin_lock(&sbi->lookup_lock); 270 spin_lock(&sbi->lookup_lock);
271 if (!list_empty(&ino->expiring)) 271 if (!list_empty(&ino->expiring))
272 list_del_init(&ino->expiring); 272 list_del_init(&ino->expiring);
273 spin_unlock(&sbi->lookup_lock); 273 spin_unlock(&sbi->lookup_lock);
274 } 274 }
275 return;
276} 275}
277 276
278extern void autofs4_kill_sb(struct super_block *); 277extern void autofs4_kill_sb(struct super_block *);
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index ac7d921ed984..c64b9fa839c5 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -72,8 +72,8 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param)
72{ 72{
73 int err = 0; 73 int err = 0;
74 74
75 if ((AUTOFS_DEV_IOCTL_VERSION_MAJOR != param->ver_major) || 75 if ((param->ver_major != AUTOFS_DEV_IOCTL_VERSION_MAJOR) ||
76 (AUTOFS_DEV_IOCTL_VERSION_MINOR < param->ver_minor)) { 76 (param->ver_minor > AUTOFS_DEV_IOCTL_VERSION_MINOR)) {
77 AUTOFS_WARN("ioctl control interface version mismatch: " 77 AUTOFS_WARN("ioctl control interface version mismatch: "
78 "kernel(%u.%u), user(%u.%u), cmd(%d)", 78 "kernel(%u.%u), user(%u.%u), cmd(%d)",
79 AUTOFS_DEV_IOCTL_VERSION_MAJOR, 79 AUTOFS_DEV_IOCTL_VERSION_MAJOR,
@@ -93,7 +93,8 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param)
93 * Copy parameter control struct, including a possible path allocated 93 * Copy parameter control struct, including a possible path allocated
94 * at the end of the struct. 94 * at the end of the struct.
95 */ 95 */
96static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in) 96static struct autofs_dev_ioctl *
97 copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
97{ 98{
98 struct autofs_dev_ioctl tmp, *res; 99 struct autofs_dev_ioctl tmp, *res;
99 100
@@ -116,7 +117,6 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i
116static inline void free_dev_ioctl(struct autofs_dev_ioctl *param) 117static inline void free_dev_ioctl(struct autofs_dev_ioctl *param)
117{ 118{
118 kfree(param); 119 kfree(param);
119 return;
120} 120}
121 121
122/* 122/*
@@ -197,7 +197,9 @@ static int find_autofs_mount(const char *pathname,
197 void *data) 197 void *data)
198{ 198{
199 struct path path; 199 struct path path;
200 int err = kern_path_mountpoint(AT_FDCWD, pathname, &path, 0); 200 int err;
201
202 err = kern_path_mountpoint(AT_FDCWD, pathname, &path, 0);
201 if (err) 203 if (err)
202 return err; 204 return err;
203 err = -ENOENT; 205 err = -ENOENT;
@@ -225,6 +227,7 @@ static int test_by_dev(struct path *path, void *p)
225static int test_by_type(struct path *path, void *p) 227static int test_by_type(struct path *path, void *p)
226{ 228{
227 struct autofs_info *ino = autofs4_dentry_ino(path->dentry); 229 struct autofs_info *ino = autofs4_dentry_ino(path->dentry);
230
228 return ino && ino->sbi->type & *(unsigned *)p; 231 return ino && ino->sbi->type & *(unsigned *)p;
229} 232}
230 233
@@ -456,8 +459,10 @@ static int autofs_dev_ioctl_requester(struct file *fp,
456 err = 0; 459 err = 0;
457 autofs4_expire_wait(path.dentry, 0); 460 autofs4_expire_wait(path.dentry, 0);
458 spin_lock(&sbi->fs_lock); 461 spin_lock(&sbi->fs_lock);
459 param->requester.uid = from_kuid_munged(current_user_ns(), ino->uid); 462 param->requester.uid =
460 param->requester.gid = from_kgid_munged(current_user_ns(), ino->gid); 463 from_kuid_munged(current_user_ns(), ino->uid);
464 param->requester.gid =
465 from_kgid_munged(current_user_ns(), ino->gid);
461 spin_unlock(&sbi->fs_lock); 466 spin_unlock(&sbi->fs_lock);
462 } 467 }
463 path_put(&path); 468 path_put(&path);
@@ -619,7 +624,8 @@ static ioctl_fn lookup_dev_ioctl(unsigned int cmd)
619} 624}
620 625
621/* ioctl dispatcher */ 626/* ioctl dispatcher */
622static int _autofs_dev_ioctl(unsigned int command, struct autofs_dev_ioctl __user *user) 627static int _autofs_dev_ioctl(unsigned int command,
628 struct autofs_dev_ioctl __user *user)
623{ 629{
624 struct autofs_dev_ioctl *param; 630 struct autofs_dev_ioctl *param;
625 struct file *fp; 631 struct file *fp;
@@ -711,6 +717,7 @@ out:
711static long autofs_dev_ioctl(struct file *file, uint command, ulong u) 717static long autofs_dev_ioctl(struct file *file, uint command, ulong u)
712{ 718{
713 int err; 719 int err;
720
714 err = _autofs_dev_ioctl(command, (struct autofs_dev_ioctl __user *) u); 721 err = _autofs_dev_ioctl(command, (struct autofs_dev_ioctl __user *) u);
715 return (long) err; 722 return (long) err;
716} 723}
@@ -733,8 +740,8 @@ static const struct file_operations _dev_ioctl_fops = {
733 740
734static struct miscdevice _autofs_dev_ioctl_misc = { 741static struct miscdevice _autofs_dev_ioctl_misc = {
735 .minor = AUTOFS_MINOR, 742 .minor = AUTOFS_MINOR,
736 .name = AUTOFS_DEVICE_NAME, 743 .name = AUTOFS_DEVICE_NAME,
737 .fops = &_dev_ioctl_fops 744 .fops = &_dev_ioctl_fops
738}; 745};
739 746
740MODULE_ALIAS_MISCDEV(AUTOFS_MINOR); 747MODULE_ALIAS_MISCDEV(AUTOFS_MINOR);
@@ -757,6 +764,5 @@ int __init autofs_dev_ioctl_init(void)
757void autofs_dev_ioctl_exit(void) 764void autofs_dev_ioctl_exit(void)
758{ 765{
759 misc_deregister(&_autofs_dev_ioctl_misc); 766 misc_deregister(&_autofs_dev_ioctl_misc);
760 return;
761} 767}
762 768
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index 1cebc3c52fa5..8ba37c73b372 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -1,16 +1,12 @@
1/* -*- c -*- --------------------------------------------------------------- * 1/*
2 * 2 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
3 * linux/fs/autofs/expire.c 3 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
4 * 4 * Copyright 2001-2006 Ian Kent <raven@themaw.net>
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
7 * Copyright 2001-2006 Ian Kent <raven@themaw.net>
8 * 5 *
9 * This file is part of the Linux kernel and is made available under 6 * This file is part of the Linux kernel and is made available under
10 * the terms of the GNU General Public License, version 2, or at your 7 * the terms of the GNU General Public License, version 2, or at your
11 * option, any later version, incorporated herein by reference. 8 * option, any later version, incorporated herein by reference.
12 * 9 */
13 * ------------------------------------------------------------------------- */
14 10
15#include "autofs_i.h" 11#include "autofs_i.h"
16 12
@@ -18,7 +14,7 @@ static unsigned long now;
18 14
19/* Check if a dentry can be expired */ 15/* Check if a dentry can be expired */
20static inline int autofs4_can_expire(struct dentry *dentry, 16static inline int autofs4_can_expire(struct dentry *dentry,
21 unsigned long timeout, int do_now) 17 unsigned long timeout, int do_now)
22{ 18{
23 struct autofs_info *ino = autofs4_dentry_ino(dentry); 19 struct autofs_info *ino = autofs4_dentry_ino(dentry);
24 20
@@ -58,7 +54,9 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
58 54
59 /* Update the expiry counter if fs is busy */ 55 /* Update the expiry counter if fs is busy */
60 if (!may_umount_tree(path.mnt)) { 56 if (!may_umount_tree(path.mnt)) {
61 struct autofs_info *ino = autofs4_dentry_ino(top); 57 struct autofs_info *ino;
58
59 ino = autofs4_dentry_ino(top);
62 ino->last_used = jiffies; 60 ino->last_used = jiffies;
63 goto done; 61 goto done;
64 } 62 }
@@ -74,7 +72,7 @@ done:
74 * Calculate and dget next entry in the subdirs list under root. 72 * Calculate and dget next entry in the subdirs list under root.
75 */ 73 */
76static struct dentry *get_next_positive_subdir(struct dentry *prev, 74static struct dentry *get_next_positive_subdir(struct dentry *prev,
77 struct dentry *root) 75 struct dentry *root)
78{ 76{
79 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); 77 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb);
80 struct list_head *next; 78 struct list_head *next;
@@ -121,7 +119,7 @@ cont:
121 * Calculate and dget next entry in top down tree traversal. 119 * Calculate and dget next entry in top down tree traversal.
122 */ 120 */
123static struct dentry *get_next_positive_dentry(struct dentry *prev, 121static struct dentry *get_next_positive_dentry(struct dentry *prev,
124 struct dentry *root) 122 struct dentry *root)
125{ 123{
126 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); 124 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb);
127 struct list_head *next; 125 struct list_head *next;
@@ -187,15 +185,17 @@ again:
187 * autofs submounts. 185 * autofs submounts.
188 */ 186 */
189static int autofs4_direct_busy(struct vfsmount *mnt, 187static int autofs4_direct_busy(struct vfsmount *mnt,
190 struct dentry *top, 188 struct dentry *top,
191 unsigned long timeout, 189 unsigned long timeout,
192 int do_now) 190 int do_now)
193{ 191{
194 DPRINTK("top %p %pd", top, top); 192 DPRINTK("top %p %pd", top, top);
195 193
196 /* If it's busy update the expiry counters */ 194 /* If it's busy update the expiry counters */
197 if (!may_umount_tree(mnt)) { 195 if (!may_umount_tree(mnt)) {
198 struct autofs_info *ino = autofs4_dentry_ino(top); 196 struct autofs_info *ino;
197
198 ino = autofs4_dentry_ino(top);
199 if (ino) 199 if (ino)
200 ino->last_used = jiffies; 200 ino->last_used = jiffies;
201 return 1; 201 return 1;
@@ -208,7 +208,8 @@ static int autofs4_direct_busy(struct vfsmount *mnt,
208 return 0; 208 return 0;
209} 209}
210 210
211/* Check a directory tree of mount points for busyness 211/*
212 * Check a directory tree of mount points for busyness
212 * The tree is not busy iff no mountpoints are busy 213 * The tree is not busy iff no mountpoints are busy
213 */ 214 */
214static int autofs4_tree_busy(struct vfsmount *mnt, 215static int autofs4_tree_busy(struct vfsmount *mnt,
@@ -404,6 +405,7 @@ static struct dentry *should_expire(struct dentry *dentry,
404 } else { 405 } else {
405 /* Path walk currently on this dentry? */ 406 /* Path walk currently on this dentry? */
406 struct dentry *expired; 407 struct dentry *expired;
408
407 ino_count = atomic_read(&ino->count) + 1; 409 ino_count = atomic_read(&ino->count) + 1;
408 if (d_count(dentry) > ino_count) 410 if (d_count(dentry) > ino_count)
409 return NULL; 411 return NULL;
@@ -522,21 +524,22 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk)
522 524
523/* Perform an expiry operation */ 525/* Perform an expiry operation */
524int autofs4_expire_run(struct super_block *sb, 526int autofs4_expire_run(struct super_block *sb,
525 struct vfsmount *mnt, 527 struct vfsmount *mnt,
526 struct autofs_sb_info *sbi, 528 struct autofs_sb_info *sbi,
527 struct autofs_packet_expire __user *pkt_p) 529 struct autofs_packet_expire __user *pkt_p)
528{ 530{
529 struct autofs_packet_expire pkt; 531 struct autofs_packet_expire pkt;
530 struct autofs_info *ino; 532 struct autofs_info *ino;
531 struct dentry *dentry; 533 struct dentry *dentry;
532 int ret = 0; 534 int ret = 0;
533 535
534 memset(&pkt,0,sizeof pkt); 536 memset(&pkt, 0, sizeof(pkt));
535 537
536 pkt.hdr.proto_version = sbi->version; 538 pkt.hdr.proto_version = sbi->version;
537 pkt.hdr.type = autofs_ptype_expire; 539 pkt.hdr.type = autofs_ptype_expire;
538 540
539 if ((dentry = autofs4_expire_indirect(sb, mnt, sbi, 0)) == NULL) 541 dentry = autofs4_expire_indirect(sb, mnt, sbi, 0);
542 if (!dentry)
540 return -EAGAIN; 543 return -EAGAIN;
541 544
542 pkt.len = dentry->d_name.len; 545 pkt.len = dentry->d_name.len;
@@ -544,7 +547,7 @@ int autofs4_expire_run(struct super_block *sb,
544 pkt.name[pkt.len] = '\0'; 547 pkt.name[pkt.len] = '\0';
545 dput(dentry); 548 dput(dentry);
546 549
547 if ( copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)) ) 550 if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)))
548 ret = -EFAULT; 551 ret = -EFAULT;
549 552
550 spin_lock(&sbi->fs_lock); 553 spin_lock(&sbi->fs_lock);
@@ -573,7 +576,8 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt,
573 struct autofs_info *ino = autofs4_dentry_ino(dentry); 576 struct autofs_info *ino = autofs4_dentry_ino(dentry);
574 577
575 /* This is synchronous because it makes the daemon a 578 /* This is synchronous because it makes the daemon a
576 little easier */ 579 * little easier
580 */
577 ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); 581 ret = autofs4_wait(sbi, dentry, NFY_EXPIRE);
578 582
579 spin_lock(&sbi->fs_lock); 583 spin_lock(&sbi->fs_lock);
@@ -588,8 +592,10 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt,
588 return ret; 592 return ret;
589} 593}
590 594
591/* Call repeatedly until it returns -EAGAIN, meaning there's nothing 595/*
592 more to be done */ 596 * Call repeatedly until it returns -EAGAIN, meaning there's nothing
597 * more to be done.
598 */
593int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt, 599int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt,
594 struct autofs_sb_info *sbi, int __user *arg) 600 struct autofs_sb_info *sbi, int __user *arg)
595{ 601{
diff --git a/fs/autofs4/init.c b/fs/autofs4/init.c
index b3db517e89ec..8cf0e63389ae 100644
--- a/fs/autofs4/init.c
+++ b/fs/autofs4/init.c
@@ -1,14 +1,10 @@
1/* -*- c -*- --------------------------------------------------------------- * 1/*
2 * 2 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
3 * linux/fs/autofs/init.c
4 *
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * 3 *
7 * This file is part of the Linux kernel and is made available under 4 * This file is part of the Linux kernel and is made available under
8 * the terms of the GNU General Public License, version 2, or at your 5 * the terms of the GNU General Public License, version 2, or at your
9 * option, any later version, incorporated herein by reference. 6 * option, any later version, incorporated herein by reference.
10 * 7 */
11 * ------------------------------------------------------------------------- */
12 8
13#include <linux/module.h> 9#include <linux/module.h>
14#include <linux/init.h> 10#include <linux/init.h>
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 4320faa2d2dc..ad03705aac43 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -1,15 +1,11 @@
1/* -*- c -*- --------------------------------------------------------------- * 1/*
2 * 2 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
3 * linux/fs/autofs/inode.c 3 * Copyright 2005-2006 Ian Kent <raven@themaw.net>
4 *
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * Copyright 2005-2006 Ian Kent <raven@themaw.net>
7 * 4 *
8 * This file is part of the Linux kernel and is made available under 5 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your 6 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference. 7 * option, any later version, incorporated herein by reference.
11 * 8 */
12 * ------------------------------------------------------------------------- */
13 9
14#include <linux/kernel.h> 10#include <linux/kernel.h>
15#include <linux/slab.h> 11#include <linux/slab.h>
@@ -24,7 +20,9 @@
24 20
25struct autofs_info *autofs4_new_ino(struct autofs_sb_info *sbi) 21struct autofs_info *autofs4_new_ino(struct autofs_sb_info *sbi)
26{ 22{
27 struct autofs_info *ino = kzalloc(sizeof(*ino), GFP_KERNEL); 23 struct autofs_info *ino;
24
25 ino = kzalloc(sizeof(*ino), GFP_KERNEL);
28 if (ino) { 26 if (ino) {
29 INIT_LIST_HEAD(&ino->active); 27 INIT_LIST_HEAD(&ino->active);
30 INIT_LIST_HEAD(&ino->expiring); 28 INIT_LIST_HEAD(&ino->expiring);
@@ -152,6 +150,7 @@ static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid,
152 150
153 while ((p = strsep(&options, ",")) != NULL) { 151 while ((p = strsep(&options, ",")) != NULL) {
154 int token; 152 int token;
153
155 if (!*p) 154 if (!*p)
156 continue; 155 continue;
157 156
@@ -209,9 +208,9 @@ static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid,
209 208
210int autofs4_fill_super(struct super_block *s, void *data, int silent) 209int autofs4_fill_super(struct super_block *s, void *data, int silent)
211{ 210{
212 struct inode * root_inode; 211 struct inode *root_inode;
213 struct dentry * root; 212 struct dentry *root;
214 struct file * pipe; 213 struct file *pipe;
215 int pipefd; 214 int pipefd;
216 struct autofs_sb_info *sbi; 215 struct autofs_sb_info *sbi;
217 struct autofs_info *ino; 216 struct autofs_info *ino;
@@ -222,7 +221,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
222 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); 221 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
223 if (!sbi) 222 if (!sbi)
224 return -ENOMEM; 223 return -ENOMEM;
225 DPRINTK("starting up, sbi = %p",sbi); 224 DPRINTK("starting up, sbi = %p", sbi);
226 225
227 s->s_fs_info = sbi; 226 s->s_fs_info = sbi;
228 sbi->magic = AUTOFS_SBI_MAGIC; 227 sbi->magic = AUTOFS_SBI_MAGIC;
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index c6d7d3dbd52a..bdeb8838a901 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -1,16 +1,12 @@
1/* -*- c -*- --------------------------------------------------------------- * 1/*
2 * 2 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
3 * linux/fs/autofs/root.c 3 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
4 * 4 * Copyright 2001-2006 Ian Kent <raven@themaw.net>
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
7 * Copyright 2001-2006 Ian Kent <raven@themaw.net>
8 * 5 *
9 * This file is part of the Linux kernel and is made available under 6 * This file is part of the Linux kernel and is made available under
10 * the terms of the GNU General Public License, version 2, or at your 7 * the terms of the GNU General Public License, version 2, or at your
11 * option, any later version, incorporated herein by reference. 8 * option, any later version, incorporated herein by reference.
12 * 9 */
13 * ------------------------------------------------------------------------- */
14 10
15#include <linux/capability.h> 11#include <linux/capability.h>
16#include <linux/errno.h> 12#include <linux/errno.h>
@@ -23,16 +19,18 @@
23 19
24#include "autofs_i.h" 20#include "autofs_i.h"
25 21
26static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); 22static int autofs4_dir_symlink(struct inode *, struct dentry *, const char *);
27static int autofs4_dir_unlink(struct inode *,struct dentry *); 23static int autofs4_dir_unlink(struct inode *, struct dentry *);
28static int autofs4_dir_rmdir(struct inode *,struct dentry *); 24static int autofs4_dir_rmdir(struct inode *, struct dentry *);
29static int autofs4_dir_mkdir(struct inode *,struct dentry *,umode_t); 25static int autofs4_dir_mkdir(struct inode *, struct dentry *, umode_t);
30static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); 26static long autofs4_root_ioctl(struct file *, unsigned int, unsigned long);
31#ifdef CONFIG_COMPAT 27#ifdef CONFIG_COMPAT
32static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); 28static long autofs4_root_compat_ioctl(struct file *,
29 unsigned int, unsigned long);
33#endif 30#endif
34static int autofs4_dir_open(struct inode *inode, struct file *file); 31static int autofs4_dir_open(struct inode *inode, struct file *file);
35static struct dentry *autofs4_lookup(struct inode *,struct dentry *, unsigned int); 32static struct dentry *autofs4_lookup(struct inode *,
33 struct dentry *, unsigned int);
36static struct vfsmount *autofs4_d_automount(struct path *); 34static struct vfsmount *autofs4_d_automount(struct path *);
37static int autofs4_d_manage(struct dentry *, bool); 35static int autofs4_d_manage(struct dentry *, bool);
38static void autofs4_dentry_release(struct dentry *); 36static void autofs4_dentry_release(struct dentry *);
@@ -74,7 +72,9 @@ const struct dentry_operations autofs4_dentry_operations = {
74static void autofs4_add_active(struct dentry *dentry) 72static void autofs4_add_active(struct dentry *dentry)
75{ 73{
76 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 74 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
77 struct autofs_info *ino = autofs4_dentry_ino(dentry); 75 struct autofs_info *ino;
76
77 ino = autofs4_dentry_ino(dentry);
78 if (ino) { 78 if (ino) {
79 spin_lock(&sbi->lookup_lock); 79 spin_lock(&sbi->lookup_lock);
80 if (!ino->active_count) { 80 if (!ino->active_count) {
@@ -84,13 +84,14 @@ static void autofs4_add_active(struct dentry *dentry)
84 ino->active_count++; 84 ino->active_count++;
85 spin_unlock(&sbi->lookup_lock); 85 spin_unlock(&sbi->lookup_lock);
86 } 86 }
87 return;
88} 87}
89 88
90static void autofs4_del_active(struct dentry *dentry) 89static void autofs4_del_active(struct dentry *dentry)
91{ 90{
92 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 91 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
93 struct autofs_info *ino = autofs4_dentry_ino(dentry); 92 struct autofs_info *ino;
93
94 ino = autofs4_dentry_ino(dentry);
94 if (ino) { 95 if (ino) {
95 spin_lock(&sbi->lookup_lock); 96 spin_lock(&sbi->lookup_lock);
96 ino->active_count--; 97 ino->active_count--;
@@ -100,7 +101,6 @@ static void autofs4_del_active(struct dentry *dentry)
100 } 101 }
101 spin_unlock(&sbi->lookup_lock); 102 spin_unlock(&sbi->lookup_lock);
102 } 103 }
103 return;
104} 104}
105 105
106static int autofs4_dir_open(struct inode *inode, struct file *file) 106static int autofs4_dir_open(struct inode *inode, struct file *file)
@@ -320,7 +320,9 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path)
320 if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) { 320 if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) {
321 struct dentry *parent = dentry->d_parent; 321 struct dentry *parent = dentry->d_parent;
322 struct autofs_info *ino; 322 struct autofs_info *ino;
323 struct dentry *new = d_lookup(parent, &dentry->d_name); 323 struct dentry *new;
324
325 new = d_lookup(parent, &dentry->d_name);
324 if (!new) 326 if (!new)
325 return NULL; 327 return NULL;
326 ino = autofs4_dentry_ino(new); 328 ino = autofs4_dentry_ino(new);
@@ -455,6 +457,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk)
455 * a mount-trap. 457 * a mount-trap.
456 */ 458 */
457 struct inode *inode; 459 struct inode *inode;
460
458 if (ino->flags & (AUTOFS_INF_EXPIRING | AUTOFS_INF_NO_RCU)) 461 if (ino->flags & (AUTOFS_INF_EXPIRING | AUTOFS_INF_NO_RCU))
459 return 0; 462 return 0;
460 if (d_mountpoint(dentry)) 463 if (d_mountpoint(dentry))
@@ -494,7 +497,8 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk)
494} 497}
495 498
496/* Lookups in the root directory */ 499/* Lookups in the root directory */
497static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) 500static struct dentry *autofs4_lookup(struct inode *dir,
501 struct dentry *dentry, unsigned int flags)
498{ 502{
499 struct autofs_sb_info *sbi; 503 struct autofs_sb_info *sbi;
500 struct autofs_info *ino; 504 struct autofs_info *ino;
@@ -513,9 +517,9 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, u
513 autofs4_oz_mode(sbi)); 517 autofs4_oz_mode(sbi));
514 518
515 active = autofs4_lookup_active(dentry); 519 active = autofs4_lookup_active(dentry);
516 if (active) { 520 if (active)
517 return active; 521 return active;
518 } else { 522 else {
519 /* 523 /*
520 * A dentry that is not within the root can never trigger a 524 * A dentry that is not within the root can never trigger a
521 * mount operation, unless the directory already exists, so we 525 * mount operation, unless the directory already exists, so we
@@ -526,7 +530,8 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, u
526 return ERR_PTR(-ENOENT); 530 return ERR_PTR(-ENOENT);
527 531
528 /* Mark entries in the root as mount triggers */ 532 /* Mark entries in the root as mount triggers */
529 if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) 533 if (IS_ROOT(dentry->d_parent) &&
534 autofs_type_indirect(sbi->type))
530 __managed_dentry_set_managed(dentry); 535 __managed_dentry_set_managed(dentry);
531 536
532 ino = autofs4_new_ino(sbi); 537 ino = autofs4_new_ino(sbi);
@@ -664,7 +669,6 @@ static void autofs_set_leaf_automount_flags(struct dentry *dentry)
664 if (IS_ROOT(parent->d_parent)) 669 if (IS_ROOT(parent->d_parent))
665 return; 670 return;
666 managed_dentry_clear_managed(parent); 671 managed_dentry_clear_managed(parent);
667 return;
668} 672}
669 673
670static void autofs_clear_leaf_automount_flags(struct dentry *dentry) 674static void autofs_clear_leaf_automount_flags(struct dentry *dentry)
@@ -687,7 +691,6 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry)
687 if (d_child->next == &parent->d_subdirs && 691 if (d_child->next == &parent->d_subdirs &&
688 d_child->prev == &parent->d_subdirs) 692 d_child->prev == &parent->d_subdirs)
689 managed_dentry_set_managed(parent); 693 managed_dentry_set_managed(parent);
690 return;
691} 694}
692 695
693static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) 696static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
@@ -728,7 +731,8 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
728 return 0; 731 return 0;
729} 732}
730 733
731static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) 734static int autofs4_dir_mkdir(struct inode *dir,
735 struct dentry *dentry, umode_t mode)
732{ 736{
733 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); 737 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
734 struct autofs_info *ino = autofs4_dentry_ino(dentry); 738 struct autofs_info *ino = autofs4_dentry_ino(dentry);
@@ -768,7 +772,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t m
768/* Get/set timeout ioctl() operation */ 772/* Get/set timeout ioctl() operation */
769#ifdef CONFIG_COMPAT 773#ifdef CONFIG_COMPAT
770static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, 774static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi,
771 compat_ulong_t __user *p) 775 compat_ulong_t __user *p)
772{ 776{
773 int rv; 777 int rv;
774 unsigned long ntimeout; 778 unsigned long ntimeout;
@@ -787,7 +791,7 @@ static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi,
787#endif 791#endif
788 792
789static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, 793static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
790 unsigned long __user *p) 794 unsigned long __user *p)
791{ 795{
792 int rv; 796 int rv;
793 unsigned long ntimeout; 797 unsigned long ntimeout;
@@ -805,13 +809,15 @@ static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
805} 809}
806 810
807/* Return protocol version */ 811/* Return protocol version */
808static inline int autofs4_get_protover(struct autofs_sb_info *sbi, int __user *p) 812static inline int autofs4_get_protover(struct autofs_sb_info *sbi,
813 int __user *p)
809{ 814{
810 return put_user(sbi->version, p); 815 return put_user(sbi->version, p);
811} 816}
812 817
813/* Return protocol sub version */ 818/* Return protocol sub version */
814static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, int __user *p) 819static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi,
820 int __user *p)
815{ 821{
816 return put_user(sbi->sub_version, p); 822 return put_user(sbi->sub_version, p);
817} 823}
@@ -834,9 +840,9 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
834} 840}
835 841
836/* Identify autofs4_dentries - this is so we can tell if there's 842/* Identify autofs4_dentries - this is so we can tell if there's
837 an extra dentry refcount or not. We only hold a refcount on the 843 * an extra dentry refcount or not. We only hold a refcount on the
838 dentry if its non-negative (ie, d_inode != NULL) 844 * dentry if its non-negative (ie, d_inode != NULL)
839*/ 845 */
840int is_autofs4_dentry(struct dentry *dentry) 846int is_autofs4_dentry(struct dentry *dentry)
841{ 847{
842 return dentry && d_really_is_positive(dentry) && 848 return dentry && d_really_is_positive(dentry) &&
@@ -855,7 +861,7 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
855 void __user *p = (void __user *)arg; 861 void __user *p = (void __user *)arg;
856 862
857 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u", 863 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
858 cmd,arg,sbi,task_pgrp_nr(current)); 864 cmd, arg, sbi, task_pgrp_nr(current));
859 865
860 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || 866 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
861 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) 867 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
@@ -864,11 +870,11 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
864 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) 870 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
865 return -EPERM; 871 return -EPERM;
866 872
867 switch(cmd) { 873 switch (cmd) {
868 case AUTOFS_IOC_READY: /* Wait queue: go ahead and retry */ 874 case AUTOFS_IOC_READY: /* Wait queue: go ahead and retry */
869 return autofs4_wait_release(sbi,(autofs_wqt_t)arg,0); 875 return autofs4_wait_release(sbi, (autofs_wqt_t) arg, 0);
870 case AUTOFS_IOC_FAIL: /* Wait queue: fail with ENOENT */ 876 case AUTOFS_IOC_FAIL: /* Wait queue: fail with ENOENT */
871 return autofs4_wait_release(sbi,(autofs_wqt_t)arg,-ENOENT); 877 return autofs4_wait_release(sbi, (autofs_wqt_t) arg, -ENOENT);
872 case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */ 878 case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */
873 autofs4_catatonic_mode(sbi); 879 autofs4_catatonic_mode(sbi);
874 return 0; 880 return 0;
@@ -888,10 +894,12 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
888 894
889 /* return a single thing to expire */ 895 /* return a single thing to expire */
890 case AUTOFS_IOC_EXPIRE: 896 case AUTOFS_IOC_EXPIRE:
891 return autofs4_expire_run(inode->i_sb,filp->f_path.mnt,sbi, p); 897 return autofs4_expire_run(inode->i_sb,
898 filp->f_path.mnt, sbi, p);
892 /* same as above, but can send multiple expires through pipe */ 899 /* same as above, but can send multiple expires through pipe */
893 case AUTOFS_IOC_EXPIRE_MULTI: 900 case AUTOFS_IOC_EXPIRE_MULTI:
894 return autofs4_expire_multi(inode->i_sb,filp->f_path.mnt,sbi, p); 901 return autofs4_expire_multi(inode->i_sb,
902 filp->f_path.mnt, sbi, p);
895 903
896 default: 904 default:
897 return -ENOSYS; 905 return -ENOSYS;
@@ -902,12 +910,13 @@ static long autofs4_root_ioctl(struct file *filp,
902 unsigned int cmd, unsigned long arg) 910 unsigned int cmd, unsigned long arg)
903{ 911{
904 struct inode *inode = file_inode(filp); 912 struct inode *inode = file_inode(filp);
913
905 return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 914 return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
906} 915}
907 916
908#ifdef CONFIG_COMPAT 917#ifdef CONFIG_COMPAT
909static long autofs4_root_compat_ioctl(struct file *filp, 918static long autofs4_root_compat_ioctl(struct file *filp,
910 unsigned int cmd, unsigned long arg) 919 unsigned int cmd, unsigned long arg)
911{ 920{
912 struct inode *inode = file_inode(filp); 921 struct inode *inode = file_inode(filp);
913 int ret; 922 int ret;
@@ -916,7 +925,7 @@ static long autofs4_root_compat_ioctl(struct file *filp,
916 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 925 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
917 else 926 else
918 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, 927 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd,
919 (unsigned long)compat_ptr(arg)); 928 (unsigned long) compat_ptr(arg));
920 929
921 return ret; 930 return ret;
922} 931}
diff --git a/fs/autofs4/symlink.c b/fs/autofs4/symlink.c
index 84e037d1d129..99aab00dc217 100644
--- a/fs/autofs4/symlink.c
+++ b/fs/autofs4/symlink.c
@@ -1,14 +1,10 @@
1/* -*- c -*- --------------------------------------------------------------- * 1/*
2 * 2 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
3 * linux/fs/autofs/symlink.c
4 *
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * 3 *
7 * This file is part of the Linux kernel and is made available under 4 * This file is part of the Linux kernel and is made available under
8 * the terms of the GNU General Public License, version 2, or at your 5 * the terms of the GNU General Public License, version 2, or at your
9 * option, any later version, incorporated herein by reference. 6 * option, any later version, incorporated herein by reference.
10 * 7 */
11 * ------------------------------------------------------------------------- */
12 8
13#include "autofs_i.h" 9#include "autofs_i.h"
14 10
@@ -18,6 +14,7 @@ static const char *autofs4_get_link(struct dentry *dentry,
18{ 14{
19 struct autofs_sb_info *sbi; 15 struct autofs_sb_info *sbi;
20 struct autofs_info *ino; 16 struct autofs_info *ino;
17
21 if (!dentry) 18 if (!dentry)
22 return ERR_PTR(-ECHILD); 19 return ERR_PTR(-ECHILD);
23 sbi = autofs4_sbi(dentry->d_sb); 20 sbi = autofs4_sbi(dentry->d_sb);
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 35b755e79c2d..4e0c8d62dc1f 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -1,15 +1,11 @@
1/* -*- c -*- --------------------------------------------------------------- * 1/*
2 * 2 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
3 * linux/fs/autofs/waitq.c 3 * Copyright 2001-2006 Ian Kent <raven@themaw.net>
4 *
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * Copyright 2001-2006 Ian Kent <raven@themaw.net>
7 * 4 *
8 * This file is part of the Linux kernel and is made available under 5 * This file is part of the Linux kernel and is made available under
9 * the terms of the GNU General Public License, version 2, or at your 6 * the terms of the GNU General Public License, version 2, or at your
10 * option, any later version, incorporated herein by reference. 7 * option, any later version, incorporated herein by reference.
11 * 8 */
12 * ------------------------------------------------------------------------- */
13 9
14#include <linux/slab.h> 10#include <linux/slab.h>
15#include <linux/time.h> 11#include <linux/time.h>
@@ -18,7 +14,8 @@
18#include "autofs_i.h" 14#include "autofs_i.h"
19 15
20/* We make this a static variable rather than a part of the superblock; it 16/* We make this a static variable rather than a part of the superblock; it
21 is better if we don't reassign numbers easily even across filesystems */ 17 * is better if we don't reassign numbers easily even across filesystems
18 */
22static autofs_wqt_t autofs4_next_wait_queue = 1; 19static autofs_wqt_t autofs4_next_wait_queue = 1;
23 20
24/* These are the signals we allow interrupting a pending mount */ 21/* These are the signals we allow interrupting a pending mount */
@@ -69,17 +66,19 @@ static int autofs4_write(struct autofs_sb_info *sbi,
69 set_fs(KERNEL_DS); 66 set_fs(KERNEL_DS);
70 67
71 mutex_lock(&sbi->pipe_mutex); 68 mutex_lock(&sbi->pipe_mutex);
72 while (bytes && 69 wr = __vfs_write(file, data, bytes, &file->f_pos);
73 (wr = __vfs_write(file,data,bytes,&file->f_pos)) > 0) { 70 while (bytes && wr) {
74 data += wr; 71 data += wr;
75 bytes -= wr; 72 bytes -= wr;
73 wr = __vfs_write(file, data, bytes, &file->f_pos);
76 } 74 }
77 mutex_unlock(&sbi->pipe_mutex); 75 mutex_unlock(&sbi->pipe_mutex);
78 76
79 set_fs(fs); 77 set_fs(fs);
80 78
81 /* Keep the currently executing process from receiving a 79 /* Keep the currently executing process from receiving a
82 SIGPIPE unless it was already supposed to get one */ 80 * SIGPIPE unless it was already supposed to get one
81 */
83 if (wr == -EPIPE && !sigpipe) { 82 if (wr == -EPIPE && !sigpipe) {
84 spin_lock_irqsave(&current->sighand->siglock, flags); 83 spin_lock_irqsave(&current->sighand->siglock, flags);
85 sigdelset(&current->pending.signal, SIGPIPE); 84 sigdelset(&current->pending.signal, SIGPIPE);
@@ -103,9 +102,10 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
103 size_t pktsz; 102 size_t pktsz;
104 103
105 DPRINTK("wait id = 0x%08lx, name = %.*s, type=%d", 104 DPRINTK("wait id = 0x%08lx, name = %.*s, type=%d",
106 (unsigned long) wq->wait_queue_token, wq->name.len, wq->name.name, type); 105 (unsigned long) wq->wait_queue_token,
106 wq->name.len, wq->name.name, type);
107 107
108 memset(&pkt,0,sizeof pkt); /* For security reasons */ 108 memset(&pkt, 0, sizeof(pkt)); /* For security reasons */
109 109
110 pkt.hdr.proto_version = sbi->version; 110 pkt.hdr.proto_version = sbi->version;
111 pkt.hdr.type = type; 111 pkt.hdr.type = type;
@@ -126,7 +126,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
126 } 126 }
127 case autofs_ptype_expire_multi: 127 case autofs_ptype_expire_multi:
128 { 128 {
129 struct autofs_packet_expire_multi *ep = &pkt.v4_pkt.expire_multi; 129 struct autofs_packet_expire_multi *ep =
130 &pkt.v4_pkt.expire_multi;
130 131
131 pktsz = sizeof(*ep); 132 pktsz = sizeof(*ep);
132 133
@@ -231,7 +232,7 @@ autofs4_find_wait(struct autofs_sb_info *sbi, struct qstr *qstr)
231 if (wq->name.hash == qstr->hash && 232 if (wq->name.hash == qstr->hash &&
232 wq->name.len == qstr->len && 233 wq->name.len == qstr->len &&
233 wq->name.name && 234 wq->name.name &&
234 !memcmp(wq->name.name, qstr->name, qstr->len)) 235 !memcmp(wq->name.name, qstr->name, qstr->len))
235 break; 236 break;
236 } 237 }
237 return wq; 238 return wq;
@@ -248,7 +249,7 @@ autofs4_find_wait(struct autofs_sb_info *sbi, struct qstr *qstr)
248static int validate_request(struct autofs_wait_queue **wait, 249static int validate_request(struct autofs_wait_queue **wait,
249 struct autofs_sb_info *sbi, 250 struct autofs_sb_info *sbi,
250 struct qstr *qstr, 251 struct qstr *qstr,
251 struct dentry*dentry, enum autofs_notify notify) 252 struct dentry *dentry, enum autofs_notify notify)
252{ 253{
253 struct autofs_wait_queue *wq; 254 struct autofs_wait_queue *wq;
254 struct autofs_info *ino; 255 struct autofs_info *ino;
@@ -322,8 +323,10 @@ static int validate_request(struct autofs_wait_queue **wait,
322 * continue on and create a new request. 323 * continue on and create a new request.
323 */ 324 */
324 if (!IS_ROOT(dentry)) { 325 if (!IS_ROOT(dentry)) {
325 if (d_really_is_positive(dentry) && d_unhashed(dentry)) { 326 if (d_unhashed(dentry) &&
327 d_really_is_positive(dentry)) {
326 struct dentry *parent = dentry->d_parent; 328 struct dentry *parent = dentry->d_parent;
329
327 new = d_lookup(parent, &dentry->d_name); 330 new = d_lookup(parent, &dentry->d_name);
328 if (new) 331 if (new)
329 dentry = new; 332 dentry = new;
@@ -340,8 +343,8 @@ static int validate_request(struct autofs_wait_queue **wait,
340 return 1; 343 return 1;
341} 344}
342 345
343int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, 346int autofs4_wait(struct autofs_sb_info *sbi,
344 enum autofs_notify notify) 347 struct dentry *dentry, enum autofs_notify notify)
345{ 348{
346 struct autofs_wait_queue *wq; 349 struct autofs_wait_queue *wq;
347 struct qstr qstr; 350 struct qstr qstr;
@@ -411,7 +414,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
411 414
412 if (!wq) { 415 if (!wq) {
413 /* Create a new wait queue */ 416 /* Create a new wait queue */
414 wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); 417 wq = kmalloc(sizeof(struct autofs_wait_queue), GFP_KERNEL);
415 if (!wq) { 418 if (!wq) {
416 kfree(qstr.name); 419 kfree(qstr.name);
417 mutex_unlock(&sbi->wq_mutex); 420 mutex_unlock(&sbi->wq_mutex);
@@ -454,7 +457,9 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
454 (unsigned long) wq->wait_queue_token, wq->name.len, 457 (unsigned long) wq->wait_queue_token, wq->name.len,
455 wq->name.name, notify); 458 wq->name.name, notify);
456 459
457 /* autofs4_notify_daemon() may block; it will unlock ->wq_mutex */ 460 /*
461 * autofs4_notify_daemon() may block; it will unlock ->wq_mutex
462 */
458 autofs4_notify_daemon(sbi, wq, type); 463 autofs4_notify_daemon(sbi, wq, type);
459 } else { 464 } else {
460 wq->wait_ctr++; 465 wq->wait_ctr++;
diff --git a/include/linux/auto_dev-ioctl.h b/include/linux/auto_dev-ioctl.h
index 850f39b33e74..642781612062 100644
--- a/include/linux/auto_dev-ioctl.h
+++ b/include/linux/auto_dev-ioctl.h
@@ -125,7 +125,6 @@ static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
125 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; 125 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
126 in->size = sizeof(struct autofs_dev_ioctl); 126 in->size = sizeof(struct autofs_dev_ioctl);
127 in->ioctlfd = -1; 127 in->ioctlfd = -1;
128 return;
129} 128}
130 129
131/* 130/*
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index fcd704d354c4..b4066bb89083 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -1,14 +1,10 @@
1/* -*- linux-c -*- ------------------------------------------------------- * 1/*
2 * 2 * Copyright 1997 Transmeta Corporation - All Rights Reserved
3 * linux/include/linux/auto_fs.h
4 *
5 * Copyright 1997 Transmeta Corporation - All Rights Reserved
6 * 3 *
7 * This file is part of the Linux kernel and is made available under 4 * This file is part of the Linux kernel and is made available under
8 * the terms of the GNU General Public License, version 2, or at your 5 * the terms of the GNU General Public License, version 2, or at your
9 * option, any later version, incorporated herein by reference. 6 * option, any later version, incorporated herein by reference.
10 * 7 */
11 * ----------------------------------------------------------------------- */
12 8
13#ifndef _LINUX_AUTO_FS_H 9#ifndef _LINUX_AUTO_FS_H
14#define _LINUX_AUTO_FS_H 10#define _LINUX_AUTO_FS_H
diff --git a/include/uapi/linux/auto_fs.h b/include/uapi/linux/auto_fs.h
index bb991dfe134f..5fe176aa61d1 100644
--- a/include/uapi/linux/auto_fs.h
+++ b/include/uapi/linux/auto_fs.h
@@ -1,7 +1,4 @@
1/* -*- linux-c -*- ------------------------------------------------------- * 1/*
2 *
3 * linux/include/linux/auto_fs.h
4 *
5 * Copyright 1997 Transmeta Corporation - All Rights Reserved 2 * Copyright 1997 Transmeta Corporation - All Rights Reserved
6 * 3 *
7 * This file is part of the Linux kernel and is made available under 4 * This file is part of the Linux kernel and is made available under
@@ -63,12 +60,12 @@ struct autofs_packet_expire {
63 char name[NAME_MAX+1]; 60 char name[NAME_MAX+1];
64}; 61};
65 62
66#define AUTOFS_IOC_READY _IO(0x93,0x60) 63#define AUTOFS_IOC_READY _IO(0x93, 0x60)
67#define AUTOFS_IOC_FAIL _IO(0x93,0x61) 64#define AUTOFS_IOC_FAIL _IO(0x93, 0x61)
68#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) 65#define AUTOFS_IOC_CATATONIC _IO(0x93, 0x62)
69#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) 66#define AUTOFS_IOC_PROTOVER _IOR(0x93, 0x63, int)
70#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t) 67#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93, 0x64, compat_ulong_t)
71#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) 68#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93, 0x64, unsigned long)
72#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) 69#define AUTOFS_IOC_EXPIRE _IOR(0x93, 0x65, struct autofs_packet_expire)
73 70
74#endif /* _UAPI_LINUX_AUTO_FS_H */ 71#endif /* _UAPI_LINUX_AUTO_FS_H */
diff --git a/include/uapi/linux/auto_fs4.h b/include/uapi/linux/auto_fs4.h
index e02982fa2953..924fb1adab0b 100644
--- a/include/uapi/linux/auto_fs4.h
+++ b/include/uapi/linux/auto_fs4.h
@@ -1,6 +1,4 @@
1/* -*- c -*- 1/*
2 * linux/include/linux/auto_fs4.h
3 *
4 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> 2 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
5 * 3 *
6 * This file is part of the Linux kernel and is made available under 4 * This file is part of the Linux kernel and is made available under
@@ -38,7 +36,6 @@
38static inline void set_autofs_type_indirect(unsigned int *type) 36static inline void set_autofs_type_indirect(unsigned int *type)
39{ 37{
40 *type = AUTOFS_TYPE_INDIRECT; 38 *type = AUTOFS_TYPE_INDIRECT;
41 return;
42} 39}
43 40
44static inline unsigned int autofs_type_indirect(unsigned int type) 41static inline unsigned int autofs_type_indirect(unsigned int type)
@@ -49,7 +46,6 @@ static inline unsigned int autofs_type_indirect(unsigned int type)
49static inline void set_autofs_type_direct(unsigned int *type) 46static inline void set_autofs_type_direct(unsigned int *type)
50{ 47{
51 *type = AUTOFS_TYPE_DIRECT; 48 *type = AUTOFS_TYPE_DIRECT;
52 return;
53} 49}
54 50
55static inline unsigned int autofs_type_direct(unsigned int type) 51static inline unsigned int autofs_type_direct(unsigned int type)
@@ -60,7 +56,6 @@ static inline unsigned int autofs_type_direct(unsigned int type)
60static inline void set_autofs_type_offset(unsigned int *type) 56static inline void set_autofs_type_offset(unsigned int *type)
61{ 57{
62 *type = AUTOFS_TYPE_OFFSET; 58 *type = AUTOFS_TYPE_OFFSET;
63 return;
64} 59}
65 60
66static inline unsigned int autofs_type_offset(unsigned int type) 61static inline unsigned int autofs_type_offset(unsigned int type)
@@ -81,7 +76,6 @@ static inline unsigned int autofs_type_trigger(unsigned int type)
81static inline void set_autofs_type_any(unsigned int *type) 76static inline void set_autofs_type_any(unsigned int *type)
82{ 77{
83 *type = AUTOFS_TYPE_ANY; 78 *type = AUTOFS_TYPE_ANY;
84 return;
85} 79}
86 80
87static inline unsigned int autofs_type_any(unsigned int type) 81static inline unsigned int autofs_type_any(unsigned int type)
@@ -154,11 +148,10 @@ union autofs_v5_packet_union {
154 autofs_packet_expire_direct_t expire_direct; 148 autofs_packet_expire_direct_t expire_direct;
155}; 149};
156 150
157#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) 151#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93, 0x66, int)
158#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI 152#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
159#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI 153#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
160#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) 154#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93, 0x67, int)
161#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int) 155#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93, 0x70, int)
162
163 156
164#endif /* _LINUX_AUTO_FS4_H */ 157#endif /* _LINUX_AUTO_FS4_H */