Full support for Ginger Console
[linux-ginger.git] / fs / xfs / linux-2.6 / xfs_sysctl.c
blobc5bc67c4e3bb32527acca1e560797bec87e217cb
1 /*
2 * Copyright (c) 2001-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #include "xfs.h"
19 #include <linux/sysctl.h>
20 #include <linux/proc_fs.h>
22 static struct ctl_table_header *xfs_table_header;
24 #ifdef CONFIG_PROC_FS
25 STATIC int
26 xfs_stats_clear_proc_handler(
27 ctl_table *ctl,
28 int write,
29 void __user *buffer,
30 size_t *lenp,
31 loff_t *ppos)
33 int c, ret, *valp = ctl->data;
34 __uint32_t vn_active;
36 ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
38 if (!ret && write && *valp) {
39 printk("XFS Clearing xfsstats\n");
40 for_each_possible_cpu(c) {
41 preempt_disable();
42 /* save vn_active, it's a universal truth! */
43 vn_active = per_cpu(xfsstats, c).vn_active;
44 memset(&per_cpu(xfsstats, c), 0,
45 sizeof(struct xfsstats));
46 per_cpu(xfsstats, c).vn_active = vn_active;
47 preempt_enable();
49 xfs_stats_clear = 0;
52 return ret;
54 #endif /* CONFIG_PROC_FS */
56 static ctl_table xfs_table[] = {
58 .ctl_name = XFS_SGID_INHERIT,
59 .procname = "irix_sgid_inherit",
60 .data = &xfs_params.sgid_inherit.val,
61 .maxlen = sizeof(int),
62 .mode = 0644,
63 .proc_handler = &proc_dointvec_minmax,
64 .strategy = &sysctl_intvec,
65 .extra1 = &xfs_params.sgid_inherit.min,
66 .extra2 = &xfs_params.sgid_inherit.max
69 .ctl_name = XFS_SYMLINK_MODE,
70 .procname = "irix_symlink_mode",
71 .data = &xfs_params.symlink_mode.val,
72 .maxlen = sizeof(int),
73 .mode = 0644,
74 .proc_handler = &proc_dointvec_minmax,
75 .strategy = &sysctl_intvec,
76 .extra1 = &xfs_params.symlink_mode.min,
77 .extra2 = &xfs_params.symlink_mode.max
80 .ctl_name = XFS_PANIC_MASK,
81 .procname = "panic_mask",
82 .data = &xfs_params.panic_mask.val,
83 .maxlen = sizeof(int),
84 .mode = 0644,
85 .proc_handler = &proc_dointvec_minmax,
86 .strategy = &sysctl_intvec,
87 .extra1 = &xfs_params.panic_mask.min,
88 .extra2 = &xfs_params.panic_mask.max
92 .ctl_name = XFS_ERRLEVEL,
93 .procname = "error_level",
94 .data = &xfs_params.error_level.val,
95 .maxlen = sizeof(int),
96 .mode = 0644,
97 .proc_handler = &proc_dointvec_minmax,
98 .strategy = &sysctl_intvec,
99 .extra1 = &xfs_params.error_level.min,
100 .extra2 = &xfs_params.error_level.max
103 .ctl_name = XFS_SYNCD_TIMER,
104 .procname = "xfssyncd_centisecs",
105 .data = &xfs_params.syncd_timer.val,
106 .maxlen = sizeof(int),
107 .mode = 0644,
108 .proc_handler = &proc_dointvec_minmax,
109 .strategy = &sysctl_intvec,
110 .extra1 = &xfs_params.syncd_timer.min,
111 .extra2 = &xfs_params.syncd_timer.max
114 .ctl_name = XFS_INHERIT_SYNC,
115 .procname = "inherit_sync",
116 .data = &xfs_params.inherit_sync.val,
117 .maxlen = sizeof(int),
118 .mode = 0644,
119 .proc_handler = &proc_dointvec_minmax,
120 .strategy = &sysctl_intvec,
121 .extra1 = &xfs_params.inherit_sync.min,
122 .extra2 = &xfs_params.inherit_sync.max
125 .ctl_name = XFS_INHERIT_NODUMP,
126 .procname = "inherit_nodump",
127 .data = &xfs_params.inherit_nodump.val,
128 .maxlen = sizeof(int),
129 .mode = 0644,
130 .proc_handler = &proc_dointvec_minmax,
131 .strategy = &sysctl_intvec,
132 .extra1 = &xfs_params.inherit_nodump.min,
133 .extra2 = &xfs_params.inherit_nodump.max
136 .ctl_name = XFS_INHERIT_NOATIME,
137 .procname = "inherit_noatime",
138 .data = &xfs_params.inherit_noatim.val,
139 .maxlen = sizeof(int),
140 .mode = 0644,
141 .proc_handler = &proc_dointvec_minmax,
142 .strategy = &sysctl_intvec,
143 .extra1 = &xfs_params.inherit_noatim.min,
144 .extra2 = &xfs_params.inherit_noatim.max
147 .ctl_name = XFS_BUF_TIMER,
148 .procname = "xfsbufd_centisecs",
149 .data = &xfs_params.xfs_buf_timer.val,
150 .maxlen = sizeof(int),
151 .mode = 0644,
152 .proc_handler = &proc_dointvec_minmax,
153 .strategy = &sysctl_intvec,
154 .extra1 = &xfs_params.xfs_buf_timer.min,
155 .extra2 = &xfs_params.xfs_buf_timer.max
158 .ctl_name = XFS_BUF_AGE,
159 .procname = "age_buffer_centisecs",
160 .data = &xfs_params.xfs_buf_age.val,
161 .maxlen = sizeof(int),
162 .mode = 0644,
163 .proc_handler = &proc_dointvec_minmax,
164 .strategy = &sysctl_intvec,
165 .extra1 = &xfs_params.xfs_buf_age.min,
166 .extra2 = &xfs_params.xfs_buf_age.max
169 .ctl_name = XFS_INHERIT_NOSYM,
170 .procname = "inherit_nosymlinks",
171 .data = &xfs_params.inherit_nosym.val,
172 .maxlen = sizeof(int),
173 .mode = 0644,
174 .proc_handler = &proc_dointvec_minmax,
175 .strategy = &sysctl_intvec,
176 .extra1 = &xfs_params.inherit_nosym.min,
177 .extra2 = &xfs_params.inherit_nosym.max
180 .ctl_name = XFS_ROTORSTEP,
181 .procname = "rotorstep",
182 .data = &xfs_params.rotorstep.val,
183 .maxlen = sizeof(int),
184 .mode = 0644,
185 .proc_handler = &proc_dointvec_minmax,
186 .strategy = &sysctl_intvec,
187 .extra1 = &xfs_params.rotorstep.min,
188 .extra2 = &xfs_params.rotorstep.max
191 .ctl_name = XFS_INHERIT_NODFRG,
192 .procname = "inherit_nodefrag",
193 .data = &xfs_params.inherit_nodfrg.val,
194 .maxlen = sizeof(int),
195 .mode = 0644,
196 .proc_handler = &proc_dointvec_minmax,
197 .strategy = &sysctl_intvec,
198 .extra1 = &xfs_params.inherit_nodfrg.min,
199 .extra2 = &xfs_params.inherit_nodfrg.max
202 .ctl_name = XFS_FILESTREAM_TIMER,
203 .procname = "filestream_centisecs",
204 .data = &xfs_params.fstrm_timer.val,
205 .maxlen = sizeof(int),
206 .mode = 0644,
207 .proc_handler = &proc_dointvec_minmax,
208 .strategy = &sysctl_intvec,
209 .extra1 = &xfs_params.fstrm_timer.min,
210 .extra2 = &xfs_params.fstrm_timer.max,
212 /* please keep this the last entry */
213 #ifdef CONFIG_PROC_FS
215 .ctl_name = XFS_STATS_CLEAR,
216 .procname = "stats_clear",
217 .data = &xfs_params.stats_clear.val,
218 .maxlen = sizeof(int),
219 .mode = 0644,
220 .proc_handler = &xfs_stats_clear_proc_handler,
221 .strategy = &sysctl_intvec,
222 .extra1 = &xfs_params.stats_clear.min,
223 .extra2 = &xfs_params.stats_clear.max
225 #endif /* CONFIG_PROC_FS */
230 static ctl_table xfs_dir_table[] = {
232 .ctl_name = FS_XFS,
233 .procname = "xfs",
234 .mode = 0555,
235 .child = xfs_table
240 static ctl_table xfs_root_table[] = {
242 .ctl_name = CTL_FS,
243 .procname = "fs",
244 .mode = 0555,
245 .child = xfs_dir_table
251 xfs_sysctl_register(void)
253 xfs_table_header = register_sysctl_table(xfs_root_table);
254 if (!xfs_table_header)
255 return -ENOMEM;
256 return 0;
259 void
260 xfs_sysctl_unregister(void)
262 unregister_sysctl_table(xfs_table_header);