1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <sys/param.h>
23 #include <sys/kernel.h>
24 #include <sys/malloc.h>
25 #include <sys/systm.h>
26 #include <sys/sysctl.h>
28 #include <sys/unistd.h>
29 #include <mach/mach_types.h>
31 #define DEBUG_SUBSYSTEM S_PORTALS
32 #include <libcfs/libcfs.h>
34 static cfs_sysctl_table_header_t *portals_table_header = NULL;
35 extern unsigned int portal_debug;
36 extern char debug_file_path[1024];
37 extern unsigned int portal_subsystem_debug;
38 extern unsigned int portal_printk;
39 extern unsigned int portals_catastrophe;
40 extern atomic_t portal_kmemory;
42 extern long max_debug_mb;
43 extern int cfs_trace_daemon SYSCTL_HANDLER_ARGS;
44 extern int cfs_debug_mb SYSCTL_HANDLER_ARGS;
46 * sysctl table for portals
48 SYSCTL_NODE (, OID_AUTO, portals, CTLFLAG_RW,
49 0, "portals sysctl top");
51 SYSCTL_INT(_portals, OID_AUTO, debug,
52 CTLTYPE_INT | CTLFLAG_RW , &portal_debug,
54 SYSCTL_INT(_portals, OID_AUTO, subsystem_debug,
55 CTLTYPE_INT | CTLFLAG_RW, &portal_subsystem_debug,
56 0, "subsystem debug");
57 SYSCTL_INT(_portals, OID_AUTO, printk,
58 CTLTYPE_INT | CTLFLAG_RW, &portal_printk,
60 SYSCTL_STRING(_portals, OID_AUTO, debug_path,
61 CTLTYPE_STRING | CTLFLAG_RW, debug_file_path,
63 SYSCTL_INT(_portals, OID_AUTO, memused,
64 CTLTYPE_INT | CTLFLAG_RW, (int *)&portal_kmemory.counter,
66 SYSCTL_PROC(_portals, OID_AUTO, trace_daemon,
67 CTLTYPE_STRING | CTLFLAG_RW, 0,
68 0, &cfs_trace_daemon, "A", "trace daemon");
69 SYSCTL_PROC(_portals, OID_AUTO, debug_mb,
70 CTLTYPE_INT | CTLFLAG_RW, &max_debug_mb,
71 0, &cfs_debug_mb, "L", "max debug size");
72 #warning "add 'catastrophe' entry for LBUG detection"
75 static cfs_sysctl_table_t top_table[] = {
77 &sysctl__portals_debug,
78 &sysctl__portals_subsystem_debug,
79 &sysctl__portals_printk,
80 &sysctl__portals_debug_path,
81 &sysctl__portals_memused,
82 &sysctl__portals_trace_daemon,
83 &sysctl__portals_debug_mb,
88 cfs_proc_dir_entry_t *
89 cfs_create_proc_entry(char *name, int mod, cfs_proc_dir_entry_t *parent)
91 cfs_proc_dir_entry_t *entry;
92 MALLOC(entry, cfs_proc_dir_entry_t *, sizeof(cfs_proc_dir_entry_t), M_TEMP, M_WAITOK|M_ZERO);
98 cfs_free_proc_entry(cfs_proc_dir_entry_t *de){
104 cfs_remove_proc_entry(char *name, cfs_proc_dir_entry_t *entry)
106 cfs_free_proc_entry(entry);
114 if (!portals_table_header)
115 portals_table_header = register_cfs_sysctl_table(top_table, 0);
124 if (portals_table_header != NULL)
125 unregister_cfs_sysctl_table(portals_table_header);
126 portals_table_header = NULL;