e75603b20fe065d0062621c2dbf649ba6642750b
[openafs.git] / src / afs / LINUX / osi_sysctl.c
1 /*
2  * osi_sysctl.c: Linux sysctl interface to OpenAFS
3  *
4  * $Id$
5  *
6  * Written Jan 30, 2002 by Kris Van Hees (Sine Nomine Associates)
7  */
8
9 #include <afsconfig.h>
10 #include "../afs/param.h"
11
12 #include "../afs/sysincludes.h" /* Standard vendor system headers */
13 #include "../afs/afsincludes.h" /* Afs-based standard headers */
14 #include "../afs/afs_stats.h"   /* afs statistics */
15
16 #include <linux/sysctl.h>
17 #include <linux/config.h>
18
19 /* From afs_analyze.c */
20 extern afs_int32 hm_retry_RO;
21 extern afs_int32 hm_retry_RW;
22 extern afs_int32 hm_retry_int;
23
24 #ifdef CONFIG_SYSCTL
25 static struct ctl_table_header *afs_sysctl = NULL;
26
27 static ctl_table afs_sysctl_table[] = {
28         {1, "hm_retry_RO",
29          &hm_retry_RO, sizeof(afs_int32), 0644, NULL,
30          &proc_dointvec},
31         {2, "hm_retry_RW",
32          &hm_retry_RW, sizeof(afs_int32), 0644, NULL,
33          &proc_dointvec},
34         {3, "hm_retry_int",
35          &hm_retry_int, sizeof(afs_int32), 0644, NULL,
36          &proc_dointvec},
37         {0}
38 };
39
40 static ctl_table fs_sysctl_table[] = {
41         {1, "afs", NULL, 0, 0555, afs_sysctl_table},
42         {0}
43 };
44
45 int osi_sysctl_init()
46 {
47         afs_sysctl = register_sysctl_table(fs_sysctl_table, 0);
48         if (!afs_sysctl)
49                 return -1;
50
51         return 0;
52 }
53
54 void osi_sysctl_clean()
55 {
56         if (afs_sysctl) {
57                 unregister_sysctl_table(afs_sysctl);
58                 afs_sysctl = NULL;
59         }
60 }
61
62 #endif /* CONFIG_SYSCTL */