Linux 5.10.7
[linux/fpc-iii.git] / fs / xfs / xfs_sysctl.c
blobfac9de7ee6d00ad62ba29b59c547841350f75378
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) 2001-2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6 #include "xfs.h"
7 #include "xfs_error.h"
9 static struct ctl_table_header *xfs_table_header;
11 #ifdef CONFIG_PROC_FS
12 STATIC int
13 xfs_stats_clear_proc_handler(
14 struct ctl_table *ctl,
15 int write,
16 void *buffer,
17 size_t *lenp,
18 loff_t *ppos)
20 int ret, *valp = ctl->data;
22 ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
24 if (!ret && write && *valp) {
25 xfs_stats_clearall(xfsstats.xs_stats);
26 xfs_stats_clear = 0;
29 return ret;
32 STATIC int
33 xfs_panic_mask_proc_handler(
34 struct ctl_table *ctl,
35 int write,
36 void *buffer,
37 size_t *lenp,
38 loff_t *ppos)
40 int ret, *valp = ctl->data;
42 ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
43 if (!ret && write) {
44 xfs_panic_mask = *valp;
45 #ifdef DEBUG
46 xfs_panic_mask |= (XFS_PTAG_SHUTDOWN_CORRUPT | XFS_PTAG_LOGRES);
47 #endif
49 return ret;
51 #endif /* CONFIG_PROC_FS */
53 STATIC int
54 xfs_deprecate_irix_sgid_inherit_proc_handler(
55 struct ctl_table *ctl,
56 int write,
57 void *buffer,
58 size_t *lenp,
59 loff_t *ppos)
61 if (write) {
62 printk_once(KERN_WARNING
63 "XFS: " "%s sysctl option is deprecated.\n",
64 ctl->procname);
66 return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
69 STATIC int
70 xfs_deprecate_irix_symlink_mode_proc_handler(
71 struct ctl_table *ctl,
72 int write,
73 void *buffer,
74 size_t *lenp,
75 loff_t *ppos)
77 if (write) {
78 printk_once(KERN_WARNING
79 "XFS: " "%s sysctl option is deprecated.\n",
80 ctl->procname);
82 return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
85 static struct ctl_table xfs_table[] = {
87 .procname = "irix_sgid_inherit",
88 .data = &xfs_params.sgid_inherit.val,
89 .maxlen = sizeof(int),
90 .mode = 0644,
91 .proc_handler = xfs_deprecate_irix_sgid_inherit_proc_handler,
92 .extra1 = &xfs_params.sgid_inherit.min,
93 .extra2 = &xfs_params.sgid_inherit.max
96 .procname = "irix_symlink_mode",
97 .data = &xfs_params.symlink_mode.val,
98 .maxlen = sizeof(int),
99 .mode = 0644,
100 .proc_handler = xfs_deprecate_irix_symlink_mode_proc_handler,
101 .extra1 = &xfs_params.symlink_mode.min,
102 .extra2 = &xfs_params.symlink_mode.max
105 .procname = "panic_mask",
106 .data = &xfs_params.panic_mask.val,
107 .maxlen = sizeof(int),
108 .mode = 0644,
109 .proc_handler = xfs_panic_mask_proc_handler,
110 .extra1 = &xfs_params.panic_mask.min,
111 .extra2 = &xfs_params.panic_mask.max
115 .procname = "error_level",
116 .data = &xfs_params.error_level.val,
117 .maxlen = sizeof(int),
118 .mode = 0644,
119 .proc_handler = proc_dointvec_minmax,
120 .extra1 = &xfs_params.error_level.min,
121 .extra2 = &xfs_params.error_level.max
124 .procname = "xfssyncd_centisecs",
125 .data = &xfs_params.syncd_timer.val,
126 .maxlen = sizeof(int),
127 .mode = 0644,
128 .proc_handler = proc_dointvec_minmax,
129 .extra1 = &xfs_params.syncd_timer.min,
130 .extra2 = &xfs_params.syncd_timer.max
133 .procname = "inherit_sync",
134 .data = &xfs_params.inherit_sync.val,
135 .maxlen = sizeof(int),
136 .mode = 0644,
137 .proc_handler = proc_dointvec_minmax,
138 .extra1 = &xfs_params.inherit_sync.min,
139 .extra2 = &xfs_params.inherit_sync.max
142 .procname = "inherit_nodump",
143 .data = &xfs_params.inherit_nodump.val,
144 .maxlen = sizeof(int),
145 .mode = 0644,
146 .proc_handler = proc_dointvec_minmax,
147 .extra1 = &xfs_params.inherit_nodump.min,
148 .extra2 = &xfs_params.inherit_nodump.max
151 .procname = "inherit_noatime",
152 .data = &xfs_params.inherit_noatim.val,
153 .maxlen = sizeof(int),
154 .mode = 0644,
155 .proc_handler = proc_dointvec_minmax,
156 .extra1 = &xfs_params.inherit_noatim.min,
157 .extra2 = &xfs_params.inherit_noatim.max
160 .procname = "inherit_nosymlinks",
161 .data = &xfs_params.inherit_nosym.val,
162 .maxlen = sizeof(int),
163 .mode = 0644,
164 .proc_handler = proc_dointvec_minmax,
165 .extra1 = &xfs_params.inherit_nosym.min,
166 .extra2 = &xfs_params.inherit_nosym.max
169 .procname = "rotorstep",
170 .data = &xfs_params.rotorstep.val,
171 .maxlen = sizeof(int),
172 .mode = 0644,
173 .proc_handler = proc_dointvec_minmax,
174 .extra1 = &xfs_params.rotorstep.min,
175 .extra2 = &xfs_params.rotorstep.max
178 .procname = "inherit_nodefrag",
179 .data = &xfs_params.inherit_nodfrg.val,
180 .maxlen = sizeof(int),
181 .mode = 0644,
182 .proc_handler = proc_dointvec_minmax,
183 .extra1 = &xfs_params.inherit_nodfrg.min,
184 .extra2 = &xfs_params.inherit_nodfrg.max
187 .procname = "filestream_centisecs",
188 .data = &xfs_params.fstrm_timer.val,
189 .maxlen = sizeof(int),
190 .mode = 0644,
191 .proc_handler = proc_dointvec_minmax,
192 .extra1 = &xfs_params.fstrm_timer.min,
193 .extra2 = &xfs_params.fstrm_timer.max,
196 .procname = "speculative_prealloc_lifetime",
197 .data = &xfs_params.eofb_timer.val,
198 .maxlen = sizeof(int),
199 .mode = 0644,
200 .proc_handler = proc_dointvec_minmax,
201 .extra1 = &xfs_params.eofb_timer.min,
202 .extra2 = &xfs_params.eofb_timer.max,
205 .procname = "speculative_cow_prealloc_lifetime",
206 .data = &xfs_params.cowb_timer.val,
207 .maxlen = sizeof(int),
208 .mode = 0644,
209 .proc_handler = proc_dointvec_minmax,
210 .extra1 = &xfs_params.cowb_timer.min,
211 .extra2 = &xfs_params.cowb_timer.max,
213 /* please keep this the last entry */
214 #ifdef CONFIG_PROC_FS
216 .procname = "stats_clear",
217 .data = &xfs_params.stats_clear.val,
218 .maxlen = sizeof(int),
219 .mode = 0644,
220 .proc_handler = xfs_stats_clear_proc_handler,
221 .extra1 = &xfs_params.stats_clear.min,
222 .extra2 = &xfs_params.stats_clear.max
224 #endif /* CONFIG_PROC_FS */
229 static struct ctl_table xfs_dir_table[] = {
231 .procname = "xfs",
232 .mode = 0555,
233 .child = xfs_table
238 static struct ctl_table xfs_root_table[] = {
240 .procname = "fs",
241 .mode = 0555,
242 .child = xfs_dir_table
248 xfs_sysctl_register(void)
250 xfs_table_header = register_sysctl_table(xfs_root_table);
251 if (!xfs_table_header)
252 return -ENOMEM;
253 return 0;
256 void
257 xfs_sysctl_unregister(void)
259 unregister_sysctl_table(xfs_table_header);