1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2004 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.
23 #define DEBUG_SUBSYSTEM S_SM
25 #include <linux/module.h>
26 #include <linux/kmod.h>
27 #include <linux/init.h>
29 #include <linux/slab.h>
30 #include <linux/string.h>
31 #include <linux/sysctl.h>
32 #include <linux/proc_fs.h>
33 #include <linux/obd_class.h>
34 #include <linux/obd_support.h>
35 #include <linux/lustre_lib.h>
36 #include <linux/lustre_idl.h>
37 #include <linux/lustre_smfs.h>
39 #include "smfs_internal.h"
43 static struct proc_dir_entry *proc_smfs_root;
48 static struct ctl_table_header *smfs_table_header = NULL;
49 /* 0x100 to avoid any chance of collisions at any point in the tree with
52 #define PSDEV_SMFS (0x130)
54 #define PSDEV_DEBUG 1 /* control debugging */
55 #define PSDEV_TRACE 2 /* control enter/leave pattern */
57 /* These are global control options */
60 int sm_print_entry = 1;
61 int sm_debug_level = 0;
63 /* XXX - doesn't seem to be working in 2.2.15 */
64 static struct ctl_table smfs_ctltable[] =
66 {PSDEV_DEBUG, "debug", &sm_debug_level, sizeof(int), 0644, NULL,
68 {PSDEV_TRACE, "trace", &sm_print_entry, sizeof(int), 0644, NULL,
73 static ctl_table smfs_table[2] = {
74 {PSDEV_SMFS, "smfs", NULL, 0, 0555, smfs_ctltable},
79 int __init init_smfs_proc_sys(void)
82 proc_smfs_root = proc_mkdir("smfs", proc_root_fs);
83 if (!proc_smfs_root) {
84 printk(KERN_ERR "SMFS: error registering /proc/fs/smfs\n");
87 proc_smfs_root->owner = THIS_MODULE;
91 if ( !smfs_table_header )
93 register_sysctl_table(smfs_table, 0);
98 void cleanup_smfs_proc_sys(void)
101 if ( smfs_table_header )
102 unregister_sysctl_table(smfs_table_header);
103 smfs_table_header = NULL;
106 remove_proc_entry("smfs", proc_root_fs);