forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try and make the coding style completely consistent throughtout the autofs module and inline with kernel coding style recommendations. Signed-off-by: Ian Kent <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Showing
12 changed files
with
190 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
/* -*- c -*- ------------------------------------------------------------- * | ||
* | ||
* linux/fs/autofs/autofs_i.h | ||
* | ||
* Copyright 1997-1998 Transmeta Corporation - All Rights Reserved | ||
* Copyright 2005-2006 Ian Kent <[email protected]> | ||
/* | ||
* Copyright 1997-1998 Transmeta Corporation - All Rights Reserved | ||
* Copyright 2005-2006 Ian Kent <[email protected]> | ||
* | ||
* This file is part of the Linux kernel and is made available under | ||
* the terms of the GNU General Public License, version 2, or at your | ||
* option, any later version, incorporated herein by reference. | ||
* | ||
* ----------------------------------------------------------------------- */ | ||
*/ | ||
|
||
/* Internal header file for autofs */ | ||
|
||
|
@@ -35,7 +31,7 @@ | |
#include <linux/mount.h> | ||
#include <linux/namei.h> | ||
#include <asm/current.h> | ||
#include <asm/uaccess.h> | ||
#include <linux/uaccess.h> | ||
|
||
/* #define DEBUG */ | ||
|
||
|
@@ -51,12 +47,14 @@ | |
printk(KERN_ERR "pid %d: %s: " fmt "\n", \ | ||
current->pid, __func__, ##__VA_ARGS__) | ||
|
||
/* Unified info structure. This is pointed to by both the dentry and | ||
inode structures. Each file in the filesystem has an instance of this | ||
structure. It holds a reference to the dentry, so dentries are never | ||
flushed while the file exists. All name lookups are dealt with at the | ||
dentry level, although the filesystem can interfere in the validation | ||
process. Readdir is implemented by traversing the dentry lists. */ | ||
/* | ||
* Unified info structure. This is pointed to by both the dentry and | ||
* inode structures. Each file in the filesystem has an instance of this | ||
* structure. It holds a reference to the dentry, so dentries are never | ||
* flushed while the file exists. All name lookups are dealt with at the | ||
* dentry level, although the filesystem can interfere in the validation | ||
* process. Readdir is implemented by traversing the dentry lists. | ||
*/ | ||
struct autofs_info { | ||
struct dentry *dentry; | ||
struct inode *inode; | ||
|
@@ -78,7 +76,7 @@ struct autofs_info { | |
kgid_t gid; | ||
}; | ||
|
||
#define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */ | ||
#define AUTOFS_INF_EXPIRING (1<<0) /* dentry in the process of expiring */ | ||
#define AUTOFS_INF_NO_RCU (1<<1) /* the dentry is being considered | ||
* for expiry, so RCU_walk is | ||
* not permitted | ||
|
@@ -140,10 +138,11 @@ static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry) | |
} | ||
|
||
/* autofs4_oz_mode(): do we see the man behind the curtain? (The | ||
processes which do manipulations for us in user space sees the raw | ||
filesystem without "magic".) */ | ||
|
||
static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) { | ||
* processes which do manipulations for us in user space sees the raw | ||
* filesystem without "magic".) | ||
*/ | ||
static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) | ||
{ | ||
return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp; | ||
} | ||
|
||
|
@@ -154,12 +153,12 @@ void autofs4_free_ino(struct autofs_info *); | |
int is_autofs4_dentry(struct dentry *); | ||
int autofs4_expire_wait(struct dentry *dentry, int rcu_walk); | ||
int autofs4_expire_run(struct super_block *, struct vfsmount *, | ||
struct autofs_sb_info *, | ||
struct autofs_packet_expire __user *); | ||
struct autofs_sb_info *, | ||
struct autofs_packet_expire __user *); | ||
int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, | ||
struct autofs_sb_info *sbi, int when); | ||
int autofs4_expire_multi(struct super_block *, struct vfsmount *, | ||
struct autofs_sb_info *, int __user *); | ||
struct autofs_sb_info *, int __user *); | ||
struct dentry *autofs4_expire_direct(struct super_block *sb, | ||
struct vfsmount *mnt, | ||
struct autofs_sb_info *sbi, int how); | ||
|
@@ -224,8 +223,8 @@ static inline int autofs_prepare_pipe(struct file *pipe) | |
|
||
/* Queue management functions */ | ||
|
||
int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); | ||
int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int); | ||
int autofs4_wait(struct autofs_sb_info *, struct dentry *, enum autofs_notify); | ||
int autofs4_wait_release(struct autofs_sb_info *, autofs_wqt_t, int); | ||
void autofs4_catatonic_mode(struct autofs_sb_info *); | ||
|
||
static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi) | ||
|
@@ -242,37 +241,37 @@ static inline void __autofs4_add_expiring(struct dentry *dentry) | |
{ | ||
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | ||
struct autofs_info *ino = autofs4_dentry_ino(dentry); | ||
|
||
if (ino) { | ||
if (list_empty(&ino->expiring)) | ||
list_add(&ino->expiring, &sbi->expiring_list); | ||
} | ||
return; | ||
} | ||
|
||
static inline void autofs4_add_expiring(struct dentry *dentry) | ||
{ | ||
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | ||
struct autofs_info *ino = autofs4_dentry_ino(dentry); | ||
|
||
if (ino) { | ||
spin_lock(&sbi->lookup_lock); | ||
if (list_empty(&ino->expiring)) | ||
list_add(&ino->expiring, &sbi->expiring_list); | ||
spin_unlock(&sbi->lookup_lock); | ||
} | ||
return; | ||
} | ||
|
||
static inline void autofs4_del_expiring(struct dentry *dentry) | ||
{ | ||
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | ||
struct autofs_info *ino = autofs4_dentry_ino(dentry); | ||
|
||
if (ino) { | ||
spin_lock(&sbi->lookup_lock); | ||
if (!list_empty(&ino->expiring)) | ||
list_del_init(&ino->expiring); | ||
spin_unlock(&sbi->lookup_lock); | ||
} | ||
return; | ||
} | ||
|
||
extern void autofs4_kill_sb(struct super_block *); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
/* -*- c -*- --------------------------------------------------------------- * | ||
* | ||
* linux/fs/autofs/expire.c | ||
* | ||
* Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved | ||
* Copyright 1999-2000 Jeremy Fitzhardinge <[email protected]> | ||
* Copyright 2001-2006 Ian Kent <[email protected]> | ||
/* | ||
* Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved | ||
* Copyright 1999-2000 Jeremy Fitzhardinge <[email protected]> | ||
* Copyright 2001-2006 Ian Kent <[email protected]> | ||
* | ||
* This file is part of the Linux kernel and is made available under | ||
* the terms of the GNU General Public License, version 2, or at your | ||
* option, any later version, incorporated herein by reference. | ||
* | ||
* ------------------------------------------------------------------------- */ | ||
*/ | ||
|
||
#include "autofs_i.h" | ||
|
||
static unsigned long now; | ||
|
||
/* Check if a dentry can be expired */ | ||
static inline int autofs4_can_expire(struct dentry *dentry, | ||
unsigned long timeout, int do_now) | ||
unsigned long timeout, int do_now) | ||
{ | ||
struct autofs_info *ino = autofs4_dentry_ino(dentry); | ||
|
||
|
@@ -58,7 +54,9 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) | |
|
||
/* Update the expiry counter if fs is busy */ | ||
if (!may_umount_tree(path.mnt)) { | ||
struct autofs_info *ino = autofs4_dentry_ino(top); | ||
struct autofs_info *ino; | ||
|
||
ino = autofs4_dentry_ino(top); | ||
ino->last_used = jiffies; | ||
goto done; | ||
} | ||
|
@@ -74,7 +72,7 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) | |
* Calculate and dget next entry in the subdirs list under root. | ||
*/ | ||
static struct dentry *get_next_positive_subdir(struct dentry *prev, | ||
struct dentry *root) | ||
struct dentry *root) | ||
{ | ||
struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); | ||
struct list_head *next; | ||
|
@@ -121,7 +119,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, | |
* Calculate and dget next entry in top down tree traversal. | ||
*/ | ||
static struct dentry *get_next_positive_dentry(struct dentry *prev, | ||
struct dentry *root) | ||
struct dentry *root) | ||
{ | ||
struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); | ||
struct list_head *next; | ||
|
@@ -187,15 +185,17 @@ static struct dentry *get_next_positive_dentry(struct dentry *prev, | |
* autofs submounts. | ||
*/ | ||
static int autofs4_direct_busy(struct vfsmount *mnt, | ||
struct dentry *top, | ||
unsigned long timeout, | ||
int do_now) | ||
struct dentry *top, | ||
unsigned long timeout, | ||
int do_now) | ||
{ | ||
DPRINTK("top %p %pd", top, top); | ||
|
||
/* If it's busy update the expiry counters */ | ||
if (!may_umount_tree(mnt)) { | ||
struct autofs_info *ino = autofs4_dentry_ino(top); | ||
struct autofs_info *ino; | ||
|
||
ino = autofs4_dentry_ino(top); | ||
if (ino) | ||
ino->last_used = jiffies; | ||
return 1; | ||
|
@@ -208,7 +208,8 @@ static int autofs4_direct_busy(struct vfsmount *mnt, | |
return 0; | ||
} | ||
|
||
/* Check a directory tree of mount points for busyness | ||
/* | ||
* Check a directory tree of mount points for busyness | ||
* The tree is not busy iff no mountpoints are busy | ||
*/ | ||
static int autofs4_tree_busy(struct vfsmount *mnt, | ||
|
@@ -404,6 +405,7 @@ static struct dentry *should_expire(struct dentry *dentry, | |
} else { | ||
/* Path walk currently on this dentry? */ | ||
struct dentry *expired; | ||
|
||
ino_count = atomic_read(&ino->count) + 1; | ||
if (d_count(dentry) > ino_count) | ||
return NULL; | ||
|
@@ -522,29 +524,30 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) | |
|
||
/* Perform an expiry operation */ | ||
int autofs4_expire_run(struct super_block *sb, | ||
struct vfsmount *mnt, | ||
struct autofs_sb_info *sbi, | ||
struct autofs_packet_expire __user *pkt_p) | ||
struct vfsmount *mnt, | ||
struct autofs_sb_info *sbi, | ||
struct autofs_packet_expire __user *pkt_p) | ||
{ | ||
struct autofs_packet_expire pkt; | ||
struct autofs_info *ino; | ||
struct dentry *dentry; | ||
int ret = 0; | ||
|
||
memset(&pkt,0,sizeof pkt); | ||
memset(&pkt, 0, sizeof(pkt)); | ||
|
||
pkt.hdr.proto_version = sbi->version; | ||
pkt.hdr.type = autofs_ptype_expire; | ||
|
||
if ((dentry = autofs4_expire_indirect(sb, mnt, sbi, 0)) == NULL) | ||
dentry = autofs4_expire_indirect(sb, mnt, sbi, 0); | ||
if (!dentry) | ||
return -EAGAIN; | ||
|
||
pkt.len = dentry->d_name.len; | ||
memcpy(pkt.name, dentry->d_name.name, pkt.len); | ||
pkt.name[pkt.len] = '\0'; | ||
dput(dentry); | ||
|
||
if ( copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)) ) | ||
if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire))) | ||
ret = -EFAULT; | ||
|
||
spin_lock(&sbi->fs_lock); | ||
|
@@ -573,7 +576,8 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, | |
struct autofs_info *ino = autofs4_dentry_ino(dentry); | ||
|
||
/* This is synchronous because it makes the daemon a | ||
little easier */ | ||
* little easier | ||
*/ | ||
ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); | ||
|
||
spin_lock(&sbi->fs_lock); | ||
|
@@ -588,8 +592,10 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, | |
return ret; | ||
} | ||
|
||
/* Call repeatedly until it returns -EAGAIN, meaning there's nothing | ||
more to be done */ | ||
/* | ||
* Call repeatedly until it returns -EAGAIN, meaning there's nothing | ||
* more to be done. | ||
*/ | ||
int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt, | ||
struct autofs_sb_info *sbi, int __user *arg) | ||
{ | ||
|
Oops, something went wrong.