20 #include <linux/list.h>
23 #define AUTOFS_IOC_FIRST AUTOFS_IOC_READY
24 #define AUTOFS_IOC_COUNT 32
26 #define AUTOFS_DEV_IOCTL_IOC_FIRST (AUTOFS_DEV_IOCTL_VERSION)
27 #define AUTOFS_DEV_IOCTL_IOC_COUNT (AUTOFS_IOC_COUNT - 11)
29 #include <linux/kernel.h>
30 #include <linux/slab.h>
31 #include <linux/time.h>
32 #include <linux/string.h>
33 #include <linux/wait.h>
34 #include <linux/sched.h>
37 #include <asm/current.h>
38 #include <asm/uaccess.h>
42 #define DPRINTK(fmt, ...) \
43 pr_debug("pid %d: %s: " fmt "\n", \
44 current->pid, __func__, ##__VA_ARGS__)
46 #define AUTOFS_WARN(fmt, ...) \
47 printk(KERN_WARNING "pid %d: %s: " fmt "\n", \
48 current->pid, __func__, ##__VA_ARGS__)
50 #define AUTOFS_ERROR(fmt, ...) \
51 printk(KERN_ERR "pid %d: %s: " fmt "\n", \
52 current->pid, __func__, ##__VA_ARGS__)
81 #define AUTOFS_INF_EXPIRING (1<<0)
82 #define AUTOFS_INF_PENDING (1<<2)
101 #define AUTOFS_SBI_MAGIC 0x6d4a556d
146 static inline int autofs4_ispending(
struct dentry *dentry)
148 struct autofs_info *inf = autofs4_dentry_ino(dentry);
194 static inline void __managed_dentry_set_automount(
struct dentry *dentry)
199 static inline void managed_dentry_set_automount(
struct dentry *dentry)
201 spin_lock(&dentry->
d_lock);
202 __managed_dentry_set_automount(dentry);
203 spin_unlock(&dentry->
d_lock);
206 static inline void __managed_dentry_clear_automount(
struct dentry *dentry)
211 static inline void managed_dentry_clear_automount(
struct dentry *dentry)
213 spin_lock(&dentry->
d_lock);
214 __managed_dentry_clear_automount(dentry);
215 spin_unlock(&dentry->
d_lock);
218 static inline void __managed_dentry_set_transit(
struct dentry *dentry)
223 static inline void managed_dentry_set_transit(
struct dentry *dentry)
225 spin_lock(&dentry->
d_lock);
226 __managed_dentry_set_transit(dentry);
227 spin_unlock(&dentry->
d_lock);
230 static inline void __managed_dentry_clear_transit(
struct dentry *dentry)
235 static inline void managed_dentry_clear_transit(
struct dentry *dentry)
237 spin_lock(&dentry->
d_lock);
238 __managed_dentry_clear_transit(dentry);
239 spin_unlock(&dentry->
d_lock);
242 static inline void __managed_dentry_set_managed(
struct dentry *dentry)
247 static inline void managed_dentry_set_managed(
struct dentry *dentry)
249 spin_lock(&dentry->
d_lock);
250 __managed_dentry_set_managed(dentry);
251 spin_unlock(&dentry->
d_lock);
254 static inline void __managed_dentry_clear_managed(
struct dentry *dentry)
259 static inline void managed_dentry_clear_managed(
struct dentry *dentry)
261 spin_lock(&dentry->
d_lock);
262 __managed_dentry_clear_managed(dentry);
263 spin_unlock(&dentry->
d_lock);
272 static inline int autofs_prepare_pipe(
struct file *
pipe)
274 if (!pipe->
f_op || !pipe->
f_op->write)
276 if (!
S_ISFIFO(pipe->f_dentry->d_inode->i_mode))
291 return new_encode_dev(sbi->
sb->s_dev);
296 return sbi->
sb->s_root->d_inode->i_ino;
299 static inline int simple_positive(
struct dentry *dentry)
301 return dentry->
d_inode && !d_unhashed(dentry);
304 static inline void __autofs4_add_expiring(
struct dentry *dentry)
315 static inline void autofs4_add_expiring(
struct dentry *dentry)
318 struct autofs_info *ino = autofs4_dentry_ino(dentry);
328 static inline void autofs4_del_expiring(
struct dentry *dentry)
331 struct autofs_info *ino = autofs4_dentry_ino(dentry);