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 #define DEBUG_SUBSYSTEM S_CLASS
26 #include <linux/obd_support.h>
28 struct ctl_table_header *obd_table_header = NULL;
33 static int obd_sctl_vars( ctl_table * table, int write, struct file *
34 filp, void * buffer, size_t * lenp );
35 static int obd_sctl_reset( ctl_table * table, int write, struct file
36 * filp, void * buffer, size_t * lenp );
38 #define OBD_SYSCTL 300
40 #define OBD_DEBUG 1 /* control debugging */
41 #define OBD_ENTRY 2 /* control enter/leave pattern */
42 #define OBD_TIMEOUT 3 /* timeout on upcalls to become intrble */
43 #define OBD_HARD 4 /* mount type "hard" or "soft" */
48 #define OBD_VARS_SLOT 2
50 static ctl_table obd_table[] = {
51 {OBD_DEBUG, "debug", &obd_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
52 {OBD_ENTRY, "trace", &obd_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
53 {OBD_VARS, "vars", &vars[0], sizeof(int), 0644, NULL, &proc_dointvec},
54 {OBD_INDEX, "index", &index, sizeof(int), 0644, NULL, &obd_sctl_vars},
55 {OBD_RESET, "reset", NULL, 0, 0644, NULL, &obd_sctl_reset},
59 static ctl_table parent_table[] = {
60 {OBD_SYSCTL, "obd", NULL, 0, 0555, obd_table},
64 void obd_sysctl_init (void)
67 if ( !obd_table_header )
68 obd_table_header = register_sysctl_table(parent_table, 0);
72 void obd_sysctl_clean (void)
75 if ( obd_table_header )
76 unregister_sysctl_table(obd_table_header);
77 obd_table_header = NULL;
81 int obd_sctl_reset (ctl_table * table, int write,
82 struct file * filp, void * buffer,
86 /* do something here */
95 int obd_sctl_vars (ctl_table * table, int write,
96 struct file * filp, void * buffer,
101 rc = proc_dointvec(table, write, filp, buffer, lenp);
106 if ( index < 0 || index > 1 ) {
107 printk(KERN_WARNING __FUNCTION__ "Illegal index %d!\n", index);
110 obd_table[OBD_VARS_SLOT].data = &vars[index];