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