Skip to content

Commit

Permalink
OpenZFS restructuring - move platform specific sources
Browse files Browse the repository at this point in the history
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 <lundman@lundman.net>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Macy <mmacy@FreeBSD.org>
Closes #9206
  • Loading branch information
mattmacy authored and behlendorf committed Sep 6, 2019
1 parent 870e7a5 commit bced7e3
Show file tree
Hide file tree
Showing 62 changed files with 167 additions and 87 deletions.
2 changes: 1 addition & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
44 changes: 32 additions & 12 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ 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

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
Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions copy-builtin
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
Expand Down
1 change: 0 additions & 1 deletion include/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/zfs_gitrev.h
/spl
1 change: 1 addition & 0 deletions include/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions lib/libzpool/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
67 changes: 53 additions & 14 deletions module/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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@

Expand All @@ -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@
Expand All @@ -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:
1 change: 1 addition & 0 deletions module/os/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subdirs-m = linux
1 change: 1 addition & 0 deletions module/os/linux/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subdirs-m = spl zfs
18 changes: 18 additions & 0 deletions module/os/linux/spl/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions module/os/linux/zfs/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion module/zfs/zio_crypt.c → module/os/linux/zfs/zio_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 2 additions & 18 deletions module/spl/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit bced7e3

Please sign in to comment.