2 * Copyright (c) 2001-2005 Silicon Graphics, Inc.
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
19 #include <linux/sysctl.h>
20 #include <linux/proc_fs.h>
22 static struct ctl_table_header
*xfs_table_header
;
26 xfs_stats_clear_proc_handler(
34 int c
, ret
, *valp
= ctl
->data
;
37 ret
= proc_dointvec_minmax(ctl
, write
, filp
, buffer
, lenp
, ppos
);
39 if (!ret
&& write
&& *valp
) {
40 printk("XFS Clearing xfsstats\n");
41 for_each_possible_cpu(c
) {
43 /* save vn_active, it's a universal truth! */
44 vn_active
= per_cpu(xfsstats
, c
).vn_active
;
45 memset(&per_cpu(xfsstats
, c
), 0,
46 sizeof(struct xfsstats
));
47 per_cpu(xfsstats
, c
).vn_active
= vn_active
;
55 #endif /* CONFIG_PROC_FS */
57 static ctl_table xfs_table
[] = {
59 .ctl_name
= XFS_SGID_INHERIT
,
60 .procname
= "irix_sgid_inherit",
61 .data
= &xfs_params
.sgid_inherit
.val
,
62 .maxlen
= sizeof(int),
64 .proc_handler
= &proc_dointvec_minmax
,
65 .strategy
= &sysctl_intvec
,
66 .extra1
= &xfs_params
.sgid_inherit
.min
,
67 .extra2
= &xfs_params
.sgid_inherit
.max
70 .ctl_name
= XFS_SYMLINK_MODE
,
71 .procname
= "irix_symlink_mode",
72 .data
= &xfs_params
.symlink_mode
.val
,
73 .maxlen
= sizeof(int),
75 .proc_handler
= &proc_dointvec_minmax
,
76 .strategy
= &sysctl_intvec
,
77 .extra1
= &xfs_params
.symlink_mode
.min
,
78 .extra2
= &xfs_params
.symlink_mode
.max
81 .ctl_name
= XFS_PANIC_MASK
,
82 .procname
= "panic_mask",
83 .data
= &xfs_params
.panic_mask
.val
,
84 .maxlen
= sizeof(int),
86 .proc_handler
= &proc_dointvec_minmax
,
87 .strategy
= &sysctl_intvec
,
88 .extra1
= &xfs_params
.panic_mask
.min
,
89 .extra2
= &xfs_params
.panic_mask
.max
93 .ctl_name
= XFS_ERRLEVEL
,
94 .procname
= "error_level",
95 .data
= &xfs_params
.error_level
.val
,
96 .maxlen
= sizeof(int),
98 .proc_handler
= &proc_dointvec_minmax
,
99 .strategy
= &sysctl_intvec
,
100 .extra1
= &xfs_params
.error_level
.min
,
101 .extra2
= &xfs_params
.error_level
.max
104 .ctl_name
= XFS_SYNCD_TIMER
,
105 .procname
= "xfssyncd_centisecs",
106 .data
= &xfs_params
.syncd_timer
.val
,
107 .maxlen
= sizeof(int),
109 .proc_handler
= &proc_dointvec_minmax
,
110 .strategy
= &sysctl_intvec
,
111 .extra1
= &xfs_params
.syncd_timer
.min
,
112 .extra2
= &xfs_params
.syncd_timer
.max
115 .ctl_name
= XFS_INHERIT_SYNC
,
116 .procname
= "inherit_sync",
117 .data
= &xfs_params
.inherit_sync
.val
,
118 .maxlen
= sizeof(int),
120 .proc_handler
= &proc_dointvec_minmax
,
121 .strategy
= &sysctl_intvec
,
122 .extra1
= &xfs_params
.inherit_sync
.min
,
123 .extra2
= &xfs_params
.inherit_sync
.max
126 .ctl_name
= XFS_INHERIT_NODUMP
,
127 .procname
= "inherit_nodump",
128 .data
= &xfs_params
.inherit_nodump
.val
,
129 .maxlen
= sizeof(int),
131 .proc_handler
= &proc_dointvec_minmax
,
132 .strategy
= &sysctl_intvec
,
133 .extra1
= &xfs_params
.inherit_nodump
.min
,
134 .extra2
= &xfs_params
.inherit_nodump
.max
137 .ctl_name
= XFS_INHERIT_NOATIME
,
138 .procname
= "inherit_noatime",
139 .data
= &xfs_params
.inherit_noatim
.val
,
140 .maxlen
= sizeof(int),
142 .proc_handler
= &proc_dointvec_minmax
,
143 .strategy
= &sysctl_intvec
,
144 .extra1
= &xfs_params
.inherit_noatim
.min
,
145 .extra2
= &xfs_params
.inherit_noatim
.max
148 .ctl_name
= XFS_BUF_TIMER
,
149 .procname
= "xfsbufd_centisecs",
150 .data
= &xfs_params
.xfs_buf_timer
.val
,
151 .maxlen
= sizeof(int),
153 .proc_handler
= &proc_dointvec_minmax
,
154 .strategy
= &sysctl_intvec
,
155 .extra1
= &xfs_params
.xfs_buf_timer
.min
,
156 .extra2
= &xfs_params
.xfs_buf_timer
.max
159 .ctl_name
= XFS_BUF_AGE
,
160 .procname
= "age_buffer_centisecs",
161 .data
= &xfs_params
.xfs_buf_age
.val
,
162 .maxlen
= sizeof(int),
164 .proc_handler
= &proc_dointvec_minmax
,
165 .strategy
= &sysctl_intvec
,
166 .extra1
= &xfs_params
.xfs_buf_age
.min
,
167 .extra2
= &xfs_params
.xfs_buf_age
.max
170 .ctl_name
= XFS_INHERIT_NOSYM
,
171 .procname
= "inherit_nosymlinks",
172 .data
= &xfs_params
.inherit_nosym
.val
,
173 .maxlen
= sizeof(int),
175 .proc_handler
= &proc_dointvec_minmax
,
176 .strategy
= &sysctl_intvec
,
177 .extra1
= &xfs_params
.inherit_nosym
.min
,
178 .extra2
= &xfs_params
.inherit_nosym
.max
181 .ctl_name
= XFS_ROTORSTEP
,
182 .procname
= "rotorstep",
183 .data
= &xfs_params
.rotorstep
.val
,
184 .maxlen
= sizeof(int),
186 .proc_handler
= &proc_dointvec_minmax
,
187 .strategy
= &sysctl_intvec
,
188 .extra1
= &xfs_params
.rotorstep
.min
,
189 .extra2
= &xfs_params
.rotorstep
.max
192 .ctl_name
= XFS_INHERIT_NODFRG
,
193 .procname
= "inherit_nodefrag",
194 .data
= &xfs_params
.inherit_nodfrg
.val
,
195 .maxlen
= sizeof(int),
197 .proc_handler
= &proc_dointvec_minmax
,
198 .strategy
= &sysctl_intvec
,
199 .extra1
= &xfs_params
.inherit_nodfrg
.min
,
200 .extra2
= &xfs_params
.inherit_nodfrg
.max
203 .ctl_name
= XFS_FILESTREAM_TIMER
,
204 .procname
= "filestream_centisecs",
205 .data
= &xfs_params
.fstrm_timer
.val
,
206 .maxlen
= sizeof(int),
208 .proc_handler
= &proc_dointvec_minmax
,
209 .strategy
= &sysctl_intvec
,
210 .extra1
= &xfs_params
.fstrm_timer
.min
,
211 .extra2
= &xfs_params
.fstrm_timer
.max
,
213 /* please keep this the last entry */
214 #ifdef CONFIG_PROC_FS
216 .ctl_name
= XFS_STATS_CLEAR
,
217 .procname
= "stats_clear",
218 .data
= &xfs_params
.stats_clear
.val
,
219 .maxlen
= sizeof(int),
221 .proc_handler
= &xfs_stats_clear_proc_handler
,
222 .strategy
= &sysctl_intvec
,
223 .extra1
= &xfs_params
.stats_clear
.min
,
224 .extra2
= &xfs_params
.stats_clear
.max
226 #endif /* CONFIG_PROC_FS */
231 static ctl_table xfs_dir_table
[] = {
241 static ctl_table xfs_root_table
[] = {
246 .child
= xfs_dir_table
252 xfs_sysctl_register(void)
254 xfs_table_header
= register_sysctl_table(xfs_root_table
);
255 if (!xfs_table_header
)
261 xfs_sysctl_unregister(void)
263 unregister_sysctl_table(xfs_table_header
);