2 * Copyright (C) 2001 Cluster File Systems, Inc.
4 * This code is issued under the GNU General Public License.
5 * See the file COPYING in this distribution
8 #include <linux/module.h>
9 #include <linux/autoconf.h>
10 #include <linux/sysctl.h>
11 #include <linux/sched.h>
13 #include <linux/sysctl.h>
14 #include <linux/swapctl.h>
15 #include <linux/proc_fs.h>
16 #include <linux/slab.h>
17 #include <linux/stat.h>
18 #include <linux/ctype.h>
19 #include <asm/bitops.h>
20 #include <asm/segment.h>
21 #include <asm/uaccess.h>
22 #include <linux/utsname.h>
24 #include <linux/obd_support.h>
26 struct ctl_table_header *obd_table_header = NULL;
31 static int obd_sctl_vars( ctl_table * table, int write, struct file *
32 filp, void * buffer, size_t * lenp );
33 static int obd_sctl_reset( ctl_table * table, int write, struct file
34 * filp, void * buffer, size_t * lenp );
36 #define OBD_SYSCTL 300
38 #define OBD_DEBUG 1 /* control debugging */
39 #define OBD_ENTRY 2 /* control enter/leave pattern */
40 #define OBD_TIMEOUT 3 /* timeout on upcalls to become intrble */
41 #define OBD_HARD 4 /* mount type "hard" or "soft" */
46 #define OBD_VARS_SLOT 2
48 static ctl_table obd_table[] = {
49 {OBD_DEBUG, "debug", &obd_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
50 {OBD_ENTRY, "trace", &obd_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
51 {OBD_VARS, "vars", &vars[0], sizeof(int), 0644, NULL, &proc_dointvec},
52 {OBD_INDEX, "index", &index, sizeof(int), 0644, NULL, &obd_sctl_vars},
53 {OBD_RESET, "reset", NULL, 0, 0644, NULL, &obd_sctl_reset},
57 static ctl_table parent_table[] = {
58 {OBD_SYSCTL, "obd", NULL, 0, 0555, obd_table},
62 void obd_sysctl_init (void)
65 if ( !obd_table_header )
66 obd_table_header = register_sysctl_table(parent_table, 0);
70 void obd_sysctl_clean (void)
73 if ( obd_table_header )
74 unregister_sysctl_table(obd_table_header);
75 obd_table_header = NULL;
79 int obd_sctl_reset (ctl_table * table, int write,
80 struct file * filp, void * buffer,
84 /* do something here */
93 int obd_sctl_vars (ctl_table * table, int write,
94 struct file * filp, void * buffer,
99 rc = proc_dointvec(table, write, filp, buffer, lenp);
104 if ( index < 0 || index > 1 ) {
105 printk(KERN_WARNING __FUNCTION__ "Illegal index %d!\n", index);
108 obd_table[OBD_VARS_SLOT].data = &vars[index];