From: Kris Van Hees Date: Tue, 2 Apr 2002 03:07:32 +0000 (+0000) Subject: STABLE12-linux-provide-sysctl-interface-20020206 X-Git-Tag: openafs-stable-1_2_4~80 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=377744e521f3d38f3fe6ed27973d22daa6535abd;p=packages%2Fo%2Fopenafs.git STABLE12-linux-provide-sysctl-interface-20020206 provide sysctl interface for toggling module state. provide hooks for all currently known tweakable items --- diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index 928e20c8d..bf7c9bb85 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -276,6 +276,8 @@ int init_module(void) # endif #endif /* AFS_IA64_LINUX20_ENV */ + osi_sysctl_init(); + return 0; } @@ -287,6 +289,8 @@ void cleanup_module(void) { struct task_struct *t; + osi_sysctl_clean(); + #if defined(AFS_IA64_LINUX20_ENV) sys_call_table[__NR_setgroups - 1024] = POINTER2SYSCALL ((struct fptr *) sys_setgroupsp)->ip; sys_call_table[__NR_afs_syscall - 1024] = afs_ni_syscall; diff --git a/src/afs/LINUX/osi_sysctl.c b/src/afs/LINUX/osi_sysctl.c new file mode 100644 index 000000000..af4bef26c --- /dev/null +++ b/src/afs/LINUX/osi_sysctl.c @@ -0,0 +1,62 @@ +/* + * osi_sysctl.c: Linux sysctl interface to OpenAFS + * + * $Id$ + * + * Written Jan 30, 2002 by Kris Van Hees (Sine Nomine Associates) + */ + +#include +#include + +#include +#include "../afs/param.h" + +#include "../afs/sysincludes.h" /* Standard vendor system headers */ +#include "../afs/afsincludes.h" /* Afs-based standard headers */ +#include "../afs/afs_stats.h" /* afs statistics */ + +/* From afs_analyze.c */ +extern afs_int32 hm_retry_RO; +extern afs_int32 hm_retry_RW; +extern afs_int32 hm_retry_int; + +#ifdef CONFIG_SYSCTL +static struct ctl_table_header *afs_sysctl = NULL; + +static ctl_table afs_sysctl_table[] = { + {1, "hm_retry_RO", + &hm_retry_RO, sizeof(afs_int32), 0644, NULL, + &proc_dointvec}, + {2, "hm_retry_RW", + &hm_retry_RW, sizeof(afs_int32), 0644, NULL, + &proc_dointvec}, + {3, "hm_retry_int", + &hm_retry_int, sizeof(afs_int32), 0644, NULL, + &proc_dointvec}, + {0} +}; + +static ctl_table fs_sysctl_table[] = { + {1, "afs", NULL, 0, 0555, afs_sysctl_table}, + {0} +}; + +int osi_sysctl_init() +{ + afs_sysctl = register_sysctl_table(fs_sysctl_table, 0); + if (!afs_sysctl) + return -1; + + return 0; +} + +void osi_sysctl_clean() +{ + if (afs_sysctl) { + unregister_sysctl_table(afs_sysctl); + afs_sysctl = NULL; + } +} + +#endif /* CONFIG_SYSCTL */