提交 fd39ca9a 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] knfsd: nfsd4: make needlessly global code static

This patch contains the following possible cleanups:

- make needlessly global code static
Signed-off-by: NAdrian Bunk <bunk@stusta.de>
Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: NNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a76b4319
...@@ -125,7 +125,7 @@ static short ace2type(struct nfs4_ace *); ...@@ -125,7 +125,7 @@ static short ace2type(struct nfs4_ace *);
static int _posix_to_nfsv4_one(struct posix_acl *, struct nfs4_acl *, unsigned int); static int _posix_to_nfsv4_one(struct posix_acl *, struct nfs4_acl *, unsigned int);
static struct posix_acl *_nfsv4_to_posix_one(struct nfs4_acl *, unsigned int); static struct posix_acl *_nfsv4_to_posix_one(struct nfs4_acl *, unsigned int);
int nfs4_acl_add_ace(struct nfs4_acl *, u32, u32, u32, int, uid_t); int nfs4_acl_add_ace(struct nfs4_acl *, u32, u32, u32, int, uid_t);
int nfs4_acl_split(struct nfs4_acl *, struct nfs4_acl *); static int nfs4_acl_split(struct nfs4_acl *, struct nfs4_acl *);
struct nfs4_acl * struct nfs4_acl *
nfs4_acl_posix_to_nfsv4(struct posix_acl *pacl, struct posix_acl *dpacl, nfs4_acl_posix_to_nfsv4(struct posix_acl *pacl, struct posix_acl *dpacl,
...@@ -775,7 +775,7 @@ _nfsv4_to_posix_one(struct nfs4_acl *n4acl, unsigned int flags) ...@@ -775,7 +775,7 @@ _nfsv4_to_posix_one(struct nfs4_acl *n4acl, unsigned int flags)
return pacl; return pacl;
} }
int static int
nfs4_acl_split(struct nfs4_acl *acl, struct nfs4_acl *dacl) nfs4_acl_split(struct nfs4_acl *acl, struct nfs4_acl *dacl)
{ {
struct list_head *h, *n; struct list_head *h, *n;
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
/* declarations */ /* declarations */
static void nfs4_cb_null(struct rpc_task *task); static void nfs4_cb_null(struct rpc_task *task);
extern spinlock_t recall_lock;
/* Index of predefined Linux callback client operations */ /* Index of predefined Linux callback client operations */
...@@ -329,12 +328,12 @@ nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, u32 *p) ...@@ -329,12 +328,12 @@ nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, u32 *p)
.p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \ .p_bufsiz = MAX(NFS4_##argtype##_sz,NFS4_##restype##_sz) << 2, \
} }
struct rpc_procinfo nfs4_cb_procedures[] = { static struct rpc_procinfo nfs4_cb_procedures[] = {
PROC(CB_NULL, NULL, enc_cb_null, dec_cb_null), PROC(CB_NULL, NULL, enc_cb_null, dec_cb_null),
PROC(CB_RECALL, COMPOUND, enc_cb_recall, dec_cb_recall), PROC(CB_RECALL, COMPOUND, enc_cb_recall, dec_cb_recall),
}; };
struct rpc_version nfs_cb_version4 = { static struct rpc_version nfs_cb_version4 = {
.number = 1, .number = 1,
.nrprocs = sizeof(nfs4_cb_procedures)/sizeof(nfs4_cb_procedures[0]), .nrprocs = sizeof(nfs4_cb_procedures)/sizeof(nfs4_cb_procedures[0]),
.procs = nfs4_cb_procedures .procs = nfs4_cb_procedures
...@@ -348,7 +347,7 @@ static struct rpc_version * nfs_cb_version[] = { ...@@ -348,7 +347,7 @@ static struct rpc_version * nfs_cb_version[] = {
/* /*
* Use the SETCLIENTID credential * Use the SETCLIENTID credential
*/ */
struct rpc_cred * static struct rpc_cred *
nfsd4_lookupcred(struct nfs4_client *clp, int taskflags) nfsd4_lookupcred(struct nfs4_client *clp, int taskflags)
{ {
struct auth_cred acred; struct auth_cred acred;
......
...@@ -104,7 +104,7 @@ ent_update(struct ent *new, struct ent *itm) ...@@ -104,7 +104,7 @@ ent_update(struct ent *new, struct ent *itm)
ent_init(new, itm); ent_init(new, itm);
} }
void static void
ent_put(struct cache_head *ch, struct cache_detail *cd) ent_put(struct cache_head *ch, struct cache_detail *cd)
{ {
if (cache_put(ch, cd)) { if (cache_put(ch, cd)) {
...@@ -186,7 +186,7 @@ warn_no_idmapd(struct cache_detail *detail) ...@@ -186,7 +186,7 @@ warn_no_idmapd(struct cache_detail *detail)
static int idtoname_parse(struct cache_detail *, char *, int); static int idtoname_parse(struct cache_detail *, char *, int);
static struct ent *idtoname_lookup(struct ent *, int); static struct ent *idtoname_lookup(struct ent *, int);
struct cache_detail idtoname_cache = { static struct cache_detail idtoname_cache = {
.hash_size = ENT_HASHMAX, .hash_size = ENT_HASHMAX,
.hash_table = idtoname_table, .hash_table = idtoname_table,
.name = "nfs4.idtoname", .name = "nfs4.idtoname",
...@@ -277,7 +277,7 @@ nametoid_hash(struct ent *ent) ...@@ -277,7 +277,7 @@ nametoid_hash(struct ent *ent)
return hash_str(ent->name, ENT_HASHBITS); return hash_str(ent->name, ENT_HASHBITS);
} }
void static void
nametoid_request(struct cache_detail *cd, struct cache_head *ch, char **bpp, nametoid_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
int *blen) int *blen)
{ {
...@@ -317,9 +317,9 @@ nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h) ...@@ -317,9 +317,9 @@ nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
} }
static struct ent *nametoid_lookup(struct ent *, int); static struct ent *nametoid_lookup(struct ent *, int);
int nametoid_parse(struct cache_detail *, char *, int); static int nametoid_parse(struct cache_detail *, char *, int);
struct cache_detail nametoid_cache = { static struct cache_detail nametoid_cache = {
.hash_size = ENT_HASHMAX, .hash_size = ENT_HASHMAX,
.hash_table = nametoid_table, .hash_table = nametoid_table,
.name = "nfs4.nametoid", .name = "nfs4.nametoid",
...@@ -330,7 +330,7 @@ struct cache_detail nametoid_cache = { ...@@ -330,7 +330,7 @@ struct cache_detail nametoid_cache = {
.warn_no_listener = warn_no_idmapd, .warn_no_listener = warn_no_idmapd,
}; };
int static int
nametoid_parse(struct cache_detail *cd, char *buf, int buflen) nametoid_parse(struct cache_detail *cd, char *buf, int buflen)
{ {
struct ent ent, *res; struct ent ent, *res;
......
...@@ -54,18 +54,21 @@ ...@@ -54,18 +54,21 @@
/* Globals */ /* Globals */
static time_t lease_time = 90; /* default lease time */ static time_t lease_time = 90; /* default lease time */
static time_t user_lease_time = 90; static time_t user_lease_time = 90;
time_t boot_time; static time_t boot_time;
static int in_grace = 1; static int in_grace = 1;
static u32 current_clientid = 1; static u32 current_clientid = 1;
static u32 current_ownerid = 1; static u32 current_ownerid = 1;
static u32 current_fileid = 1; static u32 current_fileid = 1;
static u32 current_delegid = 1; static u32 current_delegid = 1;
static u32 nfs4_init; static u32 nfs4_init;
stateid_t zerostateid; /* bits all 0 */ static stateid_t zerostateid; /* bits all 0 */
stateid_t onestateid; /* bits all 1 */ static stateid_t onestateid; /* bits all 1 */
#define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
/* forward declarations */ /* forward declarations */
struct nfs4_stateid * find_stateid(stateid_t *stid, int flags); static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags);
static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid);
static void release_stateid_lockowners(struct nfs4_stateid *open_stp); static void release_stateid_lockowners(struct nfs4_stateid *open_stp);
...@@ -77,10 +80,10 @@ static void release_stateid_lockowners(struct nfs4_stateid *open_stp); ...@@ -77,10 +80,10 @@ static void release_stateid_lockowners(struct nfs4_stateid *open_stp);
*/ */
static DECLARE_MUTEX(client_sema); static DECLARE_MUTEX(client_sema);
kmem_cache_t *stateowner_slab = NULL; static kmem_cache_t *stateowner_slab = NULL;
kmem_cache_t *file_slab = NULL; static kmem_cache_t *file_slab = NULL;
kmem_cache_t *stateid_slab = NULL; static kmem_cache_t *stateid_slab = NULL;
kmem_cache_t *deleg_slab = NULL; static kmem_cache_t *deleg_slab = NULL;
void void
nfs4_lock_state(void) nfs4_lock_state(void)
...@@ -116,7 +119,7 @@ static void release_stateid(struct nfs4_stateid *stp, int flags); ...@@ -116,7 +119,7 @@ static void release_stateid(struct nfs4_stateid *stp, int flags);
*/ */
/* recall_lock protects the del_recall_lru */ /* recall_lock protects the del_recall_lru */
spinlock_t recall_lock = SPIN_LOCK_UNLOCKED; static spinlock_t recall_lock = SPIN_LOCK_UNLOCKED;
static struct list_head del_recall_lru; static struct list_head del_recall_lru;
static void static void
...@@ -456,7 +459,7 @@ check_name(struct xdr_netobj name) { ...@@ -456,7 +459,7 @@ check_name(struct xdr_netobj name) {
return 1; return 1;
} }
void static void
add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval) add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval)
{ {
unsigned int idhashval; unsigned int idhashval;
...@@ -468,7 +471,7 @@ add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval) ...@@ -468,7 +471,7 @@ add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval)
clp->cl_time = get_seconds(); clp->cl_time = get_seconds();
} }
void static void
move_to_confirmed(struct nfs4_client *clp) move_to_confirmed(struct nfs4_client *clp)
{ {
unsigned int idhashval = clientid_hashval(clp->cl_clientid.cl_id); unsigned int idhashval = clientid_hashval(clp->cl_clientid.cl_id);
...@@ -567,7 +570,7 @@ parse_octet(unsigned int *lenp, char **addrp) ...@@ -567,7 +570,7 @@ parse_octet(unsigned int *lenp, char **addrp)
} }
/* parse and set the setclientid ipv4 callback address */ /* parse and set the setclientid ipv4 callback address */
int static int
parse_ipv4(unsigned int addr_len, char *addr_val, unsigned int *cbaddrp, unsigned short *cbportp) parse_ipv4(unsigned int addr_len, char *addr_val, unsigned int *cbaddrp, unsigned short *cbportp)
{ {
int temp = 0; int temp = 0;
...@@ -603,7 +606,7 @@ parse_ipv4(unsigned int addr_len, char *addr_val, unsigned int *cbaddrp, unsigne ...@@ -603,7 +606,7 @@ parse_ipv4(unsigned int addr_len, char *addr_val, unsigned int *cbaddrp, unsigne
return 1; return 1;
} }
void static void
gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se) gen_callback(struct nfs4_client *clp, struct nfsd4_setclientid *se)
{ {
struct nfs4_callback *cb = &clp->cl_callback; struct nfs4_callback *cb = &clp->cl_callback;
...@@ -1186,7 +1189,7 @@ release_stateid(struct nfs4_stateid *stp, int flags) ...@@ -1186,7 +1189,7 @@ release_stateid(struct nfs4_stateid *stp, int flags)
stp = NULL; stp = NULL;
} }
void static void
move_to_close_lru(struct nfs4_stateowner *sop) move_to_close_lru(struct nfs4_stateowner *sop)
{ {
dprintk("NFSD: move_to_close_lru nfs4_stateowner %p\n", sop); dprintk("NFSD: move_to_close_lru nfs4_stateowner %p\n", sop);
...@@ -1196,7 +1199,7 @@ move_to_close_lru(struct nfs4_stateowner *sop) ...@@ -1196,7 +1199,7 @@ move_to_close_lru(struct nfs4_stateowner *sop)
sop->so_time = get_seconds(); sop->so_time = get_seconds();
} }
void static void
release_state_owner(struct nfs4_stateid *stp, int flag) release_state_owner(struct nfs4_stateid *stp, int flag)
{ {
struct nfs4_stateowner *sop = stp->st_stateowner; struct nfs4_stateowner *sop = stp->st_stateowner;
...@@ -1250,7 +1253,7 @@ find_file(struct inode *ino) ...@@ -1250,7 +1253,7 @@ find_file(struct inode *ino)
#define TEST_ACCESS(x) ((x > 0 || x < 4)?1:0) #define TEST_ACCESS(x) ((x > 0 || x < 4)?1:0)
#define TEST_DENY(x) ((x >= 0 || x < 5)?1:0) #define TEST_DENY(x) ((x >= 0 || x < 5)?1:0)
void static void
set_access(unsigned int *access, unsigned long bmap) { set_access(unsigned int *access, unsigned long bmap) {
int i; int i;
...@@ -1261,7 +1264,7 @@ set_access(unsigned int *access, unsigned long bmap) { ...@@ -1261,7 +1264,7 @@ set_access(unsigned int *access, unsigned long bmap) {
} }
} }
void static void
set_deny(unsigned int *deny, unsigned long bmap) { set_deny(unsigned int *deny, unsigned long bmap) {
int i; int i;
...@@ -1287,7 +1290,7 @@ test_share(struct nfs4_stateid *stp, struct nfsd4_open *open) { ...@@ -1287,7 +1290,7 @@ test_share(struct nfs4_stateid *stp, struct nfsd4_open *open) {
* Called to check deny when READ with all zero stateid or * Called to check deny when READ with all zero stateid or
* WRITE with all zero or all one stateid * WRITE with all zero or all one stateid
*/ */
int static int
nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type) nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
{ {
struct inode *ino = current_fh->fh_dentry->d_inode; struct inode *ino = current_fh->fh_dentry->d_inode;
...@@ -1442,7 +1445,7 @@ int nfsd_change_deleg_cb(struct file_lock **onlist, int arg) ...@@ -1442,7 +1445,7 @@ int nfsd_change_deleg_cb(struct file_lock **onlist, int arg)
return -EAGAIN; return -EAGAIN;
} }
struct lock_manager_operations nfsd_lease_mng_ops = { static struct lock_manager_operations nfsd_lease_mng_ops = {
.fl_break = nfsd_break_deleg_cb, .fl_break = nfsd_break_deleg_cb,
.fl_release_private = nfsd_release_deleg_cb, .fl_release_private = nfsd_release_deleg_cb,
.fl_copy_lock = nfsd_copy_lock_deleg_cb, .fl_copy_lock = nfsd_copy_lock_deleg_cb,
...@@ -1915,7 +1918,7 @@ end_grace(void) ...@@ -1915,7 +1918,7 @@ end_grace(void)
in_grace = 0; in_grace = 0;
} }
time_t static time_t
nfs4_laundromat(void) nfs4_laundromat(void)
{ {
struct nfs4_client *clp; struct nfs4_client *clp;
...@@ -1996,7 +1999,7 @@ laundromat_main(void *not_used) ...@@ -1996,7 +1999,7 @@ laundromat_main(void *not_used)
/* search ownerid_hashtbl[] and close_lru for stateid owner /* search ownerid_hashtbl[] and close_lru for stateid owner
* (stateid->si_stateownerid) * (stateid->si_stateownerid)
*/ */
struct nfs4_stateowner * static struct nfs4_stateowner *
find_openstateowner_id(u32 st_id, int flags) { find_openstateowner_id(u32 st_id, int flags) {
struct nfs4_stateowner *local = NULL; struct nfs4_stateowner *local = NULL;
...@@ -2170,7 +2173,7 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl ...@@ -2170,7 +2173,7 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl
/* /*
* Checks for sequence id mutating operations. * Checks for sequence id mutating operations.
*/ */
int static int
nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, clientid_t *lockclid) nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, clientid_t *lockclid)
{ {
int status; int status;
...@@ -2486,7 +2489,7 @@ static struct list_head lock_ownerid_hashtbl[LOCK_HASH_SIZE]; ...@@ -2486,7 +2489,7 @@ static struct list_head lock_ownerid_hashtbl[LOCK_HASH_SIZE];
static struct list_head lock_ownerstr_hashtbl[LOCK_HASH_SIZE]; static struct list_head lock_ownerstr_hashtbl[LOCK_HASH_SIZE];
static struct list_head lockstateid_hashtbl[STATEID_HASH_SIZE]; static struct list_head lockstateid_hashtbl[STATEID_HASH_SIZE];
struct nfs4_stateid * static struct nfs4_stateid *
find_stateid(stateid_t *stid, int flags) find_stateid(stateid_t *stid, int flags)
{ {
struct nfs4_stateid *local = NULL; struct nfs4_stateid *local = NULL;
...@@ -2550,7 +2553,7 @@ nfs4_transform_lock_offset(struct file_lock *lock) ...@@ -2550,7 +2553,7 @@ nfs4_transform_lock_offset(struct file_lock *lock)
lock->fl_end = OFFSET_MAX; lock->fl_end = OFFSET_MAX;
} }
int static int
nfs4_verify_lock_stateowner(struct nfs4_stateowner *sop, unsigned int hashval) nfs4_verify_lock_stateowner(struct nfs4_stateowner *sop, unsigned int hashval)
{ {
struct nfs4_stateowner *local = NULL; struct nfs4_stateowner *local = NULL;
...@@ -2660,7 +2663,7 @@ alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, str ...@@ -2660,7 +2663,7 @@ alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, str
return sop; return sop;
} }
struct nfs4_stateid * static struct nfs4_stateid *
alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struct nfs4_stateid *open_stp) alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struct nfs4_stateid *open_stp)
{ {
struct nfs4_stateid *stp; struct nfs4_stateid *stp;
...@@ -2691,7 +2694,7 @@ alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struc ...@@ -2691,7 +2694,7 @@ alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struc
return stp; return stp;
} }
int static int
check_lock_length(u64 offset, u64 length) check_lock_length(u64 offset, u64 length)
{ {
return ((length == 0) || ((length != ~(u64)0) && return ((length == 0) || ((length != ~(u64)0) &&
...@@ -3149,7 +3152,7 @@ nfs4_release_reclaim(void) ...@@ -3149,7 +3152,7 @@ nfs4_release_reclaim(void)
/* /*
* called from OPEN, CLAIM_PREVIOUS with a new clientid. */ * called from OPEN, CLAIM_PREVIOUS with a new clientid. */
struct nfs4_client_reclaim * static struct nfs4_client_reclaim *
nfs4_find_reclaim_client(clientid_t *clid) nfs4_find_reclaim_client(clientid_t *clid)
{ {
unsigned int strhashval; unsigned int strhashval;
......
...@@ -136,7 +136,7 @@ xdr_error: \ ...@@ -136,7 +136,7 @@ xdr_error: \
} \ } \
} while (0) } while (0)
u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
{ {
/* We want more bytes than seem to be available. /* We want more bytes than seem to be available.
* Maybe we need a new page, maybe we have just run out * Maybe we need a new page, maybe we have just run out
...@@ -190,7 +190,7 @@ defer_free(struct nfsd4_compoundargs *argp, ...@@ -190,7 +190,7 @@ defer_free(struct nfsd4_compoundargs *argp,
return 0; return 0;
} }
char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes) static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes)
{ {
void *new = NULL; void *new = NULL;
if (p == argp->tmp) { if (p == argp->tmp) {
......
...@@ -61,11 +61,6 @@ typedef struct { ...@@ -61,11 +61,6 @@ typedef struct {
#define si_stateownerid si_opaque.so_stateownerid #define si_stateownerid si_opaque.so_stateownerid
#define si_fileid si_opaque.so_fileid #define si_fileid si_opaque.so_fileid
extern stateid_t zerostateid;
extern stateid_t onestateid;
#define ZERO_STATEID(stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))
#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
struct nfs4_cb_recall { struct nfs4_cb_recall {
u32 cbr_ident; u32 cbr_ident;
...@@ -271,12 +266,9 @@ struct nfs4_stateid { ...@@ -271,12 +266,9 @@ struct nfs4_stateid {
((err) != nfserr_stale_stateid) && \ ((err) != nfserr_stale_stateid) && \
((err) != nfserr_bad_stateid)) ((err) != nfserr_bad_stateid))
extern time_t nfs4_laundromat(void);
extern int nfsd4_renew(clientid_t *clid); extern int nfsd4_renew(clientid_t *clid);
extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh, extern int nfs4_preprocess_stateid_op(struct svc_fh *current_fh,
stateid_t *stateid, int flags, struct file **filp); stateid_t *stateid, int flags, struct file **filp);
extern int nfs4_share_conflict(struct svc_fh *current_fh,
unsigned int deny_type);
extern void nfs4_lock_state(void); extern void nfs4_lock_state(void);
extern void nfs4_unlock_state(void); extern void nfs4_unlock_state(void);
extern int nfs4_in_grace(void); extern int nfs4_in_grace(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册