blob: db61e51bb154747a949e63788c7bdd3e9765ffd2 [file] [log] [blame]
Trond Myklebusta72b4422006-01-03 09:55:41 +01001/*
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>
Trond Myklebust58df0952006-01-03 09:55:57 +010014#include <linux/nfs_idmap.h>
Trond Myklebust51d8fa62006-06-09 09:34:20 -040015#include <linux/nfs_fs.h>
Trond Myklebusta72b4422006-01-03 09:55:41 +010016
17#include "callback.h"
18
19static const int nfs_set_port_min = 0;
20static const int nfs_set_port_max = 65535;
21static struct ctl_table_header *nfs_callback_sysctl_table;
22/*
23 * Something that isn't CTL_ANY, CTL_NONE or a value that may clash.
24 * Use the same values as fs/lockd/svc.c
25 */
26#define CTL_UNNUMBERED -2
27
28static ctl_table nfs_cb_sysctls[] = {
29#ifdef CONFIG_NFS_V4
30 {
31 .ctl_name = CTL_UNNUMBERED,
32 .procname = "nfs_callback_tcpport",
33 .data = &nfs_callback_set_tcpport,
34 .maxlen = sizeof(int),
35 .mode = 0644,
36 .proc_handler = &proc_dointvec_minmax,
37 .extra1 = (int *)&nfs_set_port_min,
38 .extra2 = (int *)&nfs_set_port_max,
39 },
Trond Myklebust58df0952006-01-03 09:55:57 +010040 {
41 .ctl_name = CTL_UNNUMBERED,
42 .procname = "idmap_cache_timeout",
43 .data = &nfs_idmap_cache_timeout,
44 .maxlen = sizeof(int),
45 .mode = 0644,
46 .proc_handler = &proc_dointvec_jiffies,
47 .strategy = &sysctl_jiffies,
48 },
Trond Myklebusta72b4422006-01-03 09:55:41 +010049#endif
Trond Myklebust51d8fa62006-06-09 09:34:20 -040050 {
51 .ctl_name = CTL_UNNUMBERED,
52 .procname = "nfs_mountpoint_timeout",
53 .data = &nfs_mountpoint_expiry_timeout,
54 .maxlen = sizeof(nfs_mountpoint_expiry_timeout),
55 .mode = 0644,
56 .proc_handler = &proc_dointvec_jiffies,
57 .strategy = &sysctl_jiffies,
58 },
Trond Myklebusta72b4422006-01-03 09:55:41 +010059 { .ctl_name = 0 }
60};
61
62static ctl_table nfs_cb_sysctl_dir[] = {
63 {
64 .ctl_name = CTL_UNNUMBERED,
65 .procname = "nfs",
66 .mode = 0555,
67 .child = nfs_cb_sysctls,
68 },
69 { .ctl_name = 0 }
70};
71
72static ctl_table nfs_cb_sysctl_root[] = {
73 {
74 .ctl_name = CTL_FS,
75 .procname = "fs",
76 .mode = 0555,
77 .child = nfs_cb_sysctl_dir,
78 },
79 { .ctl_name = 0 }
80};
81
82int nfs_register_sysctl(void)
83{
84 nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root, 0);
85 if (nfs_callback_sysctl_table == NULL)
86 return -ENOMEM;
87 return 0;
88}
89
90void nfs_unregister_sysctl(void)
91{
92 unregister_sysctl_table(nfs_callback_sysctl_table);
93 nfs_callback_sysctl_table = NULL;
94}