]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - fs/nfs/sysctl.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mirror_ubuntu-bionic-kernel.git] / fs / nfs / sysctl.c
CommitLineData
a72b4422
TM
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>
58df095b 14#include <linux/nfs_idmap.h>
51d8fa6a 15#include <linux/nfs_fs.h>
a72b4422
TM
16
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 },
58df095b
TM
40 {
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 },
a72b4422 49#endif
51d8fa6a
TM
50 {
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 },
a72b4422
TM
59 { .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}