blob: c6405ce3c50ecb92f3b800b3f750dd96835d41f9 [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
Richard A. Holden III87d1fda2009-01-07 18:07:28 -080014#ifdef CONFIG_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -070015static struct ctl_table_header *fs_table_header;
Richard A. Holden III87d1fda2009-01-07 18:07:28 -080016#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Linus Torvalds1da177e2005-04-16 15:20:36 -070018static ctl_table coda_table[] = {
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080019 {
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080020 .procname = "timeout",
21 .data = &coda_timeout,
22 .maxlen = sizeof(int),
23 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -080024 .proc_handler = proc_dointvec
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080025 },
26 {
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080027 .procname = "hard",
28 .data = &coda_hard,
29 .maxlen = sizeof(int),
30 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -080031 .proc_handler = proc_dointvec
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080032 },
33 {
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080034 .procname = "fake_statfs",
35 .data = &coda_fake_statfs,
36 .maxlen = sizeof(int),
37 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -080038 .proc_handler = proc_dointvec
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080039 },
40 {}
Linus Torvalds1da177e2005-04-16 15:20:36 -070041};
42
Richard A. Holden III87d1fda2009-01-07 18:07:28 -080043#ifdef CONFIG_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -070044static ctl_table fs_table[] = {
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080045 {
Eric W. Biedermanfd6065b2007-02-14 00:33:55 -080046 .procname = "coda",
47 .mode = 0555,
48 .child = coda_table
49 },
50 {}
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
Richard A. Holden III87d1fda2009-01-07 18:07:28 -080052#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
Linus Torvalds1da177e2005-04-16 15:20:36 -070054void coda_sysctl_init(void)
55{
Linus Torvalds1da177e2005-04-16 15:20:36 -070056#ifdef CONFIG_SYSCTL
57 if ( !fs_table_header )
Eric W. Biederman0b4d4142007-02-14 00:34:09 -080058 fs_table_header = register_sysctl_table(fs_table);
Jan Harkes3cf01f22007-07-19 01:48:51 -070059#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070060}
61
Jan Harkes3cf01f22007-07-19 01:48:51 -070062void coda_sysctl_clean(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070063{
Linus Torvalds1da177e2005-04-16 15:20:36 -070064#ifdef CONFIG_SYSCTL
65 if ( fs_table_header ) {
66 unregister_sysctl_table(fs_table_header);
67 fs_table_header = NULL;
68 }
69#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070070}