aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/sysctl.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-03 03:55:41 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:52 -0500
commita72b44222d222749d54b3e370d825094352e389f (patch)
treed64815b696d207927a4154a2cbc649552708c6f2 /fs/nfs/sysctl.c
parenta895b4a198dd06f8353328867e4f6cfd28b63081 (diff)
NFSv4: Allow user to set the port used by the NFSv4 callback channel
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/sysctl.c')
-rw-r--r--fs/nfs/sysctl.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c
new file mode 100644
index 000000000000..fdc64b59a4ee
--- /dev/null
+++ b/fs/nfs/sysctl.c
@@ -0,0 +1,74 @@
1/*
2 * linux/fs/nfs/sysctl.c
3 *
4 * Sysctl interface to NFS parameters
5 */
6#include <linux/config.h>
7#include <linux/types.h>
8#include <linux/linkage.h>
9#include <linux/ctype.h>
10#include <linux/fs.h>
11#include <linux/sysctl.h>
12#include <linux/module.h>
13#include <linux/nfs4.h>
14
15#include "callback.h"
16
17static const int nfs_set_port_min = 0;
18static const int nfs_set_port_max = 65535;
19static struct ctl_table_header *nfs_callback_sysctl_table;
20/*
21 * Something that isn't CTL_ANY, CTL_NONE or a value that may clash.
22 * Use the same values as fs/lockd/svc.c
23 */
24#define CTL_UNNUMBERED -2
25
26static ctl_table nfs_cb_sysctls[] = {
27#ifdef CONFIG_NFS_V4
28 {
29 .ctl_name = CTL_UNNUMBERED,
30 .procname = "nfs_callback_tcpport",
31 .data = &nfs_callback_set_tcpport,
32 .maxlen = sizeof(int),
33 .mode = 0644,
34 .proc_handler = &proc_dointvec_minmax,
35 .extra1 = (int *)&nfs_set_port_min,
36 .extra2 = (int *)&nfs_set_port_max,
37 },
38#endif
39 { .ctl_name = 0 }
40};
41
42static ctl_table nfs_cb_sysctl_dir[] = {
43 {
44 .ctl_name = CTL_UNNUMBERED,
45 .procname = "nfs",
46 .mode = 0555,
47 .child = nfs_cb_sysctls,
48 },
49 { .ctl_name = 0 }
50};
51
52static ctl_table nfs_cb_sysctl_root[] = {
53 {
54 .ctl_name = CTL_FS,
55 .procname = "fs",
56 .mode = 0555,
57 .child = nfs_cb_sysctl_dir,
58 },
59 { .ctl_name = 0 }
60};
61
62int nfs_register_sysctl(void)
63{
64 nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root, 0);
65 if (nfs_callback_sysctl_table == NULL)
66 return -ENOMEM;
67 return 0;
68}
69
70void nfs_unregister_sysctl(void)
71{
72 unregister_sysctl_table(nfs_callback_sysctl_table);
73 nfs_callback_sysctl_table = NULL;
74}