blob: 7aea195ddb353772c736d2984f000231b3b51bee [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Trond Myklebusta72b4422006-01-03 09:55:41 +01002/*
3 * linux/fs/nfs/sysctl.c
4 *
5 * Sysctl interface to NFS parameters
6 */
Trond Myklebusta72b4422006-01-03 09:55:41 +01007#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>
Trond Myklebust51d8fa62006-06-09 09:34:20 -040013#include <linux/nfs_fs.h>
Trond Myklebusta72b4422006-01-03 09:55:41 +010014
Trond Myklebusta72b4422006-01-03 09:55:41 +010015static struct ctl_table_header *nfs_callback_sysctl_table;
Trond Myklebusta72b4422006-01-03 09:55:41 +010016
Joe Perchesf5102e52014-06-06 14:38:03 -070017static struct ctl_table nfs_cb_sysctls[] = {
Trond Myklebust51d8fa62006-06-09 09:34:20 -040018 {
Trond Myklebust51d8fa62006-06-09 09:34:20 -040019 .procname = "nfs_mountpoint_timeout",
20 .data = &nfs_mountpoint_expiry_timeout,
21 .maxlen = sizeof(nfs_mountpoint_expiry_timeout),
22 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -080023 .proc_handler = proc_dointvec_jiffies,
Trond Myklebust51d8fa62006-06-09 09:34:20 -040024 },
Peter Zijlstra89a09142007-03-16 13:38:26 -080025 {
Peter Zijlstra89a09142007-03-16 13:38:26 -080026 .procname = "nfs_congestion_kb",
27 .data = &nfs_congestion_kb,
28 .maxlen = sizeof(nfs_congestion_kb),
29 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -080030 .proc_handler = proc_dointvec,
Peter Zijlstra89a09142007-03-16 13:38:26 -080031 },
Eric W. Biedermanab092032009-11-05 14:25:10 -080032 { }
Trond Myklebusta72b4422006-01-03 09:55:41 +010033};
34
Joe Perchesf5102e52014-06-06 14:38:03 -070035static struct ctl_table nfs_cb_sysctl_dir[] = {
Trond Myklebusta72b4422006-01-03 09:55:41 +010036 {
Trond Myklebusta72b4422006-01-03 09:55:41 +010037 .procname = "nfs",
38 .mode = 0555,
39 .child = nfs_cb_sysctls,
40 },
Eric W. Biedermanab092032009-11-05 14:25:10 -080041 { }
Trond Myklebusta72b4422006-01-03 09:55:41 +010042};
43
Joe Perchesf5102e52014-06-06 14:38:03 -070044static struct ctl_table nfs_cb_sysctl_root[] = {
Trond Myklebusta72b4422006-01-03 09:55:41 +010045 {
Trond Myklebusta72b4422006-01-03 09:55:41 +010046 .procname = "fs",
47 .mode = 0555,
48 .child = nfs_cb_sysctl_dir,
49 },
Eric W. Biedermanab092032009-11-05 14:25:10 -080050 { }
Trond Myklebusta72b4422006-01-03 09:55:41 +010051};
52
53int nfs_register_sysctl(void)
54{
Eric W. Biederman0b4d4142007-02-14 00:34:09 -080055 nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root);
Trond Myklebusta72b4422006-01-03 09:55:41 +010056 if (nfs_callback_sysctl_table == NULL)
57 return -ENOMEM;
58 return 0;
59}
60
61void nfs_unregister_sysctl(void)
62{
63 unregister_sysctl_table(nfs_callback_sysctl_table);
64 nfs_callback_sysctl_table = NULL;
65}