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; |
Richard A. Holden III | 87d1fda | 2009-01-07 18:07:28 -0800 | [diff] [blame] | 16 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | static ctl_table coda_table[] = { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 19 | { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 20 | .procname = "timeout", |
| 21 | .data = &coda_timeout, |
| 22 | .maxlen = sizeof(int), |
| 23 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 24 | .proc_handler = proc_dointvec |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 25 | }, |
| 26 | { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 27 | .procname = "hard", |
| 28 | .data = &coda_hard, |
| 29 | .maxlen = sizeof(int), |
| 30 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 31 | .proc_handler = proc_dointvec |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 32 | }, |
| 33 | { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 34 | .procname = "fake_statfs", |
| 35 | .data = &coda_fake_statfs, |
| 36 | .maxlen = sizeof(int), |
| 37 | .mode = 0600, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 38 | .proc_handler = proc_dointvec |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 39 | }, |
| 40 | {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | }; |
| 42 | |
Richard A. Holden III | 87d1fda | 2009-01-07 18:07:28 -0800 | [diff] [blame] | 43 | #ifdef CONFIG_SYSCTL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | static ctl_table fs_table[] = { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 45 | { |
Eric W. Biederman | fd6065b | 2007-02-14 00:33:55 -0800 | [diff] [blame] | 46 | .procname = "coda", |
| 47 | .mode = 0555, |
| 48 | .child = coda_table |
| 49 | }, |
| 50 | {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | }; |
Richard A. Holden III | 87d1fda | 2009-01-07 18:07:28 -0800 | [diff] [blame] | 52 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | void coda_sysctl_init(void) |
| 55 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #ifdef CONFIG_SYSCTL |
| 57 | if ( !fs_table_header ) |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 58 | fs_table_header = register_sysctl_table(fs_table); |
Jan Harkes | 3cf01f2 | 2007-07-19 01:48:51 -0700 | [diff] [blame] | 59 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | } |
| 61 | |
Jan Harkes | 3cf01f2 | 2007-07-19 01:48:51 -0700 | [diff] [blame] | 62 | void coda_sysctl_clean(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | #ifdef CONFIG_SYSCTL |
| 65 | if ( fs_table_header ) { |
| 66 | unregister_sysctl_table(fs_table_header); |
| 67 | fs_table_header = NULL; |
| 68 | } |
| 69 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | } |