0001
0002
0003
0004
0005
0006 #include "xfs.h"
0007 #include "xfs_error.h"
0008
0009 static struct ctl_table_header *xfs_table_header;
0010
0011 #ifdef CONFIG_PROC_FS
0012 STATIC int
0013 xfs_stats_clear_proc_handler(
0014 struct ctl_table *ctl,
0015 int write,
0016 void *buffer,
0017 size_t *lenp,
0018 loff_t *ppos)
0019 {
0020 int ret, *valp = ctl->data;
0021
0022 ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
0023
0024 if (!ret && write && *valp) {
0025 xfs_stats_clearall(xfsstats.xs_stats);
0026 xfs_stats_clear = 0;
0027 }
0028
0029 return ret;
0030 }
0031
0032 STATIC int
0033 xfs_panic_mask_proc_handler(
0034 struct ctl_table *ctl,
0035 int write,
0036 void *buffer,
0037 size_t *lenp,
0038 loff_t *ppos)
0039 {
0040 int ret, *valp = ctl->data;
0041
0042 ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
0043 if (!ret && write) {
0044 xfs_panic_mask = *valp;
0045 #ifdef DEBUG
0046 xfs_panic_mask |= (XFS_PTAG_SHUTDOWN_CORRUPT | XFS_PTAG_LOGRES);
0047 #endif
0048 }
0049 return ret;
0050 }
0051 #endif
0052
0053 STATIC int
0054 xfs_deprecated_dointvec_minmax(
0055 struct ctl_table *ctl,
0056 int write,
0057 void *buffer,
0058 size_t *lenp,
0059 loff_t *ppos)
0060 {
0061 if (write) {
0062 printk_ratelimited(KERN_WARNING
0063 "XFS: %s sysctl option is deprecated.\n",
0064 ctl->procname);
0065 }
0066 return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
0067 }
0068
0069 static struct ctl_table xfs_table[] = {
0070 {
0071 .procname = "irix_sgid_inherit",
0072 .data = &xfs_params.sgid_inherit.val,
0073 .maxlen = sizeof(int),
0074 .mode = 0644,
0075 .proc_handler = xfs_deprecated_dointvec_minmax,
0076 .extra1 = &xfs_params.sgid_inherit.min,
0077 .extra2 = &xfs_params.sgid_inherit.max
0078 },
0079 {
0080 .procname = "irix_symlink_mode",
0081 .data = &xfs_params.symlink_mode.val,
0082 .maxlen = sizeof(int),
0083 .mode = 0644,
0084 .proc_handler = xfs_deprecated_dointvec_minmax,
0085 .extra1 = &xfs_params.symlink_mode.min,
0086 .extra2 = &xfs_params.symlink_mode.max
0087 },
0088 {
0089 .procname = "panic_mask",
0090 .data = &xfs_params.panic_mask.val,
0091 .maxlen = sizeof(int),
0092 .mode = 0644,
0093 .proc_handler = xfs_panic_mask_proc_handler,
0094 .extra1 = &xfs_params.panic_mask.min,
0095 .extra2 = &xfs_params.panic_mask.max
0096 },
0097
0098 {
0099 .procname = "error_level",
0100 .data = &xfs_params.error_level.val,
0101 .maxlen = sizeof(int),
0102 .mode = 0644,
0103 .proc_handler = proc_dointvec_minmax,
0104 .extra1 = &xfs_params.error_level.min,
0105 .extra2 = &xfs_params.error_level.max
0106 },
0107 {
0108 .procname = "xfssyncd_centisecs",
0109 .data = &xfs_params.syncd_timer.val,
0110 .maxlen = sizeof(int),
0111 .mode = 0644,
0112 .proc_handler = proc_dointvec_minmax,
0113 .extra1 = &xfs_params.syncd_timer.min,
0114 .extra2 = &xfs_params.syncd_timer.max
0115 },
0116 {
0117 .procname = "inherit_sync",
0118 .data = &xfs_params.inherit_sync.val,
0119 .maxlen = sizeof(int),
0120 .mode = 0644,
0121 .proc_handler = proc_dointvec_minmax,
0122 .extra1 = &xfs_params.inherit_sync.min,
0123 .extra2 = &xfs_params.inherit_sync.max
0124 },
0125 {
0126 .procname = "inherit_nodump",
0127 .data = &xfs_params.inherit_nodump.val,
0128 .maxlen = sizeof(int),
0129 .mode = 0644,
0130 .proc_handler = proc_dointvec_minmax,
0131 .extra1 = &xfs_params.inherit_nodump.min,
0132 .extra2 = &xfs_params.inherit_nodump.max
0133 },
0134 {
0135 .procname = "inherit_noatime",
0136 .data = &xfs_params.inherit_noatim.val,
0137 .maxlen = sizeof(int),
0138 .mode = 0644,
0139 .proc_handler = proc_dointvec_minmax,
0140 .extra1 = &xfs_params.inherit_noatim.min,
0141 .extra2 = &xfs_params.inherit_noatim.max
0142 },
0143 {
0144 .procname = "inherit_nosymlinks",
0145 .data = &xfs_params.inherit_nosym.val,
0146 .maxlen = sizeof(int),
0147 .mode = 0644,
0148 .proc_handler = proc_dointvec_minmax,
0149 .extra1 = &xfs_params.inherit_nosym.min,
0150 .extra2 = &xfs_params.inherit_nosym.max
0151 },
0152 {
0153 .procname = "rotorstep",
0154 .data = &xfs_params.rotorstep.val,
0155 .maxlen = sizeof(int),
0156 .mode = 0644,
0157 .proc_handler = proc_dointvec_minmax,
0158 .extra1 = &xfs_params.rotorstep.min,
0159 .extra2 = &xfs_params.rotorstep.max
0160 },
0161 {
0162 .procname = "inherit_nodefrag",
0163 .data = &xfs_params.inherit_nodfrg.val,
0164 .maxlen = sizeof(int),
0165 .mode = 0644,
0166 .proc_handler = proc_dointvec_minmax,
0167 .extra1 = &xfs_params.inherit_nodfrg.min,
0168 .extra2 = &xfs_params.inherit_nodfrg.max
0169 },
0170 {
0171 .procname = "filestream_centisecs",
0172 .data = &xfs_params.fstrm_timer.val,
0173 .maxlen = sizeof(int),
0174 .mode = 0644,
0175 .proc_handler = proc_dointvec_minmax,
0176 .extra1 = &xfs_params.fstrm_timer.min,
0177 .extra2 = &xfs_params.fstrm_timer.max,
0178 },
0179 {
0180 .procname = "speculative_prealloc_lifetime",
0181 .data = &xfs_params.blockgc_timer.val,
0182 .maxlen = sizeof(int),
0183 .mode = 0644,
0184 .proc_handler = proc_dointvec_minmax,
0185 .extra1 = &xfs_params.blockgc_timer.min,
0186 .extra2 = &xfs_params.blockgc_timer.max,
0187 },
0188 {
0189 .procname = "speculative_cow_prealloc_lifetime",
0190 .data = &xfs_params.blockgc_timer.val,
0191 .maxlen = sizeof(int),
0192 .mode = 0644,
0193 .proc_handler = xfs_deprecated_dointvec_minmax,
0194 .extra1 = &xfs_params.blockgc_timer.min,
0195 .extra2 = &xfs_params.blockgc_timer.max,
0196 },
0197
0198 #ifdef CONFIG_PROC_FS
0199 {
0200 .procname = "stats_clear",
0201 .data = &xfs_params.stats_clear.val,
0202 .maxlen = sizeof(int),
0203 .mode = 0644,
0204 .proc_handler = xfs_stats_clear_proc_handler,
0205 .extra1 = &xfs_params.stats_clear.min,
0206 .extra2 = &xfs_params.stats_clear.max
0207 },
0208 #endif
0209
0210 {}
0211 };
0212
0213 static struct ctl_table xfs_dir_table[] = {
0214 {
0215 .procname = "xfs",
0216 .mode = 0555,
0217 .child = xfs_table
0218 },
0219 {}
0220 };
0221
0222 static struct ctl_table xfs_root_table[] = {
0223 {
0224 .procname = "fs",
0225 .mode = 0555,
0226 .child = xfs_dir_table
0227 },
0228 {}
0229 };
0230
0231 int
0232 xfs_sysctl_register(void)
0233 {
0234 xfs_table_header = register_sysctl_table(xfs_root_table);
0235 if (!xfs_table_header)
0236 return -ENOMEM;
0237 return 0;
0238 }
0239
0240 void
0241 xfs_sysctl_unregister(void)
0242 {
0243 unregister_sysctl_table(xfs_table_header);
0244 }