Restore FreeBSD sysctl processing for arc.min and arc.max
[zfs.git] / include / os / freebsd / spl / sys / mod_os.h
blob5695abee7b858e0718d1eb4a1e39c25670f7a22f
1 /*
2 * Copyright (c) 2020 iXsystems, Inc.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
26 * $FreeBSD$
29 #ifndef _SPL_MOD_H
30 #define _SPL_MOD_H
32 #include <sys/sysctl.h>
34 #define ZFS_MODULE_DESCRIPTION(s)
35 #define ZFS_MODULE_AUTHOR(s)
36 #define ZFS_MODULE_LICENSE(s)
37 #define ZFS_MODULE_VERSION(s)
39 #define EXPORT_SYMBOL(x)
40 #define module_param(a, b, c)
41 #define MODULE_PARM_DESC(a, b)
43 #define ZMOD_RW CTLFLAG_RWTUN
44 #define ZMOD_RD CTLFLAG_RDTUN
46 /* BEGIN CSTYLED */
47 #define ZFS_MODULE_PARAM(scope_prefix, name_prefix, name, type, perm, desc) \
48 SYSCTL_DECL(_vfs_ ## scope_prefix); \
49 SYSCTL_##type(_vfs_ ## scope_prefix, OID_AUTO, name, perm, &name_prefix ## name, 0, desc)
51 #define ZFS_MODULE_PARAM_ARGS SYSCTL_HANDLER_ARGS
53 #define ZFS_MODULE_PARAM_CALL_IMPL(parent, name, perm, args, desc) \
54 SYSCTL_DECL(parent); \
55 SYSCTL_PROC(parent, OID_AUTO, name, perm | args, desc)
57 #define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, func, _, perm, desc) \
58 ZFS_MODULE_PARAM_CALL_IMPL(_vfs_ ## scope_prefix, name, perm, func ## _args(name_prefix ## name), desc)
60 #define ZFS_MODULE_VIRTUAL_PARAM_CALL ZFS_MODULE_PARAM_CALL
62 #define param_set_arc_long_args(var) \
63 CTLTYPE_ULONG, &var, 0, param_set_arc_long, "LU"
65 #define param_set_arc_min_args(var) \
66 CTLTYPE_ULONG, &var, 0, param_set_arc_min, "LU"
68 #define param_set_arc_max_args(var) \
69 CTLTYPE_ULONG, &var, 0, param_set_arc_max, "LU"
71 #define param_set_arc_int_args(var) \
72 CTLTYPE_INT, &var, 0, param_set_arc_int, "I"
74 #define param_set_deadman_failmode_args(var) \
75 CTLTYPE_STRING, NULL, 0, param_set_deadman_failmode, "A"
77 #define param_set_deadman_synctime_args(var) \
78 CTLTYPE_ULONG, NULL, 0, param_set_deadman_synctime, "LU"
80 #define param_set_deadman_ziotime_args(var) \
81 CTLTYPE_ULONG, NULL, 0, param_set_deadman_ziotime, "LU"
83 #define param_set_multihost_interval_args(var) \
84 CTLTYPE_ULONG, &var, 0, param_set_multihost_interval, "LU"
86 #define param_set_slop_shift_args(var) \
87 CTLTYPE_INT, &var, 0, param_set_slop_shift, "I"
89 #define param_set_min_auto_ashift_args(var) \
90 CTLTYPE_U64, &var, 0, param_set_min_auto_ashift, "QU"
92 #define param_set_max_auto_ashift_args(var) \
93 CTLTYPE_U64, &var, 0, param_set_max_auto_ashift, "QU"
95 #define fletcher_4_param_set_args(var) \
96 CTLTYPE_STRING, NULL, 0, fletcher_4_param, "A"
98 #include <sys/kernel.h>
99 #define module_init(fn) \
100 static void \
101 wrap_ ## fn(void *dummy __unused) \
103 fn(); \
105 SYSINIT(zfs_ ## fn, SI_SUB_LAST, SI_ORDER_FIRST, wrap_ ## fn, NULL)
107 #define module_init_early(fn) \
108 static void \
109 wrap_ ## fn(void *dummy __unused) \
111 fn(); \
113 SYSINIT(zfs_ ## fn, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_FIRST, wrap_ ## fn, NULL)
115 #define module_exit(fn) \
116 static void \
117 wrap_ ## fn(void *dummy __unused) \
119 fn(); \
121 SYSUNINIT(zfs_ ## fn, SI_SUB_LAST, SI_ORDER_FIRST, wrap_ ## fn, NULL)
122 /* END CSTYLED */
124 #endif /* SPL_MOD_H */