Whamcloud - gitweb
smash the HEAD with the contents of b_cmd. HEAD_PRE_CMD_SMASH and
[fs/lustre-release.git] / lustre / smfs / sysctl.c
1 /*
2  *  Sysctrl entries for Snapfs
3  */
4
5 /* /proc entries */
6
7 #define DEBUG_SUBSYSTEM S_SNAP
8
9 #include <linux/module.h>
10 #include <linux/kmod.h>
11 #include <linux/init.h>
12 #include <linux/fs.h>
13 #include <linux/slab.h>
14 #include <linux/string.h>
15 #include <linux/sysctl.h>
16 #include <linux/proc_fs.h>
17 #include <linux/lustre_idl.h>
18 #include "smfs_internal.h" 
19
20
21 #ifdef CONFIG_PROC_FS
22 static struct proc_dir_entry *proc_smfs_root;
23 #endif
24
25
26 /* SYSCTL below */
27
28 static struct ctl_table_header *smfs_table_header = NULL;
29 /* 0x100 to avoid any chance of collisions at any point in the tree with
30  * non-directories
31  */
32 #define PSDEV_SMFS  (0x130)
33
34 #define PSDEV_DEBUG        1      /* control debugging */
35 #define PSDEV_TRACE        2      /* control enter/leave pattern */
36
37 /* These are global control options */
38 #define ENTRY_CNT 3
39
40 int sm_print_entry = 1;
41 int sm_debug_level = 0;
42
43 /* XXX - doesn't seem to be working in 2.2.15 */
44 static struct ctl_table smfs_ctltable[] =
45 {
46         {PSDEV_DEBUG, "debug", &sm_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
47         {PSDEV_TRACE, "trace", &sm_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
48         {0}
49 };
50
51 static ctl_table smfs_table[2] = {
52         {PSDEV_SMFS, "smfs",    NULL, 0, 0555, smfs_ctltable},
53         {0}
54 };
55
56
57 int  __init  init_smfs_proc_sys(void)
58 {
59 #ifdef CONFIG_PROC_FS
60         proc_smfs_root = proc_mkdir("smfs", proc_root_fs);
61         if (!proc_smfs_root) {
62                 printk(KERN_ERR "SMFS: error registering /proc/fs/smfs\n");
63                 RETURN(-ENOMEM);
64         }
65         proc_smfs_root->owner = THIS_MODULE;
66 #endif
67
68 #ifdef CONFIG_SYSCTL
69         if ( !smfs_table_header )
70                 smfs_table_header =
71                         register_sysctl_table(smfs_table, 0);
72 #endif
73         return 0;
74 }
75
76 void cleanup_smfs_proc_sys(void) 
77 {
78 #ifdef CONFIG_SYSCTL
79         if ( smfs_table_header )
80                 unregister_sysctl_table(smfs_table_header);
81         smfs_table_header = NULL;
82 #endif
83 #if CONFIG_PROC_FS
84         remove_proc_entry("smfs", proc_root_fs);
85 #endif
86 }
87