blob: 81b7771c64653d7e3f18f6caff0288b8ca33c669 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Torvalds1da177e2005-04-16 15:20:36 -07008 */
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/sysctl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Jan Harkes3cf01f22007-07-19 01:48:51 -070012#include "coda_int.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14static struct ctl_table_header *fs_table_header;
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016static ctl_table coda_table[] = {
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080017 {
18 .ctl_name = CTL_UNNUMBERED,
19 .procname = "timeout",
20 .data = &coda_timeout,
21 .maxlen = sizeof(int),
22 .mode = 0644,
23 .proc_handler = &proc_dointvec
24 },
25 {
26 .ctl_name = CTL_UNNUMBERED,
27 .procname = "hard",
28 .data = &coda_hard,
29 .maxlen = sizeof(int),
30 .mode = 0644,
31 .proc_handler = &proc_dointvec
32 },
33 {
34 .ctl_name = CTL_UNNUMBERED,
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080035 .procname = "fake_statfs",
36 .data = &coda_fake_statfs,
37 .maxlen = sizeof(int),
38 .mode = 0600,
39 .proc_handler = &proc_dointvec
40 },
41 {}
Linus Torvalds1da177e2005-04-16 15:20:36 -070042};
43
44static ctl_table fs_table[] = {
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080045 {
46 .ctl_name = CTL_UNNUMBERED,
47 .procname = "coda",
48 .mode = 0555,
49 .child = coda_table
50 },
51 {}
Linus Torvalds1da177e2005-04-16 15:20:36 -070052};
53
54
Linus Torvalds1da177e2005-04-16 15:20:36 -070055void coda_sysctl_init(void)
56{
Linus Torvalds1da177e2005-04-16 15:20:36 -070057#ifdef CONFIG_SYSCTL
58 if ( !fs_table_header )
Eric W. Biederman0b4d4142007-02-14 00:34:09 -080059 fs_table_header = register_sysctl_table(fs_table);
Jan Harkes3cf01f22007-07-19 01:48:51 -070060#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070061}
62
Jan Harkes3cf01f22007-07-19 01:48:51 -070063void coda_sysctl_clean(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070064{
Linus Torvalds1da177e2005-04-16 15:20:36 -070065#ifdef CONFIG_SYSCTL
66 if ( fs_table_header ) {
67 unregister_sysctl_table(fs_table_header);
68 fs_table_header = NULL;
69 }
70#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070071}