aboutsummaryrefslogtreecommitdiff
path: root/include/os/linux/spl
diff options
context:
space:
mode:
Diffstat (limited to 'include/os/linux/spl')
-rw-r--r--include/os/linux/spl/rpc/types.h31
-rw-r--r--include/os/linux/spl/rpc/xdr.h152
-rw-r--r--include/os/linux/spl/sys/acl.h117
-rw-r--r--include/os/linux/spl/sys/atomic.h115
-rw-r--r--include/os/linux/spl/sys/byteorder.h102
-rw-r--r--include/os/linux/spl/sys/callb.h54
-rw-r--r--include/os/linux/spl/sys/callo.h52
-rw-r--r--include/os/linux/spl/sys/cmn_err.h66
-rw-r--r--include/os/linux/spl/sys/condvar.h120
-rw-r--r--include/os/linux/spl/sys/cred.h183
-rw-r--r--include/os/linux/spl/sys/ctype.h30
-rw-r--r--include/os/linux/spl/sys/debug.h311
-rw-r--r--include/os/linux/spl/sys/disp.h36
-rw-r--r--include/os/linux/spl/sys/errno.h58
-rw-r--r--include/os/linux/spl/sys/fcntl.h37
-rw-r--r--include/os/linux/spl/sys/file.h41
-rw-r--r--include/os/linux/spl/sys/ia32/asm_linkage.h213
-rw-r--r--include/os/linux/spl/sys/inttypes.h28
-rw-r--r--include/os/linux/spl/sys/isa_defs.h249
-rw-r--r--include/os/linux/spl/sys/kmem.h171
-rw-r--r--include/os/linux/spl/sys/kmem_cache.h222
-rw-r--r--include/os/linux/spl/sys/kstat.h225
-rw-r--r--include/os/linux/spl/sys/list.h210
-rw-r--r--include/os/linux/spl/sys/misc.h36
-rw-r--r--include/os/linux/spl/sys/mod.h28
-rw-r--r--include/os/linux/spl/sys/mutex.h190
-rw-r--r--include/os/linux/spl/sys/param.h36
-rw-r--r--include/os/linux/spl/sys/proc.h42
-rw-r--r--include/os/linux/spl/sys/processor.h32
-rw-r--r--include/os/linux/spl/sys/procfs_list.h74
-rw-r--r--include/os/linux/spl/sys/random.h55
-rw-r--r--include/os/linux/spl/sys/rwlock.h199
-rw-r--r--include/os/linux/spl/sys/shrinker.h86
-rw-r--r--include/os/linux/spl/sys/sid.h61
-rw-r--r--include/os/linux/spl/sys/signal.h33
-rw-r--r--include/os/linux/spl/sys/simd.h31
-rw-r--r--include/os/linux/spl/sys/stat.h30
-rw-r--r--include/os/linux/spl/sys/string.h44
-rw-r--r--include/os/linux/spl/sys/sunddi.h57
-rw-r--r--include/os/linux/spl/sys/sysmacros.h219
-rw-r--r--include/os/linux/spl/sys/systeminfo.h36
-rw-r--r--include/os/linux/spl/sys/taskq.h214
-rw-r--r--include/os/linux/spl/sys/thread.h84
-rw-r--r--include/os/linux/spl/sys/time.h98
-rw-r--r--include/os/linux/spl/sys/timer.h66
-rw-r--r--include/os/linux/spl/sys/trace.h176
-rw-r--r--include/os/linux/spl/sys/trace_spl.h31
-rw-r--r--include/os/linux/spl/sys/trace_taskq.h84
-rw-r--r--include/os/linux/spl/sys/tsd.h46
-rw-r--r--include/os/linux/spl/sys/types.h93
-rw-r--r--include/os/linux/spl/sys/types32.h35
-rw-r--r--include/os/linux/spl/sys/uio.h213
-rw-r--r--include/os/linux/spl/sys/user.h42
-rw-r--r--include/os/linux/spl/sys/vfs.h51
-rw-r--r--include/os/linux/spl/sys/vmem.h104
-rw-r--r--include/os/linux/spl/sys/vmsystm.h95
-rw-r--r--include/os/linux/spl/sys/vnode.h113
-rw-r--r--include/os/linux/spl/sys/wait.h31
-rw-r--r--include/os/linux/spl/sys/wmsum.h68
-rw-r--r--include/os/linux/spl/sys/zmod.h70
-rw-r--r--include/os/linux/spl/sys/zone.h59
61 files changed, 0 insertions, 5885 deletions
diff --git a/include/os/linux/spl/rpc/types.h b/include/os/linux/spl/rpc/types.h
deleted file mode 100644
index 1e51b123aea7..000000000000
--- a/include/os/linux/spl/rpc/types.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2008 Sun Microsystems, Inc.
- * Written by Ricardo Correia <Ricardo.M.Correia@Sun.COM>
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_RPC_TYPES_H
-#define _SPL_RPC_TYPES_H
-
-#include <sys/types.h>
-
-/* Just enough to support rpc/xdr.h */
-
-typedef int bool_t;
-
-#endif /* SPL_RPC_TYPES_H */
diff --git a/include/os/linux/spl/rpc/xdr.h b/include/os/linux/spl/rpc/xdr.h
deleted file mode 100644
index 3522609fd0ea..000000000000
--- a/include/os/linux/spl/rpc/xdr.h
+++ /dev/null
@@ -1,152 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2008 Sun Microsystems, Inc.
- * Written by Ricardo Correia <Ricardo.M.Correia@Sun.COM>
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_RPC_XDR_H
-#define _SPL_RPC_XDR_H
-
-#include <sys/types.h>
-
-/*
- * XDR enums and types.
- */
-enum xdr_op {
- XDR_ENCODE,
- XDR_DECODE
-};
-
-struct xdr_ops;
-
-typedef struct {
- const struct xdr_ops *x_ops;
- /* Let caller know xdrmem_create() succeeds */
- caddr_t x_addr; /* Current buffer addr */
- caddr_t x_addr_end; /* End of the buffer */
- enum xdr_op x_op; /* Stream direction */
-} XDR;
-
-typedef bool_t (*xdrproc_t)(XDR *xdrs, void *ptr);
-
-struct xdr_ops {
- bool_t (*xdr_control)(XDR *, int, void *);
-
- bool_t (*xdr_char)(XDR *, char *);
- bool_t (*xdr_u_short)(XDR *, unsigned short *);
- bool_t (*xdr_u_int)(XDR *, unsigned *);
- bool_t (*xdr_u_longlong_t)(XDR *, u_longlong_t *);
-
- bool_t (*xdr_opaque)(XDR *, caddr_t, const uint_t);
- bool_t (*xdr_string)(XDR *, char **, const uint_t);
- bool_t (*xdr_array)(XDR *, caddr_t *, uint_t *, const uint_t,
- const uint_t, const xdrproc_t);
-};
-
-/*
- * XDR control operator.
- */
-#define XDR_GET_BYTES_AVAIL 1
-
-struct xdr_bytesrec {
- bool_t xc_is_last_record;
- size_t xc_num_avail;
-};
-
-/*
- * XDR functions.
- */
-void xdrmem_create(XDR *xdrs, const caddr_t addr, const uint_t size,
- const enum xdr_op op);
-
-#define xdr_control(xdrs, req, info) \
- (xdrs)->x_ops->xdr_control((xdrs), (req), (info))
-
-/*
- * For precaution, the following are defined as static inlines instead of macros
- * to get some amount of type safety.
- *
- * Also, macros wouldn't work in the case where typecasting is done, because it
- * must be possible to reference the functions' addresses by these names.
- */
-static inline bool_t xdr_char(XDR *xdrs, char *cp)
-{
- return (xdrs->x_ops->xdr_char(xdrs, cp));
-}
-
-static inline bool_t xdr_u_short(XDR *xdrs, unsigned short *usp)
-{
- return (xdrs->x_ops->xdr_u_short(xdrs, usp));
-}
-
-static inline bool_t xdr_short(XDR *xdrs, short *sp)
-{
- BUILD_BUG_ON(sizeof (short) != 2);
- return (xdrs->x_ops->xdr_u_short(xdrs, (unsigned short *) sp));
-}
-
-static inline bool_t xdr_u_int(XDR *xdrs, unsigned *up)
-{
- return (xdrs->x_ops->xdr_u_int(xdrs, up));
-}
-
-static inline bool_t xdr_int(XDR *xdrs, int *ip)
-{
- BUILD_BUG_ON(sizeof (int) != 4);
- return (xdrs->x_ops->xdr_u_int(xdrs, (unsigned *)ip));
-}
-
-static inline bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp)
-{
- return (xdrs->x_ops->xdr_u_longlong_t(xdrs, ullp));
-}
-
-static inline bool_t xdr_longlong_t(XDR *xdrs, longlong_t *llp)
-{
- BUILD_BUG_ON(sizeof (longlong_t) != 8);
- return (xdrs->x_ops->xdr_u_longlong_t(xdrs, (u_longlong_t *)llp));
-}
-
-/*
- * Fixed-length opaque data.
- */
-static inline bool_t xdr_opaque(XDR *xdrs, caddr_t cp, const uint_t cnt)
-{
- return (xdrs->x_ops->xdr_opaque(xdrs, cp, cnt));
-}
-
-/*
- * Variable-length string.
- * The *sp buffer must have (maxsize + 1) bytes.
- */
-static inline bool_t xdr_string(XDR *xdrs, char **sp, const uint_t maxsize)
-{
- return (xdrs->x_ops->xdr_string(xdrs, sp, maxsize));
-}
-
-/*
- * Variable-length arrays.
- */
-static inline bool_t xdr_array(XDR *xdrs, caddr_t *arrp, uint_t *sizep,
- const uint_t maxsize, const uint_t elsize, const xdrproc_t elproc)
-{
- return xdrs->x_ops->xdr_array(xdrs, arrp, sizep, maxsize, elsize,
- elproc);
-}
-
-#endif /* SPL_RPC_XDR_H */
diff --git a/include/os/linux/spl/sys/acl.h b/include/os/linux/spl/sys/acl.h
deleted file mode 100644
index 05edc3768bda..000000000000
--- a/include/os/linux/spl/sys/acl.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_ACL_H
-#define _SPL_ACL_H
-
-#include <sys/types.h>
-
-typedef struct ace {
- uid_t a_who;
- uint32_t a_access_mask;
- uint16_t a_flags;
- uint16_t a_type;
-} ace_t;
-
-typedef struct ace_object {
- uid_t a_who; /* uid or gid */
- uint32_t a_access_mask; /* read,write,... */
- uint16_t a_flags; /* see below */
- uint16_t a_type; /* allow or deny */
- uint8_t a_obj_type[16]; /* obj type */
- uint8_t a_inherit_obj_type[16]; /* inherit obj */
-} ace_object_t;
-
-#define MAX_ACL_ENTRIES 1024
-
-#define ACE_READ_DATA 0x00000001
-#define ACE_LIST_DIRECTORY 0x00000001
-#define ACE_WRITE_DATA 0x00000002
-#define ACE_ADD_FILE 0x00000002
-#define ACE_APPEND_DATA 0x00000004
-#define ACE_ADD_SUBDIRECTORY 0x00000004
-#define ACE_READ_NAMED_ATTRS 0x00000008
-#define ACE_WRITE_NAMED_ATTRS 0x00000010
-#define ACE_EXECUTE 0x00000020
-#define ACE_DELETE_CHILD 0x00000040
-#define ACE_READ_ATTRIBUTES 0x00000080
-#define ACE_WRITE_ATTRIBUTES 0x00000100
-#define ACE_DELETE 0x00010000
-#define ACE_READ_ACL 0x00020000
-#define ACE_WRITE_ACL 0x00040000
-#define ACE_WRITE_OWNER 0x00080000
-#define ACE_SYNCHRONIZE 0x00100000
-
-#define ACE_FILE_INHERIT_ACE 0x0001
-#define ACE_DIRECTORY_INHERIT_ACE 0x0002
-#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004
-#define ACE_INHERIT_ONLY_ACE 0x0008
-#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010
-#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020
-#define ACE_IDENTIFIER_GROUP 0x0040
-#define ACE_INHERITED_ACE 0x0080
-#define ACE_OWNER 0x1000
-#define ACE_GROUP 0x2000
-#define ACE_EVERYONE 0x4000
-
-#define ACE_ACCESS_ALLOWED_ACE_TYPE 0x0000
-#define ACE_ACCESS_DENIED_ACE_TYPE 0x0001
-#define ACE_SYSTEM_AUDIT_ACE_TYPE 0x0002
-#define ACE_SYSTEM_ALARM_ACE_TYPE 0x0003
-
-#define ACL_AUTO_INHERIT 0x0001
-#define ACL_PROTECTED 0x0002
-#define ACL_DEFAULTED 0x0004
-#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT|ACL_PROTECTED|ACL_DEFAULTED)
-
-#define ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE 0x04
-#define ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE 0x05
-#define ACE_ACCESS_DENIED_OBJECT_ACE_TYPE 0x06
-#define ACE_SYSTEM_AUDIT_OBJECT_ACE_TYPE 0x07
-#define ACE_SYSTEM_ALARM_OBJECT_ACE_TYPE 0x08
-#define ACE_ACCESS_ALLOWED_CALLBACK_ACE_TYPE 0x09
-#define ACE_ACCESS_DENIED_CALLBACK_ACE_TYPE 0x0A
-#define ACE_ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE 0x0B
-#define ACE_ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE 0x0C
-#define ACE_SYSTEM_AUDIT_CALLBACK_ACE_TYPE 0x0D
-#define ACE_SYSTEM_ALARM_CALLBACK_ACE_TYPE 0x0E
-#define ACE_SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE 0x0F
-#define ACE_SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE 0x10
-
-#define ACE_ALL_TYPES 0x001F
-
-#define ACE_TYPE_FLAGS (ACE_OWNER|ACE_GROUP|ACE_EVERYONE|ACE_IDENTIFIER_GROUP)
-
-#define ACE_ALL_PERMS (ACE_READ_DATA|ACE_LIST_DIRECTORY|ACE_WRITE_DATA| \
- ACE_ADD_FILE|ACE_APPEND_DATA|ACE_ADD_SUBDIRECTORY|ACE_READ_NAMED_ATTRS|\
- ACE_WRITE_NAMED_ATTRS|ACE_EXECUTE|ACE_DELETE_CHILD|ACE_READ_ATTRIBUTES|\
- ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \
- ACE_WRITE_OWNER|ACE_SYNCHRONIZE)
-
-#define VSA_ACE 0x0010
-#define VSA_ACECNT 0x0020
-#define VSA_ACE_ALLTYPES 0x0040
-#define VSA_ACE_ACLFLAGS 0x0080
-
-#endif /* _SPL_ACL_H */
diff --git a/include/os/linux/spl/sys/atomic.h b/include/os/linux/spl/sys/atomic.h
deleted file mode 100644
index f4bcd58bd281..000000000000
--- a/include/os/linux/spl/sys/atomic.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_ATOMIC_H
-#define _SPL_ATOMIC_H
-
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <sys/types.h>
-
-/*
- * Map the atomic_* functions to the Linux counterparts. This relies on the
- * fact that the atomic types are internally really a uint32 or uint64. If
- * this were to change an alternate approach would be needed.
- *
- * N.B. Due to the limitations of the original API atomicity is not strictly
- * preserved when using the 64-bit functions on a 32-bit system. In order
- * to support this all consumers would need to be updated to use the Linux
- * provided atomic_t and atomic64_t types.
- */
-#define atomic_inc_32(v) atomic_inc((atomic_t *)(v))
-#define atomic_dec_32(v) atomic_dec((atomic_t *)(v))
-#define atomic_add_32(v, i) atomic_add((i), (atomic_t *)(v))
-#define atomic_sub_32(v, i) atomic_sub((i), (atomic_t *)(v))
-#define atomic_inc_32_nv(v) atomic_inc_return((atomic_t *)(v))
-#define atomic_dec_32_nv(v) atomic_dec_return((atomic_t *)(v))
-#define atomic_add_32_nv(v, i) atomic_add_return((i), (atomic_t *)(v))
-#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v))
-#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y)
-#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x)
-#define atomic_load_32(v) atomic_read((atomic_t *)(v))
-#define atomic_store_32(v, x) atomic_set((atomic_t *)(v), x)
-#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v))
-#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v))
-#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v))
-#define atomic_sub_64(v, i) atomic64_sub((i), (atomic64_t *)(v))
-#define atomic_inc_64_nv(v) atomic64_inc_return((atomic64_t *)(v))
-#define atomic_dec_64_nv(v) atomic64_dec_return((atomic64_t *)(v))
-#define atomic_add_64_nv(v, i) atomic64_add_return((i), (atomic64_t *)(v))
-#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v))
-#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y)
-#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x)
-#define atomic_load_64(v) atomic64_read((atomic64_t *)(v))
-#define atomic_store_64(v, x) atomic64_set((atomic64_t *)(v), x)
-
-#ifdef _LP64
-static __inline__ void *
-atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
-{
- return ((void *)atomic_cas_64((volatile uint64_t *)target,
- (uint64_t)cmp, (uint64_t)newval));
-}
-static __inline__ void *
-atomic_swap_ptr(volatile void *target, void *newval)
-{
- return ((void *)atomic_swap_64((volatile uint64_t *)target,
- (uint64_t)newval));
-}
-static __inline__ void *
-atomic_load_ptr(volatile void *target)
-{
- return ((void *)atomic_load_64((volatile uint64_t *)target));
-}
-static __inline__ void
-atomic_store_ptr(volatile void *target, void *newval)
-{
- atomic_store_64((volatile uint64_t *)target, (uint64_t)newval);
-}
-#else /* _LP64 */
-static __inline__ void *
-atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
-{
- return ((void *)atomic_cas_32((volatile uint32_t *)target,
- (uint32_t)cmp, (uint32_t)newval));
-}
-static __inline__ void *
-atomic_swap_ptr(volatile void *target, void *newval)
-{
- return ((void *)atomic_swap_32((volatile uint32_t *)target,
- (uint32_t)newval));
-}
-static __inline__ void *
-atomic_load_ptr(volatile void *target)
-{
- return ((void *)atomic_load_32((volatile uint32_t *)target));
-}
-static __inline__ void
-atomic_store_ptr(volatile void *target, void *newval)
-{
- atomic_store_32((volatile uint32_t *)target, (uint32_t)newval);
-}
-#endif /* _LP64 */
-
-#endif /* _SPL_ATOMIC_H */
diff --git a/include/os/linux/spl/sys/byteorder.h b/include/os/linux/spl/sys/byteorder.h
deleted file mode 100644
index ea33287f34cd..000000000000
--- a/include/os/linux/spl/sys/byteorder.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_BYTEORDER_H
-#define _SPL_BYTEORDER_H
-
-#include <asm/byteorder.h>
-
-#if defined(__BIG_ENDIAN) && !defined(_ZFS_BIG_ENDIAN)
-#define _ZFS_BIG_ENDIAN
-#endif
-
-#if defined(__LITTLE_ENDIAN) && !defined(_ZFS_LITTLE_ENDIAN)
-#define _ZFS_LITTLE_ENDIAN
-#endif
-
-#include <sys/isa_defs.h>
-
-#ifdef __COVERITY__
-/*
- * Coverity's taint warnings from byteswapping are false positives for us.
- * Suppress them by hiding byteswapping from Coverity.
- */
-
-#define BSWAP_8(x) ((x) & 0xff)
-#define BSWAP_16(x) ((x) & 0xffff)
-#define BSWAP_32(x) ((x) & 0xffffffff)
-#define BSWAP_64(x) (x)
-
-#else /* __COVERITY__ */
-
-#define BSWAP_8(x) ((x) & 0xff)
-#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8))
-#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16))
-#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32))
-
-#endif /* __COVERITY__ */
-
-#define LE_16(x) cpu_to_le16(x)
-#define LE_32(x) cpu_to_le32(x)
-#define LE_64(x) cpu_to_le64(x)
-#define BE_16(x) cpu_to_be16(x)
-#define BE_32(x) cpu_to_be32(x)
-#define BE_64(x) cpu_to_be64(x)
-
-#define BE_IN8(xa) \
- *((uint8_t *)(xa))
-
-#define BE_IN16(xa) \
- (((uint16_t)BE_IN8(xa) << 8) | BE_IN8((uint8_t *)(xa)+1))
-
-#define BE_IN32(xa) \
- (((uint32_t)BE_IN16(xa) << 16) | BE_IN16((uint8_t *)(xa)+2))
-
-#ifdef _ZFS_BIG_ENDIAN
-static __inline__ uint64_t
-htonll(uint64_t n)
-{
- return (n);
-}
-
-static __inline__ uint64_t
-ntohll(uint64_t n)
-{
- return (n);
-}
-#else
-static __inline__ uint64_t
-htonll(uint64_t n)
-{
- return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32));
-}
-
-static __inline__ uint64_t
-ntohll(uint64_t n)
-{
- return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32));
-}
-#endif
-
-#endif /* SPL_BYTEORDER_H */
diff --git a/include/os/linux/spl/sys/callb.h b/include/os/linux/spl/sys/callb.h
deleted file mode 100644
index fb190b484dfc..000000000000
--- a/include/os/linux/spl/sys/callb.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_CALLB_H
-#define _SPL_CALLB_H
-
-#include <linux/module.h>
-#include <sys/mutex.h>
-
-#define CALLB_CPR_ASSERT(cp) ASSERT(MUTEX_HELD((cp)->cc_lockp));
-
-typedef struct callb_cpr {
- kmutex_t *cc_lockp;
-} callb_cpr_t;
-
-#define CALLB_CPR_INIT(cp, lockp, func, name) { \
- (cp)->cc_lockp = lockp; \
-}
-
-#define CALLB_CPR_SAFE_BEGIN(cp) { \
- CALLB_CPR_ASSERT(cp); \
-}
-
-#define CALLB_CPR_SAFE_END(cp, lockp) { \
- CALLB_CPR_ASSERT(cp); \
-}
-
-#define CALLB_CPR_EXIT(cp) { \
- ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
- mutex_exit((cp)->cc_lockp); \
-}
-
-#endif /* _SPL_CALLB_H */
diff --git a/include/os/linux/spl/sys/callo.h b/include/os/linux/spl/sys/callo.h
deleted file mode 100644
index f10bba0d5fb0..000000000000
--- a/include/os/linux/spl/sys/callo.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2013 Lawrence Livermore National Security, LLC.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_CALLO_H
-#define _SPL_CALLO_H
-
-/*
- * Callout flags:
- *
- * CALLOUT_FLAG_ROUNDUP
- * Roundup the expiration time to the next resolution boundary.
- * If this flag is not specified, the expiration time is rounded down.
- * CALLOUT_FLAG_ABSOLUTE
- * Normally, the expiration passed to the timeout API functions is an
- * expiration interval. If this flag is specified, then it is
- * interpreted as the expiration time itself.
- * CALLOUT_FLAG_HRESTIME
- * Normally, callouts are not affected by changes to system time
- * (hrestime). This flag is used to create a callout that is affected
- * by system time. If system time changes, these timers must be
- * handled in a special way (see callout.c). These are used by condition
- * variables and LWP timers that need this behavior.
- * CALLOUT_FLAG_32BIT
- * Legacy interfaces timeout() and realtime_timeout() pass this flag
- * to timeout_generic() to indicate that a 32-bit ID should be allocated.
- */
-#define CALLOUT_FLAG_ROUNDUP 0x1
-#define CALLOUT_FLAG_ABSOLUTE 0x2
-#define CALLOUT_FLAG_HRESTIME 0x4
-#define CALLOUT_FLAG_32BIT 0x8
-
-#endif /* _SPL_CALLB_H */
diff --git a/include/os/linux/spl/sys/cmn_err.h b/include/os/linux/spl/sys/cmn_err.h
deleted file mode 100644
index 4955bbb3e0c8..000000000000
--- a/include/os/linux/spl/sys/cmn_err.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_CMN_ERR_H
-#define _SPL_CMN_ERR_H
-
-#if defined(_KERNEL) && defined(HAVE_STANDALONE_LINUX_STDARG)
-#include <linux/stdarg.h>
-#else
-#include <stdarg.h>
-#endif
-#include <sys/atomic.h>
-
-#define CE_CONT 0 /* continuation */
-#define CE_NOTE 1 /* notice */
-#define CE_WARN 2 /* warning */
-#define CE_PANIC 3 /* panic */
-#define CE_IGNORE 4 /* print nothing */
-
-extern void cmn_err(int, const char *, ...)
- __attribute__((format(printf, 2, 3)));
-extern void vcmn_err(int, const char *, va_list)
- __attribute__((format(printf, 2, 0)));
-extern void vpanic(const char *, va_list)
- __attribute__((format(printf, 1, 0), __noreturn__));
-
-#define fm_panic panic
-
-#define cmn_err_once(ce, ...) \
-do { \
- static volatile uint32_t printed = 0; \
- if (atomic_cas_32(&printed, 0, 1) == 0) { \
- cmn_err(ce, __VA_ARGS__); \
- } \
-} while (0)
-
-#define vcmn_err_once(ce, fmt, ap) \
-do { \
- static volatile uint32_t printed = 0; \
- if (atomic_cas_32(&printed, 0, 1) == 0) { \
- vcmn_err(ce, fmt, ap); \
- } \
-} while (0)
-
-#endif /* SPL_CMN_ERR_H */
diff --git a/include/os/linux/spl/sys/condvar.h b/include/os/linux/spl/sys/condvar.h
deleted file mode 100644
index 18b29850472e..000000000000
--- a/include/os/linux/spl/sys/condvar.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_CONDVAR_H
-#define _SPL_CONDVAR_H
-
-#include <linux/module.h>
-#include <sys/kmem.h>
-#include <sys/mutex.h>
-#include <sys/callo.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-
-/*
- * cv_timedwait() is similar to cv_wait() except that it additionally expects
- * a timeout value specified in ticks. When woken by cv_signal() or
- * cv_broadcast() it returns 1, otherwise when the timeout is reached -1 is
- * returned.
- *
- * cv_timedwait_sig() behaves the same as cv_timedwait() but blocks
- * interruptibly and can be woken by a signal (EINTR, ERESTART). When
- * this occurs 0 is returned.
- *
- * cv_timedwait_io() and cv_timedwait_sig_io() are variants of cv_timedwait()
- * and cv_timedwait_sig() which should be used when waiting for outstanding
- * IO to complete. They are responsible for updating the iowait accounting
- * when this is supported by the platform.
- *
- * cv_timedwait_hires() and cv_timedwait_sig_hires() are high resolution
- * versions of cv_timedwait() and cv_timedwait_sig(). They expect the timeout
- * to be specified as a hrtime_t allowing for timeouts of less than a tick.
- *
- * N.B. The return values differ slightly from the illumos implementation
- * which returns the time remaining, instead of 1, when woken. They both
- * return -1 on timeout. Consumers which need to know the time remaining
- * are responsible for tracking it themselves.
- */
-
-
-/*
- * The kcondvar_t struct is protected by mutex taken externally before
- * calling any of the wait/signal funs, and passed into the wait funs.
- */
-#define CV_MAGIC 0x346545f4
-#define CV_DESTROY 0x346545f5
-
-typedef struct {
- int cv_magic;
- wait_queue_head_t cv_event;
- wait_queue_head_t cv_destroy;
- atomic_t cv_refs;
- atomic_t cv_waiters;
- kmutex_t *cv_mutex;
-} kcondvar_t;
-
-typedef enum { CV_DEFAULT = 0, CV_DRIVER } kcv_type_t;
-
-extern void __cv_init(kcondvar_t *, char *, kcv_type_t, void *);
-extern void __cv_destroy(kcondvar_t *);
-extern void __cv_wait(kcondvar_t *, kmutex_t *);
-extern void __cv_wait_io(kcondvar_t *, kmutex_t *);
-extern void __cv_wait_idle(kcondvar_t *, kmutex_t *);
-extern int __cv_wait_io_sig(kcondvar_t *, kmutex_t *);
-extern int __cv_wait_sig(kcondvar_t *, kmutex_t *);
-extern int __cv_timedwait(kcondvar_t *, kmutex_t *, clock_t);
-extern int __cv_timedwait_io(kcondvar_t *, kmutex_t *, clock_t);
-extern int __cv_timedwait_sig(kcondvar_t *, kmutex_t *, clock_t);
-extern int __cv_timedwait_idle(kcondvar_t *, kmutex_t *, clock_t);
-extern int cv_timedwait_hires(kcondvar_t *, kmutex_t *, hrtime_t,
- hrtime_t res, int flag);
-extern int cv_timedwait_sig_hires(kcondvar_t *, kmutex_t *, hrtime_t,
- hrtime_t res, int flag);
-extern int cv_timedwait_idle_hires(kcondvar_t *, kmutex_t *, hrtime_t,
- hrtime_t res, int flag);
-extern void __cv_signal(kcondvar_t *);
-extern void __cv_broadcast(kcondvar_t *c);
-
-#define cv_init(cvp, name, type, arg) __cv_init(cvp, name, type, arg)
-#define cv_destroy(cvp) __cv_destroy(cvp)
-#define cv_wait(cvp, mp) __cv_wait(cvp, mp)
-#define cv_wait_io(cvp, mp) __cv_wait_io(cvp, mp)
-#define cv_wait_idle(cvp, mp) __cv_wait_idle(cvp, mp)
-#define cv_wait_io_sig(cvp, mp) __cv_wait_io_sig(cvp, mp)
-#define cv_wait_sig(cvp, mp) __cv_wait_sig(cvp, mp)
-#define cv_signal(cvp) __cv_signal(cvp)
-#define cv_broadcast(cvp) __cv_broadcast(cvp)
-
-/*
- * NB: There is no way to reliably distinguish between having been signalled
- * and having timed out on Linux. If the client code needs to reliably
- * distinguish between the two it should use the hires variant.
- */
-#define cv_timedwait(cvp, mp, t) __cv_timedwait(cvp, mp, t)
-#define cv_timedwait_io(cvp, mp, t) __cv_timedwait_io(cvp, mp, t)
-#define cv_timedwait_sig(cvp, mp, t) __cv_timedwait_sig(cvp, mp, t)
-#define cv_timedwait_idle(cvp, mp, t) __cv_timedwait_idle(cvp, mp, t)
-
-
-#endif /* _SPL_CONDVAR_H */
diff --git a/include/os/linux/spl/sys/cred.h b/include/os/linux/spl/sys/cred.h
deleted file mode 100644
index cd0fe96c8110..000000000000
--- a/include/os/linux/spl/sys/cred.h
+++ /dev/null
@@ -1,183 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_CRED_H
-#define _SPL_CRED_H
-
-#include <linux/module.h>
-#include <linux/cred.h>
-#include <linux/sched.h>
-#include <sys/types.h>
-#include <sys/vfs.h>
-
-typedef struct cred cred_t;
-
-extern struct task_struct init_task;
-
-#define kcred ((cred_t *)(init_task.cred))
-#define CRED() ((cred_t *)current_cred())
-
-/* Linux 4.9 API change, GROUP_AT was removed */
-#ifndef GROUP_AT
-#define GROUP_AT(gi, i) ((gi)->gid[i])
-#endif
-
-#define KUID_TO_SUID(x) (__kuid_val(x))
-#define KGID_TO_SGID(x) (__kgid_val(x))
-#define SUID_TO_KUID(x) (KUIDT_INIT(x))
-#define SGID_TO_KGID(x) (KGIDT_INIT(x))
-#define KGIDP_TO_SGIDP(x) (&(x)->val)
-
-extern zidmap_t *zfs_get_init_idmap(void);
-
-/* Check if the user ns is the initial one */
-static inline boolean_t
-zfs_is_init_userns(struct user_namespace *user_ns)
-{
-#if defined(CONFIG_USER_NS)
- return (user_ns == kcred->user_ns);
-#else
- return (B_FALSE);
-#endif
-}
-
-static inline struct user_namespace *zfs_i_user_ns(struct inode *inode)
-{
- return (inode->i_sb->s_user_ns);
-}
-
-static inline boolean_t zfs_no_idmapping(struct user_namespace *mnt_userns,
- struct user_namespace *fs_userns)
-{
- return (zfs_is_init_userns(mnt_userns) ||
- mnt_userns == fs_userns);
-}
-
-static inline uid_t zfs_uid_to_vfsuid(zidmap_t *mnt_userns,
- struct user_namespace *fs_userns, uid_t uid)
-{
- struct user_namespace *owner;
-#ifdef HAVE_IOPS_CREATE_IDMAP
- if (mnt_userns == zfs_init_idmap)
- return (uid);
-#endif
-#ifdef HAVE_IDMAP_NO_USERNS
- struct user_namespace ns;
- ns.uid_map = mnt_userns->uid_map;
- owner = &ns;
-#else
- owner = idmap_owner(mnt_userns);
-#endif
- if (zfs_no_idmapping(owner, fs_userns))
- return (uid);
- if (!zfs_is_init_userns(fs_userns))
- uid = from_kuid(fs_userns, KUIDT_INIT(uid));
- if (uid == (uid_t)-1)
- return (uid);
- return (__kuid_val(make_kuid(owner, uid)));
-}
-
-static inline gid_t zfs_gid_to_vfsgid(zidmap_t *mnt_userns,
- struct user_namespace *fs_userns, gid_t gid)
-{
- struct user_namespace *owner;
-#ifdef HAVE_IOPS_CREATE_IDMAP
- if (mnt_userns == zfs_init_idmap)
- return (gid);
-#endif
-#ifdef HAVE_IDMAP_NO_USERNS
- struct user_namespace ns;
- ns.gid_map = mnt_userns->gid_map;
- owner = &ns;
-#else
- owner = idmap_owner(mnt_userns);
-#endif
- if (zfs_no_idmapping(owner, fs_userns))
- return (gid);
- if (!zfs_is_init_userns(fs_userns))
- gid = from_kgid(fs_userns, KGIDT_INIT(gid));
- if (gid == (gid_t)-1)
- return (gid);
- return (__kgid_val(make_kgid(owner, gid)));
-}
-
-static inline uid_t zfs_vfsuid_to_uid(zidmap_t *mnt_userns,
- struct user_namespace *fs_userns, uid_t uid)
-{
- struct user_namespace *owner;
-#ifdef HAVE_IOPS_CREATE_IDMAP
- if (mnt_userns == zfs_init_idmap)
- return (uid);
-#endif
-#ifdef HAVE_IDMAP_NO_USERNS
- struct user_namespace ns;
- ns.uid_map = mnt_userns->uid_map;
- owner = &ns;
-#else
- owner = idmap_owner(mnt_userns);
-#endif
- if (zfs_no_idmapping(owner, fs_userns))
- return (uid);
- uid = from_kuid(owner, KUIDT_INIT(uid));
- if (uid == (uid_t)-1)
- return (uid);
- if (zfs_is_init_userns(fs_userns))
- return (uid);
- return (__kuid_val(make_kuid(fs_userns, uid)));
-}
-
-static inline gid_t zfs_vfsgid_to_gid(zidmap_t *mnt_userns,
- struct user_namespace *fs_userns, gid_t gid)
-{
- struct user_namespace *owner;
-#ifdef HAVE_IOPS_CREATE_IDMAP
- if (mnt_userns == zfs_init_idmap)
- return (gid);
-#endif
-#ifdef HAVE_IDMAP_NO_USERNS
- struct user_namespace ns;
- ns.gid_map = mnt_userns->gid_map;
- owner = &ns;
-#else
- owner = idmap_owner(mnt_userns);
-#endif
- if (zfs_no_idmapping(owner, fs_userns))
- return (gid);
- gid = from_kgid(owner, KGIDT_INIT(gid));
- if (gid == (gid_t)-1)
- return (gid);
- if (zfs_is_init_userns(fs_userns))
- return (gid);
- return (__kgid_val(make_kgid(fs_userns, gid)));
-}
-
-extern void crhold(cred_t *cr);
-extern void crfree(cred_t *cr);
-extern uid_t crgetuid(const cred_t *cr);
-extern uid_t crgetruid(const cred_t *cr);
-extern gid_t crgetgid(const cred_t *cr);
-extern int crgetngroups(const cred_t *cr);
-extern gid_t *crgetgroups(const cred_t *cr);
-extern int groupmember(gid_t gid, const cred_t *cr);
-#endif /* _SPL_CRED_H */
diff --git a/include/os/linux/spl/sys/ctype.h b/include/os/linux/spl/sys/ctype.h
deleted file mode 100644
index dea4af09cb38..000000000000
--- a/include/os/linux/spl/sys/ctype.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_CTYPE_H
-#define _SPL_CTYPE_H
-
-#include <linux/ctype.h>
-
-#endif /* SPL_CTYPE_H */
diff --git a/include/os/linux/spl/sys/debug.h b/include/os/linux/spl/sys/debug.h
deleted file mode 100644
index 85b96e1e23a7..000000000000
--- a/include/os/linux/spl/sys/debug.h
+++ /dev/null
@@ -1,311 +0,0 @@
-// SPDX-License-Identifier: BSD-2-Clause
-/*
- * Copyright (c) 2020 iXsystems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Available Solaris debug functions. All of the ASSERT() macros will be
- * compiled out when NDEBUG is defined, this is the default behavior for
- * the SPL. To enable assertions use the --enable-debug with configure.
- * The VERIFY() functions are never compiled out and cannot be disabled.
- *
- * PANIC() - Panic the node and print message.
- * ASSERT() - Assert X is true, if not panic.
- * ASSERT3B() - Assert boolean X OP Y is true, if not panic.
- * ASSERT3S() - Assert signed X OP Y is true, if not panic.
- * ASSERT3U() - Assert unsigned X OP Y is true, if not panic.
- * ASSERT3P() - Assert pointer X OP Y is true, if not panic.
- * ASSERT0() - Assert value is zero, if not panic.
- * ASSERT0P() - Assert pointer is null, if not panic.
- * VERIFY() - Verify X is true, if not panic.
- * VERIFY3B() - Verify boolean X OP Y is true, if not panic.
- * VERIFY3S() - Verify signed X OP Y is true, if not panic.
- * VERIFY3U() - Verify unsigned X OP Y is true, if not panic.
- * VERIFY3P() - Verify pointer X OP Y is true, if not panic.
- * VERIFY0() - Verify value is zero, if not panic.
- * VERIFY0P() - Verify pointer is null, if not panic.
- */
-
-#ifndef _SPL_DEBUG_H
-#define _SPL_DEBUG_H
-
-
-/*
- * Common DEBUG functionality.
- */
-#ifdef __FreeBSD__
-#include <linux/compiler.h>
-#endif
-
-#ifndef __printflike
-#define __printflike(a, b) __printf(a, b)
-#endif
-
-#ifndef __maybe_unused
-#define __maybe_unused __attribute__((unused))
-#endif
-
-#ifndef __must_check
-#define __must_check __attribute__((__warn_unused_result__))
-#endif
-
-/*
- * Without this, we see warnings from objtool during normal Linux builds when
- * the kernel is built with CONFIG_STACK_VALIDATION=y:
- *
- * warning: objtool: tsd_create() falls through to next function __list_add()
- * warning: objtool: .text: unexpected end of section
- *
- * Until the toolchain stops doing this, we must only define this attribute on
- * spl_panic() when doing static analysis.
- */
-#if defined(__COVERITY__) || defined(__clang_analyzer__)
-__attribute__((__noreturn__))
-#endif
-extern void spl_panic(const char *file, const char *func, int line,
- const char *fmt, ...);
-extern void spl_dumpstack(void);
-
-static inline int
-spl_assert(const char *buf, const char *file, const char *func, int line)
-{
- spl_panic(file, func, line, "%s", buf);
- return (0);
-}
-
-#ifndef expect
-#define expect(expr, value) (__builtin_expect((expr), (value)))
-#endif
-#ifndef __linux__
-#define likely(expr) expect((expr) != 0, 1)
-#define unlikely(expr) expect((expr) != 0, 0)
-#endif
-
-#define PANIC(fmt, a...) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a)
-
-#define VERIFY(cond) \
- (void) (unlikely(!(cond)) && \
- spl_assert("VERIFY(" #cond ") failed\n", \
- __FILE__, __FUNCTION__, __LINE__))
-
-#define VERIFYF(cond, str, ...) do { \
- if (unlikely(!(cond))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY(" #cond ") failed " str "\n", __VA_ARGS__);\
- } while (0)
-
-#define VERIFY3B(LEFT, OP, RIGHT) do { \
- const boolean_t _verify3_left = (boolean_t)!!(LEFT); \
- const boolean_t _verify3_right = (boolean_t)!!(RIGHT); \
- if (unlikely(!(_verify3_left OP _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3B(" #LEFT ", " #OP ", " #RIGHT ") " \
- "failed (%d " #OP " %d)\n", \
- _verify3_left, _verify3_right); \
- } while (0)
-
-#define VERIFY3S(LEFT, OP, RIGHT) do { \
- const int64_t _verify3_left = (int64_t)(LEFT); \
- const int64_t _verify3_right = (int64_t)(RIGHT); \
- if (unlikely(!(_verify3_left OP _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3S(" #LEFT ", " #OP ", " #RIGHT ") " \
- "failed (%lld " #OP " %lld)\n", \
- (long long)_verify3_left, \
- (long long)_verify3_right); \
- } while (0)
-
-#define VERIFY3U(LEFT, OP, RIGHT) do { \
- const uint64_t _verify3_left = (uint64_t)(LEFT); \
- const uint64_t _verify3_right = (uint64_t)(RIGHT); \
- if (unlikely(!(_verify3_left OP _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3U(" #LEFT ", " #OP ", " #RIGHT ") " \
- "failed (%llu " #OP " %llu)\n", \
- (unsigned long long)_verify3_left, \
- (unsigned long long)_verify3_right); \
- } while (0)
-
-#define VERIFY3P(LEFT, OP, RIGHT) do { \
- const uintptr_t _verify3_left = (uintptr_t)(LEFT); \
- const uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
- if (unlikely(!(_verify3_left OP _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3P(" #LEFT ", " #OP ", " #RIGHT ") " \
- "failed (%px " #OP " %px)\n", \
- (void *)_verify3_left, \
- (void *)_verify3_right); \
- } while (0)
-
-#define VERIFY0(RIGHT) do { \
- const int64_t _verify0_right = (int64_t)(RIGHT); \
- if (unlikely(!(0 == _verify0_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY0(" #RIGHT ") failed (%lld)\n", \
- (long long)_verify0_right); \
- } while (0)
-
-#define VERIFY0P(RIGHT) do { \
- const uintptr_t _verify0_right = (uintptr_t)(RIGHT); \
- if (unlikely(!(0 == _verify0_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY0P(" #RIGHT ") failed (%px)\n", \
- (void *)_verify0_right); \
- } while (0)
-
-/*
- * Note that you should not put any operations you want to always happen
- * in the print section for ASSERTs unless you only want them to run on
- * debug builds!
- * e.g. ASSERT3UF(2, <, 3, "%s", foo(x)), foo(x) won't run on non-debug
- * builds.
- */
-
-#define VERIFY3BF(LEFT, OP, RIGHT, STR, ...) do { \
- const boolean_t _verify3_left = (boolean_t)!!(LEFT); \
- const boolean_t _verify3_right = (boolean_t)!!(RIGHT); \
- if (unlikely(!(_verify3_left OP _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3B(" #LEFT ", " #OP ", " #RIGHT ") " \
- "failed (%d " #OP " %d) " STR "\n", \
- _verify3_left, _verify3_right, \
- __VA_ARGS__); \
- } while (0)
-
-#define VERIFY3SF(LEFT, OP, RIGHT, STR, ...) do { \
- const int64_t _verify3_left = (int64_t)(LEFT); \
- const int64_t _verify3_right = (int64_t)(RIGHT); \
- if (unlikely(!(_verify3_left OP _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3S(" #LEFT ", " #OP ", " #RIGHT ") " \
- "failed (%lld " #OP " %lld) " STR "\n", \
- (long long)_verify3_left, (long long)_verify3_right,\
- __VA_ARGS__); \
- } while (0)
-
-#define VERIFY3UF(LEFT, OP, RIGHT, STR, ...) do { \
- const uint64_t _verify3_left = (uint64_t)(LEFT); \
- const uint64_t _verify3_right = (uint64_t)(RIGHT); \
- if (unlikely(!(_verify3_left OP _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3U(" #LEFT ", " #OP ", " #RIGHT ") " \
- "failed (%llu " #OP " %llu) " STR "\n", \
- (unsigned long long)_verify3_left, \
- (unsigned long long)_verify3_right, \
- __VA_ARGS__); \
- } while (0)
-
-#define VERIFY3PF(LEFT, OP, RIGHT, STR, ...) do { \
- const uintptr_t _verify3_left = (uintptr_t)(LEFT); \
- const uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
- if (unlikely(!(_verify3_left OP _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY3P(" #LEFT ", " #OP ", " #RIGHT ") " \
- "failed (%px " #OP " %px) " STR "\n", \
- (void *)_verify3_left, (void *)_verify3_right, \
- __VA_ARGS__); \
- } while (0)
-
-#define VERIFY0PF(RIGHT, STR, ...) do { \
- const uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
- if (unlikely(!(0 == _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY0P(" #RIGHT ") failed (%px) " STR "\n", \
- (void *)_verify3_right, \
- __VA_ARGS__); \
- } while (0)
-
-#define VERIFY0F(RIGHT, STR, ...) do { \
- const int64_t _verify3_right = (int64_t)(RIGHT); \
- if (unlikely(!(0 == _verify3_right))) \
- spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY0(" #RIGHT ") failed (%lld) " STR "\n", \
- (long long)_verify3_right, \
- __VA_ARGS__); \
- } while (0)
-
-#define VERIFY_IMPLY(A, B) \
- ((void)(likely((!(A)) || (B)) || \
- spl_assert("(" #A ") implies (" #B ")", \
- __FILE__, __FUNCTION__, __LINE__)))
-
-#define VERIFY_EQUIV(A, B) VERIFY3B(A, ==, B)
-
-/*
- * Debugging disabled (--disable-debug)
- */
-#ifdef NDEBUG
-
-#define ASSERT(x) ((void) sizeof ((uintptr_t)(x)))
-#define ASSERT3B(x, y, z) \
- ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
-#define ASSERT3S(x, y, z) \
- ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
-#define ASSERT3U(x, y, z) \
- ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
-#define ASSERT3P(x, y, z) \
- ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
-#define ASSERT0(x) ((void) sizeof ((uintptr_t)(x)))
-#define ASSERT0P(x) ((void) sizeof ((uintptr_t)(x)))
-#define ASSERT3BF(x, y, z, str, ...) ASSERT3B(x, y, z)
-#define ASSERT3SF(x, y, z, str, ...) ASSERT3S(x, y, z)
-#define ASSERT3UF(x, y, z, str, ...) ASSERT3U(x, y, z)
-#define ASSERT3PF(x, y, z, str, ...) ASSERT3P(x, y, z)
-#define ASSERT0PF(x, str, ...) ASSERT0P(x)
-#define ASSERT0F(x, str, ...) ASSERT0(x)
-#define ASSERTF(x, str, ...) ASSERT(x)
-#define IMPLY(A, B) \
- ((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B)))
-#define EQUIV(A, B) \
- ((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B)))
-
-/*
- * Debugging enabled (--enable-debug)
- */
-#else
-
-#define ASSERT3B VERIFY3B
-#define ASSERT3S VERIFY3S
-#define ASSERT3U VERIFY3U
-#define ASSERT3P VERIFY3P
-#define ASSERT0 VERIFY0
-#define ASSERT0P VERIFY0P
-#define ASSERT3BF VERIFY3BF
-#define ASSERT3SF VERIFY3SF
-#define ASSERT3UF VERIFY3UF
-#define ASSERT3PF VERIFY3PF
-#define ASSERT0PF VERIFY0PF
-#define ASSERT0F VERIFY0F
-#define ASSERTF VERIFYF
-#define ASSERT VERIFY
-#define IMPLY VERIFY_IMPLY
-#define EQUIV VERIFY_EQUIV
-
-#endif /* NDEBUG */
-
-#endif /* SPL_DEBUG_H */
diff --git a/include/os/linux/spl/sys/disp.h b/include/os/linux/spl/sys/disp.h
deleted file mode 100644
index e2d4084018f9..000000000000
--- a/include/os/linux/spl/sys/disp.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_DISP_H
-#define _SPL_DISP_H
-
-#include <linux/preempt.h>
-
-#define KPREEMPT_SYNC (-1)
-
-#define kpreempt(unused) cond_resched()
-#define kpreempt_disable() preempt_disable()
-#define kpreempt_enable() preempt_enable()
-
-#endif /* SPL_DISP_H */
diff --git a/include/os/linux/spl/sys/errno.h b/include/os/linux/spl/sys/errno.h
deleted file mode 100644
index 9f12ef2a09d4..000000000000
--- a/include/os/linux/spl/sys/errno.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: CDDL-1.0
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or https://opensource.org/licenses/CDDL-1.0.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2000 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/*
- * University Copyright- Copyright (c) 1982, 1986, 1988
- * The Regents of the University of California
- * All Rights Reserved
- *
- * University Acknowledgment- Portions of this document are derived from
- * software developed by the University of California, Berkeley, and its
- * contributors.
- */
-
-#ifndef _SYS_ERRNO_H
-#define _SYS_ERRNO_H
-
-#include <linux/errno.h>
-
-#define ENOTSUP EOPNOTSUPP
-
-/*
- * We'll take the unused errnos, 'EBADE' and 'EBADR' (from the Convergent
- * graveyard) to indicate checksum errors and fragmentation.
- */
-#define ECKSUM EBADE
-#define EFRAGS EBADR
-
-/* Similar for ENOACTIVE */
-#define ENOTACTIVE ENOANO
-
-#endif /* _SYS_ERRNO_H */
diff --git a/include/os/linux/spl/sys/fcntl.h b/include/os/linux/spl/sys/fcntl.h
deleted file mode 100644
index 24023bc857b6..000000000000
--- a/include/os/linux/spl/sys/fcntl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2010 Lawrence Livermore National Security, LLC.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_FCNTL_H
-#define _SPL_FCNTL_H
-
-#include <asm/fcntl.h>
-
-#define F_FREESP 11
-
-#ifdef CONFIG_64BIT
-typedef struct flock flock64_t;
-#else
-typedef struct flock64 flock64_t;
-#endif /* CONFIG_64BIT */
-
-#endif /* _SPL_FCNTL_H */
diff --git a/include/os/linux/spl/sys/file.h b/include/os/linux/spl/sys/file.h
deleted file mode 100644
index 93c9300928eb..000000000000
--- a/include/os/linux/spl/sys/file.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_FILE_H
-#define _SPL_FILE_H
-
-#define FIGNORECASE 0x00080000
-#define FKIOCTL 0x80000000
-#define ED_CASE_CONFLICT 0x10
-
-#define spl_inode_lock(ip) inode_lock(ip)
-#define spl_inode_unlock(ip) inode_unlock(ip)
-#define spl_inode_lock_shared(ip) inode_lock_shared(ip)
-#define spl_inode_unlock_shared(ip) inode_unlock_shared(ip)
-#define spl_inode_trylock(ip) inode_trylock(ip)
-#define spl_inode_trylock_shared(ip) inode_trylock_shared(ip)
-#define spl_inode_is_locked(ip) inode_is_locked(ip)
-#define spl_inode_lock_nested(ip, s) inode_lock_nested(ip, s)
-
-#endif /* SPL_FILE_H */
diff --git a/include/os/linux/spl/sys/ia32/asm_linkage.h b/include/os/linux/spl/sys/ia32/asm_linkage.h
deleted file mode 100644
index b42b8461da0f..000000000000
--- a/include/os/linux/spl/sys/ia32/asm_linkage.h
+++ /dev/null
@@ -1,213 +0,0 @@
-// SPDX-License-Identifier: CDDL-1.0
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or https://opensource.org/licenses/CDDL-1.0.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _IA32_SYS_ASM_LINKAGE_H
-#define _IA32_SYS_ASM_LINKAGE_H
-
-#if defined(_KERNEL) && defined(__linux__)
-#include <linux/linkage.h>
-#endif
-
-#ifndef ENDBR
-#if defined(__ELF__) && defined(__CET__) && defined(__has_include)
-/* CSTYLED */
-#if __has_include(<cet.h>)
-
-#include <cet.h>
-
-#ifdef _CET_ENDBR
-#define ENDBR _CET_ENDBR
-#endif /* _CET_ENDBR */
-
-#endif /* <cet.h> */
-#endif /* __ELF__ && __CET__ && __has_include */
-#endif /* !ENDBR */
-
-#ifndef ENDBR
-#define ENDBR
-#endif
-#ifndef RET
-#define RET ret
-#endif
-
-/* You can set to nothing on Unix platforms */
-#undef ASMABI
-#define ASMABI __attribute__((sysv_abi))
-
-#define SECTION_TEXT .text
-#define SECTION_STATIC .section .rodata
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef _ASM /* The remainder of this file is only for assembly files */
-
-/*
- * make annoying differences in assembler syntax go away
- */
-
-/*
- * D16 and A16 are used to insert instructions prefixes; the
- * macros help the assembler code be slightly more portable.
- */
-#if !defined(__GNUC_AS__)
-/*
- * /usr/ccs/bin/as prefixes are parsed as separate instructions
- */
-#define D16 data16;
-#define A16 addr16;
-
-/*
- * (There are some weird constructs in constant expressions)
- */
-#define _CONST(const) [const]
-#define _BITNOT(const) -1!_CONST(const)
-#define _MUL(a, b) _CONST(a \* b)
-
-#else
-/*
- * Why not use the 'data16' and 'addr16' prefixes .. well, the
- * assembler doesn't quite believe in real mode, and thus argues with
- * us about what we're trying to do.
- */
-#define D16 .byte 0x66;
-#define A16 .byte 0x67;
-
-#define _CONST(const) (const)
-#define _BITNOT(const) ~_CONST(const)
-#define _MUL(a, b) _CONST(a * b)
-
-#endif
-
-/*
- * C pointers are different sizes between i386 and amd64.
- * These constants can be used to compute offsets into pointer arrays.
- */
-#if defined(__amd64)
-#define CLONGSHIFT 3
-#define CLONGSIZE 8
-#define CLONGMASK 7
-#elif defined(__i386)
-#define CLONGSHIFT 2
-#define CLONGSIZE 4
-#define CLONGMASK 3
-#endif
-
-/*
- * Since we know we're either ILP32 or LP64 ..
- */
-#define CPTRSHIFT CLONGSHIFT
-#define CPTRSIZE CLONGSIZE
-#define CPTRMASK CLONGMASK
-
-#if CPTRSIZE != (1 << CPTRSHIFT) || CLONGSIZE != (1 << CLONGSHIFT)
-#error "inconsistent shift constants"
-#endif
-
-#if CPTRMASK != (CPTRSIZE - 1) || CLONGMASK != (CLONGSIZE - 1)
-#error "inconsistent mask constants"
-#endif
-
-#define ASM_ENTRY_ALIGN 16
-
-/*
- * SSE register alignment and save areas
- */
-
-#define XMM_SIZE 16
-#define XMM_ALIGN 16
-
-/*
- * ENTRY provides the standard procedure entry code and an easy way to
- * insert the calls to mcount for profiling. ENTRY_NP is identical, but
- * never calls mcount.
- */
-#undef ENTRY
-#define ENTRY(x) \
- .text; \
- .balign ASM_ENTRY_ALIGN; \
- .globl x; \
- .type x, @function; \
-x: MCOUNT(x)
-
-#define ENTRY_NP(x) \
- .text; \
- .balign ASM_ENTRY_ALIGN; \
- .globl x; \
- .type x, @function; \
-x:
-
-#define ENTRY_ALIGN(x, a) \
- .text; \
- .balign a; \
- .globl x; \
- .type x, @function; \
-x:
-
-#define FUNCTION(x) \
- .type x, @function; \
-x:
-
-/*
- * ENTRY2 is identical to ENTRY but provides two labels for the entry point.
- */
-#define ENTRY2(x, y) \
- .text; \
- .balign ASM_ENTRY_ALIGN; \
- .globl x, y; \
- .type x, @function; \
- .type y, @function; \
-x:; \
-y: MCOUNT(x)
-
-#define ENTRY_NP2(x, y) \
- .text; \
- .balign ASM_ENTRY_ALIGN; \
- .globl x, y; \
- .type x, @function; \
- .type y, @function; \
-x:; \
-y:
-
-
-/*
- * SET_SIZE trails a function and set the size for the ELF symbol table.
- */
-#define SET_SIZE(x) \
- .size x, [.-x]
-
-#define SET_OBJ(x) .type x, @object
-
-
-#endif /* _ASM */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IA32_SYS_ASM_LINKAGE_H */
diff --git a/include/os/linux/spl/sys/inttypes.h b/include/os/linux/spl/sys/inttypes.h
deleted file mode 100644
index 0c81724694e5..000000000000
--- a/include/os/linux/spl/sys/inttypes.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_INTTYPES_H
-#define _SPL_INTTYPES_H
-
-#endif /* SPL_INTTYPES_H */
diff --git a/include/os/linux/spl/sys/isa_defs.h b/include/os/linux/spl/sys/isa_defs.h
deleted file mode 100644
index 82b45fbaee4d..000000000000
--- a/include/os/linux/spl/sys/isa_defs.h
+++ /dev/null
@@ -1,249 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_ISA_DEFS_H
-#define _SPL_ISA_DEFS_H
-
-/* x86_64 arch specific defines */
-#if defined(__x86_64) || defined(__x86_64__)
-
-#if !defined(__x86_64)
-#define __x86_64
-#endif
-
-#if !defined(__amd64)
-#define __amd64
-#endif
-
-#if !defined(__x86)
-#define __x86
-#endif
-
-#if defined(_ILP32)
-/* x32-specific defines; careful to *not* define _LP64 here */
-#else
-#if !defined(_LP64)
-#define _LP64
-#endif
-#endif
-
-/* i386 arch specific defines */
-#elif defined(__i386) || defined(__i386__)
-
-#if !defined(__i386)
-#define __i386
-#endif
-
-#if !defined(__x86)
-#define __x86
-#endif
-
-#if !defined(_ILP32)
-#define _ILP32
-#endif
-
-/* powerpc (ppc64) arch specific defines */
-#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__)
-
-#if !defined(__powerpc)
-#define __powerpc
-#endif
-
-#if !defined(__powerpc__)
-#define __powerpc__
-#endif
-
-#if defined(__powerpc64__)
-#if !defined(_LP64)
-#define _LP64
-#endif
-#else
-#if !defined(_ILP32)
-#define _ILP32
-#endif
-#endif
-
-/* arm arch specific defines */
-#elif defined(__arm) || defined(__arm__)
-
-#if !defined(__arm)
-#define __arm
-#endif
-
-#if !defined(__arm__)
-#define __arm__
-#endif
-
-#if !defined(_ILP32)
-#define _ILP32
-#endif
-
-#if defined(__ARMEL__)
-#define _ZFS_LITTLE_ENDIAN
-#else
-#define _ZFS_BIG_ENDIAN
-#endif
-
-/* aarch64 arch specific defines */
-#elif defined(__aarch64__)
-
-#if !defined(_LP64)
-#define _LP64
-#endif
-
-#if defined(__AARCH64EL__)
-#define _ZFS_LITTLE_ENDIAN
-#else
-#define _ZFS_BIG_ENDIAN
-#endif
-
-/* sparc arch specific defines */
-#elif defined(__sparc) || defined(__sparc__)
-
-#if !defined(__sparc)
-#define __sparc
-#endif
-
-#if !defined(__sparc__)
-#define __sparc__
-#endif
-
-#if defined(__arch64__)
-#if !defined(_LP64)
-#define _LP64
-#endif
-#else
-#if !defined(_ILP32)
-#define _ILP32
-#endif
-#endif
-
-#define _ZFS_BIG_ENDIAN
-#define _SUNOS_VTOC_16
-
-/* s390 arch specific defines */
-#elif defined(__s390__)
-#if defined(__s390x__)
-#if !defined(_LP64)
-#define _LP64
-#endif
-#else
-#if !defined(_ILP32)
-#define _ILP32
-#endif
-#endif
-
-#define _ZFS_BIG_ENDIAN
-
-/* MIPS arch specific defines */
-#elif defined(__mips__)
-
-#if defined(__MIPSEB__)
-#define _ZFS_BIG_ENDIAN
-#elif defined(__MIPSEL__)
-#define _ZFS_LITTLE_ENDIAN
-#else
-#error MIPS no endian specified
-#endif
-
-#ifndef _LP64
-#define _ILP32
-#endif
-
-#define _SUNOS_VTOC_16
-
-/*
- * RISC-V arch specific defines
- * only RV64G (including atomic) LP64 is supported yet
- */
-#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 && \
- defined(__riscv_atomic) && __riscv_atomic
-
-#if !defined(_LP64)
-#define _LP64 1
-#endif
-
-#ifndef __riscv__
-#define __riscv__
-#endif
-
-#ifndef __rv64g__
-#define __rv64g__
-#endif
-
-#define _ZFS_LITTLE_ENDIAN
-
-#define _SUNOS_VTOC_16
-
-/*
- * LoongArch arch specific defines
- * only LoongArch64 is supported yet
- */
-#elif defined(__loongarch__) && defined(__loongarch_lp64)
-
-#if !defined(_LP64)
-#define _LP64
-#endif
-
-#define _ZFS_LITTLE_ENDIAN
-#define _SUNOS_VTOC_16
-
-/* not all LoongArch cores support unaligned accesses in hardware */
-#define _ALIGNMENT_REQUIRED 1
-
-#else
-/*
- * Currently supported:
- * x86_64, x32, i386, arm, powerpc, s390, sparc, mips, RV64G, and LoongArch64
- */
-#error "Unsupported ISA type"
-#endif
-
-#if defined(_ILP32) && defined(_LP64)
-#error "Both _ILP32 and _LP64 are defined"
-#endif
-
-#if !defined(_ILP32) && !defined(_LP64)
-#error "Neither _ILP32 or _LP64 are defined"
-#endif
-
-#include <sys/byteorder.h>
-
-/*
- * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS will be defined by the Linux
- * kernel for architectures which support efficient unaligned access.
- */
-#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
-#define HAVE_EFFICIENT_UNALIGNED_ACCESS
-#endif
-
-#if defined(_ZFS_LITTLE_ENDIAN) && defined(_ZFS_BIG_ENDIAN)
-#error "Both _ZFS_LITTLE_ENDIAN and _ZFS_BIG_ENDIAN are defined"
-#endif
-
-#if !defined(_ZFS_LITTLE_ENDIAN) && !defined(_ZFS_BIG_ENDIAN)
-#error "Neither _ZFS_LITTLE_ENDIAN or _ZFS_BIG_ENDIAN are defined"
-#endif
-
-#endif /* _SPL_ISA_DEFS_H */
diff --git a/include/os/linux/spl/sys/kmem.h b/include/os/linux/spl/sys/kmem.h
deleted file mode 100644
index fe34de9c179e..000000000000
--- a/include/os/linux/spl/sys/kmem.h
+++ /dev/null
@@ -1,171 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_KMEM_H
-#define _SPL_KMEM_H
-
-#include <sys/debug.h>
-#include <linux/slab.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/vmalloc.h>
-
-extern int kmem_debugging(void);
-__attribute__((format(printf, 1, 0)))
-extern char *kmem_vasprintf(const char *fmt, va_list ap);
-__attribute__((format(printf, 1, 2)))
-extern char *kmem_asprintf(const char *fmt, ...);
-extern char *kmem_strdup(const char *str);
-extern void kmem_strfree(char *str);
-
-#define kmem_scnprintf scnprintf
-
-#define POINTER_IS_VALID(p) (!((uintptr_t)(p) & 0x3))
-#define POINTER_INVALIDATE(pp) (*(pp) = (void *)((uintptr_t)(*(pp)) | 0x1))
-
-/*
- * Memory allocation interfaces
- */
-#define KM_SLEEP 0x0000 /* can block for memory; success guaranteed */
-#define KM_NOSLEEP 0x0001 /* cannot block for memory; may fail */
-#define KM_PUSHPAGE 0x0004 /* can block for memory; may use reserve */
-#define KM_ZERO 0x1000 /* zero the allocation */
-#define KM_VMEM 0x2000 /* caller is vmem_* wrapper */
-
-#define KM_PUBLIC_MASK (KM_SLEEP | KM_NOSLEEP | KM_PUSHPAGE)
-
-static int spl_fstrans_check(void);
-void *spl_kvmalloc(size_t size, gfp_t flags);
-
-/*
- * Convert a KM_* flags mask to its Linux GFP_* counterpart. The conversion
- * function is context aware which means that KM_SLEEP allocations can be
- * safely used in syncing contexts which have set SPL_FSTRANS.
- */
-static inline gfp_t
-kmem_flags_convert(int flags)
-{
- gfp_t lflags = __GFP_NOWARN | __GFP_COMP;
-
- if (flags & KM_NOSLEEP) {
- lflags |= GFP_ATOMIC | __GFP_NORETRY;
- } else {
- lflags |= GFP_KERNEL;
- if (spl_fstrans_check())
- lflags &= ~(__GFP_IO|__GFP_FS);
- }
-
- if (flags & KM_PUSHPAGE)
- lflags |= __GFP_HIGH;
-
- if (flags & KM_ZERO)
- lflags |= __GFP_ZERO;
-
- return (lflags);
-}
-
-typedef struct {
- struct task_struct *fstrans_thread;
- unsigned int saved_flags;
-} fstrans_cookie_t;
-
-/*
- * SPL_FSTRANS is the set of flags that indicate that the task is in a
- * filesystem or IO codepath, and so any allocation must not call back into
- * those codepaths (eg to swap).
- */
-#define SPL_FSTRANS (PF_MEMALLOC_NOIO)
-
-static inline fstrans_cookie_t
-spl_fstrans_mark(void)
-{
- fstrans_cookie_t cookie;
-
- BUILD_BUG_ON(SPL_FSTRANS == 0);
-
- cookie.fstrans_thread = current;
- cookie.saved_flags = current->flags & SPL_FSTRANS;
- current->flags |= SPL_FSTRANS;
-
- return (cookie);
-}
-
-static inline void
-spl_fstrans_unmark(fstrans_cookie_t cookie)
-{
- ASSERT3P(cookie.fstrans_thread, ==, current);
- ASSERT((current->flags & SPL_FSTRANS) == SPL_FSTRANS);
-
- current->flags &= ~SPL_FSTRANS;
- current->flags |= cookie.saved_flags;
-}
-
-static inline int
-spl_fstrans_check(void)
-{
- return (current->flags & SPL_FSTRANS);
-}
-
-extern atomic64_t kmem_alloc_used;
-extern uint64_t kmem_alloc_max;
-
-extern unsigned int spl_kmem_alloc_warn;
-extern unsigned int spl_kmem_alloc_max;
-
-#define kmem_alloc(sz, fl) spl_kmem_alloc((sz), (fl), __func__, __LINE__)
-#define kmem_zalloc(sz, fl) spl_kmem_zalloc((sz), (fl), __func__, __LINE__)
-#define kmem_free(ptr, sz) spl_kmem_free((ptr), (sz))
-#define kmem_cache_reap_active spl_kmem_cache_reap_active
-
-__attribute__((malloc, alloc_size(1)))
-extern void *spl_kmem_alloc(size_t sz, int fl, const char *func, int line);
-__attribute__((malloc, alloc_size(1)))
-extern void *spl_kmem_zalloc(size_t sz, int fl, const char *func, int line);
-extern void spl_kmem_free(const void *ptr, size_t sz);
-
-/*
- * 5.8 API change, pgprot_t argument removed.
- */
-#ifdef HAVE_VMALLOC_PAGE_KERNEL
-#define spl_vmalloc(size, flags) __vmalloc(size, flags, PAGE_KERNEL)
-#else
-#define spl_vmalloc(size, flags) __vmalloc(size, flags)
-#endif
-
-/*
- * The following functions are only available for internal use.
- */
-extern void *spl_kmem_alloc_impl(size_t size, int flags, int node);
-extern void *spl_kmem_alloc_debug(size_t size, int flags, int node);
-extern void *spl_kmem_alloc_track(size_t size, int flags,
- const char *func, int line, int node);
-extern void spl_kmem_free_impl(const void *buf, size_t size);
-extern void spl_kmem_free_debug(const void *buf, size_t size);
-extern void spl_kmem_free_track(const void *buf, size_t size);
-
-extern int spl_kmem_init(void);
-extern void spl_kmem_fini(void);
-extern int spl_kmem_cache_reap_active(void);
-
-#endif /* _SPL_KMEM_H */
diff --git a/include/os/linux/spl/sys/kmem_cache.h b/include/os/linux/spl/sys/kmem_cache.h
deleted file mode 100644
index ca84a92999b9..000000000000
--- a/include/os/linux/spl/sys/kmem_cache.h
+++ /dev/null
@@ -1,222 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_KMEM_CACHE_H
-#define _SPL_KMEM_CACHE_H
-
-#include <sys/taskq.h>
-
-/*
- * Slab allocation interfaces. The SPL slab differs from the standard
- * Linux SLAB or SLUB primarily in that each cache may be backed by slabs
- * allocated from the physical or virtual memory address space. The virtual
- * slabs allow for good behavior when allocation large objects of identical
- * size. This slab implementation also supports both constructors and
- * destructors which the Linux slab does not.
- */
-typedef enum kmc_bit {
- KMC_BIT_NODEBUG = 1, /* Default behavior */
- KMC_BIT_KVMEM = 7, /* Use kvmalloc linux allocator */
- KMC_BIT_SLAB = 8, /* Use Linux slab cache */
- KMC_BIT_DEADLOCKED = 14, /* Deadlock detected */
- KMC_BIT_GROWING = 15, /* Growing in progress */
- KMC_BIT_REAPING = 16, /* Reaping in progress */
- KMC_BIT_DESTROY = 17, /* Destroy in progress */
- KMC_BIT_TOTAL = 18, /* Proc handler helper bit */
- KMC_BIT_ALLOC = 19, /* Proc handler helper bit */
- KMC_BIT_MAX = 20, /* Proc handler helper bit */
- KMC_BIT_RECLAIMABLE = 21, /* Can be freed by shrinker */
-} kmc_bit_t;
-
-/* kmem move callback return values */
-typedef enum kmem_cbrc {
- KMEM_CBRC_YES = 0, /* Object moved */
- KMEM_CBRC_NO = 1, /* Object not moved */
- KMEM_CBRC_LATER = 2, /* Object not moved, try again later */
- KMEM_CBRC_DONT_NEED = 3, /* Neither object is needed */
- KMEM_CBRC_DONT_KNOW = 4, /* Object unknown */
-} kmem_cbrc_t;
-
-#define KMC_NODEBUG (1 << KMC_BIT_NODEBUG)
-#define KMC_KVMEM (1 << KMC_BIT_KVMEM)
-#define KMC_SLAB (1 << KMC_BIT_SLAB)
-#define KMC_DEADLOCKED (1 << KMC_BIT_DEADLOCKED)
-#define KMC_GROWING (1 << KMC_BIT_GROWING)
-#define KMC_REAPING (1 << KMC_BIT_REAPING)
-#define KMC_DESTROY (1 << KMC_BIT_DESTROY)
-#define KMC_TOTAL (1 << KMC_BIT_TOTAL)
-#define KMC_ALLOC (1 << KMC_BIT_ALLOC)
-#define KMC_MAX (1 << KMC_BIT_MAX)
-#define KMC_RECLAIMABLE (1 << KMC_BIT_RECLAIMABLE)
-
-extern struct list_head spl_kmem_cache_list;
-extern struct rw_semaphore spl_kmem_cache_sem;
-
-#define SKM_MAGIC 0x2e2e2e2e
-#define SKO_MAGIC 0x20202020
-#define SKS_MAGIC 0x22222222
-#define SKC_MAGIC 0x2c2c2c2c
-
-#define SPL_KMEM_CACHE_OBJ_PER_SLAB 8 /* Target objects per slab */
-#define SPL_KMEM_CACHE_ALIGN 8 /* Default object alignment */
-#ifdef _LP64
-#define SPL_KMEM_CACHE_MAX_SIZE 32 /* Max slab size in MB */
-#else
-#define SPL_KMEM_CACHE_MAX_SIZE 4 /* Max slab size in MB */
-#endif
-
-#define SPL_MAX_ORDER (MAX_ORDER - 3)
-#define SPL_MAX_ORDER_NR_PAGES (1 << (SPL_MAX_ORDER - 1))
-
-#ifdef CONFIG_SLUB
-#define SPL_MAX_KMEM_CACHE_ORDER PAGE_ALLOC_COSTLY_ORDER
-#define SPL_MAX_KMEM_ORDER_NR_PAGES (1 << (SPL_MAX_KMEM_CACHE_ORDER - 1))
-#else
-#define SPL_MAX_KMEM_ORDER_NR_PAGES (KMALLOC_MAX_SIZE >> PAGE_SHIFT)
-#endif
-
-typedef int (*spl_kmem_ctor_t)(void *, void *, int);
-typedef void (*spl_kmem_dtor_t)(void *, void *);
-
-typedef struct spl_kmem_magazine {
- uint32_t skm_magic; /* Sanity magic */
- uint32_t skm_avail; /* Available objects */
- uint32_t skm_size; /* Magazine size */
- uint32_t skm_refill; /* Batch refill size */
- struct spl_kmem_cache *skm_cache; /* Owned by cache */
- unsigned int skm_cpu; /* Owned by cpu */
- void *skm_objs[]; /* Object pointers */
-} spl_kmem_magazine_t;
-
-typedef struct spl_kmem_obj {
- uint32_t sko_magic; /* Sanity magic */
- void *sko_addr; /* Buffer address */
- struct spl_kmem_slab *sko_slab; /* Owned by slab */
- struct list_head sko_list; /* Free object list linkage */
-} spl_kmem_obj_t;
-
-typedef struct spl_kmem_slab {
- uint32_t sks_magic; /* Sanity magic */
- uint32_t sks_objs; /* Objects per slab */
- struct spl_kmem_cache *sks_cache; /* Owned by cache */
- struct list_head sks_list; /* Slab list linkage */
- struct list_head sks_free_list; /* Free object list */
- unsigned long sks_age; /* Last modify jiffie */
- uint32_t sks_ref; /* Ref count used objects */
-} spl_kmem_slab_t;
-
-typedef struct spl_kmem_alloc {
- struct spl_kmem_cache *ska_cache; /* Owned by cache */
- int ska_flags; /* Allocation flags */
- taskq_ent_t ska_tqe; /* Task queue entry */
-} spl_kmem_alloc_t;
-
-typedef struct spl_kmem_emergency {
- struct rb_node ske_node; /* Emergency tree linkage */
- unsigned long ske_obj; /* Buffer address */
-} spl_kmem_emergency_t;
-
-typedef struct spl_kmem_cache {
- uint32_t skc_magic; /* Sanity magic */
- uint32_t skc_name_size; /* Name length */
- char *skc_name; /* Name string */
- spl_kmem_magazine_t **skc_mag; /* Per-CPU warm cache */
- uint32_t skc_mag_size; /* Magazine size */
- uint32_t skc_mag_refill; /* Magazine refill count */
- spl_kmem_ctor_t skc_ctor; /* Constructor */
- spl_kmem_dtor_t skc_dtor; /* Destructor */
- void *skc_private; /* Private data */
- void *skc_vmp; /* Unused */
- struct kmem_cache *skc_linux_cache; /* Linux slab cache if used */
- unsigned long skc_flags; /* Flags */
- uint32_t skc_obj_size; /* Object size */
- uint32_t skc_obj_align; /* Object alignment */
- uint32_t skc_slab_objs; /* Objects per slab */
- uint32_t skc_slab_size; /* Slab size */
- atomic_t skc_ref; /* Ref count callers */
- taskqid_t skc_taskqid; /* Slab reclaim task */
- struct list_head skc_list; /* List of caches linkage */
- struct list_head skc_complete_list; /* Completely alloc'ed */
- struct list_head skc_partial_list; /* Partially alloc'ed */
- struct rb_root skc_emergency_tree; /* Min sized objects */
- spinlock_t skc_lock; /* Cache lock */
- wait_queue_head_t skc_waitq; /* Allocation waiters */
- uint64_t skc_slab_fail; /* Slab alloc failures */
- uint64_t skc_slab_create; /* Slab creates */
- uint64_t skc_slab_destroy; /* Slab destroys */
- uint64_t skc_slab_total; /* Slab total current */
- uint64_t skc_slab_alloc; /* Slab alloc current */
- uint64_t skc_slab_max; /* Slab max historic */
- uint64_t skc_obj_total; /* Obj total current */
- uint64_t skc_obj_alloc; /* Obj alloc current */
- struct percpu_counter skc_linux_alloc; /* Linux-backed Obj alloc */
- uint64_t skc_obj_max; /* Obj max historic */
- uint64_t skc_obj_deadlock; /* Obj emergency deadlocks */
- uint64_t skc_obj_emergency; /* Obj emergency current */
- uint64_t skc_obj_emergency_max; /* Obj emergency max */
-} spl_kmem_cache_t;
-#define kmem_cache_t spl_kmem_cache_t
-
-extern spl_kmem_cache_t *spl_kmem_cache_create(const char *name, size_t size,
- size_t align, spl_kmem_ctor_t ctor, spl_kmem_dtor_t dtor,
- void *reclaim, void *priv, void *vmp, int flags);
-extern void spl_kmem_cache_set_move(spl_kmem_cache_t *,
- kmem_cbrc_t (*)(void *, void *, size_t, void *));
-extern void spl_kmem_cache_destroy(spl_kmem_cache_t *skc);
-extern void *spl_kmem_cache_alloc(spl_kmem_cache_t *skc, int flags);
-extern void spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj);
-extern void spl_kmem_cache_set_allocflags(spl_kmem_cache_t *skc, gfp_t flags);
-extern void spl_kmem_cache_reap_now(spl_kmem_cache_t *skc);
-extern void spl_kmem_reap(void);
-extern uint64_t spl_kmem_cache_inuse(kmem_cache_t *cache);
-extern uint64_t spl_kmem_cache_entry_size(kmem_cache_t *cache);
-
-#ifndef SPL_KMEM_CACHE_IMPLEMENTING
-/*
- * Macros for the kmem_cache_* API expected by ZFS and SPL clients. We don't
- * define them inside spl-kmem-cache.c, as that uses the kernel's incompatible
- * kmem_cache_* facilities to implement ours.
- */
-
-/* Avoid conflicts with kernel names that might be implemented as macros. */
-#undef kmem_cache_alloc
-#undef kmem_cache_create
-
-#define kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl) \
- spl_kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl)
-#define kmem_cache_set_move(skc, move) spl_kmem_cache_set_move(skc, move)
-#define kmem_cache_destroy(skc) spl_kmem_cache_destroy(skc)
-#define kmem_cache_alloc(skc, flags) spl_kmem_cache_alloc(skc, flags)
-#define kmem_cache_free(skc, obj) spl_kmem_cache_free(skc, obj)
-#define kmem_cache_reap_now(skc) spl_kmem_cache_reap_now(skc)
-#define kmem_reap() spl_kmem_reap()
-#endif
-
-/*
- * The following functions are only available for internal use.
- */
-extern int spl_kmem_cache_init(void);
-extern void spl_kmem_cache_fini(void);
-
-#endif /* _SPL_KMEM_CACHE_H */
diff --git a/include/os/linux/spl/sys/kstat.h b/include/os/linux/spl/sys/kstat.h
deleted file mode 100644
index be58b455f9b5..000000000000
--- a/include/os/linux/spl/sys/kstat.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-/*
- * Copyright (c) 2024-2025, Klara, Inc.
- * Copyright (c) 2024-2025, Syneto
- */
-
-#ifndef _SPL_KSTAT_H
-#define _SPL_KSTAT_H
-
-#include <linux/module.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/kmem.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#define KSTAT_STRLEN 255
-#define KSTAT_RAW_MAX (128*1024)
-
-/*
- * For reference valid classes are:
- * disk, tape, net, controller, vm, kvm, hat, streams, kstat, misc
- */
-
-#define KSTAT_TYPE_RAW 0 /* can be anything; ks_ndata >= 1 */
-#define KSTAT_TYPE_NAMED 1 /* name/value pair; ks_ndata >= 1 */
-#define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */
-#define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */
-#define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */
-#define KSTAT_NUM_TYPES 5
-
-#define KSTAT_DATA_CHAR 0
-#define KSTAT_DATA_INT32 1
-#define KSTAT_DATA_UINT32 2
-#define KSTAT_DATA_INT64 3
-#define KSTAT_DATA_UINT64 4
-#define KSTAT_DATA_LONG 5
-#define KSTAT_DATA_ULONG 6
-#define KSTAT_DATA_STRING 7
-#define KSTAT_NUM_DATAS 8
-
-#define KSTAT_INTR_HARD 0
-#define KSTAT_INTR_SOFT 1
-#define KSTAT_INTR_WATCHDOG 2
-#define KSTAT_INTR_SPURIOUS 3
-#define KSTAT_INTR_MULTSVC 4
-#define KSTAT_NUM_INTRS 5
-
-#define KSTAT_FLAG_VIRTUAL 0x01
-#define KSTAT_FLAG_VAR_SIZE 0x02
-#define KSTAT_FLAG_WRITABLE 0x04
-#define KSTAT_FLAG_PERSISTENT 0x08
-#define KSTAT_FLAG_DORMANT 0x10
-#define KSTAT_FLAG_INVALID 0x20
-#define KSTAT_FLAG_LONGSTRINGS 0x40
-#define KSTAT_FLAG_NO_HEADERS 0x80
-
-#define KS_MAGIC 0x9d9d9d9d
-
-/* Dynamic updates */
-#define KSTAT_READ 0
-#define KSTAT_WRITE 1
-
-struct kstat_s;
-typedef struct kstat_s kstat_t;
-
-typedef int kid_t; /* unique kstat id */
-typedef int kstat_update_t(struct kstat_s *, int); /* dynamic update cb */
-
-typedef struct kstat_module {
- char ksm_name[KSTAT_STRLEN]; /* module name */
- struct list_head ksm_module_list; /* module linkage */
- struct list_head ksm_kstat_list; /* list of kstat entries */
- struct proc_dir_entry *ksm_proc; /* proc entry */
- struct kstat_module *ksm_parent; /* parent module in hierarchy */
- uint_t ksm_nchildren; /* number of child modules */
-} kstat_module_t;
-
-typedef struct kstat_raw_ops {
- int (*headers)(char *buf, size_t size);
- int (*data)(char *buf, size_t size, void *data);
- void *(*addr)(kstat_t *ksp, loff_t index);
-} kstat_raw_ops_t;
-
-typedef struct kstat_proc_entry {
- char kpe_name[KSTAT_STRLEN]; /* kstat name */
- char kpe_module[KSTAT_STRLEN]; /* provider module name */
- kstat_module_t *kpe_owner; /* kstat module linkage */
- struct list_head kpe_list; /* kstat linkage */
- struct proc_dir_entry *kpe_proc; /* procfs entry */
-} kstat_proc_entry_t;
-
-struct kstat_s {
- int ks_magic; /* magic value */
- kid_t ks_kid; /* unique kstat ID */
- hrtime_t ks_crtime; /* creation time */
- hrtime_t ks_snaptime; /* last access time */
- int ks_instance; /* provider module instance */
- char ks_class[KSTAT_STRLEN]; /* kstat class */
- uchar_t ks_type; /* kstat data type */
- uchar_t ks_flags; /* kstat flags */
- void *ks_data; /* kstat type-specific data */
- uint_t ks_ndata; /* # of data records */
- size_t ks_data_size; /* size of kstat data section */
- kstat_update_t *ks_update; /* dynamic updates */
- void *ks_private; /* private data */
- kmutex_t ks_private_lock; /* kstat private data lock */
- kmutex_t *ks_lock; /* kstat data lock */
- kstat_raw_ops_t ks_raw_ops; /* ops table for raw type */
- char *ks_raw_buf; /* buf used for raw ops */
- size_t ks_raw_bufsize; /* size of raw ops buffer */
- kstat_proc_entry_t ks_proc; /* data for procfs entry */
-};
-
-typedef struct kstat_named_s {
- char name[KSTAT_STRLEN]; /* name of counter */
- uchar_t data_type; /* data type */
- union {
- char c[16]; /* 128-bit int */
- int32_t i32; /* 32-bit signed int */
- uint32_t ui32; /* 32-bit unsigned int */
- int64_t i64; /* 64-bit signed int */
- uint64_t ui64; /* 64-bit unsigned int */
- long l; /* native signed long */
- ulong_t ul; /* native unsigned long */
- struct {
- union {
- char *ptr; /* NULL-term string */
- char __pad[8]; /* 64-bit padding */
- } addr;
- uint32_t len; /* # bytes for strlen + '\0' */
- } string;
- } value;
-} kstat_named_t;
-
-#define KSTAT_NAMED_STR_PTR(knptr) ((knptr)->value.string.addr.ptr)
-#define KSTAT_NAMED_STR_BUFLEN(knptr) ((knptr)->value.string.len)
-
-#ifdef HAVE_PROC_OPS_STRUCT
-typedef struct proc_ops kstat_proc_op_t;
-#else
-typedef struct file_operations kstat_proc_op_t;
-#endif
-
-typedef struct kstat_intr {
- uint_t intrs[KSTAT_NUM_INTRS];
-} kstat_intr_t;
-
-typedef struct kstat_io {
- u_longlong_t nread; /* number of bytes read */
- u_longlong_t nwritten; /* number of bytes written */
- uint_t reads; /* number of read operations */
- uint_t writes; /* number of write operations */
- hrtime_t wtime; /* cumulative wait (pre-service) time */
- hrtime_t wlentime; /* cumulative wait len*time product */
- hrtime_t wlastupdate; /* last time wait queue changed */
- hrtime_t rtime; /* cumulative run (service) time */
- hrtime_t rlentime; /* cumulative run length*time product */
- hrtime_t rlastupdate; /* last time run queue changed */
- uint_t wcnt; /* count of elements in wait state */
- uint_t rcnt; /* count of elements in run state */
-} kstat_io_t;
-
-typedef struct kstat_timer {
- char name[KSTAT_STRLEN]; /* event name */
- u_longlong_t num_events; /* number of events */
- hrtime_t elapsed_time; /* cumulative elapsed time */
- hrtime_t min_time; /* shortest event duration */
- hrtime_t max_time; /* longest event duration */
- hrtime_t start_time; /* previous event start time */
- hrtime_t stop_time; /* previous event stop time */
-} kstat_timer_t;
-
-int spl_kstat_init(void);
-void spl_kstat_fini(void);
-
-extern void __kstat_set_raw_ops(kstat_t *ksp,
- int (*headers)(char *buf, size_t size),
- int (*data)(char *buf, size_t size, void *data),
- void* (*addr)(kstat_t *ksp, loff_t index));
-
-extern kstat_t *__kstat_create(const char *ks_module, int ks_instance,
- const char *ks_name, const char *ks_class, uchar_t ks_type,
- uint_t ks_ndata, uchar_t ks_flags);
-
-extern void kstat_proc_entry_init(kstat_proc_entry_t *kpep,
- const char *module, const char *name);
-extern void kstat_proc_entry_delete(kstat_proc_entry_t *kpep);
-extern void kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
- const kstat_proc_op_t *file_ops, void *data);
-
-extern void __kstat_install(kstat_t *ksp);
-extern void __kstat_delete(kstat_t *ksp);
-
-#define kstat_set_raw_ops(k, h, d, a) \
- __kstat_set_raw_ops(k, h, d, a)
-#define kstat_create(m, i, n, c, t, s, f) \
- __kstat_create(m, i, n, c, t, s, f)
-
-#define kstat_install(k) __kstat_install(k)
-#define kstat_delete(k) __kstat_delete(k)
-
-#endif /* _SPL_KSTAT_H */
diff --git a/include/os/linux/spl/sys/list.h b/include/os/linux/spl/sys/list.h
deleted file mode 100644
index ebde0b076c07..000000000000
--- a/include/os/linux/spl/sys/list.h
+++ /dev/null
@@ -1,210 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_LIST_H
-#define _SPL_LIST_H
-
-#include <sys/types.h>
-#include <sys/debug.h>
-#include <linux/list.h>
-
-/*
- * NOTE: I have implemented the Solaris list API in terms of the native
- * linux API. This has certain advantages in terms of leveraging the linux
- * list debugging infrastructure, but it also means that the internals of a
- * list differ slightly than on Solaris. This is not a problem as long as
- * all callers stick to the published API. The two major differences are:
- *
- * 1) A list_node_t is mapped to a linux list_head struct which changes
- * the name of the list_next/list_prev pointers to next/prev respectively.
- *
- * 2) A list_node_t which is not attached to a list on Solaris is denoted
- * by having its list_next/list_prev pointers set to NULL. Under linux
- * the next/prev pointers are set to LIST_POISON1 and LIST_POISON2
- * respectively. At this moment this only impacts the implementation
- * of the list_link_init() and list_link_active() functions.
- */
-
-typedef struct list_head list_node_t;
-
-typedef struct list {
- size_t list_offset;
- list_node_t list_head;
-} list_t;
-
-#define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset))
-#define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset))
-
-static inline int
-list_is_empty(list_t *list)
-{
- return (list_empty(&list->list_head));
-}
-
-static inline void
-list_link_init(list_node_t *node)
-{
- node->next = LIST_POISON1;
- node->prev = LIST_POISON2;
-}
-
-static inline void
-list_create(list_t *list, size_t size, size_t offset)
-{
- (void) size;
-
- list->list_offset = offset;
- INIT_LIST_HEAD(&list->list_head);
-}
-
-static inline void
-list_destroy(list_t *list)
-{
- list_del(&list->list_head);
-}
-
-static inline void
-list_insert_head(list_t *list, void *object)
-{
- list_add(list_d2l(list, object), &list->list_head);
-}
-
-static inline void
-list_insert_tail(list_t *list, void *object)
-{
- list_add_tail(list_d2l(list, object), &list->list_head);
-}
-
-static inline void
-list_insert_after(list_t *list, void *object, void *nobject)
-{
- if (object == NULL)
- list_insert_head(list, nobject);
- else
- list_add(list_d2l(list, nobject), list_d2l(list, object));
-}
-
-static inline void
-list_insert_before(list_t *list, void *object, void *nobject)
-{
- if (object == NULL)
- list_insert_tail(list, nobject);
- else
- list_add_tail(list_d2l(list, nobject), list_d2l(list, object));
-}
-
-static inline void
-list_remove(list_t *list, void *object)
-{
- list_del(list_d2l(list, object));
-}
-
-static inline void *
-list_remove_head(list_t *list)
-{
- list_node_t *head = list->list_head.next;
- if (head == &list->list_head)
- return (NULL);
-
- list_del(head);
- return (list_object(list, head));
-}
-
-static inline void *
-list_remove_tail(list_t *list)
-{
- list_node_t *tail = list->list_head.prev;
- if (tail == &list->list_head)
- return (NULL);
-
- list_del(tail);
- return (list_object(list, tail));
-}
-
-static inline void *
-list_head(list_t *list)
-{
- if (list_is_empty(list))
- return (NULL);
-
- return (list_object(list, list->list_head.next));
-}
-
-static inline void *
-list_tail(list_t *list)
-{
- if (list_is_empty(list))
- return (NULL);
-
- return (list_object(list, list->list_head.prev));
-}
-
-static inline void *
-list_next(list_t *list, void *object)
-{
- list_node_t *node = list_d2l(list, object);
-
- if (node->next != &list->list_head)
- return (list_object(list, node->next));
-
- return (NULL);
-}
-
-static inline void *
-list_prev(list_t *list, void *object)
-{
- list_node_t *node = list_d2l(list, object);
-
- if (node->prev != &list->list_head)
- return (list_object(list, node->prev));
-
- return (NULL);
-}
-
-static inline int
-list_link_active(list_node_t *node)
-{
- EQUIV(node->next == LIST_POISON1, node->prev == LIST_POISON2);
- return (node->next != LIST_POISON1);
-}
-
-static inline void
-spl_list_move_tail(list_t *dst, list_t *src)
-{
- list_splice_init(&src->list_head, dst->list_head.prev);
-}
-
-#define list_move_tail(dst, src) spl_list_move_tail(dst, src)
-
-static inline void
-list_link_replace(list_node_t *old_node, list_node_t *new_node)
-{
- new_node->next = old_node->next;
- new_node->prev = old_node->prev;
- old_node->prev->next = new_node;
- old_node->next->prev = new_node;
- list_link_init(old_node);
-}
-
-#endif /* SPL_LIST_H */
diff --git a/include/os/linux/spl/sys/misc.h b/include/os/linux/spl/sys/misc.h
deleted file mode 100644
index fbaaf229bd1a..000000000000
--- a/include/os/linux/spl/sys/misc.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: CDDL-1.0
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or https://opensource.org/licenses/CDDL-1.0.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-#ifndef _OS_LINUX_SPL_MISC_H
-#define _OS_LINUX_SPL_MISC_H
-
-#include <linux/kobject.h>
-#include <linux/swap.h>
-
-extern void spl_signal_kobj_evt(struct block_device *bdev);
-
-/*
- * Check if the current thread is a memory reclaim thread.
- */
-extern int current_is_reclaim_thread(void);
-
-#endif
diff --git a/include/os/linux/spl/sys/mod.h b/include/os/linux/spl/sys/mod.h
deleted file mode 100644
index eaeb9255039e..000000000000
--- a/include/os/linux/spl/sys/mod.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef _SPL_MOD_H
-#define _SPL_MOD_H
-#include <linux/mod_compat.h>
-
-#endif /* SPL_MOD_H */
diff --git a/include/os/linux/spl/sys/mutex.h b/include/os/linux/spl/sys/mutex.h
deleted file mode 100644
index 4eca2414fc5b..000000000000
--- a/include/os/linux/spl/sys/mutex.h
+++ /dev/null
@@ -1,190 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_MUTEX_H
-#define _SPL_MUTEX_H
-
-#include <sys/types.h>
-#include <linux/sched.h>
-#include <linux/mutex.h>
-#include <linux/lockdep.h>
-#include <linux/compiler_compat.h>
-
-typedef enum {
- MUTEX_DEFAULT = 0,
- MUTEX_SPIN = 1,
- MUTEX_ADAPTIVE = 2,
- MUTEX_NOLOCKDEP = 3
-} kmutex_type_t;
-
-typedef struct {
- struct mutex m_mutex;
- spinlock_t m_lock; /* used for serializing mutex_exit */
- kthread_t *m_owner;
-#ifdef CONFIG_LOCKDEP
- kmutex_type_t m_type;
-#endif /* CONFIG_LOCKDEP */
-} kmutex_t;
-
-#define MUTEX(mp) (&((mp)->m_mutex))
-
-static inline void
-spl_mutex_set_owner(kmutex_t *mp)
-{
- mp->m_owner = current;
-}
-
-static inline void
-spl_mutex_clear_owner(kmutex_t *mp)
-{
- mp->m_owner = NULL;
-}
-
-#define mutex_owner(mp) (READ_ONCE((mp)->m_owner))
-#define mutex_owned(mp) (mutex_owner(mp) == current)
-#define MUTEX_HELD(mp) mutex_owned(mp)
-#define MUTEX_NOT_HELD(mp) (!MUTEX_HELD(mp))
-
-#ifdef CONFIG_LOCKDEP
-static inline void
-spl_mutex_set_type(kmutex_t *mp, kmutex_type_t type)
-{
- mp->m_type = type;
-}
-static inline void
-spl_mutex_lockdep_off_maybe(kmutex_t *mp) \
-{ \
- if (mp && mp->m_type == MUTEX_NOLOCKDEP) \
- lockdep_off(); \
-}
-static inline void
-spl_mutex_lockdep_on_maybe(kmutex_t *mp) \
-{ \
- if (mp && mp->m_type == MUTEX_NOLOCKDEP) \
- lockdep_on(); \
-}
-#else /* CONFIG_LOCKDEP */
-#define spl_mutex_set_type(mp, type)
-#define spl_mutex_lockdep_off_maybe(mp)
-#define spl_mutex_lockdep_on_maybe(mp)
-#endif /* CONFIG_LOCKDEP */
-
-/*
- * The following functions must be a #define and not static inline.
- * This ensures that the native linux mutex functions (lock/unlock)
- * will be correctly located in the users code which is important
- * for the built in kernel lock analysis tools
- */
-#undef mutex_init
-#define mutex_init(mp, name, type, ibc) \
-{ \
- static struct lock_class_key __key; \
- ASSERT(type == MUTEX_DEFAULT || type == MUTEX_NOLOCKDEP); \
- \
- __mutex_init(MUTEX(mp), (name) ? (#name) : (#mp), &__key); \
- spin_lock_init(&(mp)->m_lock); \
- spl_mutex_clear_owner(mp); \
- spl_mutex_set_type(mp, type); \
-}
-
-#undef mutex_destroy
-#define mutex_destroy(mp) \
-{ \
- VERIFY0P(mutex_owner(mp)); \
-}
-
-#define mutex_tryenter(mp) \
-/* CSTYLED */ \
-({ \
- int _rc_; \
- \
- spl_mutex_lockdep_off_maybe(mp); \
- if ((_rc_ = mutex_trylock(MUTEX(mp))) == 1) \
- spl_mutex_set_owner(mp); \
- spl_mutex_lockdep_on_maybe(mp); \
- \
- _rc_; \
-})
-
-#define NESTED_SINGLE 1
-
-#define mutex_enter_nested(mp, subclass) \
-{ \
- ASSERT3P(mutex_owner(mp), !=, current); \
- spl_mutex_lockdep_off_maybe(mp); \
- mutex_lock_nested(MUTEX(mp), (subclass)); \
- spl_mutex_lockdep_on_maybe(mp); \
- spl_mutex_set_owner(mp); \
-}
-
-#define mutex_enter_interruptible(mp) \
-/* CSTYLED */ \
-({ \
- int _rc_; \
- \
- ASSERT3P(mutex_owner(mp), !=, current); \
- spl_mutex_lockdep_off_maybe(mp); \
- _rc_ = mutex_lock_interruptible(MUTEX(mp)); \
- spl_mutex_lockdep_on_maybe(mp); \
- if (!_rc_) { \
- spl_mutex_set_owner(mp); \
- } \
- \
- _rc_; \
-})
-
-#define mutex_enter(mp) mutex_enter_nested((mp), 0)
-
-/*
- * The reason for the spinlock:
- *
- * The Linux mutex is designed with a fast-path/slow-path design such that it
- * does not guarantee serialization upon itself, allowing a race where latter
- * acquirers finish mutex_unlock before former ones.
- *
- * The race renders it unsafe to be used for serializing the freeing of an
- * object in which the mutex is embedded, where the latter acquirer could go
- * on to free the object while the former one is still doing mutex_unlock and
- * causing memory corruption.
- *
- * However, there are many places in ZFS where the mutex is used for
- * serializing object freeing, and the code is shared among other OSes without
- * this issue. Thus, we need the spinlock to force the serialization on
- * mutex_exit().
- *
- * See http://lwn.net/Articles/575477/ for the information about the race.
- */
-#define mutex_exit(mp) \
-{ \
- ASSERT3P(mutex_owner(mp), ==, current); \
- spl_mutex_clear_owner(mp); \
- spin_lock(&(mp)->m_lock); \
- spl_mutex_lockdep_off_maybe(mp); \
- mutex_unlock(MUTEX(mp)); \
- spl_mutex_lockdep_on_maybe(mp); \
- spin_unlock(&(mp)->m_lock); \
- /* NOTE: do not dereference mp after this point */ \
-}
-
-#endif /* _SPL_MUTEX_H */
diff --git a/include/os/linux/spl/sys/param.h b/include/os/linux/spl/sys/param.h
deleted file mode 100644
index d0628cd3a4d3..000000000000
--- a/include/os/linux/spl/sys/param.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_PARAM_H
-#define _SPL_PARAM_H
-
-#include <asm/page.h>
-
-/* Pages to bytes and back */
-#define ptob(pages) ((pages) << PAGE_SHIFT)
-#define btop(bytes) ((bytes) >> PAGE_SHIFT)
-
-#define MAXUID UINT32_MAX
-
-#endif /* SPL_PARAM_H */
diff --git a/include/os/linux/spl/sys/proc.h b/include/os/linux/spl/sys/proc.h
deleted file mode 100644
index b57f57567e3b..000000000000
--- a/include/os/linux/spl/sys/proc.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_PROC_H
-#define _SPL_PROC_H
-
-#include <linux/proc_fs.h>
-#include <linux/sched.h>
-
-extern struct proc_dir_entry *proc_spl_kstat;
-
-int spl_proc_init(void);
-void spl_proc_fini(void);
-
-static inline boolean_t
-zfs_proc_is_caller(struct task_struct *t)
-{
- return (t->group_leader == current->group_leader);
-}
-
-#endif /* SPL_PROC_H */
diff --git a/include/os/linux/spl/sys/processor.h b/include/os/linux/spl/sys/processor.h
deleted file mode 100644
index 24c510ad38be..000000000000
--- a/include/os/linux/spl/sys/processor.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_PROCESSOR_H
-#define _SPL_PROCESSOR_H
-
-#define getcpuid() smp_processor_id()
-
-typedef int processorid_t;
-
-#endif /* _SPL_PROCESSOR_H */
diff --git a/include/os/linux/spl/sys/procfs_list.h b/include/os/linux/spl/sys/procfs_list.h
deleted file mode 100644
index 8213d26f3b10..000000000000
--- a/include/os/linux/spl/sys/procfs_list.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: CDDL-1.0
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or https://opensource.org/licenses/CDDL-1.0.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 2018 by Delphix. All rights reserved.
- */
-
-#ifndef _SPL_PROCFS_LIST_H
-#define _SPL_PROCFS_LIST_H
-
-#include <sys/kstat.h>
-#include <sys/mutex.h>
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-
-typedef struct procfs_list procfs_list_t;
-struct procfs_list {
- /* Accessed only by user of a procfs_list */
- void *pl_private;
-
- /*
- * Accessed both by user of a procfs_list and by procfs_list
- * implementation
- */
- kmutex_t pl_lock;
- list_t pl_list;
-
- /* Accessed only by procfs_list implementation */
- uint64_t pl_next_id;
- int (*pl_show)(struct seq_file *f, void *p);
- int (*pl_show_header)(struct seq_file *f);
- int (*pl_clear)(procfs_list_t *procfs_list);
- size_t pl_node_offset;
- kstat_proc_entry_t pl_kstat_entry;
-};
-
-typedef struct procfs_list_node {
- list_node_t pln_link;
- uint64_t pln_id;
-} procfs_list_node_t;
-
-void procfs_list_install(const char *module,
- const char *submodule,
- const char *name,
- mode_t mode,
- procfs_list_t *procfs_list,
- int (*show)(struct seq_file *f, void *p),
- int (*show_header)(struct seq_file *f),
- int (*clear)(procfs_list_t *procfs_list),
- size_t procfs_list_node_off);
-void procfs_list_uninstall(procfs_list_t *procfs_list);
-void procfs_list_destroy(procfs_list_t *procfs_list);
-
-void procfs_list_add(procfs_list_t *procfs_list, void *p);
-
-#endif /* _SPL_PROCFS_LIST_H */
diff --git a/include/os/linux/spl/sys/random.h b/include/os/linux/spl/sys/random.h
deleted file mode 100644
index 08eb805350e0..000000000000
--- a/include/os/linux/spl/sys/random.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_RANDOM_H
-#define _SPL_RANDOM_H
-
-#include <linux/module.h>
-#include <linux/random.h>
-
-static __inline__ int
-random_get_bytes(uint8_t *ptr, size_t len)
-{
- get_random_bytes((void *)ptr, (int)len);
- return (0);
-}
-
-extern int random_get_pseudo_bytes(uint8_t *ptr, size_t len);
-
-static __inline__ uint32_t
-random_in_range(uint32_t range)
-{
- uint32_t r;
-
- ASSERT(range != 0);
-
- if (range == 1)
- return (0);
-
- (void) random_get_pseudo_bytes((uint8_t *)&r, sizeof (r));
-
- return (r % range);
-}
-
-#endif /* _SPL_RANDOM_H */
diff --git a/include/os/linux/spl/sys/rwlock.h b/include/os/linux/spl/sys/rwlock.h
deleted file mode 100644
index c883836c2f83..000000000000
--- a/include/os/linux/spl/sys/rwlock.h
+++ /dev/null
@@ -1,199 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_RWLOCK_H
-#define _SPL_RWLOCK_H
-
-#include <sys/types.h>
-#include <linux/rwsem.h>
-#include <linux/sched.h>
-
-typedef enum {
- RW_DRIVER = 2,
- RW_DEFAULT = 4,
- RW_NOLOCKDEP = 5
-} krw_type_t;
-
-typedef enum {
- RW_NONE = 0,
- RW_WRITER = 1,
- RW_READER = 2
-} krw_t;
-
-typedef struct {
- struct rw_semaphore rw_rwlock;
- kthread_t *rw_owner;
-#ifdef CONFIG_LOCKDEP
- krw_type_t rw_type;
-#endif /* CONFIG_LOCKDEP */
-} krwlock_t;
-
-#define SEM(rwp) (&(rwp)->rw_rwlock)
-
-static inline void
-spl_rw_set_owner(krwlock_t *rwp)
-{
- rwp->rw_owner = current;
-}
-
-static inline void
-spl_rw_clear_owner(krwlock_t *rwp)
-{
- rwp->rw_owner = NULL;
-}
-
-static inline kthread_t *
-rw_owner(krwlock_t *rwp)
-{
- return (rwp->rw_owner);
-}
-
-#ifdef CONFIG_LOCKDEP
-static inline void
-spl_rw_set_type(krwlock_t *rwp, krw_type_t type)
-{
- rwp->rw_type = type;
-}
-static inline void
-spl_rw_lockdep_off_maybe(krwlock_t *rwp) \
-{ \
- if (rwp && rwp->rw_type == RW_NOLOCKDEP) \
- lockdep_off(); \
-}
-static inline void
-spl_rw_lockdep_on_maybe(krwlock_t *rwp) \
-{ \
- if (rwp && rwp->rw_type == RW_NOLOCKDEP) \
- lockdep_on(); \
-}
-#else /* CONFIG_LOCKDEP */
-#define spl_rw_set_type(rwp, type)
-#define spl_rw_lockdep_off_maybe(rwp)
-#define spl_rw_lockdep_on_maybe(rwp)
-#endif /* CONFIG_LOCKDEP */
-
-static inline int
-RW_LOCK_HELD(krwlock_t *rwp)
-{
- return (rwsem_is_locked(SEM(rwp)));
-}
-
-static inline int
-RW_WRITE_HELD(krwlock_t *rwp)
-{
- return (rw_owner(rwp) == current);
-}
-
-static inline int
-RW_READ_HELD(krwlock_t *rwp)
-{
- return (RW_LOCK_HELD(rwp) && rw_owner(rwp) == NULL);
-}
-
-/*
- * The following functions must be a #define and not static inline.
- * This ensures that the native linux semaphore functions (down/up)
- * will be correctly located in the users code which is important
- * for the built in kernel lock analysis tools
- */
-#define rw_init(rwp, name, type, arg) /* CSTYLED */ \
-({ \
- static struct lock_class_key __key; \
- ASSERT(type == RW_DEFAULT || type == RW_NOLOCKDEP); \
- \
- __init_rwsem(SEM(rwp), #rwp, &__key); \
- spl_rw_clear_owner(rwp); \
- spl_rw_set_type(rwp, type); \
-})
-
-/*
- * The Linux rwsem implementation does not require a matching destroy.
- */
-#define rw_destroy(rwp) ASSERT(!(RW_LOCK_HELD(rwp)))
-
-/*
- * Upgrading a rwsem from a reader to a writer is not supported by the
- * Linux kernel. The lock must be dropped and reacquired as a writer.
- */
-#define rw_tryupgrade(rwp) RW_WRITE_HELD(rwp)
-
-#define rw_tryenter(rwp, rw) /* CSTYLED */ \
-({ \
- int _rc_ = 0; \
- \
- spl_rw_lockdep_off_maybe(rwp); \
- switch (rw) { \
- case RW_READER: \
- _rc_ = down_read_trylock(SEM(rwp)); \
- break; \
- case RW_WRITER: \
- if ((_rc_ = down_write_trylock(SEM(rwp)))) \
- spl_rw_set_owner(rwp); \
- break; \
- default: \
- VERIFY(0); \
- } \
- spl_rw_lockdep_on_maybe(rwp); \
- _rc_; \
-})
-
-#define rw_enter(rwp, rw) /* CSTYLED */ \
-({ \
- spl_rw_lockdep_off_maybe(rwp); \
- switch (rw) { \
- case RW_READER: \
- down_read(SEM(rwp)); \
- break; \
- case RW_WRITER: \
- down_write(SEM(rwp)); \
- spl_rw_set_owner(rwp); \
- break; \
- default: \
- VERIFY(0); \
- } \
- spl_rw_lockdep_on_maybe(rwp); \
-})
-
-#define rw_exit(rwp) /* CSTYLED */ \
-({ \
- spl_rw_lockdep_off_maybe(rwp); \
- if (RW_WRITE_HELD(rwp)) { \
- spl_rw_clear_owner(rwp); \
- up_write(SEM(rwp)); \
- } else { \
- ASSERT(RW_READ_HELD(rwp)); \
- up_read(SEM(rwp)); \
- } \
- spl_rw_lockdep_on_maybe(rwp); \
-})
-
-#define rw_downgrade(rwp) /* CSTYLED */ \
-({ \
- spl_rw_lockdep_off_maybe(rwp); \
- spl_rw_clear_owner(rwp); \
- downgrade_write(SEM(rwp)); \
- spl_rw_lockdep_on_maybe(rwp); \
-})
-
-#endif /* _SPL_RWLOCK_H */
diff --git a/include/os/linux/spl/sys/shrinker.h b/include/os/linux/spl/sys/shrinker.h
deleted file mode 100644
index 6f67c52f5857..000000000000
--- a/include/os/linux/spl/sys/shrinker.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_SHRINKER_H
-#define _SPL_SHRINKER_H
-
-#include <linux/mm.h>
-#include <linux/fs.h>
-
-/*
- * Due to frequent changes in the shrinker API the following
- * compatibility wrapper should be used.
- *
- * shrinker = spl_register_shrinker(name, countfunc, scanfunc, seek_cost);
- * spl_unregister_shrinker(shrinker);
- *
- * spl_register_shrinker is used to create and register a shrinker with the
- * given name.
- * The countfunc returns the number of free-able objects.
- * The scanfunc returns the number of objects that were freed.
- * The callbacks can return SHRINK_STOP if further calls can't make any more
- * progress. Note that a return value of SHRINK_EMPTY is currently not
- * supported.
- *
- * Example:
- *
- * static unsigned long
- * my_count(struct shrinker *shrink, struct shrink_control *sc)
- * {
- * ...calculate number of objects in the cache...
- *
- * return (number of objects in the cache);
- * }
- *
- * static unsigned long
- * my_scan(struct shrinker *shrink, struct shrink_control *sc)
- * {
- * ...scan objects in the cache and reclaim them...
- * }
- *
- * static struct shrinker *my_shrinker;
- *
- * void my_init_func(void) {
- * my_shrinker = spl_register_shrinker("my-shrinker",
- * my_count, my_scan, DEFAULT_SEEKS);
- * }
- *
- * void my_fini_func(void) {
- * spl_unregister_shrinker(my_shrinker);
- * }
- */
-
-typedef unsigned long (*spl_shrinker_cb)
- (struct shrinker *, struct shrink_control *);
-
-struct shrinker *spl_register_shrinker(const char *name,
- spl_shrinker_cb countfunc, spl_shrinker_cb scanfunc, int seek_cost);
-void spl_unregister_shrinker(struct shrinker *);
-
-#ifndef SHRINK_STOP
-/* 3.0-3.11 compatibility */
-#define SHRINK_STOP (-1)
-#endif
-
-#endif /* SPL_SHRINKER_H */
diff --git a/include/os/linux/spl/sys/sid.h b/include/os/linux/spl/sys/sid.h
deleted file mode 100644
index 6258f0fd3f4e..000000000000
--- a/include/os/linux/spl/sys/sid.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_SID_H
-#define _SPL_SID_H
-
-typedef struct ksiddomain {
- char *kd_name;
-} ksiddomain_t;
-
-typedef enum ksid_index {
- KSID_USER,
- KSID_GROUP,
- KSID_OWNER,
- KSID_COUNT
-} ksid_index_t;
-
-typedef int ksid_t;
-
-static inline ksiddomain_t *
-ksid_lookupdomain(const char *dom)
-{
- ksiddomain_t *kd;
- int len = strlen(dom);
-
- kd = kmem_zalloc(sizeof (ksiddomain_t), KM_SLEEP);
- kd->kd_name = kmem_zalloc(len + 1, KM_SLEEP);
- memcpy(kd->kd_name, dom, len);
-
- return (kd);
-}
-
-static inline void
-ksiddomain_rele(ksiddomain_t *ksid)
-{
- kmem_free(ksid->kd_name, strlen(ksid->kd_name) + 1);
- kmem_free(ksid, sizeof (ksiddomain_t));
-}
-
-#endif /* _SPL_SID_H */
diff --git a/include/os/linux/spl/sys/signal.h b/include/os/linux/spl/sys/signal.h
deleted file mode 100644
index e4b8e8e18cbd..000000000000
--- a/include/os/linux/spl/sys/signal.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_SIGNAL_H
-#define _SPL_SIGNAL_H
-
-#include <linux/sched.h>
-#include <linux/sched/signal.h>
-
-extern int issig(void);
-
-#endif /* SPL_SIGNAL_H */
diff --git a/include/os/linux/spl/sys/simd.h b/include/os/linux/spl/sys/simd.h
deleted file mode 100644
index 35061f189464..000000000000
--- a/include/os/linux/spl/sys/simd.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_SYS_SIMD_H
-#define _SPL_SYS_SIMD_H
-
-#include <sys/isa_defs.h>
-#include <linux/simd.h>
-
-#endif /* _SPL_SYS_SIMD_H */
diff --git a/include/os/linux/spl/sys/stat.h b/include/os/linux/spl/sys/stat.h
deleted file mode 100644
index ad2815e46394..000000000000
--- a/include/os/linux/spl/sys/stat.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_STAT_H
-#define _SPL_STAT_H
-
-#include <sys/stat.h>
-
-#endif /* SPL_STAT_H */
diff --git a/include/os/linux/spl/sys/string.h b/include/os/linux/spl/sys/string.h
deleted file mode 100644
index 59a0dc31d0e4..000000000000
--- a/include/os/linux/spl/sys/string.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_STRING_H
-#define _SPL_STRING_H
-
-#include <linux/string.h>
-
-#ifndef HAVE_KERNEL_STRLCPY
-/*
- * strscpy is strlcpy, but returns an error on truncation. strlcpy is defined
- * to return strlen(src), so detect error and override it.
- */
-static inline size_t
-strlcpy(char *dest, const char *src, size_t size)
-{
- ssize_t ret = strscpy(dest, src, size);
- if (likely(ret > 0))
- return ((size_t)ret);
- return (strlen(src));
-}
-#endif /* HAVE_KERNEL_STRLCPY */
-
-#endif /* _SPL_STRING_H */
diff --git a/include/os/linux/spl/sys/sunddi.h b/include/os/linux/spl/sys/sunddi.h
deleted file mode 100644
index 32dcaa8f1f61..000000000000
--- a/include/os/linux/spl/sys/sunddi.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_SUNDDI_H
-#define _SPL_SUNDDI_H
-
-#include <sys/cred.h>
-#include <sys/uio.h>
-#include <sys/mutex.h>
-#include <sys/u8_textprep.h>
-#include <sys/vnode.h>
-
-typedef int ddi_devid_t;
-
-#define DDI_DEV_T_NONE ((dev_t)-1)
-#define DDI_DEV_T_ANY ((dev_t)-2)
-#define DI_MAJOR_T_UNKNOWN ((major_t)0)
-
-#define DDI_PROP_DONTPASS 0x0001
-#define DDI_PROP_CANSLEEP 0x0002
-
-#define DDI_SUCCESS 0
-#define DDI_FAILURE -1
-
-#define ddi_prop_lookup_string(x1, x2, x3, x4, x5) (*x5 = NULL)
-#define ddi_prop_free(x) (void)0
-#define ddi_root_node() (void)0
-
-extern int ddi_strtol(const char *, char **, int, long *);
-extern int ddi_strtoull(const char *, char **, int, unsigned long long *);
-extern int ddi_strtoll(const char *, char **, int, long long *);
-
-extern int ddi_copyin(const void *from, void *to, size_t len, int flags);
-extern int ddi_copyout(const void *from, void *to, size_t len, int flags);
-
-#endif /* SPL_SUNDDI_H */
diff --git a/include/os/linux/spl/sys/sysmacros.h b/include/os/linux/spl/sys/sysmacros.h
deleted file mode 100644
index db48222b712a..000000000000
--- a/include/os/linux/spl/sys/sysmacros.h
+++ /dev/null
@@ -1,219 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_SYSMACROS_H
-#define _SPL_SYSMACROS_H
-
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/sched/rt.h>
-#include <linux/cpumask.h>
-#include <sys/debug.h>
-#include <sys/zone.h>
-#include <sys/signal.h>
-#include <asm/page.h>
-
-
-#ifndef _KERNEL
-#define _KERNEL __KERNEL__
-#endif
-
-#define FALSE 0
-#define TRUE 1
-
-#define INT8_MAX (127)
-#define INT8_MIN (-128)
-#define UINT8_MAX (255)
-#define UINT8_MIN (0)
-
-#define INT16_MAX (32767)
-#define INT16_MIN (-32768)
-#define UINT16_MAX (65535)
-#define UINT16_MIN (0)
-
-#define INT32_MAX INT_MAX
-#define INT32_MIN INT_MIN
-#define UINT32_MAX UINT_MAX
-#define UINT32_MIN UINT_MIN
-
-#define INT64_MAX LLONG_MAX
-#define INT64_MIN LLONG_MIN
-#define UINT64_MAX ULLONG_MAX
-#define UINT64_MIN ULLONG_MIN
-
-#define NBBY 8
-
-#define MAXMSGLEN 256
-#define MAXNAMELEN 256
-#define MAXPATHLEN 4096
-#define MAXOFFSET_T LLONG_MAX
-#define MAXBSIZE 8192
-#define DEV_BSIZE 512
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-
-#define proc_pageout NULL
-#define curproc current
-#define max_ncpus num_possible_cpus()
-#define boot_ncpus num_online_cpus()
-#define CPU_SEQID smp_processor_id()
-#define CPU_SEQID_UNSTABLE raw_smp_processor_id()
-#define is_system_labeled() 0
-
-#ifndef RLIM64_INFINITY
-#define RLIM64_INFINITY (~0ULL)
-#endif
-
-/*
- * 0..MAX_PRIO-1: Process priority
- * 0..MAX_RT_PRIO-1: RT priority tasks
- * MAX_RT_PRIO..MAX_PRIO-1: SCHED_NORMAL tasks
- *
- * Treat shim tasks as SCHED_NORMAL tasks
- */
-#define minclsyspri (MAX_PRIO-1)
-#define defclsyspri (DEFAULT_PRIO)
-/* Write issue taskq priority. */
-#define wtqclsyspri (MAX_RT_PRIO + 1)
-#define maxclsyspri (MAX_RT_PRIO)
-
-#ifndef NICE_TO_PRIO
-#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
-#endif
-#ifndef PRIO_TO_NICE
-#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
-#endif
-
-/*
- * Missing macros
- */
-#ifndef PAGESIZE
-#define PAGESIZE PAGE_SIZE
-#endif
-
-#ifndef PAGESHIFT
-#define PAGESHIFT PAGE_SHIFT
-#endif
-
-/* Missing globals */
-extern unsigned long spl_hostid;
-
-/* Missing misc functions */
-extern uint32_t zone_get_hostid(void *zone);
-extern void spl_setup(void);
-extern void spl_cleanup(void);
-
-/*
- * Only handles the first 4096 majors and first 256 minors. We don't have a
- * libc for the kernel module so we define this inline.
- */
-static inline dev_t
-makedev(unsigned int major, unsigned int minor)
-{
- return ((major & 0xFFF) << 8) | (minor & 0xFF);
-}
-
-#define highbit(x) __fls(x)
-#define lowbit(x) __ffs(x)
-
-#define highbit64(x) fls64(x)
-#define makedevice(maj, min) makedev(maj, min)
-
-/* common macros */
-#ifndef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a, b) ((a) < (b) ? (b) : (a))
-#endif
-#ifndef ABS
-#define ABS(a) ((a) < 0 ? -(a) : (a))
-#endif
-#ifndef DIV_ROUND_UP
-#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
-#endif
-#ifndef roundup
-#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
-#endif
-#ifndef howmany
-#define howmany(x, y) (((x) + ((y) - 1)) / (y))
-#endif
-
-/*
- * Compatibility macros/typedefs needed for Solaris -> Linux port
- */
-// Deprecated. Use P2ALIGN_TYPED instead.
-// #define P2ALIGN(x, align) ((x) & -(align))
-#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1)
-#define P2ROUNDUP(x, align) ((((x) - 1) | ((align) - 1)) + 1)
-#define P2PHASE(x, align) ((x) & ((align) - 1))
-#define P2NPHASE(x, align) (-(x) & ((align) - 1))
-#define ISP2(x) (((x) & ((x) - 1)) == 0)
-#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
-#define P2BOUNDARY(off, len, align) \
- (((off) ^ ((off) + (len) - 1)) > (align) - 1)
-
-/*
- * Typed version of the P2* macros. These macros should be used to ensure
- * that the result is correctly calculated based on the data type of (x),
- * which is passed in as the last argument, regardless of the data
- * type of the alignment. For example, if (x) is of type uint64_t,
- * and we want to round it up to a page boundary using "PAGESIZE" as
- * the alignment, we can do either
- *
- * P2ROUNDUP(x, (uint64_t)PAGESIZE)
- * or
- * P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t)
- */
-#define P2ALIGN_TYPED(x, align, type) \
- ((type)(x) & -(type)(align))
-#define P2PHASE_TYPED(x, align, type) \
- ((type)(x) & ((type)(align) - 1))
-#define P2NPHASE_TYPED(x, align, type) \
- (-(type)(x) & ((type)(align) - 1))
-#define P2ROUNDUP_TYPED(x, align, type) \
- ((((type)(x) - 1) | ((type)(align) - 1)) + 1)
-#define P2END_TYPED(x, align, type) \
- (-(~(type)(x) & -(type)(align)))
-#define P2PHASEUP_TYPED(x, align, phase, type) \
- ((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align)))
-#define P2CROSS_TYPED(x, y, align, type) \
- (((type)(x) ^ (type)(y)) > (type)(align) - 1)
-#define P2SAMEHIGHBIT_TYPED(x, y, type) \
- (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
-
-#define SET_ERROR(err) \
- (__set_error(__FILE__, __func__, __LINE__, err), err)
-
-#include <linux/sort.h>
-#define qsort(base, num, size, cmp) \
- sort(base, num, size, cmp, NULL)
-
-#if !defined(_KMEMUSER) && !defined(offsetof)
-
-/* avoid any possibility of clashing with <stddef.h> version */
-
-#define offsetof(s, m) ((size_t)(&(((s *)0)->m)))
-#endif
-
-#endif /* _SPL_SYSMACROS_H */
diff --git a/include/os/linux/spl/sys/systeminfo.h b/include/os/linux/spl/sys/systeminfo.h
deleted file mode 100644
index 8c964fc16acd..000000000000
--- a/include/os/linux/spl/sys/systeminfo.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_SYSTEMINFO_H
-#define _SPL_SYSTEMINFO_H
-
-#define HW_HOSTID_LEN 11 /* minimum buffer size needed */
- /* to hold a decimal or hex */
- /* hostid string */
-
-/* Supplemental definitions for Linux. */
-#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */
-#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */
-
-#endif /* SPL_SYSTEMINFO_H */
diff --git a/include/os/linux/spl/sys/taskq.h b/include/os/linux/spl/sys/taskq.h
deleted file mode 100644
index c9b2bc994c8c..000000000000
--- a/include/os/linux/spl/sys/taskq.h
+++ /dev/null
@@ -1,214 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-/*
- * Copyright (c) 2024, Klara Inc.
- * Copyright (c) 2024, Syneto
- */
-
-#ifndef _SPL_TASKQ_H
-#define _SPL_TASKQ_H
-
-#include <linux/module.h>
-#include <linux/gfp.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/kthread.h>
-#include <sys/types.h>
-#include <sys/thread.h>
-#include <sys/rwlock.h>
-#include <sys/wait.h>
-#include <sys/wmsum.h>
-#include <sys/kstat.h>
-
-#define TASKQ_NAMELEN 31
-
-#define TASKQ_PREPOPULATE 0x00000001
-#define TASKQ_CPR_SAFE 0x00000002
-#define TASKQ_DYNAMIC 0x00000004
-#define TASKQ_THREADS_CPU_PCT 0x00000008
-#define TASKQ_DC_BATCH 0x00000010
-#define TASKQ_ACTIVE 0x80000000
-
-/*
- * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as
- * KM_SLEEP/KM_NOSLEEP. TQ_NOQUEUE/TQ_NOALLOC are set particularly
- * large so as not to conflict with already used GFP_* defines.
- */
-#define TQ_SLEEP 0x00000000
-#define TQ_NOSLEEP 0x00000001
-#define TQ_PUSHPAGE 0x00000002
-#define TQ_NOQUEUE 0x01000000
-#define TQ_NOALLOC 0x02000000
-#define TQ_NEW 0x04000000
-#define TQ_FRONT 0x08000000
-
-/*
- * Reserved taskqid values.
- */
-#define TASKQID_INVALID ((taskqid_t)0)
-#define TASKQID_INITIAL ((taskqid_t)1)
-
-/*
- * spin_lock(lock) and spin_lock_nested(lock,0) are equivalent,
- * so TQ_LOCK_DYNAMIC must not evaluate to 0
- */
-typedef enum tq_lock_role {
- TQ_LOCK_GENERAL = 0,
- TQ_LOCK_DYNAMIC = 1,
-} tq_lock_role_t;
-
-typedef unsigned long taskqid_t;
-typedef void (task_func_t)(void *);
-
-typedef struct taskq_sums {
- /* gauges (inc/dec counters, current value) */
- wmsum_t tqs_threads_active; /* threads running a task */
- wmsum_t tqs_threads_idle; /* threads waiting for work */
- wmsum_t tqs_threads_total; /* total threads */
- wmsum_t tqs_tasks_pending; /* tasks waiting to execute */
- wmsum_t tqs_tasks_priority; /* hi-pri tasks waiting */
- wmsum_t tqs_tasks_total; /* total waiting tasks */
- wmsum_t tqs_tasks_delayed; /* tasks deferred to future */
- wmsum_t tqs_entries_free; /* task entries on free list */
-
- /* counters (inc only, since taskq creation) */
- wmsum_t tqs_threads_created; /* threads created */
- wmsum_t tqs_threads_destroyed; /* threads destroyed */
- wmsum_t tqs_tasks_dispatched; /* tasks dispatched */
- wmsum_t tqs_tasks_dispatched_delayed; /* tasks delayed to future */
- wmsum_t tqs_tasks_executed_normal; /* normal pri tasks executed */
- wmsum_t tqs_tasks_executed_priority; /* high pri tasks executed */
- wmsum_t tqs_tasks_executed; /* total tasks executed */
- wmsum_t tqs_tasks_delayed_requeued; /* delayed tasks requeued */
- wmsum_t tqs_tasks_cancelled; /* tasks cancelled before run */
- wmsum_t tqs_thread_wakeups; /* total thread wakeups */
- wmsum_t tqs_thread_wakeups_nowork; /* thread woken but no tasks */
- wmsum_t tqs_thread_sleeps; /* total thread sleeps */
-} taskq_sums_t;
-
-typedef struct taskq {
- spinlock_t tq_lock; /* protects taskq_t */
- char *tq_name; /* taskq name */
- int tq_instance; /* instance of tq_name */
- struct list_head tq_thread_list; /* list of all threads */
- struct list_head tq_active_list; /* list of active threads */
- int tq_nactive; /* # of active threads */
- int tq_nthreads; /* # of existing threads */
- int tq_nspawn; /* # of threads being spawned */
- int tq_maxthreads; /* # of threads maximum */
- /* If PERCPU flag is set, percent of NCPUs to have as threads */
- int tq_cpu_pct;
- int tq_pri; /* priority */
- int tq_minalloc; /* min taskq_ent_t pool size */
- int tq_maxalloc; /* max taskq_ent_t pool size */
- int tq_nalloc; /* cur taskq_ent_t pool size */
- uint_t tq_flags; /* flags */
- taskqid_t tq_next_id; /* next pend/work id */
- taskqid_t tq_lowest_id; /* lowest pend/work id */
- struct list_head tq_free_list; /* free taskq_ent_t's */
- struct list_head tq_pend_list; /* pending taskq_ent_t's */
- struct list_head tq_prio_list; /* priority taskq_ent_t's */
- struct list_head tq_delay_list; /* delayed taskq_ent_t's */
- struct list_head tq_taskqs; /* all taskq_t's */
- wait_queue_head_t tq_work_waitq; /* new work waitq */
- wait_queue_head_t tq_wait_waitq; /* wait waitq */
- tq_lock_role_t tq_lock_class; /* class when taking tq_lock */
- /* list node for the cpu hotplug callback */
- struct hlist_node tq_hp_cb_node;
- boolean_t tq_hp_support;
- unsigned long lastspawnstop; /* when to purge dynamic */
- taskq_sums_t tq_sums;
- kstat_t *tq_ksp;
-} taskq_t;
-
-typedef struct taskq_ent {
- spinlock_t tqent_lock;
- wait_queue_head_t tqent_waitq;
- struct timer_list tqent_timer;
- struct list_head tqent_list;
- taskqid_t tqent_id;
- task_func_t *tqent_func;
- void *tqent_arg;
- taskq_t *tqent_taskq;
- uintptr_t tqent_flags;
- unsigned long tqent_birth;
-} taskq_ent_t;
-
-#define TQENT_FLAG_PREALLOC 0x1
-#define TQENT_FLAG_CANCEL 0x2
-
-/* bits 2-3 are which list tqent is on */
-#define TQENT_LIST_NONE 0x0
-#define TQENT_LIST_PENDING 0x4
-#define TQENT_LIST_PRIORITY 0x8
-#define TQENT_LIST_DELAY 0xc
-#define TQENT_LIST_MASK 0xc
-
-typedef struct taskq_thread {
- struct list_head tqt_thread_list;
- struct list_head tqt_active_list;
- struct task_struct *tqt_thread;
- taskq_t *tqt_tq;
- taskqid_t tqt_id;
- taskq_ent_t *tqt_task;
- uintptr_t tqt_flags;
-} taskq_thread_t;
-
-/* Global system-wide dynamic task queue available for all consumers */
-extern taskq_t *system_taskq;
-/* Global dynamic task queue for long delay */
-extern taskq_t *system_delay_taskq;
-
-/* List of all taskqs */
-extern struct list_head tq_list;
-extern struct rw_semaphore tq_list_sem;
-
-extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
-extern taskqid_t taskq_dispatch_delay(taskq_t *, task_func_t, void *,
- uint_t, clock_t);
-extern void taskq_dispatch_ent(taskq_t *, task_func_t, void *, uint_t,
- taskq_ent_t *);
-extern int taskq_empty_ent(taskq_ent_t *);
-extern void taskq_init_ent(taskq_ent_t *);
-extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
-extern taskq_t *taskq_create_synced(const char *, int, pri_t, int, int, uint_t,
- kthread_t ***);
-extern void taskq_destroy(taskq_t *);
-extern void taskq_wait_id(taskq_t *, taskqid_t);
-extern void taskq_wait_outstanding(taskq_t *, taskqid_t);
-extern void taskq_wait(taskq_t *);
-extern int taskq_cancel_id(taskq_t *, taskqid_t);
-extern int taskq_member(taskq_t *, kthread_t *);
-extern taskq_t *taskq_of_curthread(void);
-
-#define taskq_create_proc(name, nthreads, pri, min, max, proc, flags) \
- taskq_create(name, nthreads, pri, min, max, flags)
-#define taskq_create_sysdc(name, nthreads, min, max, proc, dc, flags) \
- ((void) sizeof (dc), \
- taskq_create(name, nthreads, maxclsyspri, min, max, flags))
-
-int spl_taskq_init(void);
-void spl_taskq_fini(void);
-
-#endif /* _SPL_TASKQ_H */
diff --git a/include/os/linux/spl/sys/thread.h b/include/os/linux/spl/sys/thread.h
deleted file mode 100644
index 5f643d06245d..000000000000
--- a/include/os/linux/spl/sys/thread.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_THREAD_H
-#define _SPL_THREAD_H
-
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/spinlock.h>
-#include <linux/kthread.h>
-#include <sys/types.h>
-#include <sys/sysmacros.h>
-#include <sys/tsd.h>
-
-/*
- * Thread interfaces
- */
-#define TP_MAGIC 0x53535353
-
-#define TS_SLEEP TASK_INTERRUPTIBLE
-#define TS_RUN TASK_RUNNING
-#define TS_ZOMB EXIT_ZOMBIE
-#define TS_STOPPED TASK_STOPPED
-
-typedef void (*thread_func_t)(void *) __attribute__((noreturn));
-
-#define thread_create_named(name, stk, stksize, func, arg, len, \
- pp, state, pri) \
- __thread_create(stk, stksize, (thread_func_t)func, \
- name, arg, len, pp, state, pri)
-
-#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
- __thread_create(stk, stksize, (thread_func_t)func, #func, \
- arg, len, pp, state, pri)
-
-#define thread_exit() spl_thread_exit()
-#define thread_join(t) VERIFY(0)
-#define curthread current
-#define getcomm() current->comm
-#define getpid() current->pid
-
-extern kthread_t *__thread_create(caddr_t stk, size_t stksize,
- thread_func_t func, const char *name, void *args, size_t len, proc_t *pp,
- int state, pri_t pri);
-extern struct task_struct *spl_kthread_create(int (*func)(void *),
- void *data, const char namefmt[], ...);
-
-static inline __attribute__((noreturn)) void
-spl_thread_exit(void)
-{
- tsd_exit();
- SPL_KTHREAD_COMPLETE_AND_EXIT(NULL, 0);
-}
-
-extern proc_t p0;
-
-#ifdef HAVE_SIGINFO
-typedef kernel_siginfo_t spl_kernel_siginfo_t;
-#else
-typedef siginfo_t spl_kernel_siginfo_t;
-#endif
-
-#endif /* _SPL_THREAD_H */
diff --git a/include/os/linux/spl/sys/time.h b/include/os/linux/spl/sys/time.h
deleted file mode 100644
index 4edc42a8aef9..000000000000
--- a/include/os/linux/spl/sys/time.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_TIME_H
-#define _SPL_TIME_H
-
-#include <linux/module.h>
-#include <linux/time.h>
-#include <sys/types.h>
-#include <sys/timer.h>
-
-#if defined(CONFIG_64BIT)
-#define TIME_MAX INT64_MAX
-#define TIME_MIN INT64_MIN
-#else
-#define TIME_MAX INT32_MAX
-#define TIME_MIN INT32_MIN
-#endif
-
-#define SEC 1
-#define MILLISEC 1000
-#define MICROSEC 1000000
-#define NANOSEC 1000000000
-
-#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
-#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
-
-#define USEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MICROSEC))
-#define NSEC2USEC(n) ((n) / (NANOSEC / MICROSEC))
-
-#define NSEC2SEC(n) ((n) / (NANOSEC / SEC))
-#define SEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC))
-
-static const int hz = HZ;
-
-typedef longlong_t hrtime_t;
-typedef struct timespec timespec_t;
-
-#define TIMESPEC_OVERFLOW(ts) \
- ((ts)->tv_sec < TIME_MIN || (ts)->tv_sec > TIME_MAX)
-
-typedef struct timespec64 inode_timespec_t;
-
-/* Include for Lustre compatibility */
-#define timestruc_t inode_timespec_t
-
-static inline void
-gethrestime(inode_timespec_t *ts)
-{
- ktime_get_coarse_real_ts64(ts);
-}
-
-static inline uint64_t
-gethrestime_sec(void)
-{
- inode_timespec_t ts;
- ktime_get_coarse_real_ts64(&ts);
- return (ts.tv_sec);
-}
-
-static inline hrtime_t
-getlrtime(void)
-{
- inode_timespec_t ts;
- ktime_get_coarse_ts64(&ts);
- return (((hrtime_t)ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec);
-}
-
-static inline hrtime_t
-gethrtime(void)
-{
- struct timespec64 ts;
- ktime_get_raw_ts64(&ts);
- return (((hrtime_t)ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec);
-}
-
-#endif /* _SPL_TIME_H */
diff --git a/include/os/linux/spl/sys/timer.h b/include/os/linux/spl/sys/timer.h
deleted file mode 100644
index f16f99a8e953..000000000000
--- a/include/os/linux/spl/sys/timer.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_TIMER_H
-#define _SPL_TIMER_H
-
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/sched.h>
-#include <linux/time.h>
-#include <linux/timer.h>
-
-#define lbolt ((clock_t)jiffies)
-#define lbolt64 ((int64_t)get_jiffies_64())
-
-#define ddi_get_lbolt() ((clock_t)jiffies)
-#define ddi_get_lbolt64() ((int64_t)get_jiffies_64())
-
-#define ddi_time_before(a, b) (typecheck(clock_t, a) && \
- typecheck(clock_t, b) && \
- ((a) - (b) < 0))
-#define ddi_time_after(a, b) ddi_time_before(b, a)
-#define ddi_time_before_eq(a, b) (!ddi_time_after(a, b))
-#define ddi_time_after_eq(a, b) ddi_time_before_eq(b, a)
-
-#define ddi_time_before64(a, b) (typecheck(int64_t, a) && \
- typecheck(int64_t, b) && \
- ((a) - (b) < 0))
-#define ddi_time_after64(a, b) ddi_time_before64(b, a)
-#define ddi_time_before_eq64(a, b) (!ddi_time_after64(a, b))
-#define ddi_time_after_eq64(a, b) ddi_time_before_eq64(b, a)
-
-#define delay(ticks) schedule_timeout_uninterruptible(ticks)
-
-#define SEC_TO_TICK(sec) ((sec) * HZ)
-#define MSEC_TO_TICK(ms) msecs_to_jiffies(ms)
-#define USEC_TO_TICK(us) usecs_to_jiffies(us)
-#define NSEC_TO_TICK(ns) usecs_to_jiffies(ns / NSEC_PER_USEC)
-
-#ifndef from_timer
-#define from_timer(var, timer, timer_field) \
- container_of(timer, typeof(*var), timer_field)
-#endif
-
-#endif /* _SPL_TIMER_H */
diff --git a/include/os/linux/spl/sys/trace.h b/include/os/linux/spl/sys/trace.h
deleted file mode 100644
index d6853a89c3c8..000000000000
--- a/include/os/linux/spl/sys/trace.h
+++ /dev/null
@@ -1,176 +0,0 @@
-// SPDX-License-Identifier: CDDL-1.0
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or https://opensource.org/licenses/CDDL-1.0.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-#if defined(_KERNEL)
-
-/*
- * Calls to DTRACE_PROBE* are mapped to standard Linux kernel trace points
- * when they are available(when HAVE_DECLARE_EVENT_CLASS is defined). The
- * tracepoint event class definitions are found in the general tracing
- * header file: include/sys/trace_*.h. See include/sys/trace_vdev.h for
- * a good example.
- *
- * If tracepoints are not available, stub functions are generated which can
- * be traced using kprobes. In this case, the DEFINE_DTRACE_PROBE* macros
- * are used to provide the stub functions and also the prototypes for
- * those functions. The mechanism to do this relies on DEFINE_DTRACE_PROBE
- * macros defined in the general tracing headers(see trace_vdev.h) and
- * CREATE_TRACE_POINTS being defined only in module/zfs/trace.c. When ZFS
- * source files include the general tracing headers, e.g.
- * module/zfs/vdev_removal.c including trace_vdev.h, DTRACE_PROBE calls
- * are mapped to stub functions calls and prototypes for those calls are
- * declared via DEFINE_DTRACE_PROBE*. Only module/zfs/trace.c defines
- * CREATE_TRACE_POINTS. That is followed by includes of all the general
- * tracing headers thereby defining all stub functions in one place via
- * the DEFINE_DTRACE_PROBE macros.
- *
- * When adding new DTRACE_PROBEs to zfs source, both a tracepoint event
- * class definition and a DEFINE_DTRACE_PROBE definition are needed to
- * avoid undefined function errors.
- */
-
-#if defined(HAVE_DECLARE_EVENT_CLASS)
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM zfs
-
-#if !defined(_TRACE_ZFS_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_ZFS_H
-
-#include <linux/tracepoint.h>
-#include <sys/types.h>
-
-/*
- * DTRACE_PROBE with 0 arguments is not currently available with
- * tracepoint events
- */
-#define DTRACE_PROBE(name) \
- ((void)0)
-
-#define DTRACE_PROBE1(name, t1, arg1) \
- trace_zfs_##name((arg1))
-
-#define DTRACE_PROBE2(name, t1, arg1, t2, arg2) \
- trace_zfs_##name((arg1), (arg2))
-
-#define DTRACE_PROBE3(name, t1, arg1, t2, arg2, t3, arg3) \
- trace_zfs_##name((arg1), (arg2), (arg3))
-
-#define DTRACE_PROBE4(name, t1, arg1, t2, arg2, t3, arg3, t4, arg4) \
- trace_zfs_##name((arg1), (arg2), (arg3), (arg4))
-
-#endif /* _TRACE_ZFS_H */
-
-#undef TRACE_INCLUDE_PATH
-#undef TRACE_INCLUDE_FILE
-#define TRACE_INCLUDE_PATH sys
-#define TRACE_INCLUDE_FILE trace
-#include <trace/define_trace.h>
-
-#else /* HAVE_DECLARE_EVENT_CLASS */
-
-#define DTRACE_PROBE(name) \
- trace_zfs_##name()
-
-#define DTRACE_PROBE1(name, t1, arg1) \
- trace_zfs_##name((uintptr_t)(arg1))
-
-#define DTRACE_PROBE2(name, t1, arg1, t2, arg2) \
- trace_zfs_##name((uintptr_t)(arg1), (uintptr_t)(arg2))
-
-#define DTRACE_PROBE3(name, t1, arg1, t2, arg2, t3, arg3) \
- trace_zfs_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \
- (uintptr_t)(arg3))
-
-#define DTRACE_PROBE4(name, t1, arg1, t2, arg2, t3, arg3, t4, arg4) \
- trace_zfs_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \
- (uintptr_t)(arg3), (uintptr_t)(arg4))
-
-#define PROTO_DTRACE_PROBE(name) \
- noinline void trace_zfs_##name(void)
-#define PROTO_DTRACE_PROBE1(name) \
- noinline void trace_zfs_##name(uintptr_t)
-#define PROTO_DTRACE_PROBE2(name) \
- noinline void trace_zfs_##name(uintptr_t, uintptr_t)
-#define PROTO_DTRACE_PROBE3(name) \
- noinline void trace_zfs_##name(uintptr_t, uintptr_t, \
- uintptr_t)
-#define PROTO_DTRACE_PROBE4(name) \
- noinline void trace_zfs_##name(uintptr_t, uintptr_t, \
- uintptr_t, uintptr_t)
-
-#if defined(CREATE_TRACE_POINTS)
-
-#define FUNC_DTRACE_PROBE(name) \
-PROTO_DTRACE_PROBE(name); \
-noinline void trace_zfs_##name(void) { } \
-EXPORT_SYMBOL(trace_zfs_##name)
-
-#define FUNC_DTRACE_PROBE1(name) \
-PROTO_DTRACE_PROBE1(name); \
-noinline void trace_zfs_##name(uintptr_t arg1) { } \
-EXPORT_SYMBOL(trace_zfs_##name)
-
-#define FUNC_DTRACE_PROBE2(name) \
-PROTO_DTRACE_PROBE2(name); \
-noinline void trace_zfs_##name(uintptr_t arg1, \
- uintptr_t arg2) { } \
-EXPORT_SYMBOL(trace_zfs_##name)
-
-#define FUNC_DTRACE_PROBE3(name) \
-PROTO_DTRACE_PROBE3(name); \
-noinline void trace_zfs_##name(uintptr_t arg1, \
- uintptr_t arg2, uintptr_t arg3) { } \
-EXPORT_SYMBOL(trace_zfs_##name)
-
-#define FUNC_DTRACE_PROBE4(name) \
-PROTO_DTRACE_PROBE4(name); \
-noinline void trace_zfs_##name(uintptr_t arg1, \
- uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) { } \
-EXPORT_SYMBOL(trace_zfs_##name)
-
-#undef DEFINE_DTRACE_PROBE
-#define DEFINE_DTRACE_PROBE(name) FUNC_DTRACE_PROBE(name)
-
-#undef DEFINE_DTRACE_PROBE1
-#define DEFINE_DTRACE_PROBE1(name) FUNC_DTRACE_PROBE1(name)
-
-#undef DEFINE_DTRACE_PROBE2
-#define DEFINE_DTRACE_PROBE2(name) FUNC_DTRACE_PROBE2(name)
-
-#undef DEFINE_DTRACE_PROBE3
-#define DEFINE_DTRACE_PROBE3(name) FUNC_DTRACE_PROBE3(name)
-
-#undef DEFINE_DTRACE_PROBE4
-#define DEFINE_DTRACE_PROBE4(name) FUNC_DTRACE_PROBE4(name)
-
-#else /* CREATE_TRACE_POINTS */
-
-#define DEFINE_DTRACE_PROBE(name) PROTO_DTRACE_PROBE(name)
-#define DEFINE_DTRACE_PROBE1(name) PROTO_DTRACE_PROBE1(name)
-#define DEFINE_DTRACE_PROBE2(name) PROTO_DTRACE_PROBE2(name)
-#define DEFINE_DTRACE_PROBE3(name) PROTO_DTRACE_PROBE3(name)
-#define DEFINE_DTRACE_PROBE4(name) PROTO_DTRACE_PROBE4(name)
-
-#endif /* CREATE_TRACE_POINTS */
-#endif /* HAVE_DECLARE_EVENT_CLASS */
-#endif /* _KERNEL */
diff --git a/include/os/linux/spl/sys/trace_spl.h b/include/os/linux/spl/sys/trace_spl.h
deleted file mode 100644
index ccdb1f86e652..000000000000
--- a/include/os/linux/spl/sys/trace_spl.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: CDDL-1.0
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or https://opensource.org/licenses/CDDL-1.0.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-#ifndef _OS_LINUX_SPL_TRACE_H
-#define _OS_LINUX_SPL_TRACE_H
-
-#include <sys/taskq.h>
-
-#include <sys/trace.h>
-#include <sys/trace_taskq.h>
-
-#endif
diff --git a/include/os/linux/spl/sys/trace_taskq.h b/include/os/linux/spl/sys/trace_taskq.h
deleted file mode 100644
index 7d1d64927163..000000000000
--- a/include/os/linux/spl/sys/trace_taskq.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// SPDX-License-Identifier: CDDL-1.0
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or https://opensource.org/licenses/CDDL-1.0.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-#if defined(_KERNEL)
-#if defined(HAVE_DECLARE_EVENT_CLASS)
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM zfs
-
-#undef TRACE_SYSTEM_VAR
-#define TRACE_SYSTEM_VAR zfs_taskq
-
-#if !defined(_TRACE_TASKQ_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_TASKQ_H
-
-#include <linux/tracepoint.h>
-#include <sys/types.h>
-
-/*
- * Generic support for single argument tracepoints of the form:
- *
- * DTRACE_PROBE1(...,
- * taskq_ent_t *, ...);
- */
-DECLARE_EVENT_CLASS(zfs_taskq_ent_class,
- TP_PROTO(taskq_ent_t *taskq_ent),
- TP_ARGS(taskq_ent),
- TP_STRUCT__entry(__field(taskq_ent_t *, taskq_ent)),
- TP_fast_assign(
- __entry->taskq_ent = taskq_ent;
-),
- TP_printk("taskq_ent %p", __entry->taskq_ent)
-);
-
-#define DEFINE_TASKQ_EVENT(name) \
-DEFINE_EVENT(zfs_taskq_ent_class, name, \
- TP_PROTO(taskq_ent_t *taskq_ent), \
- TP_ARGS(taskq_ent))
-DEFINE_TASKQ_EVENT(zfs_taskq_ent__birth);
-DEFINE_TASKQ_EVENT(zfs_taskq_ent__start);
-DEFINE_TASKQ_EVENT(zfs_taskq_ent__finish);
-
-#endif /* _TRACE_TASKQ_H */
-
-#undef TRACE_INCLUDE_PATH
-#undef TRACE_INCLUDE_FILE
-#define TRACE_INCLUDE_PATH sys
-#define TRACE_INCLUDE_FILE trace_taskq
-#include <trace/define_trace.h>
-
-#else
-
-/*
- * When tracepoints are not available, a DEFINE_DTRACE_PROBE* macro is
- * needed for each DTRACE_PROBE. These will be used to generate stub
- * tracing functions and prototypes for those functions. See
- * include/os/linux/spl/sys/trace.h.
- */
-
-DEFINE_DTRACE_PROBE1(taskq_ent__birth);
-DEFINE_DTRACE_PROBE1(taskq_ent__start);
-DEFINE_DTRACE_PROBE1(taskq_ent__finish);
-
-#endif /* HAVE_DECLARE_EVENT_CLASS */
-#endif /* _KERNEL */
diff --git a/include/os/linux/spl/sys/tsd.h b/include/os/linux/spl/sys/tsd.h
deleted file mode 100644
index 8358da684261..000000000000
--- a/include/os/linux/spl/sys/tsd.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2010 Lawrence Livermore National Security, LLC.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_TSD_H
-#define _SPL_TSD_H
-
-#include <sys/types.h>
-
-#define TSD_HASH_TABLE_BITS_DEFAULT 9
-#define TSD_KEYS_MAX 32768
-#define DTOR_PID (PID_MAX_LIMIT+1)
-#define PID_KEY (TSD_KEYS_MAX+1)
-
-typedef void (*dtor_func_t)(void *);
-
-extern int tsd_set(uint_t, void *);
-extern void *tsd_get(uint_t);
-extern void *tsd_get_by_thread(uint_t, kthread_t *);
-extern void tsd_create(uint_t *, dtor_func_t);
-extern void tsd_destroy(uint_t *);
-extern void tsd_exit(void);
-
-int spl_tsd_init(void);
-void spl_tsd_fini(void);
-
-#endif /* _SPL_TSD_H */
diff --git a/include/os/linux/spl/sys/types.h b/include/os/linux/spl/sys/types.h
deleted file mode 100644
index f0133394ed0b..000000000000
--- a/include/os/linux/spl/sys/types.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_TYPES_H
-#define _SPL_TYPES_H
-
-#include <linux/types.h>
-
-typedef enum {
- B_FALSE = 0,
- B_TRUE = 1
-} boolean_t;
-
-typedef unsigned char uchar_t;
-typedef unsigned short ushort_t;
-typedef unsigned int uint_t;
-typedef unsigned long ulong_t;
-typedef unsigned long long u_longlong_t;
-typedef long long longlong_t;
-
-#ifndef HAVE_KERNEL_INTPTR_T
-typedef long intptr_t;
-#endif
-typedef unsigned long long rlim64_t;
-
-typedef struct task_struct kthread_t;
-typedef struct task_struct proc_t;
-
-typedef int id_t;
-typedef short pri_t;
-typedef short index_t;
-typedef longlong_t offset_t;
-typedef u_longlong_t u_offset_t;
-typedef ulong_t pgcnt_t;
-
-typedef int major_t;
-typedef int minor_t;
-
-struct user_namespace;
-#ifdef HAVE_IOPS_CREATE_IDMAP
-#include <linux/refcount.h>
-#ifdef HAVE_IDMAP_NO_USERNS
-#include <linux/user_namespace.h>
-struct mnt_idmap {
- struct uid_gid_map uid_map;
- struct uid_gid_map gid_map;
- refcount_t count;
-};
-typedef struct mnt_idmap zidmap_t;
-#define idmap_owner(p) (NULL)
-#else
-struct mnt_idmap {
- struct user_namespace *owner;
- refcount_t count;
-};
-typedef struct mnt_idmap zidmap_t;
-#define idmap_owner(p) (((struct mnt_idmap *)p)->owner)
-#endif
-#else
-typedef struct user_namespace zidmap_t;
-#define idmap_owner(p) ((struct user_namespace *)p)
-#endif
-
-extern zidmap_t *zfs_init_idmap;
-
-#ifdef HAVE_1ARG_ASSIGN_STR
-#define __assign_str_impl(a, b) __assign_str(a)
-#else
-#define __assign_str_impl(a, b) __assign_str(a, b)
-#endif
-
-#endif /* _SPL_TYPES_H */
diff --git a/include/os/linux/spl/sys/types32.h b/include/os/linux/spl/sys/types32.h
deleted file mode 100644
index c83813623170..000000000000
--- a/include/os/linux/spl/sys/types32.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_TYPES32_H
-#define _SPL_TYPES32_H
-
-#include <sys/types.h>
-
-typedef uint32_t caddr32_t;
-typedef int32_t daddr32_t;
-typedef int32_t time32_t;
-typedef uint32_t size32_t;
-
-#endif /* _SPL_TYPES32_H */
diff --git a/include/os/linux/spl/sys/uio.h b/include/os/linux/spl/sys/uio.h
deleted file mode 100644
index 26c2c387caa3..000000000000
--- a/include/os/linux/spl/sys/uio.h
+++ /dev/null
@@ -1,213 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Copyright (c) 2015 by Chunwei Chen. All rights reserved.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_UIO_H
-#define _SPL_UIO_H
-
-#include <sys/debug.h>
-#include <linux/uio.h>
-#include <linux/blkdev.h>
-#include <linux/blkdev_compat.h>
-#include <linux/mm.h>
-#include <linux/bio.h>
-#include <asm/uaccess.h>
-#include <sys/types.h>
-#include <sys/string.h>
-
-/*
- * uio_extflg: extended flags
- */
-#define UIO_DIRECT 0x0001 /* Direct I/O request */
-
-#if defined(HAVE_FAULT_IN_IOV_ITER_READABLE)
-#define iov_iter_fault_in_readable(a, b) fault_in_iov_iter_readable(a, b)
-#endif
-
-typedef struct iovec iovec_t;
-
-typedef enum zfs_uio_rw {
- UIO_READ = 0,
- UIO_WRITE = 1,
-} zfs_uio_rw_t;
-
-typedef enum zfs_uio_seg {
- UIO_SYSSPACE = 0,
- UIO_BVEC = 1,
- UIO_ITER = 2,
-} zfs_uio_seg_t;
-
-/*
- * This structures is used when doing Direct I/O.
- */
-typedef struct {
- struct page **pages; /* Mapped pages */
- long npages; /* Number of mapped pages */
- boolean_t pinned; /* Whether FOLL_PIN was used */
-} zfs_uio_dio_t;
-
-typedef struct zfs_uio {
- union {
- const struct iovec *uio_iov;
- const struct bio_vec *uio_bvec;
- struct iov_iter *uio_iter;
- };
- int uio_iovcnt; /* Number of iovecs */
- offset_t uio_soffset; /* Starting logical offset */
- offset_t uio_loffset; /* Current logical offset */
- zfs_uio_seg_t uio_segflg; /* Segment type */
- boolean_t uio_fault_disable;
- uint16_t uio_fmode; /* Access mode (unused) */
- uint16_t uio_extflg; /* Extra flags (UIO_DIRECT) */
- ssize_t uio_resid; /* Residual unprocessed bytes */
- size_t uio_skip; /* Skipped bytes in current iovec */
- zfs_uio_dio_t uio_dio; /* Direct I/O user pages */
-
- struct request *rq;
-} zfs_uio_t;
-
-
-#define zfs_uio_segflg(u) (u)->uio_segflg
-#define zfs_uio_offset(u) (u)->uio_loffset
-#define zfs_uio_resid(u) (u)->uio_resid
-#define zfs_uio_iovcnt(u) (u)->uio_iovcnt
-#define zfs_uio_iovlen(u, idx) (u)->uio_iov[(idx)].iov_len
-#define zfs_uio_iovbase(u, idx) (u)->uio_iov[(idx)].iov_base
-#define zfs_uio_fault_disable(u, set) (u)->uio_fault_disable = set
-#define zfs_uio_soffset(u) (u)->uio_soffset
-#define zfs_uio_rlimit_fsize(z, u) (0)
-#define zfs_uio_fault_move(p, n, rw, u) zfs_uiomove((p), (n), (rw), (u))
-
-extern int zfs_uio_prefaultpages(ssize_t, zfs_uio_t *);
-
-static inline void
-zfs_uio_setoffset(zfs_uio_t *uio, offset_t off)
-{
- uio->uio_loffset = off;
-}
-
-static inline void
-zfs_uio_setsoffset(zfs_uio_t *uio, offset_t off)
-{
- ASSERT3U(zfs_uio_offset(uio), ==, off);
- zfs_uio_soffset(uio) = off;
-}
-
-static inline void
-zfs_uio_advance(zfs_uio_t *uio, ssize_t size)
-{
- uio->uio_resid -= size;
- uio->uio_loffset += size;
-}
-
-static inline void
-zfs_uio_iovec_init(zfs_uio_t *uio, const struct iovec *iov,
- unsigned long nr_segs, offset_t offset, zfs_uio_seg_t seg, ssize_t resid,
- size_t skip)
-{
- ASSERT(seg == UIO_SYSSPACE);
-
- uio->uio_iov = iov;
- uio->uio_iovcnt = nr_segs;
- uio->uio_loffset = offset;
- uio->uio_segflg = seg;
- uio->uio_fault_disable = B_FALSE;
- uio->uio_fmode = 0;
- uio->uio_extflg = 0;
- uio->uio_resid = resid;
- uio->uio_skip = skip;
- uio->uio_soffset = uio->uio_loffset;
- memset(&uio->uio_dio, 0, sizeof (zfs_uio_dio_t));
-}
-
-static inline void
-zfs_uio_bvec_init(zfs_uio_t *uio, struct bio *bio, struct request *rq)
-{
- /* Either bio or rq will be set, but not both */
- ASSERT3P(uio, !=, bio);
-
- if (bio) {
- uio->uio_iovcnt = bio->bi_vcnt - BIO_BI_IDX(bio);
- uio->uio_bvec = &bio->bi_io_vec[BIO_BI_IDX(bio)];
- } else {
- uio->uio_bvec = NULL;
- uio->uio_iovcnt = 0;
- }
-
- uio->uio_loffset = io_offset(bio, rq);
- uio->uio_segflg = UIO_BVEC;
- uio->uio_fault_disable = B_FALSE;
- uio->uio_fmode = 0;
- uio->uio_extflg = 0;
- uio->uio_resid = io_size(bio, rq);
- if (bio) {
- uio->uio_skip = BIO_BI_SKIP(bio);
- } else {
- uio->uio_skip = 0;
- }
-
- uio->rq = rq;
- uio->uio_soffset = uio->uio_loffset;
- memset(&uio->uio_dio, 0, sizeof (zfs_uio_dio_t));
-}
-
-static inline void
-zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
- ssize_t resid)
-{
- uio->uio_iter = iter;
- uio->uio_iovcnt = iter->nr_segs;
- uio->uio_loffset = offset;
- uio->uio_segflg = UIO_ITER;
- uio->uio_fault_disable = B_FALSE;
- uio->uio_fmode = 0;
- uio->uio_extflg = 0;
- uio->uio_resid = resid;
- uio->uio_skip = 0;
- uio->uio_soffset = uio->uio_loffset;
- memset(&uio->uio_dio, 0, sizeof (zfs_uio_dio_t));
-}
-
-#if defined(HAVE_ITER_IOV)
-#define zfs_uio_iter_iov(iter) iter_iov((iter))
-#else
-#define zfs_uio_iter_iov(iter) (iter)->iov
-#endif
-
-#if defined(HAVE_IOV_ITER_TYPE)
-#define zfs_uio_iov_iter_type(iter) iov_iter_type((iter))
-#else
-#define zfs_uio_iov_iter_type(iter) (iter)->type
-#endif
-
-#if defined(HAVE_ITER_IS_UBUF)
-#define zfs_user_backed_iov_iter(iter) \
- (iter_is_ubuf((iter)) || \
- (zfs_uio_iov_iter_type((iter)) == ITER_IOVEC))
-#else
-#define zfs_user_backed_iov_iter(iter) \
- (zfs_uio_iov_iter_type((iter)) == ITER_IOVEC)
-#endif
-
-#endif /* SPL_UIO_H */
diff --git a/include/os/linux/spl/sys/user.h b/include/os/linux/spl/sys/user.h
deleted file mode 100644
index 8d048b368b32..000000000000
--- a/include/os/linux/spl/sys/user.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2015 Cluster Inc.
- * Produced at ClusterHQ Inc (cf, DISCLAIMER).
- * Written by Richard Yao <richard.yao@clusterhq.com>.
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_USER_H
-#define _SPL_USER_H
-
-/*
- * We have uf_info_t for areleasef(). We implement areleasef() using a global
- * linked list of all open file descriptors with the task structs referenced,
- * so accessing the correct descriptor from areleasef() only requires knowing
- * about the Linux task_struct. Since this is internal to our compatibility
- * layer, we make it an opaque type.
- *
- * XXX: If the descriptor changes under us and we do not do a getf() between
- * the change and using it, we would get an incorrect reference.
- */
-
-struct uf_info;
-typedef struct uf_info uf_info_t;
-
-#define P_FINFO(x) ((uf_info_t *)x)
-
-#endif /* SPL_USER_H */
diff --git a/include/os/linux/spl/sys/vfs.h b/include/os/linux/spl/sys/vfs.h
deleted file mode 100644
index b8dc1fc05456..000000000000
--- a/include/os/linux/spl/sys/vfs.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_ZFS_H
-#define _SPL_ZFS_H
-
-#include <linux/mount.h>
-#include <linux/fs.h>
-#include <linux/dcache.h>
-#include <linux/statfs.h>
-#include <linux/xattr.h>
-#include <linux/security.h>
-#include <linux/seq_file.h>
-
-#define MAXFIDSZ 64
-
-typedef struct spl_fid {
- union {
- long fid_pad;
- struct {
- ushort_t len; /* length of data in bytes */
- char data[MAXFIDSZ]; /* data (variable len) */
- } _fid;
- } un;
-} fid_t;
-
-#define fid_len un._fid.len
-#define fid_data un._fid.data
-
-#endif /* SPL_ZFS_H */
diff --git a/include/os/linux/spl/sys/vmem.h b/include/os/linux/spl/sys/vmem.h
deleted file mode 100644
index c96a65bad39a..000000000000
--- a/include/os/linux/spl/sys/vmem.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_VMEM_H
-#define _SPL_VMEM_H
-
-#include <sys/kmem.h>
-#include <linux/sched.h>
-#include <linux/vmalloc.h>
-
-typedef struct vmem { } vmem_t;
-
-/*
- * Memory allocation interfaces
- */
-#define VMEM_ALLOC 0x01
-#define VMEM_FREE 0x02
-
-#ifndef VMALLOC_TOTAL
-#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
-#endif
-
-/*
- * vmem_* is an interface to a low level arena-based memory allocator on
- * Illumos that is used to allocate virtual address space. The kmem SLAB
- * allocator allocates slabs from it. Then the generic allocation functions
- * kmem_{alloc,zalloc,free}() are layered on top of SLAB allocators.
- *
- * On Linux, the primary means of doing allocations is via kmalloc(), which
- * is similarly layered on top of something called the buddy allocator. The
- * buddy allocator is not available to kernel modules, it uses physical
- * memory addresses rather than virtual memory addresses and is prone to
- * fragmentation.
- *
- * Linux sets aside a relatively small address space for in-kernel virtual
- * memory from which allocations can be done using vmalloc(). It might seem
- * like a good idea to use vmalloc() to implement something similar to
- * Illumos' allocator. However, this has the following problems:
- *
- * 1. Page directory table allocations are hard coded to use GFP_KERNEL.
- * Consequently, any KM_PUSHPAGE or KM_NOSLEEP allocations done using
- * vmalloc() will not have proper semantics.
- *
- * 2. Address space exhaustion is a real issue on 32-bit platforms where
- * only a few 100MB are available. The kernel will handle it by spinning
- * when it runs out of address space.
- *
- * 3. All vmalloc() allocations and frees are protected by a single global
- * lock which serializes all allocations.
- *
- * 4. Accessing /proc/meminfo and /proc/vmallocinfo will iterate the entire
- * list. The former will sum the allocations while the latter will print
- * them to user space in a way that user space can keep the lock held
- * indefinitely. When the total number of mapped allocations is large
- * (several 100,000) a large amount of time will be spent waiting on locks.
- *
- * 5. Linux has a wait_on_bit() locking primitive that assumes physical
- * memory is used, it simply does not work on virtual memory. Certain
- * Linux structures (e.g. the superblock) use them and might be embedded
- * into a structure from Illumos. This makes using Linux virtual memory
- * unsafe in certain situations.
- *
- * It follows that we cannot obtain identical semantics to those on Illumos.
- * Consequently, we implement the kmem_{alloc,zalloc,free}() functions in
- * such a way that they can be used as drop-in replacements for small vmem_*
- * allocations (8MB in size or smaller) and map vmem_{alloc,zalloc,free}()
- * to them.
- */
-
-#define vmem_alloc(sz, fl) spl_vmem_alloc((sz), (fl), __func__, __LINE__)
-#define vmem_zalloc(sz, fl) spl_vmem_zalloc((sz), (fl), __func__, __LINE__)
-#define vmem_free(ptr, sz) spl_vmem_free((ptr), (sz))
-
-extern void *spl_vmem_alloc(size_t sz, int fl, const char *func, int line)
- __attribute__((malloc, alloc_size(1)));
-extern void *spl_vmem_zalloc(size_t sz, int fl, const char *func, int line)
- __attribute__((malloc, alloc_size(1)));
-extern void spl_vmem_free(const void *ptr, size_t sz);
-
-int spl_vmem_init(void);
-void spl_vmem_fini(void);
-
-#endif /* _SPL_VMEM_H */
diff --git a/include/os/linux/spl/sys/vmsystm.h b/include/os/linux/spl/sys/vmsystm.h
deleted file mode 100644
index 1404a20b52cf..000000000000
--- a/include/os/linux/spl/sys/vmsystm.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_VMSYSTM_H
-#define _SPL_VMSYSTM_H
-
-#include <linux/mmzone.h>
-#include <linux/mm.h>
-#include <linux/swap.h>
-#include <linux/highmem.h>
-#include <linux/vmalloc.h>
-#include <sys/types.h>
-#include <asm/uaccess.h>
-
-#ifdef HAVE_TOTALRAM_PAGES_FUNC
-#define zfs_totalram_pages totalram_pages()
-#else
-#define zfs_totalram_pages totalram_pages
-#endif
-
-#ifdef HAVE_TOTALHIGH_PAGES
-#define zfs_totalhigh_pages totalhigh_pages()
-#else
-#define zfs_totalhigh_pages totalhigh_pages
-#endif
-
-#define membar_consumer() smp_rmb()
-#define membar_producer() smp_wmb()
-#define membar_sync() smp_mb()
-
-#define physmem zfs_totalram_pages
-
-#define xcopyin(from, to, size) copy_from_user(to, from, size)
-#define xcopyout(from, to, size) copy_to_user(to, from, size)
-
-static __inline__ int
-copyin(const void *from, void *to, size_t len)
-{
- /* On error copyin routine returns -1 */
- if (xcopyin(from, to, len))
- return (-1);
-
- return (0);
-}
-
-static __inline__ int
-copyout(const void *from, void *to, size_t len)
-{
- /* On error copyout routine returns -1 */
- if (xcopyout(from, to, len))
- return (-1);
-
- return (0);
-}
-
-static __inline__ int
-copyinstr(const void *from, void *to, size_t len, size_t *done)
-{
- size_t rc;
-
- if (len == 0)
- return (-ENAMETOOLONG);
-
- /* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */
-
- memset(to, 0, len);
- rc = copyin(from, to, len - 1);
- if (done != NULL)
- *done = rc;
-
- return (0);
-}
-
-#endif /* SPL_VMSYSTM_H */
diff --git a/include/os/linux/spl/sys/vnode.h b/include/os/linux/spl/sys/vnode.h
deleted file mode 100644
index c48c4a9c0912..000000000000
--- a/include/os/linux/spl/sys/vnode.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_VNODE_H
-#define _SPL_VNODE_H
-
-#include <linux/module.h>
-#include <linux/syscalls.h>
-#include <linux/fcntl.h>
-#include <linux/buffer_head.h>
-#include <linux/dcache.h>
-#include <linux/namei.h>
-#include <linux/file.h>
-#include <linux/fs.h>
-#include <linux/fs_struct.h>
-#include <linux/mount.h>
-#include <sys/kmem.h>
-#include <sys/mutex.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <sys/user.h>
-
-/*
- * Prior to linux-2.6.33 only O_DSYNC semantics were implemented and
- * they used the O_SYNC flag. As of linux-2.6.33 the this behavior
- * was properly split in to O_SYNC and O_DSYNC respectively.
- */
-#ifndef O_DSYNC
-#define O_DSYNC O_SYNC
-#endif
-
-#define F_FREESP 11 /* Free file space */
-
-
-#if defined(SEEK_HOLE) && defined(SEEK_DATA)
-#define F_SEEK_DATA SEEK_DATA
-#define F_SEEK_HOLE SEEK_HOLE
-#endif
-
-/*
- * The vnode AT_ flags are mapped to the Linux ATTR_* flags.
- * This allows them to be used safely with an iattr structure.
- * The AT_XVATTR flag has been added and mapped to the upper
- * bit range to avoid conflicting with the standard Linux set.
- */
-#undef AT_UID
-#undef AT_GID
-
-#define AT_MODE ATTR_MODE
-#define AT_UID ATTR_UID
-#define AT_GID ATTR_GID
-#define AT_SIZE ATTR_SIZE
-#define AT_ATIME ATTR_ATIME
-#define AT_MTIME ATTR_MTIME
-#define AT_CTIME ATTR_CTIME
-
-#define ATTR_XVATTR (1U << 31)
-#define AT_XVATTR ATTR_XVATTR
-
-#define ATTR_IATTR_MASK (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE | \
- ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_FILE)
-
-#define CRCREAT 0x01
-#define RMFILE 0x02
-
-#define B_INVAL 0x01
-#define B_TRUNC 0x02
-
-#define LOOKUP_DIR 0x01
-#define LOOKUP_XATTR 0x02
-#define CREATE_XATTR_DIR 0x04
-#define ATTR_NOACLCHECK 0x20
-
-typedef struct vattr {
- uint32_t va_mask; /* attribute bit-mask */
- ushort_t va_mode; /* acc mode */
- uid_t va_uid; /* owner uid */
- gid_t va_gid; /* owner gid */
- long va_fsid; /* fs id */
- long va_nodeid; /* node # */
- uint32_t va_nlink; /* # links */
- uint64_t va_size; /* file size */
- inode_timespec_t va_atime; /* last acc */
- inode_timespec_t va_mtime; /* last mod */
- inode_timespec_t va_ctime; /* last chg */
- dev_t va_rdev; /* dev */
- uint64_t va_nblocks; /* space used */
- uint32_t va_blksize; /* block size */
- struct dentry *va_dentry; /* dentry to wire */
-} vattr_t;
-#endif /* SPL_VNODE_H */
diff --git a/include/os/linux/spl/sys/wait.h b/include/os/linux/spl/sys/wait.h
deleted file mode 100644
index 97a75fdf46ad..000000000000
--- a/include/os/linux/spl/sys/wait.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2014 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_WAIT_H
-#define _SPL_WAIT_H
-
-#include <linux/sched.h>
-#include <linux/wait.h>
-
-#endif /* SPL_WAIT_H */
diff --git a/include/os/linux/spl/sys/wmsum.h b/include/os/linux/spl/sys/wmsum.h
deleted file mode 100644
index 5e35c976b786..000000000000
--- a/include/os/linux/spl/sys/wmsum.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// SPDX-License-Identifier: CDDL-1.0
-/*
- * CDDL HEADER START
- *
- * This file and its contents are supplied under the terms of the
- * Common Development and Distribution License ("CDDL"), version 1.0.
- * You may only use this file in accordance with the terms of version
- * 1.0 of the CDDL.
- *
- * A full copy of the text of the CDDL should have accompanied this
- * source. A copy of the CDDL is also available via the Internet at
- * http://www.illumos.org/license/CDDL.
- *
- * CDDL HEADER END
- */
-
-/*
- * wmsum counters are a reduced version of aggsum counters, optimized for
- * write-mostly scenarios. They do not provide optimized read functions,
- * but instead allow much cheaper add function. The primary usage is
- * infrequently read statistic counters, not requiring exact precision.
- *
- * The Linux implementation is directly mapped into percpu_counter KPI.
- */
-
-#ifndef _SYS_WMSUM_H
-#define _SYS_WMSUM_H
-
-#include <linux/percpu_counter.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct percpu_counter wmsum_t;
-
-static inline void
-wmsum_init(wmsum_t *ws, uint64_t value)
-{
- percpu_counter_init(ws, value, GFP_KERNEL);
-}
-
-static inline void
-wmsum_fini(wmsum_t *ws)
-{
-
- percpu_counter_destroy(ws);
-}
-
-static inline uint64_t
-wmsum_value(wmsum_t *ws)
-{
-
- return (percpu_counter_sum(ws));
-}
-
-static inline void
-wmsum_add(wmsum_t *ws, int64_t delta)
-{
-
- percpu_counter_add_batch(ws, delta, INT_MAX / 2);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SYS_WMSUM_H */
diff --git a/include/os/linux/spl/sys/zmod.h b/include/os/linux/spl/sys/zmod.h
deleted file mode 100644
index db60e4d4cdd0..000000000000
--- a/include/os/linux/spl/sys/zmod.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- *
- *
- * z_compress_level/z_uncompress are nearly identical copies of the
- * compress2/uncompress functions provided by the official zlib package
- * available at http://zlib.net/. The only changes made we to slightly
- * adapt the functions called to match the linux kernel implementation
- * of zlib. The full zlib license follows:
- *
- * zlib.h -- interface of the 'zlib' general purpose compression library
- * version 1.2.5, April 19th, 2010
- *
- * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
- *
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event will the authors be held liable for any damages
- * arising from the use of this software.
- *
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
- *
- * 1. The origin of this software must not be misrepresented; you must not
- * claim that you wrote the original software. If you use this software
- * in a product, an acknowledgment in the product documentation would be
- * appreciated but is not required.
- * 2. Altered source versions must be plainly marked as such, and must not be
- * misrepresented as being the original software.
- * 3. This notice may not be removed or altered from any source distribution.
- *
- * Jean-loup Gailly
- * Mark Adler
- */
-
-#ifndef _SPL_ZMOD_H
-#define _SPL_ZMOD_H
-
-#include <sys/types.h>
-#include <linux/zlib.h>
-
-extern int z_compress_level(void *dest, size_t *destLen, const void *source,
- size_t sourceLen, int level);
-extern int z_uncompress(void *dest, size_t *destLen, const void *source,
- size_t sourceLen);
-
-int spl_zlib_init(void);
-void spl_zlib_fini(void);
-
-#endif /* SPL_ZMOD_H */
diff --git a/include/os/linux/spl/sys/zone.h b/include/os/linux/spl/sys/zone.h
deleted file mode 100644
index 4e75202fbdde..000000000000
--- a/include/os/linux/spl/sys/zone.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
- * Copyright (C) 2007 The Regents of the University of California.
- * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
- * UCRL-CODE-235197
- *
- * This file is part of the SPL, Solaris Porting Layer.
- *
- * The SPL is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * The SPL is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with the SPL. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _SPL_ZONE_H
-#define _SPL_ZONE_H
-
-#include <sys/byteorder.h>
-#include <sys/cred.h>
-
-#include <linux/cred.h>
-#include <linux/user_namespace.h>
-
-/*
- * Attach the given dataset to the given user namespace.
- */
-extern int zone_dataset_attach(cred_t *, const char *, int);
-
-/*
- * Detach the given dataset from the given user namespace.
- */
-extern int zone_dataset_detach(cred_t *, const char *, int);
-
-/*
- * Returns true if the named pool/dataset is visible in the current zone.
- */
-extern int zone_dataset_visible(const char *dataset, int *write);
-
-int spl_zone_init(void);
-void spl_zone_fini(void);
-
-extern unsigned int crgetzoneid(const cred_t *);
-extern unsigned int global_zoneid(void);
-extern boolean_t inglobalzone(proc_t *);
-
-#define INGLOBALZONE(x) inglobalzone(x)
-#define GLOBAL_ZONEID global_zoneid()
-
-#endif /* SPL_ZONE_H */