summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-09-06 11:26:26 -0700
committerBrian Behlendorf <[email protected]>2019-09-06 11:26:26 -0700
commitbced7e3aaa3cf54d5e8e4f94e067144b27cb744b (patch)
tree729dac6996f4f11b88bc3a831b2b8d6852e6fbb6
parent870e7a52c105f26ef4254b90230d396f4ce39ea7 (diff)
OpenZFS restructuring - move platform specific sources
Move platform specific Linux source under module/os/linux/ and update the build system accordingly. Additional code restructuring will follow to make the common code fully portable. Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matthew Macy <[email protected]> Closes #9206
-rw-r--r--COPYRIGHT2
-rw-r--r--Makefile.am44
-rw-r--r--configure.ac6
-rwxr-xr-xcopy-builtin7
-rw-r--r--include/.gitignore1
-rw-r--r--include/sys/Makefile.am1
-rw-r--r--include/sys/qat.h (renamed from module/zfs/qat.h)0
-rw-r--r--lib/libzpool/Makefile.am1
-rw-r--r--module/Makefile.in67
-rw-r--r--module/os/Makefile.in1
-rw-r--r--module/os/linux/Makefile.in1
-rw-r--r--module/os/linux/spl/Makefile.in18
-rw-r--r--module/os/linux/spl/README.md (renamed from module/spl/README.md)0
-rw-r--r--module/os/linux/spl/THIRDPARTYLICENSE.gplv2 (renamed from module/spl/THIRDPARTYLICENSE.gplv2)0
-rw-r--r--module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip (renamed from module/spl/THIRDPARTYLICENSE.gplv2.descrip)0
-rw-r--r--module/os/linux/spl/spl-atomic.c (renamed from module/spl/spl-atomic.c)0
-rw-r--r--module/os/linux/spl/spl-condvar.c (renamed from module/spl/spl-condvar.c)0
-rw-r--r--module/os/linux/spl/spl-cred.c (renamed from module/spl/spl-cred.c)0
-rw-r--r--module/os/linux/spl/spl-err.c (renamed from module/spl/spl-err.c)0
-rw-r--r--module/os/linux/spl/spl-generic.c (renamed from module/spl/spl-generic.c)0
-rw-r--r--module/os/linux/spl/spl-kmem-cache.c (renamed from module/spl/spl-kmem-cache.c)0
-rw-r--r--module/os/linux/spl/spl-kmem.c (renamed from module/spl/spl-kmem.c)0
-rw-r--r--module/os/linux/spl/spl-kobj.c (renamed from module/spl/spl-kobj.c)0
-rw-r--r--module/os/linux/spl/spl-kstat.c (renamed from module/spl/spl-kstat.c)0
-rw-r--r--module/os/linux/spl/spl-proc.c (renamed from module/spl/spl-proc.c)0
-rw-r--r--module/os/linux/spl/spl-procfs-list.c (renamed from module/spl/spl-procfs-list.c)0
-rw-r--r--module/os/linux/spl/spl-taskq.c (renamed from module/spl/spl-taskq.c)0
-rw-r--r--module/os/linux/spl/spl-thread.c (renamed from module/spl/spl-thread.c)0
-rw-r--r--module/os/linux/spl/spl-tsd.c (renamed from module/spl/spl-tsd.c)0
-rw-r--r--module/os/linux/spl/spl-vmem.c (renamed from module/spl/spl-vmem.c)0
-rw-r--r--module/os/linux/spl/spl-vnode.c (renamed from module/spl/spl-vnode.c)0
-rw-r--r--module/os/linux/spl/spl-xdr.c (renamed from module/spl/spl-xdr.c)0
-rw-r--r--module/os/linux/spl/spl-zlib.c (renamed from module/spl/spl-zlib.c)0
-rw-r--r--module/os/linux/zfs/Makefile.in34
-rw-r--r--module/os/linux/zfs/abd.c (renamed from module/zfs/abd.c)0
-rw-r--r--module/os/linux/zfs/policy.c (renamed from module/zfs/policy.c)0
-rw-r--r--module/os/linux/zfs/qat.c (renamed from module/zfs/qat.c)0
-rw-r--r--module/os/linux/zfs/qat_compress.c (renamed from module/zfs/qat_compress.c)0
-rw-r--r--module/os/linux/zfs/qat_crypt.c (renamed from module/zfs/qat_crypt.c)0
-rw-r--r--module/os/linux/zfs/spa_stats.c (renamed from module/zfs/spa_stats.c)0
-rw-r--r--module/os/linux/zfs/vdev_disk.c (renamed from module/zfs/vdev_disk.c)0
-rw-r--r--module/os/linux/zfs/vdev_file.c (renamed from module/zfs/vdev_file.c)0
-rw-r--r--module/os/linux/zfs/zfs_acl.c (renamed from module/zfs/zfs_acl.c)0
-rw-r--r--module/os/linux/zfs/zfs_ctldir.c (renamed from module/zfs/zfs_ctldir.c)0
-rw-r--r--module/os/linux/zfs/zfs_debug.c (renamed from module/zfs/zfs_debug.c)0
-rw-r--r--module/os/linux/zfs/zfs_dir.c (renamed from module/zfs/zfs_dir.c)0
-rw-r--r--module/os/linux/zfs/zfs_sysfs.c (renamed from module/zfs/zfs_sysfs.c)0
-rw-r--r--module/os/linux/zfs/zfs_vfsops.c (renamed from module/zfs/zfs_vfsops.c)0
-rw-r--r--module/os/linux/zfs/zfs_vnops.c (renamed from module/zfs/zfs_vnops.c)0
-rw-r--r--module/os/linux/zfs/zfs_znode.c (renamed from module/zfs/zfs_znode.c)0
-rw-r--r--module/os/linux/zfs/zio_crypt.c (renamed from module/zfs/zio_crypt.c)2
-rw-r--r--module/os/linux/zfs/zpl_ctldir.c (renamed from module/zfs/zpl_ctldir.c)0
-rw-r--r--module/os/linux/zfs/zpl_export.c (renamed from module/zfs/zpl_export.c)0
-rw-r--r--module/os/linux/zfs/zpl_file.c (renamed from module/zfs/zpl_file.c)0
-rw-r--r--module/os/linux/zfs/zpl_inode.c (renamed from module/zfs/zpl_inode.c)0
-rw-r--r--module/os/linux/zfs/zpl_super.c (renamed from module/zfs/zpl_super.c)0
-rw-r--r--module/os/linux/zfs/zpl_xattr.c (renamed from module/zfs/zpl_xattr.c)0
-rw-r--r--module/spl/Makefile.in20
-rw-r--r--module/zfs/Makefile.in43
-rw-r--r--module/zfs/gzip.c2
-rw-r--r--module/zfs/sha256.c2
-rw-r--r--module/zfs/spa_misc.c2
62 files changed, 167 insertions, 87 deletions
diff --git a/COPYRIGHT b/COPYRIGHT
index 54fbceade..58d8e2a75 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -19,7 +19,7 @@ notable exceptions and their respective licenses include:
* AES Implementation: module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
* AES Implementation: module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
* PBKDF2 Implementation: lib/libzfs/THIRDPARTYLICENSE.openssl
- * SPL Implementation: module/spl/THIRDPARTYLICENSE.gplv2
+ * SPL Implementation: module/os/linux/spl/THIRDPARTYLICENSE.gplv2
This product includes software developed by the OpenSSL Project for use
in the OpenSSL Toolkit (http://www.openssl.org/)
diff --git a/Makefile.am b/Makefile.am
index 3992fe9ad..8266ca300 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,9 +4,16 @@ include config/rpm.am
include config/deb.am
include config/tgz.am
-SUBDIRS = include rpm
+SUBDIRS = include
+if BUILD_LINUX
+SUBDIRS += rpm
+endif
+
if CONFIG_USER
-SUBDIRS += udev etc man scripts lib tests cmd contrib
+SUBDIRS += etc man scripts lib tests cmd contrib
+if BUILD_LINUX
+SUBDIRS += udev
+endif
endif
if CONFIG_KERNEL
SUBDIRS += module
@@ -14,9 +21,11 @@ SUBDIRS += module
extradir = $(prefix)/src/zfs-$(VERSION)
extra_HEADERS = zfs.release.in zfs_config.h.in
+if BUILD_LINUX
kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION)
nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS)
endif
+endif
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = autogen.sh copy-builtin
@@ -31,8 +40,8 @@ EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
-EXTRA_DIST += module/spl/THIRDPARTYLICENSE.gplv2
-EXTRA_DIST += module/spl/THIRDPARTYLICENSE.gplv2.descrip
+EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2
+EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash
EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip
@@ -63,9 +72,10 @@ all-local:
dist-hook: gitrev
cp ${top_srcdir}/include/zfs_gitrev.h $(distdir)/include; \
- sed -i 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
+ sed ${ac_inplace} -e 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
$(distdir)/META
+if BUILD_LINUX
# For compatibility, create a matching spl-x.y.z directly which contains
# symlinks to the updated header and object file locations. These
# compatibility links will be removed in the next major release.
@@ -82,6 +92,7 @@ install-data-hook:
ln -fs zfs_config.h spl_config.h && \
ln -fs zfs.release spl.release
endif
+endif
codecheck: cstyle shellcheck flake8 mancheck testscheck vcscheck
@@ -97,12 +108,15 @@ cstyle:
! -name '*.mod.c' -type f \
-exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+
+filter_executable = -exec test -x '{}' \; -print
+
shellcheck:
@if type shellcheck > /dev/null 2>&1; then \
- shellcheck --exclude=SC1090 --format=gcc \
+ shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
$$(find ${top_srcdir}/scripts/*.sh -type f) \
$$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
- $$(find ${top_srcdir}/cmd/zpool/zpool.d/* -executable); \
+ $$(find ${top_srcdir}/cmd/zpool/zpool.d/* \
+ -type f ${filter_executable}); \
else \
echo "skipping shellcheck because shellcheck is not installed"; \
fi
@@ -117,13 +131,19 @@ mancheck:
echo "skipping mancheck because mandoc is not installed"; \
fi
+if BUILD_LINUX
+stat_fmt = -c '%A %n'
+else
+stat_fmt = -f '%Sp %N'
+endif
+
testscheck:
@find ${top_srcdir}/tests/zfs-tests -type f \
- \( -name '*.ksh' -not -executable \) -o \
- \( -name '*.kshlib' -executable \) -o \
- \( -name '*.shlib' -executable \) -o \
- \( -name '*.cfg' -executable \) | \
- xargs -r stat -c '%A %n' | \
+ \( -name '*.ksh' -not ${filter_executable} \) -o \
+ \( -name '*.kshlib' ${filter_executable} \) -o \
+ \( -name '*.shlib' ${filter_executable} \) -o \
+ \( -name '*.cfg' ${filter_executable} \) | \
+ xargs -r stat ${stat_fmt} | \
awk '{c++; print} END {if(c>0) exit 1}'
vcscheck:
diff --git a/configure.ac b/configure.ac
index eccc09c28..fceb66b04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,12 +139,16 @@ AC_CONFIG_FILES([
module/Makefile
module/avl/Makefile
module/nvpair/Makefile
+ module/os/Makefile
+ module/os/linux/Makefile
+ module/os/linux/spl/Makefile
+ module/os/linux/zfs/Makefile
+ module/spl/Makefile
module/unicode/Makefile
module/zcommon/Makefile
module/zfs/Makefile
module/lua/Makefile
module/icp/Makefile
- module/spl/Makefile
include/Makefile
include/os/Makefile
include/os/linux/Makefile
diff --git a/copy-builtin b/copy-builtin
index adb3bd544..c108cfc67 100755
--- a/copy-builtin
+++ b/copy-builtin
@@ -12,12 +12,11 @@ usage()
KERNEL_DIR="$(readlink --canonicalize-existing "$1")"
MODULES=()
-MODULES+="spl"
-for MODULE_DIR in module/*
+for MODULE_DIR in module/* module/os/linux/*
do
[ -d "$MODULE_DIR" ] || continue
- [ "spl" = "${MODULE_DIR##*/}" ] && continue
- MODULES+=("${MODULE_DIR##*/}")
+ [ "os" = "${MODULE_DIR#*/}" ] && continue
+ MODULES+=("${MODULE_DIR#*/}")
done
if ! [ -e 'zfs_config.h' ]
diff --git a/include/.gitignore b/include/.gitignore
index 416f36b9e..e6eb2116f 100644
--- a/include/.gitignore
+++ b/include/.gitignore
@@ -1,2 +1 @@
/zfs_gitrev.h
-/spl
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am
index b3845cb95..75033d913 100644
--- a/include/sys/Makefile.am
+++ b/include/sys/Makefile.am
@@ -52,6 +52,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/nvpair_impl.h \
$(top_srcdir)/include/sys/objlist.h \
$(top_srcdir)/include/sys/pathname.h \
+ $(top_srcdir)/include/sys/qat.h \
$(top_srcdir)/include/sys/range_tree.h \
$(top_srcdir)/include/sys/refcount.h \
$(top_srcdir)/include/sys/rrwlock.h \
diff --git a/module/zfs/qat.h b/include/sys/qat.h
index fdd608139..fdd608139 100644
--- a/module/zfs/qat.h
+++ b/include/sys/qat.h
diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am
index 072cd1a46..1b2405a53 100644
--- a/lib/libzpool/Makefile.am
+++ b/lib/libzpool/Makefile.am
@@ -4,6 +4,7 @@ VPATH = \
$(top_srcdir)/module/zfs \
$(top_srcdir)/module/zcommon \
$(top_srcdir)/module/lua \
+ $(top_srcdir)/module/os/linux/zfs \
$(top_srcdir)/lib/libzpool
# Suppress unused but set variable warnings often due to ASSERTs
diff --git a/module/Makefile.in b/module/Makefile.in
index bf0eb101c..194133864 100644
--- a/module/Makefile.in
+++ b/module/Makefile.in
@@ -3,9 +3,11 @@ obj-m += icp/
obj-m += lua/
obj-m += nvpair/
obj-m += spl/
+obj-m += os/linux/spl/
obj-m += unicode/
obj-m += zcommon/
obj-m += zfs/
+obj-m += os/linux/zfs/
INSTALL_MOD_DIR ?= extra
@@ -16,7 +18,6 @@ ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include/os/linux/kernel
ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include/os/linux/spl
ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include/os/linux/zfs
ZFS_MODULE_CFLAGS += -I@abs_top_srcdir@/include
-
ZFS_MODULE_CPPFLAGS += -D_KERNEL
ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@
@@ -27,25 +28,38 @@ export ZFS_MODULE_CFLAGS ZFS_MODULE_CPPFLAGS
SUBDIR_TARGETS = icp lua
-modules:
+all: modules
+distclean maintainer-clean: clean
+install: modules_install
+uninstall: modules_uninstall
+check:
+
+modules-Linux:
list='$(SUBDIR_TARGETS)'; for targetdir in $$list; do \
$(MAKE) -C $$targetdir; \
done
- $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ CONFIG_ZFS=m $@
+ $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ CONFIG_ZFS=m modules
+
+modules-unknown:
+ @true
+
+modules: modules-@ac_system@
-clean:
+clean-Linux:
@# Only cleanup the kernel build directories when CONFIG_KERNEL
@# is defined. This indicates that kernel modules should be built.
-@CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ $@
+@CONFIG_KERNEL_TRUE@ $(MAKE) -C @LINUX_OBJ@ M=`pwd` @KERNEL_MAKE@ clean
if [ -f @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
if [ -f Module.markers ]; then $(RM) Module.markers; fi
find . -name '*.ur-safe' -type f -print | xargs $(RM)
-modules_install:
+clean: clean-@ac_system@
+
+modules_install-Linux:
@# Install the kernel modules
- $(MAKE) -C @LINUX_OBJ@ M=`pwd` $@ \
+ $(MAKE) -C @LINUX_OBJ@ M=`pwd` modules_install \
INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
KERNELRELEASE=@LINUX_VERSION@
@@ -59,22 +73,47 @@ modules_install:
depmod -ae -F $$sysmap @LINUX_VERSION@; \
fi
-modules_uninstall:
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+modules_install: modules_install-@ac_system@
+
+modules_uninstall-Linux:
@# Uninstall the kernel modules
kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@
list='$(obj-m)'; for objdir in $$list; do \
$(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \
done
+modules_uninstall: modules_uninstall-@ac_system@
+
distdir:
list='$(obj-m)'; for objdir in $$list; do \
(cd @top_srcdir@/module && find $$objdir \
-name '*.c' -o -name '*.h' -o -name '*.S' | \
xargs cp --parents -t @abs_top_builddir@/module/$$distdir); \
done
-
-distclean maintainer-clean: clean
-install: modules_install
-uninstall: modules_uninstall
-all: modules
-check:
diff --git a/module/os/Makefile.in b/module/os/Makefile.in
new file mode 100644
index 000000000..b9990d1bc
--- /dev/null
+++ b/module/os/Makefile.in
@@ -0,0 +1 @@
+subdirs-m = linux
diff --git a/module/os/linux/Makefile.in b/module/os/linux/Makefile.in
new file mode 100644
index 000000000..ab01708a3
--- /dev/null
+++ b/module/os/linux/Makefile.in
@@ -0,0 +1 @@
+subdirs-m = spl zfs
diff --git a/module/os/linux/spl/Makefile.in b/module/os/linux/spl/Makefile.in
new file mode 100644
index 000000000..a29c36a2a
--- /dev/null
+++ b/module/os/linux/spl/Makefile.in
@@ -0,0 +1,18 @@
+$(MODULE)-objs += ../os/linux/spl/spl-atomic.o
+$(MODULE)-objs += ../os/linux/spl/spl-condvar.o
+$(MODULE)-objs += ../os/linux/spl/spl-cred.o
+$(MODULE)-objs += ../os/linux/spl/spl-err.o
+$(MODULE)-objs += ../os/linux/spl/spl-generic.o
+$(MODULE)-objs += ../os/linux/spl/spl-kmem.o
+$(MODULE)-objs += ../os/linux/spl/spl-kmem-cache.o
+$(MODULE)-objs += ../os/linux/spl/spl-kobj.o
+$(MODULE)-objs += ../os/linux/spl/spl-kstat.o
+$(MODULE)-objs += ../os/linux/spl/spl-proc.o
+$(MODULE)-objs += ../os/linux/spl/spl-procfs-list.o
+$(MODULE)-objs += ../os/linux/spl/spl-taskq.o
+$(MODULE)-objs += ../os/linux/spl/spl-thread.o
+$(MODULE)-objs += ../os/linux/spl/spl-tsd.o
+$(MODULE)-objs += ../os/linux/spl/spl-vmem.o
+$(MODULE)-objs += ../os/linux/spl/spl-vnode.o
+$(MODULE)-objs += ../os/linux/spl/spl-xdr.o
+$(MODULE)-objs += ../os/linux/spl/spl-zlib.o
diff --git a/module/spl/README.md b/module/os/linux/spl/README.md
index 57f635aed..57f635aed 100644
--- a/module/spl/README.md
+++ b/module/os/linux/spl/README.md
diff --git a/module/spl/THIRDPARTYLICENSE.gplv2 b/module/os/linux/spl/THIRDPARTYLICENSE.gplv2
index d159169d1..d159169d1 100644
--- a/module/spl/THIRDPARTYLICENSE.gplv2
+++ b/module/os/linux/spl/THIRDPARTYLICENSE.gplv2
diff --git a/module/spl/THIRDPARTYLICENSE.gplv2.descrip b/module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
index 78535a8ee..78535a8ee 100644
--- a/module/spl/THIRDPARTYLICENSE.gplv2.descrip
+++ b/module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
diff --git a/module/spl/spl-atomic.c b/module/os/linux/spl/spl-atomic.c
index 47ed1886e..47ed1886e 100644
--- a/module/spl/spl-atomic.c
+++ b/module/os/linux/spl/spl-atomic.c
diff --git a/module/spl/spl-condvar.c b/module/os/linux/spl/spl-condvar.c
index 3cc33da62..3cc33da62 100644
--- a/module/spl/spl-condvar.c
+++ b/module/os/linux/spl/spl-condvar.c
diff --git a/module/spl/spl-cred.c b/module/os/linux/spl/spl-cred.c
index ea3e903f9..ea3e903f9 100644
--- a/module/spl/spl-cred.c
+++ b/module/os/linux/spl/spl-cred.c
diff --git a/module/spl/spl-err.c b/module/os/linux/spl/spl-err.c
index 3c0bb71c0..3c0bb71c0 100644
--- a/module/spl/spl-err.c
+++ b/module/os/linux/spl/spl-err.c
diff --git a/module/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c
index 1deb2f444..1deb2f444 100644
--- a/module/spl/spl-generic.c
+++ b/module/os/linux/spl/spl-generic.c
diff --git a/module/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c
index b39867b03..b39867b03 100644
--- a/module/spl/spl-kmem-cache.c
+++ b/module/os/linux/spl/spl-kmem-cache.c
diff --git a/module/spl/spl-kmem.c b/module/os/linux/spl/spl-kmem.c
index 824b5e89f..824b5e89f 100644
--- a/module/spl/spl-kmem.c
+++ b/module/os/linux/spl/spl-kmem.c
diff --git a/module/spl/spl-kobj.c b/module/os/linux/spl/spl-kobj.c
index 7019369bd..7019369bd 100644
--- a/module/spl/spl-kobj.c
+++ b/module/os/linux/spl/spl-kobj.c
diff --git a/module/spl/spl-kstat.c b/module/os/linux/spl/spl-kstat.c
index 1f67bf157..1f67bf157 100644
--- a/module/spl/spl-kstat.c
+++ b/module/os/linux/spl/spl-kstat.c
diff --git a/module/spl/spl-proc.c b/module/os/linux/spl/spl-proc.c
index a75bcc214..a75bcc214 100644
--- a/module/spl/spl-proc.c
+++ b/module/os/linux/spl/spl-proc.c
diff --git a/module/spl/spl-procfs-list.c b/module/os/linux/spl/spl-procfs-list.c
index f6a00da5c..f6a00da5c 100644
--- a/module/spl/spl-procfs-list.c
+++ b/module/os/linux/spl/spl-procfs-list.c
diff --git a/module/spl/spl-taskq.c b/module/os/linux/spl/spl-taskq.c
index 90e1d0a4d..90e1d0a4d 100644
--- a/module/spl/spl-taskq.c
+++ b/module/os/linux/spl/spl-taskq.c
diff --git a/module/spl/spl-thread.c b/module/os/linux/spl/spl-thread.c
index 29de9252a..29de9252a 100644
--- a/module/spl/spl-thread.c
+++ b/module/os/linux/spl/spl-thread.c
diff --git a/module/spl/spl-tsd.c b/module/os/linux/spl/spl-tsd.c
index 14342d5a6..14342d5a6 100644
--- a/module/spl/spl-tsd.c
+++ b/module/os/linux/spl/spl-tsd.c
diff --git a/module/spl/spl-vmem.c b/module/os/linux/spl/spl-vmem.c
index e1a84a911..e1a84a911 100644
--- a/module/spl/spl-vmem.c
+++ b/module/os/linux/spl/spl-vmem.c
diff --git a/module/spl/spl-vnode.c b/module/os/linux/spl/spl-vnode.c
index d9056c964..d9056c964 100644
--- a/module/spl/spl-vnode.c
+++ b/module/os/linux/spl/spl-vnode.c
diff --git a/module/spl/spl-xdr.c b/module/os/linux/spl/spl-xdr.c
index 1dd31ffc1..1dd31ffc1 100644
--- a/module/spl/spl-xdr.c
+++ b/module/os/linux/spl/spl-xdr.c
diff --git a/module/spl/spl-zlib.c b/module/os/linux/spl/spl-zlib.c
index 62423343c..62423343c 100644
--- a/module/spl/spl-zlib.c
+++ b/module/os/linux/spl/spl-zlib.c
diff --git a/module/os/linux/zfs/Makefile.in b/module/os/linux/zfs/Makefile.in
new file mode 100644
index 000000000..84900bd2c
--- /dev/null
+++ b/module/os/linux/zfs/Makefile.in
@@ -0,0 +1,34 @@
+#
+# Linux specific sources included from module/zfs/Makefile.in
+#
+
+# Suppress unused-value warnings in sparc64 architecture headers
+ifeq ($(target_cpu),sparc64)
+ccflags-y += -Wno-unused-value
+endif
+
+ccflags-y += -I@abs_top_srcdir@/module/os/linux/zfs
+
+$(MODULE)-objs += ../os/linux/zfs/abd.o
+$(MODULE)-objs += ../os/linux/zfs/policy.o
+$(MODULE)-objs += ../os/linux/zfs/qat.o
+$(MODULE)-objs += ../os/linux/zfs/qat_compress.o
+$(MODULE)-objs += ../os/linux/zfs/qat_crypt.o
+$(MODULE)-objs += ../os/linux/zfs/spa_stats.o
+$(MODULE)-objs += ../os/linux/zfs/vdev_disk.o
+$(MODULE)-objs += ../os/linux/zfs/vdev_file.o
+$(MODULE)-objs += ../os/linux/zfs/zfs_acl.o
+$(MODULE)-objs += ../os/linux/zfs/zfs_ctldir.o
+$(MODULE)-objs += ../os/linux/zfs/zfs_debug.o
+$(MODULE)-objs += ../os/linux/zfs/zfs_dir.o
+$(MODULE)-objs += ../os/linux/zfs/zfs_sysfs.o
+$(MODULE)-objs += ../os/linux/zfs/zfs_vfsops.o
+$(MODULE)-objs += ../os/linux/zfs/zfs_vnops.o
+$(MODULE)-objs += ../os/linux/zfs/zfs_znode.o
+$(MODULE)-objs += ../os/linux/zfs/zio_crypt.o
+$(MODULE)-objs += ../os/linux/zfs/zpl_ctldir.o
+$(MODULE)-objs += ../os/linux/zfs/zpl_export.o
+$(MODULE)-objs += ../os/linux/zfs/zpl_file.o
+$(MODULE)-objs += ../os/linux/zfs/zpl_inode.o
+$(MODULE)-objs += ../os/linux/zfs/zpl_super.o
+$(MODULE)-objs += ../os/linux/zfs/zpl_xattr.o
diff --git a/module/zfs/abd.c b/module/os/linux/zfs/abd.c
index ac6b0b742..ac6b0b742 100644
--- a/module/zfs/abd.c
+++ b/module/os/linux/zfs/abd.c
diff --git a/module/zfs/policy.c b/module/os/linux/zfs/policy.c
index 7f9456a67..7f9456a67 100644
--- a/module/zfs/policy.c
+++ b/module/os/linux/zfs/policy.c
diff --git a/module/zfs/qat.c b/module/os/linux/zfs/qat.c
index a6f024cb4..a6f024cb4 100644
--- a/module/zfs/qat.c
+++ b/module/os/linux/zfs/qat.c
diff --git a/module/zfs/qat_compress.c b/module/os/linux/zfs/qat_compress.c
index 4136b6555..4136b6555 100644
--- a/module/zfs/qat_compress.c
+++ b/module/os/linux/zfs/qat_compress.c
diff --git a/module/zfs/qat_crypt.c b/module/os/linux/zfs/qat_crypt.c
index 02e19d21d..02e19d21d 100644
--- a/module/zfs/qat_crypt.c
+++ b/module/os/linux/zfs/qat_crypt.c
diff --git a/module/zfs/spa_stats.c b/module/os/linux/zfs/spa_stats.c
index 6895428f4..6895428f4 100644
--- a/module/zfs/spa_stats.c
+++ b/module/os/linux/zfs/spa_stats.c
diff --git a/module/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c
index 21f9ae454..21f9ae454 100644
--- a/module/zfs/vdev_disk.c
+++ b/module/os/linux/zfs/vdev_disk.c
diff --git a/module/zfs/vdev_file.c b/module/os/linux/zfs/vdev_file.c
index b79017f3a..b79017f3a 100644
--- a/module/zfs/vdev_file.c
+++ b/module/os/linux/zfs/vdev_file.c
diff --git a/module/zfs/zfs_acl.c b/module/os/linux/zfs/zfs_acl.c
index 26af91e27..26af91e27 100644
--- a/module/zfs/zfs_acl.c
+++ b/module/os/linux/zfs/zfs_acl.c
diff --git a/module/zfs/zfs_ctldir.c b/module/os/linux/zfs/zfs_ctldir.c
index 1e61ef06d..1e61ef06d 100644
--- a/module/zfs/zfs_ctldir.c
+++ b/module/os/linux/zfs/zfs_ctldir.c
diff --git a/module/zfs/zfs_debug.c b/module/os/linux/zfs/zfs_debug.c
index 538533d27..538533d27 100644
--- a/module/zfs/zfs_debug.c
+++ b/module/os/linux/zfs/zfs_debug.c
diff --git a/module/zfs/zfs_dir.c b/module/os/linux/zfs/zfs_dir.c
index 6bdad737c..6bdad737c 100644
--- a/module/zfs/zfs_dir.c
+++ b/module/os/linux/zfs/zfs_dir.c
diff --git a/module/zfs/zfs_sysfs.c b/module/os/linux/zfs/zfs_sysfs.c
index bb7f3b69a..bb7f3b69a 100644
--- a/module/zfs/zfs_sysfs.c
+++ b/module/os/linux/zfs/zfs_sysfs.c
diff --git a/module/zfs/zfs_vfsops.c b/module/os/linux/zfs/zfs_vfsops.c
index 0914e4b7d..0914e4b7d 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/os/linux/zfs/zfs_vfsops.c
diff --git a/module/zfs/zfs_vnops.c b/module/os/linux/zfs/zfs_vnops.c
index de7b59935..de7b59935 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/os/linux/zfs/zfs_vnops.c
diff --git a/module/zfs/zfs_znode.c b/module/os/linux/zfs/zfs_znode.c
index 549c701a0..549c701a0 100644
--- a/module/zfs/zfs_znode.c
+++ b/module/os/linux/zfs/zfs_znode.c
diff --git a/module/zfs/zio_crypt.c b/module/os/linux/zfs/zio_crypt.c
index 7cf20f413..486622c8a 100644
--- a/module/zfs/zio_crypt.c
+++ b/module/os/linux/zfs/zio_crypt.c
@@ -26,7 +26,7 @@
#include <sys/zil.h>
#include <sys/sha2.h>
#include <sys/hkdf.h>
-#include "qat.h"
+#include <sys/qat.h>
/*
* This file is responsible for handling all of the details of generating
diff --git a/module/zfs/zpl_ctldir.c b/module/os/linux/zfs/zpl_ctldir.c
index 6df367b81..6df367b81 100644
--- a/module/zfs/zpl_ctldir.c
+++ b/module/os/linux/zfs/zpl_ctldir.c
diff --git a/module/zfs/zpl_export.c b/module/os/linux/zfs/zpl_export.c
index a264d664c..a264d664c 100644
--- a/module/zfs/zpl_export.c
+++ b/module/os/linux/zfs/zpl_export.c
diff --git a/module/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c
index acad4670d..acad4670d 100644
--- a/module/zfs/zpl_file.c
+++ b/module/os/linux/zfs/zpl_file.c
diff --git a/module/zfs/zpl_inode.c b/module/os/linux/zfs/zpl_inode.c
index 3f3b2e2dc..3f3b2e2dc 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/os/linux/zfs/zpl_inode.c
diff --git a/module/zfs/zpl_super.c b/module/os/linux/zfs/zpl_super.c
index 810ab2898..810ab2898 100644
--- a/module/zfs/zpl_super.c
+++ b/module/os/linux/zfs/zpl_super.c
diff --git a/module/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c
index 95523f28e..95523f28e 100644
--- a/module/zfs/zpl_xattr.c
+++ b/module/os/linux/zfs/zpl_xattr.c
diff --git a/module/spl/Makefile.in b/module/spl/Makefile.in
index e16666aa9..8602f4edd 100644
--- a/module/spl/Makefile.in
+++ b/module/spl/Makefile.in
@@ -7,21 +7,5 @@ obj-$(CONFIG_ZFS) := $(MODULE).o
ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
-$(MODULE)-objs += spl-atomic.o
-$(MODULE)-objs += spl-condvar.o
-$(MODULE)-objs += spl-cred.o
-$(MODULE)-objs += spl-err.o
-$(MODULE)-objs += spl-generic.o
-$(MODULE)-objs += spl-kmem.o
-$(MODULE)-objs += spl-kmem-cache.o
-$(MODULE)-objs += spl-kobj.o
-$(MODULE)-objs += spl-kstat.o
-$(MODULE)-objs += spl-proc.o
-$(MODULE)-objs += spl-procfs-list.o
-$(MODULE)-objs += spl-taskq.o
-$(MODULE)-objs += spl-thread.o
-$(MODULE)-objs += spl-tsd.o
-$(MODULE)-objs += spl-vmem.o
-$(MODULE)-objs += spl-vnode.o
-$(MODULE)-objs += spl-xdr.o
-$(MODULE)-objs += spl-zlib.o
+
+-include @abs_top_builddir@/module/os/linux/spl/Makefile
diff --git a/module/zfs/Makefile.in b/module/zfs/Makefile.in
index 5adea9fb5..7c560fad7 100644
--- a/module/zfs/Makefile.in
+++ b/module/zfs/Makefile.in
@@ -16,18 +16,17 @@ endif
# Suppress unused but set variable warnings often due to ASSERTs
ccflags-y += $(NO_UNUSED_BUT_SET_VARIABLE)
-$(MODULE)-objs += abd.o
$(MODULE)-objs += aggsum.o
$(MODULE)-objs += arc.o
$(MODULE)-objs += blkptr.o
$(MODULE)-objs += bplist.o
$(MODULE)-objs += bpobj.o
-$(MODULE)-objs += cityhash.o
-$(MODULE)-objs += dbuf.o
-$(MODULE)-objs += dbuf_stats.o
$(MODULE)-objs += bptree.o
$(MODULE)-objs += bqueue.o
+$(MODULE)-objs += cityhash.o
$(MODULE)-objs += dataset_kstats.o
+$(MODULE)-objs += dbuf.o
+$(MODULE)-objs += dbuf_stats.o
$(MODULE)-objs += ddt.o
$(MODULE)-objs += ddt_zap.o
$(MODULE)-objs += dmu.o
@@ -42,28 +41,29 @@ $(MODULE)-objs += dmu_tx.o
$(MODULE)-objs += dmu_zfetch.o
$(MODULE)-objs += dnode.o
$(MODULE)-objs += dnode_sync.o
+$(MODULE)-objs += dsl_bookmark.o
+$(MODULE)-objs += dsl_crypt.o
$(MODULE)-objs += dsl_dataset.o
$(MODULE)-objs += dsl_deadlist.o
$(MODULE)-objs += dsl_deleg.o
-$(MODULE)-objs += dsl_bookmark.o
+$(MODULE)-objs += dsl_destroy.o
$(MODULE)-objs += dsl_dir.o
-$(MODULE)-objs += dsl_crypt.o
$(MODULE)-objs += dsl_pool.o
$(MODULE)-objs += dsl_prop.o
$(MODULE)-objs += dsl_scan.o
$(MODULE)-objs += dsl_synctask.o
+$(MODULE)-objs += dsl_userhold.o
$(MODULE)-objs += edonr_zfs.o
$(MODULE)-objs += fm.o
$(MODULE)-objs += gzip.o
$(MODULE)-objs += hkdf.o
-$(MODULE)-objs += lzjb.o
$(MODULE)-objs += lz4.o
+$(MODULE)-objs += lzjb.o
$(MODULE)-objs += metaslab.o
$(MODULE)-objs += mmp.o
$(MODULE)-objs += multilist.o
$(MODULE)-objs += objlist.o
$(MODULE)-objs += pathname.o
-$(MODULE)-objs += policy.o
$(MODULE)-objs += range_tree.o
$(MODULE)-objs += refcount.o
$(MODULE)-objs += rrwlock.o
@@ -78,17 +78,14 @@ $(MODULE)-objs += spa_errlog.o
$(MODULE)-objs += spa_history.o
$(MODULE)-objs += spa_log_spacemap.o
$(MODULE)-objs += spa_misc.o
-$(MODULE)-objs += spa_stats.o
$(MODULE)-objs += space_map.o
$(MODULE)-objs += space_reftree.o
-$(MODULE)-objs += txg.o
$(MODULE)-objs += trace.o
+$(MODULE)-objs += txg.o
$(MODULE)-objs += uberblock.o
$(MODULE)-objs += unique.o
$(MODULE)-objs += vdev.o
$(MODULE)-objs += vdev_cache.o
-$(MODULE)-objs += vdev_disk.o
-$(MODULE)-objs += vdev_file.o
$(MODULE)-objs += vdev_indirect.o
$(MODULE)-objs += vdev_indirect_births.o
$(MODULE)-objs += vdev_indirect_mapping.o
@@ -112,11 +109,7 @@ $(MODULE)-objs += zcp_global.o
$(MODULE)-objs += zcp_iter.o
$(MODULE)-objs += zcp_synctask.o
$(MODULE)-objs += zfeature.o
-$(MODULE)-objs += zfs_acl.o
$(MODULE)-objs += zfs_byteswap.o
-$(MODULE)-objs += zfs_ctldir.o
-$(MODULE)-objs += zfs_debug.o
-$(MODULE)-objs += zfs_dir.o
$(MODULE)-objs += zfs_fm.o
$(MODULE)-objs += zfs_fuid.o
$(MODULE)-objs += zfs_ioctl.o
@@ -126,31 +119,15 @@ $(MODULE)-objs += zfs_ratelimit.o
$(MODULE)-objs += zfs_replay.o
$(MODULE)-objs += zfs_rlock.o
$(MODULE)-objs += zfs_sa.o
-$(MODULE)-objs += zfs_sysfs.o
-$(MODULE)-objs += zfs_vfsops.o
-$(MODULE)-objs += zfs_vnops.o
-$(MODULE)-objs += zfs_znode.o
$(MODULE)-objs += zil.o
$(MODULE)-objs += zio.o
$(MODULE)-objs += zio_checksum.o
$(MODULE)-objs += zio_compress.o
-$(MODULE)-objs += zio_crypt.o
$(MODULE)-objs += zio_inject.o
$(MODULE)-objs += zle.o
-$(MODULE)-objs += zpl_ctldir.o
-$(MODULE)-objs += zpl_export.o
-$(MODULE)-objs += zpl_file.o
-$(MODULE)-objs += zpl_inode.o
-$(MODULE)-objs += zpl_super.o
-$(MODULE)-objs += zpl_xattr.o
$(MODULE)-objs += zrlock.o
$(MODULE)-objs += zthr.o
$(MODULE)-objs += zvol.o
-$(MODULE)-objs += dsl_destroy.o
-$(MODULE)-objs += dsl_userhold.o
-$(MODULE)-objs += qat.o
-$(MODULE)-objs += qat_compress.o
-$(MODULE)-objs += qat_crypt.o
# Suppress incorrect warnings from versions of objtool which are not
# aware of x86 EVEX prefix instructions used for AVX512.
@@ -165,3 +142,5 @@ $(MODULE)-$(CONFIG_X86) += vdev_raidz_math_avx512bw.o
$(MODULE)-$(CONFIG_ARM64) += vdev_raidz_math_aarch64_neon.o
$(MODULE)-$(CONFIG_ARM64) += vdev_raidz_math_aarch64_neonx2.o
+
+-include @abs_top_builddir@/module/os/linux/zfs/Makefile
diff --git a/module/zfs/gzip.c b/module/zfs/gzip.c
index 5cac2a7de..9d8af3228 100644
--- a/module/zfs/gzip.c
+++ b/module/zfs/gzip.c
@@ -29,7 +29,7 @@
#include <sys/debug.h>
#include <sys/types.h>
#include <sys/strings.h>
-#include "qat.h"
+#include <sys/qat.h>
#ifdef _KERNEL
diff --git a/module/zfs/sha256.c b/module/zfs/sha256.c
index 2adadf56f..406c926a0 100644
--- a/module/zfs/sha256.c
+++ b/module/zfs/sha256.c
@@ -30,7 +30,7 @@
#include <sys/zio.h>
#include <sys/sha2.h>
#include <sys/abd.h>
-#include "qat.h"
+#include <sys/qat.h>
static int
sha_incremental(void *buf, size_t size, void *arg)
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index b0c1ae1e6..a18f9604a 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -59,7 +59,7 @@
#include <sys/kstat.h>
#include "zfs_prop.h"
#include <sys/zfeature.h>
-#include "qat.h"
+#include <sys/qat.h>
/*
* SPA locking