Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / xfs / linux-2.6 / xfs_sysctl.c
blob0dc010356f4dd4fad46ee960ef027a1e941ec208
1 /*
2 * Copyright (c) 2001-2004 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:
26 * http://www.sgi.com
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33 #include "xfs.h"
34 #include "xfs_rw.h"
35 #include <linux/sysctl.h>
36 #include <linux/proc_fs.h>
39 static struct ctl_table_header *xfs_table_header;
42 #ifdef CONFIG_PROC_FS
43 STATIC int
44 xfs_stats_clear_proc_handler(
45 ctl_table *ctl,
46 int write,
47 struct file *filp,
48 void __user *buffer,
49 size_t *lenp,
50 loff_t *ppos)
52 int c, ret, *valp = ctl->data;
53 __uint32_t vn_active;
55 ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp, ppos);
57 if (!ret && write && *valp) {
58 printk("XFS Clearing xfsstats\n");
59 for (c = 0; c < NR_CPUS; c++) {
60 if (!cpu_possible(c)) continue;
61 preempt_disable();
62 /* save vn_active, it's a universal truth! */
63 vn_active = per_cpu(xfsstats, c).vn_active;
64 memset(&per_cpu(xfsstats, c), 0,
65 sizeof(struct xfsstats));
66 per_cpu(xfsstats, c).vn_active = vn_active;
67 preempt_enable();
69 xfs_stats_clear = 0;
72 return ret;
74 #endif /* CONFIG_PROC_FS */
76 STATIC ctl_table xfs_table[] = {
77 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
78 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
79 &sysctl_intvec, NULL,
80 &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
82 {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
83 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
84 &sysctl_intvec, NULL,
85 &xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max},
87 {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
88 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
89 &sysctl_intvec, NULL,
90 &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
92 {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
93 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
94 &sysctl_intvec, NULL,
95 &xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
97 {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
98 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
99 &sysctl_intvec, NULL,
100 &xfs_params.error_level.min, &xfs_params.error_level.max},
102 {XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val,
103 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
104 &sysctl_intvec, NULL,
105 &xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max},
107 {XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
108 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
109 &sysctl_intvec, NULL,
110 &xfs_params.inherit_sync.min, &xfs_params.inherit_sync.max},
112 {XFS_INHERIT_NODUMP, "inherit_nodump", &xfs_params.inherit_nodump.val,
113 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
114 &sysctl_intvec, NULL,
115 &xfs_params.inherit_nodump.min, &xfs_params.inherit_nodump.max},
117 {XFS_INHERIT_NOATIME, "inherit_noatime", &xfs_params.inherit_noatim.val,
118 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
119 &sysctl_intvec, NULL,
120 &xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max},
122 {XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val,
123 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
124 &sysctl_intvec, NULL,
125 &xfs_params.xfs_buf_timer.min, &xfs_params.xfs_buf_timer.max},
127 {XFS_BUF_AGE, "age_buffer_centisecs", &xfs_params.xfs_buf_age.val,
128 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
129 &sysctl_intvec, NULL,
130 &xfs_params.xfs_buf_age.min, &xfs_params.xfs_buf_age.max},
132 {XFS_INHERIT_NOSYM, "inherit_nosymlinks", &xfs_params.inherit_nosym.val,
133 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
134 &sysctl_intvec, NULL,
135 &xfs_params.inherit_nosym.min, &xfs_params.inherit_nosym.max},
137 {XFS_ROTORSTEP, "rotorstep", &xfs_params.rotorstep.val,
138 sizeof(int), 0644, NULL, &proc_dointvec_minmax,
139 &sysctl_intvec, NULL,
140 &xfs_params.rotorstep.min, &xfs_params.rotorstep.max},
142 /* please keep this the last entry */
143 #ifdef CONFIG_PROC_FS
144 {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
145 sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler,
146 &sysctl_intvec, NULL,
147 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
148 #endif /* CONFIG_PROC_FS */
153 STATIC ctl_table xfs_dir_table[] = {
154 {FS_XFS, "xfs", NULL, 0, 0555, xfs_table},
158 STATIC ctl_table xfs_root_table[] = {
159 {CTL_FS, "fs", NULL, 0, 0555, xfs_dir_table},
163 void
164 xfs_sysctl_register(void)
166 xfs_table_header = register_sysctl_table(xfs_root_table, 1);
169 void
170 xfs_sysctl_unregister(void)
172 if (xfs_table_header)
173 unregister_sysctl_table(xfs_table_header);