1 /* 2 * linux/fs/nfs/sysctl.c 3 * 4 * Sysctl interface to NFS parameters 5 */ 6 #include <linux/config.h> 7 #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> 13 #include <linux/nfs4.h> 14 #include <linux/nfs_idmap.h> 15 #include <linux/nfs_fs.h> 16 17 #include "callback.h" 18 19 static const int nfs_set_port_min = 0; 20 static const int nfs_set_port_max = 65535; 21 static struct ctl_table_header *nfs_callback_sysctl_table; 22 /* 23 * Something that isn't CTL_ANY, CTL_NONE or a value that may clash. 24 * Use the same values as fs/lockd/svc.c 25 */ 26 #define CTL_UNNUMBERED -2 27 28 static ctl_table nfs_cb_sysctls[] = { 29 #ifdef CONFIG_NFS_V4 30 { 31 .ctl_name = CTL_UNNUMBERED, 32 .procname = "nfs_callback_tcpport", 33 .data = &nfs_callback_set_tcpport, 34 .maxlen = sizeof(int), 35 .mode = 0644, 36 .proc_handler = &proc_dointvec_minmax, 37 .extra1 = (int *)&nfs_set_port_min, 38 .extra2 = (int *)&nfs_set_port_max, 39 }, 40 { 41 .ctl_name = CTL_UNNUMBERED, 42 .procname = "idmap_cache_timeout", 43 .data = &nfs_idmap_cache_timeout, 44 .maxlen = sizeof(int), 45 .mode = 0644, 46 .proc_handler = &proc_dointvec_jiffies, 47 .strategy = &sysctl_jiffies, 48 }, 49 #endif 50 { 51 .ctl_name = CTL_UNNUMBERED, 52 .procname = "nfs_mountpoint_timeout", 53 .data = &nfs_mountpoint_expiry_timeout, 54 .maxlen = sizeof(nfs_mountpoint_expiry_timeout), 55 .mode = 0644, 56 .proc_handler = &proc_dointvec_jiffies, 57 .strategy = &sysctl_jiffies, 58 }, 59 { .ctl_name = 0 } 60 }; 61 62 static ctl_table nfs_cb_sysctl_dir[] = { 63 { 64 .ctl_name = CTL_UNNUMBERED, 65 .procname = "nfs", 66 .mode = 0555, 67 .child = nfs_cb_sysctls, 68 }, 69 { .ctl_name = 0 } 70 }; 71 72 static ctl_table nfs_cb_sysctl_root[] = { 73 { 74 .ctl_name = CTL_FS, 75 .procname = "fs", 76 .mode = 0555, 77 .child = nfs_cb_sysctl_dir, 78 }, 79 { .ctl_name = 0 } 80 }; 81 82 int nfs_register_sysctl(void) 83 { 84 nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root, 0); 85 if (nfs_callback_sysctl_table == NULL) 86 return -ENOMEM; 87 return 0; 88 } 89 90 void nfs_unregister_sysctl(void) 91 { 92 unregister_sysctl_table(nfs_callback_sysctl_table); 93 nfs_callback_sysctl_table = NULL; 94 } 95