root/fs/xfs/xfs_sysctl.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. xfs_stats_clear_proc_handler
  2. xfs_panic_mask_proc_handler
  3. xfs_sysctl_register
  4. xfs_sysctl_unregister

   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"
   8 
   9 static struct ctl_table_header *xfs_table_header;
  10 
  11 #ifdef CONFIG_PROC_FS
  12 STATIC int
  13 xfs_stats_clear_proc_handler(
  14         struct ctl_table        *ctl,
  15         int                     write,
  16         void                    __user *buffer,
  17         size_t                  *lenp,
  18         loff_t                  *ppos)
  19 {
  20         int             ret, *valp = ctl->data;
  21 
  22         ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
  23 
  24         if (!ret && write && *valp) {
  25                 xfs_stats_clearall(xfsstats.xs_stats);
  26                 xfs_stats_clear = 0;
  27         }
  28 
  29         return ret;
  30 }
  31 
  32 STATIC int
  33 xfs_panic_mask_proc_handler(
  34         struct ctl_table        *ctl,
  35         int                     write,
  36         void                    __user *buffer,
  37         size_t                  *lenp,
  38         loff_t                  *ppos)
  39 {
  40         int             ret, *valp = ctl->data;
  41 
  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
  48         }
  49         return ret;
  50 }
  51 #endif /* CONFIG_PROC_FS */
  52 
  53 static struct ctl_table xfs_table[] = {
  54         {
  55                 .procname       = "irix_sgid_inherit",
  56                 .data           = &xfs_params.sgid_inherit.val,
  57                 .maxlen         = sizeof(int),
  58                 .mode           = 0644,
  59                 .proc_handler   = proc_dointvec_minmax,
  60                 .extra1         = &xfs_params.sgid_inherit.min,
  61                 .extra2         = &xfs_params.sgid_inherit.max
  62         },
  63         {
  64                 .procname       = "irix_symlink_mode",
  65                 .data           = &xfs_params.symlink_mode.val,
  66                 .maxlen         = sizeof(int),
  67                 .mode           = 0644,
  68                 .proc_handler   = proc_dointvec_minmax,
  69                 .extra1         = &xfs_params.symlink_mode.min,
  70                 .extra2         = &xfs_params.symlink_mode.max
  71         },
  72         {
  73                 .procname       = "panic_mask",
  74                 .data           = &xfs_params.panic_mask.val,
  75                 .maxlen         = sizeof(int),
  76                 .mode           = 0644,
  77                 .proc_handler   = xfs_panic_mask_proc_handler,
  78                 .extra1         = &xfs_params.panic_mask.min,
  79                 .extra2         = &xfs_params.panic_mask.max
  80         },
  81 
  82         {
  83                 .procname       = "error_level",
  84                 .data           = &xfs_params.error_level.val,
  85                 .maxlen         = sizeof(int),
  86                 .mode           = 0644,
  87                 .proc_handler   = proc_dointvec_minmax,
  88                 .extra1         = &xfs_params.error_level.min,
  89                 .extra2         = &xfs_params.error_level.max
  90         },
  91         {
  92                 .procname       = "xfssyncd_centisecs",
  93                 .data           = &xfs_params.syncd_timer.val,
  94                 .maxlen         = sizeof(int),
  95                 .mode           = 0644,
  96                 .proc_handler   = proc_dointvec_minmax,
  97                 .extra1         = &xfs_params.syncd_timer.min,
  98                 .extra2         = &xfs_params.syncd_timer.max
  99         },
 100         {
 101                 .procname       = "inherit_sync",
 102                 .data           = &xfs_params.inherit_sync.val,
 103                 .maxlen         = sizeof(int),
 104                 .mode           = 0644,
 105                 .proc_handler   = proc_dointvec_minmax,
 106                 .extra1         = &xfs_params.inherit_sync.min,
 107                 .extra2         = &xfs_params.inherit_sync.max
 108         },
 109         {
 110                 .procname       = "inherit_nodump",
 111                 .data           = &xfs_params.inherit_nodump.val,
 112                 .maxlen         = sizeof(int),
 113                 .mode           = 0644,
 114                 .proc_handler   = proc_dointvec_minmax,
 115                 .extra1         = &xfs_params.inherit_nodump.min,
 116                 .extra2         = &xfs_params.inherit_nodump.max
 117         },
 118         {
 119                 .procname       = "inherit_noatime",
 120                 .data           = &xfs_params.inherit_noatim.val,
 121                 .maxlen         = sizeof(int),
 122                 .mode           = 0644,
 123                 .proc_handler   = proc_dointvec_minmax,
 124                 .extra1         = &xfs_params.inherit_noatim.min,
 125                 .extra2         = &xfs_params.inherit_noatim.max
 126         },
 127         {
 128                 .procname       = "inherit_nosymlinks",
 129                 .data           = &xfs_params.inherit_nosym.val,
 130                 .maxlen         = sizeof(int),
 131                 .mode           = 0644,
 132                 .proc_handler   = proc_dointvec_minmax,
 133                 .extra1         = &xfs_params.inherit_nosym.min,
 134                 .extra2         = &xfs_params.inherit_nosym.max
 135         },
 136         {
 137                 .procname       = "rotorstep",
 138                 .data           = &xfs_params.rotorstep.val,
 139                 .maxlen         = sizeof(int),
 140                 .mode           = 0644,
 141                 .proc_handler   = proc_dointvec_minmax,
 142                 .extra1         = &xfs_params.rotorstep.min,
 143                 .extra2         = &xfs_params.rotorstep.max
 144         },
 145         {
 146                 .procname       = "inherit_nodefrag",
 147                 .data           = &xfs_params.inherit_nodfrg.val,
 148                 .maxlen         = sizeof(int),
 149                 .mode           = 0644,
 150                 .proc_handler   = proc_dointvec_minmax,
 151                 .extra1         = &xfs_params.inherit_nodfrg.min,
 152                 .extra2         = &xfs_params.inherit_nodfrg.max
 153         },
 154         {
 155                 .procname       = "filestream_centisecs",
 156                 .data           = &xfs_params.fstrm_timer.val,
 157                 .maxlen         = sizeof(int),
 158                 .mode           = 0644,
 159                 .proc_handler   = proc_dointvec_minmax,
 160                 .extra1         = &xfs_params.fstrm_timer.min,
 161                 .extra2         = &xfs_params.fstrm_timer.max,
 162         },
 163         {
 164                 .procname       = "speculative_prealloc_lifetime",
 165                 .data           = &xfs_params.eofb_timer.val,
 166                 .maxlen         = sizeof(int),
 167                 .mode           = 0644,
 168                 .proc_handler   = proc_dointvec_minmax,
 169                 .extra1         = &xfs_params.eofb_timer.min,
 170                 .extra2         = &xfs_params.eofb_timer.max,
 171         },
 172         {
 173                 .procname       = "speculative_cow_prealloc_lifetime",
 174                 .data           = &xfs_params.cowb_timer.val,
 175                 .maxlen         = sizeof(int),
 176                 .mode           = 0644,
 177                 .proc_handler   = proc_dointvec_minmax,
 178                 .extra1         = &xfs_params.cowb_timer.min,
 179                 .extra2         = &xfs_params.cowb_timer.max,
 180         },
 181         /* please keep this the last entry */
 182 #ifdef CONFIG_PROC_FS
 183         {
 184                 .procname       = "stats_clear",
 185                 .data           = &xfs_params.stats_clear.val,
 186                 .maxlen         = sizeof(int),
 187                 .mode           = 0644,
 188                 .proc_handler   = xfs_stats_clear_proc_handler,
 189                 .extra1         = &xfs_params.stats_clear.min,
 190                 .extra2         = &xfs_params.stats_clear.max
 191         },
 192 #endif /* CONFIG_PROC_FS */
 193 
 194         {}
 195 };
 196 
 197 static struct ctl_table xfs_dir_table[] = {
 198         {
 199                 .procname       = "xfs",
 200                 .mode           = 0555,
 201                 .child          = xfs_table
 202         },
 203         {}
 204 };
 205 
 206 static struct ctl_table xfs_root_table[] = {
 207         {
 208                 .procname       = "fs",
 209                 .mode           = 0555,
 210                 .child          = xfs_dir_table
 211         },
 212         {}
 213 };
 214 
 215 int
 216 xfs_sysctl_register(void)
 217 {
 218         xfs_table_header = register_sysctl_table(xfs_root_table);
 219         if (!xfs_table_header)
 220                 return -ENOMEM;
 221         return 0;
 222 }
 223 
 224 void
 225 xfs_sysctl_unregister(void)
 226 {
 227         unregister_sysctl_table(xfs_table_header);
 228 }

/* [<][>][^][v][top][bottom][index][help] */