2 * Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
35 #include <linux/sysctl.h>
36 #include <linux/proc_fs.h>
39 static struct ctl_table_header *xfs_table_header;
44 xfs_stats_clear_proc_handler(
51 int c, ret, *valp = ctl->data;
54 ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
56 if (!ret && write && *valp) {
57 printk("XFS Clearing xfsstats\n");
58 for (c = 0; c < NR_CPUS; c++) {
59 if (!cpu_possible(c)) continue;
61 /* save vn_active, it's a universal truth! */
62 vn_active = per_cpu(xfsstats, c).vn_active;
63 memset(&per_cpu(xfsstats, c), 0,
64 sizeof(struct xfsstats));
65 per_cpu(xfsstats, c).vn_active = vn_active;
73 #endif /* CONFIG_PROC_FS */
75 STATIC ctl_table xfs_table[] = {
76 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
77 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
79 &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
81 {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
82 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
84 &xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max},
86 {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
87 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
89 &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
91 {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
92 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
94 &xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
96 {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
97 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
99 &xfs_params.error_level.min, &xfs_params.error_level.max},
101 {XFS_SYNC_INTERVAL, "sync_interval", &xfs_params.sync_interval.val,
102 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
103 &sysctl_intvec, NULL,
104 &xfs_params.sync_interval.min, &xfs_params.sync_interval.max},
106 {XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
107 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
108 &sysctl_intvec, NULL,
109 &xfs_params.inherit_sync.min, &xfs_params.inherit_sync.max},
111 {XFS_INHERIT_NODUMP, "inherit_nodump", &xfs_params.inherit_nodump.val,
112 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
113 &sysctl_intvec, NULL,
114 &xfs_params.inherit_nodump.min, &xfs_params.inherit_nodump.max},
116 {XFS_INHERIT_NOATIME, "inherit_noatime", &xfs_params.inherit_noatim.val,
117 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
118 &sysctl_intvec, NULL,
119 &xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max},
121 {XFS_FLUSH_INTERVAL, "flush_interval", &xfs_params.flush_interval.val,
122 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
123 &sysctl_intvec, NULL,
124 &xfs_params.flush_interval.min, &xfs_params.flush_interval.max},
126 {XFS_AGE_BUFFER, "age_buffer", &xfs_params.age_buffer.val,
127 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
128 &sysctl_intvec, NULL,
129 &xfs_params.age_buffer.min, &xfs_params.age_buffer.max},
131 /* please keep this the last entry */
132 #ifdef CONFIG_PROC_FS
133 {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
134 sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler,
135 &sysctl_intvec, NULL,
136 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
137 #endif /* CONFIG_PROC_FS */
142 STATIC ctl_table xfs_dir_table[] = {
143 {FS_XFS, "xfs", NULL, 0, 0555, xfs_table},
147 STATIC ctl_table xfs_root_table[] = {
148 {CTL_FS, "fs", NULL, 0, 0555, xfs_dir_table},
153 xfs_sysctl_register(void)
155 xfs_table_header = register_sysctl_table(xfs_root_table, 1);
159 xfs_sysctl_unregister(void)
161 if (xfs_table_header)
162 unregister_sysctl_table(xfs_table_header);