Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * linux/fs/nfs/sysctl.c
0004  *
0005  * Sysctl interface to NFS parameters
0006  */
0007 #include <linux/types.h>
0008 #include <linux/linkage.h>
0009 #include <linux/ctype.h>
0010 #include <linux/fs.h>
0011 #include <linux/sysctl.h>
0012 #include <linux/module.h>
0013 #include <linux/nfs_fs.h>
0014 
0015 static struct ctl_table_header *nfs_callback_sysctl_table;
0016 
0017 static struct ctl_table nfs_cb_sysctls[] = {
0018     {
0019         .procname   = "nfs_mountpoint_timeout",
0020         .data       = &nfs_mountpoint_expiry_timeout,
0021         .maxlen     = sizeof(nfs_mountpoint_expiry_timeout),
0022         .mode       = 0644,
0023         .proc_handler   = proc_dointvec_jiffies,
0024     },
0025     {
0026         .procname   = "nfs_congestion_kb",
0027         .data       = &nfs_congestion_kb,
0028         .maxlen     = sizeof(nfs_congestion_kb),
0029         .mode       = 0644,
0030         .proc_handler   = proc_dointvec,
0031     },
0032     { }
0033 };
0034 
0035 static struct ctl_table nfs_cb_sysctl_dir[] = {
0036     {
0037         .procname = "nfs",
0038         .mode = 0555,
0039         .child = nfs_cb_sysctls,
0040     },
0041     { }
0042 };
0043 
0044 static struct ctl_table nfs_cb_sysctl_root[] = {
0045     {
0046         .procname = "fs",
0047         .mode = 0555,
0048         .child = nfs_cb_sysctl_dir,
0049     },
0050     { }
0051 };
0052 
0053 int nfs_register_sysctl(void)
0054 {
0055     nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root);
0056     if (nfs_callback_sysctl_table == NULL)
0057         return -ENOMEM;
0058     return 0;
0059 }
0060 
0061 void nfs_unregister_sysctl(void)
0062 {
0063     unregister_sysctl_table(nfs_callback_sysctl_table);
0064     nfs_callback_sysctl_table = NULL;
0065 }