0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/sysctl.h>
0010 #include <linux/nfs_fs.h>
0011
0012 #include "nfs4_fs.h"
0013 #include "nfs4idmap.h"
0014 #include "callback.h"
0015
0016 static const int nfs_set_port_min;
0017 static const int nfs_set_port_max = 65535;
0018 static struct ctl_table_header *nfs4_callback_sysctl_table;
0019
0020 static struct ctl_table nfs4_cb_sysctls[] = {
0021 {
0022 .procname = "nfs_callback_tcpport",
0023 .data = &nfs_callback_set_tcpport,
0024 .maxlen = sizeof(int),
0025 .mode = 0644,
0026 .proc_handler = proc_dointvec_minmax,
0027 .extra1 = (int *)&nfs_set_port_min,
0028 .extra2 = (int *)&nfs_set_port_max,
0029 },
0030 {
0031 .procname = "idmap_cache_timeout",
0032 .data = &nfs_idmap_cache_timeout,
0033 .maxlen = sizeof(int),
0034 .mode = 0644,
0035 .proc_handler = proc_dointvec,
0036 },
0037 { }
0038 };
0039
0040 static struct ctl_table nfs4_cb_sysctl_dir[] = {
0041 {
0042 .procname = "nfs",
0043 .mode = 0555,
0044 .child = nfs4_cb_sysctls,
0045 },
0046 { }
0047 };
0048
0049 static struct ctl_table nfs4_cb_sysctl_root[] = {
0050 {
0051 .procname = "fs",
0052 .mode = 0555,
0053 .child = nfs4_cb_sysctl_dir,
0054 },
0055 { }
0056 };
0057
0058 int nfs4_register_sysctl(void)
0059 {
0060 nfs4_callback_sysctl_table = register_sysctl_table(nfs4_cb_sysctl_root);
0061 if (nfs4_callback_sysctl_table == NULL)
0062 return -ENOMEM;
0063 return 0;
0064 }
0065
0066 void nfs4_unregister_sysctl(void)
0067 {
0068 unregister_sysctl_table(nfs4_callback_sysctl_table);
0069 nfs4_callback_sysctl_table = NULL;
0070 }