Whamcloud - gitweb
Allow GSS password to be passed to the test-framework in $GSS_PASS.
[fs/lustre-release.git] / lustre / snapfs / 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/jbd.h>
18 #include <linux/ext3_fs.h>
19 #include <linux/snap.h>
20
21 #include "snapfs_internal.h" 
22
23
24 #ifdef CONFIG_PROC_FS
25 static struct proc_dir_entry *proc_snapfs_root;
26 #endif
27
28
29 /* SYSCTL below */
30
31 static struct ctl_table_header *snapfs_table_header = NULL;
32 /* 0x100 to avoid any chance of collisions at any point in the tree with
33  * non-directories
34  */
35 #define PSDEV_SNAPFS  (0x120)
36
37 #define PSDEV_DEBUG        1      /* control debugging */
38 #define PSDEV_TRACE        2      /* control enter/leave pattern */
39
40 /* These are global control options */
41 #define ENTRY_CNT 3
42
43 int snap_print_entry = 1;
44 int snap_debug_level = 0;
45
46 /* XXX - doesn't seem to be working in 2.2.15 */
47 static struct ctl_table snapfs_ctltable[] =
48 {
49         {PSDEV_DEBUG, "debug", &snap_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
50         {PSDEV_TRACE, "trace", &snap_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
51         {0}
52 };
53
54 static ctl_table snapfs_table[2] = {
55         {PSDEV_SNAPFS, "snapfs",    NULL, 0, 0555, snapfs_ctltable},
56         {0}
57 };
58
59
60 int  __init  init_snapfs_proc_sys(void)
61 {
62 #ifdef CONFIG_PROC_FS
63         proc_snapfs_root = proc_mkdir("snapfs", proc_root_fs);
64         if (!proc_snapfs_root) {
65                 printk(KERN_ERR "SNAPFS: error registering /proc/fs/snapfs\n");
66                 RETURN(-ENOMEM);
67         }
68         proc_snapfs_root->owner = THIS_MODULE;
69 #endif
70
71 #ifdef CONFIG_SYSCTL
72         if ( !snapfs_table_header )
73                 snapfs_table_header =
74                         register_sysctl_table(snapfs_table, 0);
75 #endif
76         return 0;
77 }
78
79 void cleanup_snapfs_proc_sys(void) 
80 {
81 #ifdef CONFIG_SYSCTL
82         if ( snapfs_table_header )
83                 unregister_sysctl_table(snapfs_table_header);
84         snapfs_table_header = NULL;
85 #endif
86 #if CONFIG_PROC_FS
87         remove_proc_entry("snapfs", proc_root_fs);
88 #endif
89
90 }
91