4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (C) 2016 Gvozden Neskovic <neskovic@gmail.com>.
24 * Copyright (c) 2020 by Delphix. All rights reserved.
30 #include <linux/module.h>
31 #include <linux/moduleparam.h>
33 /* Grsecurity kernel API change */
34 #ifdef MODULE_PARAM_CALL_CONST
35 typedef const struct kernel_param zfs_kernel_param_t
;
37 typedef struct kernel_param zfs_kernel_param_t
;
51 enum scope_prefix_types
{
61 zfs_livelist_condense
,
84 * Declare a module parameter / sysctl node
86 * "scope_prefix" the part of the the sysctl / sysfs tree the node resides under
87 * (currently a no-op on Linux)
88 * "name_prefix" the part of the variable name that will be excluded from the
89 * exported names on platforms with a hierarchical namespace
90 * "name" the part of the variable that will be exposed on platforms with a
91 * hierarchical namespace, or as name_prefix ## name on Linux
92 * "type" the variable type
93 * "perm" the permissions (read/write or read only)
94 * "desc" a brief description of the option
97 * ZFS_MODULE_PARAM(zfs_vdev_mirror, zfs_vdev_mirror_, rotating_inc, UINT,
98 * ZMOD_RW, "Rotating media load increment for non-seeking I/O's");
100 * vfs.zfs.vdev.mirror.rotating_inc
102 * zfs_vdev_mirror_rotating_inc
104 * ZFS_MODULE_PARAM(zfs, , dmu_prefetch_max, UINT, ZMOD_RW,
105 * "Limit one prefetch call to this size");
107 * vfs.zfs.dmu_prefetch_max
112 #define ZFS_MODULE_PARAM(scope_prefix, name_prefix, name, type, perm, desc) \
113 CTASSERT_GLOBAL((sizeof (scope_prefix) == sizeof (enum scope_prefix_types))); \
114 module_param(name_prefix ## name, type, perm); \
115 MODULE_PARM_DESC(name_prefix ## name, desc)
119 * Declare a module parameter / sysctl node
121 * "scope_prefix" the part of the the sysctl / sysfs tree the node resides under
122 * (currently a no-op on Linux)
123 * "name_prefix" the part of the variable name that will be excluded from the
124 * exported names on platforms with a hierarchical namespace
125 * "name" the part of the variable that will be exposed on platforms with a
126 * hierarchical namespace, or as name_prefix ## name on Linux
127 * "setfunc" setter function
128 * "getfunc" getter function
129 * "perm" the permissions (read/write or read only)
130 * "desc" a brief description of the option
133 * ZFS_MODULE_PARAM_CALL(zfs_spa, spa_, slop_shift, param_set_slop_shift,
134 * param_get_int, ZMOD_RW, "Reserved free space in pool");
136 * vfs.zfs.spa_slop_shift
141 #define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, setfunc, getfunc, perm, desc) \
142 CTASSERT_GLOBAL((sizeof (scope_prefix) == sizeof (enum scope_prefix_types))); \
143 module_param_call(name_prefix ## name, setfunc, getfunc, &name_prefix ## name, perm); \
144 MODULE_PARM_DESC(name_prefix ## name, desc)
147 #define ZFS_MODULE_PARAM_ARGS const char *buf, zfs_kernel_param_t *kp
149 #define ZFS_MODULE_DESCRIPTION(s) MODULE_DESCRIPTION(s)
150 #define ZFS_MODULE_AUTHOR(s) MODULE_AUTHOR(s)
151 #define ZFS_MODULE_LICENSE(s) MODULE_LICENSE(s)
152 #define ZFS_MODULE_VERSION(s) MODULE_VERSION(s)
154 #endif /* _MOD_COMPAT_H */