aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/sysctl.c
diff options
context:
space:
mode:
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}