Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/nfs/sysctl.c |
| 3 | * |
| 4 | * Sysctl interface to NFS parameters |
| 5 | */ |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 6 | #include <linux/types.h> |
| 7 | #include <linux/linkage.h> |
| 8 | #include <linux/ctype.h> |
| 9 | #include <linux/fs.h> |
| 10 | #include <linux/sysctl.h> |
| 11 | #include <linux/module.h> |
Trond Myklebust | 51d8fa6 | 2006-06-09 09:34:20 -0400 | [diff] [blame] | 12 | #include <linux/nfs_fs.h> |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 13 | |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 14 | static struct ctl_table_header *nfs_callback_sysctl_table; |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 15 | |
Joe Perches | f5102e5 | 2014-06-06 14:38:03 -0700 | [diff] [blame] | 16 | static struct ctl_table nfs_cb_sysctls[] = { |
Trond Myklebust | 51d8fa6 | 2006-06-09 09:34:20 -0400 | [diff] [blame] | 17 | { |
Trond Myklebust | 51d8fa6 | 2006-06-09 09:34:20 -0400 | [diff] [blame] | 18 | .procname = "nfs_mountpoint_timeout", |
| 19 | .data = &nfs_mountpoint_expiry_timeout, |
| 20 | .maxlen = sizeof(nfs_mountpoint_expiry_timeout), |
| 21 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 22 | .proc_handler = proc_dointvec_jiffies, |
Trond Myklebust | 51d8fa6 | 2006-06-09 09:34:20 -0400 | [diff] [blame] | 23 | }, |
Peter Zijlstra | 89a0914 | 2007-03-16 13:38:26 -0800 | [diff] [blame] | 24 | { |
Peter Zijlstra | 89a0914 | 2007-03-16 13:38:26 -0800 | [diff] [blame] | 25 | .procname = "nfs_congestion_kb", |
| 26 | .data = &nfs_congestion_kb, |
| 27 | .maxlen = sizeof(nfs_congestion_kb), |
| 28 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 29 | .proc_handler = proc_dointvec, |
Peter Zijlstra | 89a0914 | 2007-03-16 13:38:26 -0800 | [diff] [blame] | 30 | }, |
Eric W. Biederman | ab09203 | 2009-11-05 14:25:10 -0800 | [diff] [blame] | 31 | { } |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 32 | }; |
| 33 | |
Joe Perches | f5102e5 | 2014-06-06 14:38:03 -0700 | [diff] [blame] | 34 | static struct ctl_table nfs_cb_sysctl_dir[] = { |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 35 | { |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 36 | .procname = "nfs", |
| 37 | .mode = 0555, |
| 38 | .child = nfs_cb_sysctls, |
| 39 | }, |
Eric W. Biederman | ab09203 | 2009-11-05 14:25:10 -0800 | [diff] [blame] | 40 | { } |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 41 | }; |
| 42 | |
Joe Perches | f5102e5 | 2014-06-06 14:38:03 -0700 | [diff] [blame] | 43 | static struct ctl_table nfs_cb_sysctl_root[] = { |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 44 | { |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 45 | .procname = "fs", |
| 46 | .mode = 0555, |
| 47 | .child = nfs_cb_sysctl_dir, |
| 48 | }, |
Eric W. Biederman | ab09203 | 2009-11-05 14:25:10 -0800 | [diff] [blame] | 49 | { } |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | int nfs_register_sysctl(void) |
| 53 | { |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 54 | nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root); |
Trond Myklebust | a72b442 | 2006-01-03 09:55:41 +0100 | [diff] [blame] | 55 | if (nfs_callback_sysctl_table == NULL) |
| 56 | return -ENOMEM; |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | void nfs_unregister_sysctl(void) |
| 61 | { |
| 62 | unregister_sysctl_table(nfs_callback_sysctl_table); |
| 63 | nfs_callback_sysctl_table = NULL; |
| 64 | } |