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