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>
21 #include "xfs_error.h"
23 static struct ctl_table_header
*xfs_table_header
;
27 xfs_stats_clear_proc_handler(
28 struct ctl_table
*ctl
,
34 int c
, ret
, *valp
= ctl
->data
;
37 ret
= proc_dointvec_minmax(ctl
, write
, buffer
, lenp
, ppos
);
39 if (!ret
&& write
&& *valp
) {
40 xfs_notice(NULL
, "Clearing xfsstats");
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
;
57 xfs_panic_mask_proc_handler(
58 struct ctl_table
*ctl
,
64 int ret
, *valp
= ctl
->data
;
66 ret
= proc_dointvec_minmax(ctl
, write
, buffer
, lenp
, ppos
);
68 xfs_panic_mask
= *valp
;
70 xfs_panic_mask
|= (XFS_PTAG_SHUTDOWN_CORRUPT
| XFS_PTAG_LOGRES
);
75 #endif /* CONFIG_PROC_FS */
77 static struct ctl_table xfs_table
[] = {
79 .procname
= "irix_sgid_inherit",
80 .data
= &xfs_params
.sgid_inherit
.val
,
81 .maxlen
= sizeof(int),
83 .proc_handler
= proc_dointvec_minmax
,
84 .extra1
= &xfs_params
.sgid_inherit
.min
,
85 .extra2
= &xfs_params
.sgid_inherit
.max
88 .procname
= "irix_symlink_mode",
89 .data
= &xfs_params
.symlink_mode
.val
,
90 .maxlen
= sizeof(int),
92 .proc_handler
= proc_dointvec_minmax
,
93 .extra1
= &xfs_params
.symlink_mode
.min
,
94 .extra2
= &xfs_params
.symlink_mode
.max
97 .procname
= "panic_mask",
98 .data
= &xfs_params
.panic_mask
.val
,
99 .maxlen
= sizeof(int),
101 .proc_handler
= xfs_panic_mask_proc_handler
,
102 .extra1
= &xfs_params
.panic_mask
.min
,
103 .extra2
= &xfs_params
.panic_mask
.max
107 .procname
= "error_level",
108 .data
= &xfs_params
.error_level
.val
,
109 .maxlen
= sizeof(int),
111 .proc_handler
= proc_dointvec_minmax
,
112 .extra1
= &xfs_params
.error_level
.min
,
113 .extra2
= &xfs_params
.error_level
.max
116 .procname
= "xfssyncd_centisecs",
117 .data
= &xfs_params
.syncd_timer
.val
,
118 .maxlen
= sizeof(int),
120 .proc_handler
= proc_dointvec_minmax
,
121 .extra1
= &xfs_params
.syncd_timer
.min
,
122 .extra2
= &xfs_params
.syncd_timer
.max
125 .procname
= "inherit_sync",
126 .data
= &xfs_params
.inherit_sync
.val
,
127 .maxlen
= sizeof(int),
129 .proc_handler
= proc_dointvec_minmax
,
130 .extra1
= &xfs_params
.inherit_sync
.min
,
131 .extra2
= &xfs_params
.inherit_sync
.max
134 .procname
= "inherit_nodump",
135 .data
= &xfs_params
.inherit_nodump
.val
,
136 .maxlen
= sizeof(int),
138 .proc_handler
= proc_dointvec_minmax
,
139 .extra1
= &xfs_params
.inherit_nodump
.min
,
140 .extra2
= &xfs_params
.inherit_nodump
.max
143 .procname
= "inherit_noatime",
144 .data
= &xfs_params
.inherit_noatim
.val
,
145 .maxlen
= sizeof(int),
147 .proc_handler
= proc_dointvec_minmax
,
148 .extra1
= &xfs_params
.inherit_noatim
.min
,
149 .extra2
= &xfs_params
.inherit_noatim
.max
152 .procname
= "inherit_nosymlinks",
153 .data
= &xfs_params
.inherit_nosym
.val
,
154 .maxlen
= sizeof(int),
156 .proc_handler
= proc_dointvec_minmax
,
157 .extra1
= &xfs_params
.inherit_nosym
.min
,
158 .extra2
= &xfs_params
.inherit_nosym
.max
161 .procname
= "rotorstep",
162 .data
= &xfs_params
.rotorstep
.val
,
163 .maxlen
= sizeof(int),
165 .proc_handler
= proc_dointvec_minmax
,
166 .extra1
= &xfs_params
.rotorstep
.min
,
167 .extra2
= &xfs_params
.rotorstep
.max
170 .procname
= "inherit_nodefrag",
171 .data
= &xfs_params
.inherit_nodfrg
.val
,
172 .maxlen
= sizeof(int),
174 .proc_handler
= proc_dointvec_minmax
,
175 .extra1
= &xfs_params
.inherit_nodfrg
.min
,
176 .extra2
= &xfs_params
.inherit_nodfrg
.max
179 .procname
= "filestream_centisecs",
180 .data
= &xfs_params
.fstrm_timer
.val
,
181 .maxlen
= sizeof(int),
183 .proc_handler
= proc_dointvec_minmax
,
184 .extra1
= &xfs_params
.fstrm_timer
.min
,
185 .extra2
= &xfs_params
.fstrm_timer
.max
,
188 .procname
= "speculative_prealloc_lifetime",
189 .data
= &xfs_params
.eofb_timer
.val
,
190 .maxlen
= sizeof(int),
192 .proc_handler
= proc_dointvec_minmax
,
193 .extra1
= &xfs_params
.eofb_timer
.min
,
194 .extra2
= &xfs_params
.eofb_timer
.max
,
196 /* please keep this the last entry */
197 #ifdef CONFIG_PROC_FS
199 .procname
= "stats_clear",
200 .data
= &xfs_params
.stats_clear
.val
,
201 .maxlen
= sizeof(int),
203 .proc_handler
= xfs_stats_clear_proc_handler
,
204 .extra1
= &xfs_params
.stats_clear
.min
,
205 .extra2
= &xfs_params
.stats_clear
.max
207 #endif /* CONFIG_PROC_FS */
212 static struct ctl_table xfs_dir_table
[] = {
221 static struct ctl_table xfs_root_table
[] = {
225 .child
= xfs_dir_table
231 xfs_sysctl_register(void)
233 xfs_table_header
= register_sysctl_table(xfs_root_table
);
234 if (!xfs_table_header
)
240 xfs_sysctl_unregister(void)
242 unregister_sysctl_table(xfs_table_header
);