Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Sysctl operations for Coda filesystem |
| 3 | * Original version: (C) 1996 P. Braam and M. Callahan |
| 4 | * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University |
| 5 | * |
| 6 | * Carnegie Mellon encourages users to contribute improvements to |
| 7 | * the Coda project. Contact Peter Braam (coda@cs.cmu.edu). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | */ |
| 9 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/sysctl.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
Jan Harkes | 3cf01f2 | 2007-07-19 01:48:51 -0700 | [diff] [blame] | 12 | #include "coda_int.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
Richard A. Holden III | 87d1fda | 2009-01-07 18:07:28 -0800 | [diff] [blame] | 14 | #ifdef CONFIG_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | static struct ctl_table_header *fs_table_header; |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | static ctl_table coda_table[] = { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 18 | { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 19 | .procname = "timeout", |
| 20 | .data = &coda_timeout, |
| 21 | .maxlen = sizeof(int), |
| 22 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 23 | .proc_handler = proc_dointvec |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 24 | }, |
| 25 | { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 26 | .procname = "hard", |
| 27 | .data = &coda_hard, |
| 28 | .maxlen = sizeof(int), |
| 29 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 30 | .proc_handler = proc_dointvec |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 31 | }, |
| 32 | { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 33 | .procname = "fake_statfs", |
| 34 | .data = &coda_fake_statfs, |
| 35 | .maxlen = sizeof(int), |
| 36 | .mode = 0600, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 37 | .proc_handler = proc_dointvec |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 38 | }, |
| 39 | {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | static ctl_table fs_table[] = { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 43 | { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 44 | .procname = "coda", |
| 45 | .mode = 0555, |
| 46 | .child = coda_table |
| 47 | }, |
| 48 | {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | void coda_sysctl_init(void) |
| 52 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | if ( !fs_table_header ) |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 54 | fs_table_header = register_sysctl_table(fs_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | } |
| 56 | |
Jan Harkes | 3cf01f2 | 2007-07-19 01:48:51 -0700 | [diff] [blame] | 57 | void coda_sysctl_clean(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | if ( fs_table_header ) { |
| 60 | unregister_sysctl_table(fs_table_header); |
| 61 | fs_table_header = NULL; |
| 62 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | } |
Rakib Mullick | c03e312 | 2011-03-25 01:57:01 -0700 | [diff] [blame^] | 64 | |
| 65 | #else |
| 66 | void coda_sysctl_init(void) |
| 67 | { |
| 68 | } |
| 69 | |
| 70 | void coda_sysctl_clean(void) |
| 71 | { |
| 72 | } |
Rakib Mullick | 0bc825d | 2011-03-22 16:35:00 -0700 | [diff] [blame] | 73 | #endif |