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(
33 int c
, ret
, *valp
= ctl
->data
;
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
) {
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
;
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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
[] = {
240 static ctl_table xfs_root_table
[] = {
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
)
260 xfs_sysctl_unregister(void)
262 unregister_sysctl_table(xfs_table_header
);