aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-08-22 20:06:07 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:24:30 -0400
commit7d4e2747a0412583526a162fbbd6edeeafcceb08 (patch)
tree756180b37a02b504998c646ff027652f80e10bab /fs/nfs
parent770bfad846ab6628444428467b11fa6773ae9ea1 (diff)
NFS: Fix up split of fs/nfs/inode.c
Fix ups for the splitting of the superblock stuff out of fs/nfs/inode.c, including: (*) Move the callback tcpport module param into callback.c. (*) Move the idmap cache timeout module param into idmap.c. (*) Changes to internal.h: (*) namespace-nfs4.c was renamed to nfs4namespace.c. (*) nfs_stat_to_errno() is in nfs2xdr.c, not nfs4xdr.c. (*) nfs4xdr.c is contingent on CONFIG_NFS_V4. (*) nfs4_path() is only uses if CONFIG_NFS_V4 is set. Plus also: (*) The sec_flavours[] table should really be const. Signed-Off-By: David Howells <dhowells@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/callback.c15
-rw-r--r--fs/nfs/idmap.c14
-rw-r--r--fs/nfs/internal.h12
-rw-r--r--fs/nfs/super.c40
4 files changed, 39 insertions, 42 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index fe0a6b8ac149..d6c4bae14bb9 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -36,6 +36,21 @@ static struct svc_program nfs4_callback_program;
36 36
37unsigned int nfs_callback_set_tcpport; 37unsigned int nfs_callback_set_tcpport;
38unsigned short nfs_callback_tcpport; 38unsigned short nfs_callback_tcpport;
39static const int nfs_set_port_min = 0;
40static const int nfs_set_port_max = 65535;
41
42static int param_set_port(const char *val, struct kernel_param *kp)
43{
44 char *endp;
45 int num = simple_strtol(val, &endp, 0);
46 if (endp == val || *endp || num < nfs_set_port_min || num > nfs_set_port_max)
47 return -EINVAL;
48 *((int *)kp->arg) = num;
49 return 0;
50}
51
52module_param_call(callback_tcpport, param_set_port, param_get_int,
53 &nfs_callback_set_tcpport, 0644);
39 54
40/* 55/*
41 * This is the callback kernel thread. 56 * This is the callback kernel thread.
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 07a5dd57646e..873deb96a6cd 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -57,6 +57,20 @@
57/* Default cache timeout is 10 minutes */ 57/* Default cache timeout is 10 minutes */
58unsigned int nfs_idmap_cache_timeout = 600 * HZ; 58unsigned int nfs_idmap_cache_timeout = 600 * HZ;
59 59
60static int param_set_idmap_timeout(const char *val, struct kernel_param *kp)
61{
62 char *endp;
63 int num = simple_strtol(val, &endp, 0);
64 int jif = num * HZ;
65 if (endp == val || *endp || num < 0 || jif < num)
66 return -EINVAL;
67 *((int *)kp->arg) = jif;
68 return 0;
69}
70
71module_param_call(idmap_cache_timeout, param_set_idmap_timeout, param_get_int,
72 &nfs_idmap_cache_timeout, 0644);
73
60struct idmap_hashent { 74struct idmap_hashent {
61 unsigned long ih_expires; 75 unsigned long ih_expires;
62 __u32 ih_id; 76 __u32 ih_id;
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 660e9ff5341c..4802157963f8 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -15,7 +15,7 @@ struct nfs_clone_mount {
15 rpc_authflavor_t authflavor; 15 rpc_authflavor_t authflavor;
16}; 16};
17 17
18/* namespace-nfs4.c */ 18/* nfs4namespace.c */
19#ifdef CONFIG_NFS_V4 19#ifdef CONFIG_NFS_V4
20extern struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry); 20extern struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry);
21#else 21#else
@@ -46,6 +46,7 @@ extern void nfs_destroy_directcache(void);
46#endif 46#endif
47 47
48/* nfs2xdr.c */ 48/* nfs2xdr.c */
49extern int nfs_stat_to_errno(int);
49extern struct rpc_procinfo nfs_procedures[]; 50extern struct rpc_procinfo nfs_procedures[];
50extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); 51extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int);
51 52
@@ -54,8 +55,9 @@ extern struct rpc_procinfo nfs3_procedures[];
54extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); 55extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int);
55 56
56/* nfs4xdr.c */ 57/* nfs4xdr.c */
57extern int nfs_stat_to_errno(int); 58#ifdef CONFIG_NFS_V4
58extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); 59extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus);
60#endif
59 61
60/* nfs4proc.c */ 62/* nfs4proc.c */
61#ifdef CONFIG_NFS_V4 63#ifdef CONFIG_NFS_V4
@@ -97,15 +99,13 @@ extern char *nfs_path(const char *base, const struct dentry *dentry,
97/* 99/*
98 * Determine the mount path as a string 100 * Determine the mount path as a string
99 */ 101 */
102#ifdef CONFIG_NFS_V4
100static inline char * 103static inline char *
101nfs4_path(const struct dentry *dentry, char *buffer, ssize_t buflen) 104nfs4_path(const struct dentry *dentry, char *buffer, ssize_t buflen)
102{ 105{
103#ifdef CONFIG_NFS_V4
104 return nfs_path(NFS_SB(dentry->d_sb)->mnt_path, dentry, buffer, buflen); 106 return nfs_path(NFS_SB(dentry->d_sb)->mnt_path, dentry, buffer, buflen);
105#else
106 return NULL;
107#endif
108} 107}
108#endif
109 109
110/* 110/*
111 * Determine the device name as a string 111 * Determine the device name as a string
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 06c321beacfe..63497345806b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -187,40 +187,6 @@ static struct super_operations nfs4_sops = {
187}; 187};
188#endif 188#endif
189 189
190#ifdef CONFIG_NFS_V4
191static const int nfs_set_port_min = 0;
192static const int nfs_set_port_max = 65535;
193
194static int param_set_port(const char *val, struct kernel_param *kp)
195{
196 char *endp;
197 int num = simple_strtol(val, &endp, 0);
198 if (endp == val || *endp || num < nfs_set_port_min || num > nfs_set_port_max)
199 return -EINVAL;
200 *((int *)kp->arg) = num;
201 return 0;
202}
203
204module_param_call(callback_tcpport, param_set_port, param_get_int,
205 &nfs_callback_set_tcpport, 0644);
206#endif
207
208#ifdef CONFIG_NFS_V4
209static int param_set_idmap_timeout(const char *val, struct kernel_param *kp)
210{
211 char *endp;
212 int num = simple_strtol(val, &endp, 0);
213 int jif = num * HZ;
214 if (endp == val || *endp || num < 0 || jif < num)
215 return -EINVAL;
216 *((int *)kp->arg) = jif;
217 return 0;
218}
219
220module_param_call(idmap_cache_timeout, param_set_idmap_timeout, param_get_int,
221 &nfs_idmap_cache_timeout, 0644);
222#endif
223
224static struct shrinker *acl_shrinker; 190static struct shrinker *acl_shrinker;
225 191
226/* 192/*
@@ -328,9 +294,12 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
328 294
329} 295}
330 296
297/*
298 * Map the security flavour number to a name
299 */
331static const char *nfs_pseudoflavour_to_name(rpc_authflavor_t flavour) 300static const char *nfs_pseudoflavour_to_name(rpc_authflavor_t flavour)
332{ 301{
333 static struct { 302 static const struct {
334 rpc_authflavor_t flavour; 303 rpc_authflavor_t flavour;
335 const char *str; 304 const char *str;
336 } sec_flavours[] = { 305 } sec_flavours[] = {
@@ -1368,7 +1337,6 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
1368 } 1337 }
1369 1338
1370 s = sget(fs_type, nfs4_compare_super, nfs_set_super, server); 1339 s = sget(fs_type, nfs4_compare_super, nfs_set_super, server);
1371
1372 if (IS_ERR(s)) { 1340 if (IS_ERR(s)) {
1373 error = PTR_ERR(s); 1341 error = PTR_ERR(s);
1374 goto out_free; 1342 goto out_free;