2 * osi_sysctl.c: Linux sysctl interface to OpenAFS
6 * Written Jan 30, 2002 by Kris Van Hees (Sine Nomine Associates)
10 #include "afs/param.h"
12 #include "afs/sysincludes.h" /* Standard vendor system headers */
13 #include "afsincludes.h" /* Afs-based standard headers */
14 #include "afs/afs_stats.h" /* afs statistics */
16 #include <linux/sysctl.h>
17 #ifdef HAVE_LINUX_CONFIG_H
18 #include <linux/config.h>
24 extern afs_int32 afs_md5inum;
26 /* From afs_analyze.c */
27 extern afs_int32 hm_retry_RO;
28 extern afs_int32 hm_retry_RW;
29 extern afs_int32 hm_retry_int;
30 extern afs_int32 afs_blocksUsed_0;
31 extern afs_int32 afs_blocksUsed_1;
32 extern afs_int32 afs_blocksUsed_2;
33 extern afs_int32 afs_pct1;
34 extern afs_int32 afs_pct2;
36 # ifdef STRUCT_CTL_TABLE_HAS_CTL_NAME
37 # ifdef CTL_UNNUMBERED
38 # define AFS_SYSCTL_NAME(num) .ctl_name = CTL_UNNUMBERED,
40 # define AFS_SYSCTL_NAME(num) .ctl_name = num,
43 # define AFS_SYSCTL_NAME(num)
46 # define AFS_SYSCTL_INT2(num, perms, name, var) { \
47 AFS_SYSCTL_NAME(num) \
50 .maxlen = sizeof(var), \
52 .proc_handler = &proc_dointvec \
54 # define AFS_SYSCTL_INT(num, perms, var) \
55 AFS_SYSCTL_INT2(num, perms, #var, var)
57 static struct ctl_table_header *afs_sysctl = NULL;
59 static struct ctl_table afs_sysctl_table[] = {
60 AFS_SYSCTL_INT(1, 0644, hm_retry_RO),
61 AFS_SYSCTL_INT(2, 0644, hm_retry_RW),
62 AFS_SYSCTL_INT(3, 0644, hm_retry_int),
64 AFS_SYSCTL_INT2(4, 0644, "GCPAGs", afs_gcpags),
65 AFS_SYSCTL_INT2(5, 0644, "rx_deadtime", afs_rx_deadtime),
66 AFS_SYSCTL_INT2(6, 0644, "bkVolPref", afs_bkvolpref),
68 AFS_SYSCTL_INT( 7, 0444, afs_blocksUsed),
69 AFS_SYSCTL_INT( 8, 0644, afs_blocksUsed_0),
70 AFS_SYSCTL_INT( 9, 0644, afs_blocksUsed_1),
71 AFS_SYSCTL_INT(10, 0644, afs_blocksUsed_2),
73 AFS_SYSCTL_INT( 11, 0644, afs_pct1),
74 AFS_SYSCTL_INT( 12, 0644, afs_pct2),
75 AFS_SYSCTL_INT( 13, 0644, afs_cacheBlocks),
76 AFS_SYSCTL_INT2(14, 0644, "md5inum", afs_md5inum),
83 static struct ctl_table fs_sysctl_table[] = {
88 .child = afs_sysctl_table
98 # if defined(REGISTER_SYSCTL_TABLE_NOFLAG)
99 afs_sysctl = register_sysctl_table(fs_sysctl_table);
101 afs_sysctl = register_sysctl_table(fs_sysctl_table, 0);
113 unregister_sysctl_table(afs_sysctl);
118 #endif /* CONFIG_SYSCTL */