xref: /openbmc/linux/fs/nfs/sysctl.c (revision b2441318)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
2a72b4422STrond Myklebust /*
3a72b4422STrond Myklebust  * linux/fs/nfs/sysctl.c
4a72b4422STrond Myklebust  *
5a72b4422STrond Myklebust  * Sysctl interface to NFS parameters
6a72b4422STrond Myklebust  */
7a72b4422STrond Myklebust #include <linux/types.h>
8a72b4422STrond Myklebust #include <linux/linkage.h>
9a72b4422STrond Myklebust #include <linux/ctype.h>
10a72b4422STrond Myklebust #include <linux/fs.h>
11a72b4422STrond Myklebust #include <linux/sysctl.h>
12a72b4422STrond Myklebust #include <linux/module.h>
1351d8fa6aSTrond Myklebust #include <linux/nfs_fs.h>
14a72b4422STrond Myklebust 
15a72b4422STrond Myklebust static struct ctl_table_header *nfs_callback_sysctl_table;
16a72b4422STrond Myklebust 
17f5102e56SJoe Perches static struct ctl_table nfs_cb_sysctls[] = {
1851d8fa6aSTrond Myklebust 	{
1951d8fa6aSTrond Myklebust 		.procname	= "nfs_mountpoint_timeout",
2051d8fa6aSTrond Myklebust 		.data		= &nfs_mountpoint_expiry_timeout,
2151d8fa6aSTrond Myklebust 		.maxlen		= sizeof(nfs_mountpoint_expiry_timeout),
2251d8fa6aSTrond Myklebust 		.mode		= 0644,
236d456111SEric W. Biederman 		.proc_handler	= proc_dointvec_jiffies,
2451d8fa6aSTrond Myklebust 	},
2589a09141SPeter Zijlstra 	{
2689a09141SPeter Zijlstra 		.procname	= "nfs_congestion_kb",
2789a09141SPeter Zijlstra 		.data		= &nfs_congestion_kb,
2889a09141SPeter Zijlstra 		.maxlen		= sizeof(nfs_congestion_kb),
2989a09141SPeter Zijlstra 		.mode		= 0644,
306d456111SEric W. Biederman 		.proc_handler	= proc_dointvec,
3189a09141SPeter Zijlstra 	},
32ab09203eSEric W. Biederman 	{ }
33a72b4422STrond Myklebust };
34a72b4422STrond Myklebust 
35f5102e56SJoe Perches static struct ctl_table nfs_cb_sysctl_dir[] = {
36a72b4422STrond Myklebust 	{
37a72b4422STrond Myklebust 		.procname = "nfs",
38a72b4422STrond Myklebust 		.mode = 0555,
39a72b4422STrond Myklebust 		.child = nfs_cb_sysctls,
40a72b4422STrond Myklebust 	},
41ab09203eSEric W. Biederman 	{ }
42a72b4422STrond Myklebust };
43a72b4422STrond Myklebust 
44f5102e56SJoe Perches static struct ctl_table nfs_cb_sysctl_root[] = {
45a72b4422STrond Myklebust 	{
46a72b4422STrond Myklebust 		.procname = "fs",
47a72b4422STrond Myklebust 		.mode = 0555,
48a72b4422STrond Myklebust 		.child = nfs_cb_sysctl_dir,
49a72b4422STrond Myklebust 	},
50ab09203eSEric W. Biederman 	{ }
51a72b4422STrond Myklebust };
52a72b4422STrond Myklebust 
53a72b4422STrond Myklebust int nfs_register_sysctl(void)
54a72b4422STrond Myklebust {
550b4d4147SEric W. Biederman 	nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root);
56a72b4422STrond Myklebust 	if (nfs_callback_sysctl_table == NULL)
57a72b4422STrond Myklebust 		return -ENOMEM;
58a72b4422STrond Myklebust 	return 0;
59a72b4422STrond Myklebust }
60a72b4422STrond Myklebust 
61a72b4422STrond Myklebust void nfs_unregister_sysctl(void)
62a72b4422STrond Myklebust {
63a72b4422STrond Myklebust 	unregister_sysctl_table(nfs_callback_sysctl_table);
64a72b4422STrond Myklebust 	nfs_callback_sysctl_table = NULL;
65a72b4422STrond Myklebust }
66