blob: e645be1a338177c0626954bf64ea659b5750b691 [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 },
Trond Myklebusta72b4422006-01-03 09:55:41 +010032};
33
Trond Myklebusta72b4422006-01-03 09:55:41 +010034int nfs_register_sysctl(void)
35{
Luis Chamberlaina2189b72023-03-10 00:40:35 -080036 nfs_callback_sysctl_table = register_sysctl("fs/nfs", nfs_cb_sysctls);
Trond Myklebusta72b4422006-01-03 09:55:41 +010037 if (nfs_callback_sysctl_table == NULL)
38 return -ENOMEM;
39 return 0;
40}
41
42void nfs_unregister_sysctl(void)
43{
44 unregister_sysctl_table(nfs_callback_sysctl_table);
45 nfs_callback_sysctl_table = NULL;
46}