Merge with 2.5.75.
[linux-2.6/linux-mips.git] / fs / xfs / linux / xfs_sysctl.c
blob34041998ba39071ab7b46f242f36a59eaad861f3
1 /*
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:
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 *buffer,
49 size_t *lenp)
51 int ret, *valp = ctl->data;
52 __uint32_t vn_active;
54 ret = proc_doulongvec_minmax(ctl, write, filp, buffer, lenp);
56 if (!ret && write && *valp) {
57 printk("XFS Clearing xfsstats\n");
58 /* save vn_active, it's a universal truth! */
59 vn_active = xfsstats.vn_active;
60 memset(&xfsstats, 0, sizeof(xfsstats));
61 xfsstats.vn_active = vn_active;
62 xfs_stats_clear = 0;
65 return ret;
67 #endif /* CONFIG_PROC_FS */
69 STATIC ctl_table xfs_table[] = {
70 {XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
71 sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
72 &sysctl_intvec, NULL,
73 &xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
75 {XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
76 sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
77 &sysctl_intvec, NULL,
78 &xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max},
80 {XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
81 sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
82 &sysctl_intvec, NULL,
83 &xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
85 {XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
86 sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
87 &sysctl_intvec, NULL,
88 &xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
90 {XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
91 sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
92 &sysctl_intvec, NULL,
93 &xfs_params.error_level.min, &xfs_params.error_level.max},
95 {XFS_SYNC_INTERVAL, "sync_interval", &xfs_params.sync_interval.val,
96 sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
97 &sysctl_intvec, NULL,
98 &xfs_params.sync_interval.min, &xfs_params.sync_interval.max},
100 /* please keep this the last entry */
101 #ifdef CONFIG_PROC_FS
102 {XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
103 sizeof(ulong), 0644, NULL, &xfs_stats_clear_proc_handler,
104 &sysctl_intvec, NULL,
105 &xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
106 #endif /* CONFIG_PROC_FS */
111 STATIC ctl_table xfs_dir_table[] = {
112 {FS_XFS, "xfs", NULL, 0, 0555, xfs_table},
116 STATIC ctl_table xfs_root_table[] = {
117 {CTL_FS, "fs", NULL, 0, 0555, xfs_dir_table},
121 void
122 xfs_sysctl_register(void)
124 xfs_table_header = register_sysctl_table(xfs_root_table, 1);
127 void
128 xfs_sysctl_unregister(void)
130 if (xfs_table_header)
131 unregister_sysctl_table(xfs_table_header);