Skip to content

Commit

Permalink
Update build system
Browse files Browse the repository at this point in the history
Minimal changes required to integrate the SPL sources in to the
ZFS repository build infrastructure.

Build system and packaging:
  * Renamed SPL_* autoconf m4 macros to ZFS_*.
  * Removed redundant SPL_* autoconf m4 macros.
  * Updated the RPM spec files to remove SPL package dependency.
  * The zfs package obsoletes the spl package, and the zfs-kmod
    package obsoletes the spl-kmod package.
  * The zfs-kmod-devel* packages were updated to add compatibility
    symlinks under /usr/src/spl-x.y.z until all dependent packages
    can be updated.  They will be removed in a future release.
  * Updated copy-builtin script for in-kernel builds.
  * Updated DKMS package to include the spl.ko.
  * Updated stale AUTHORS file to include all contributors.
  * Updated stale COPYRIGHT and included the SPL as an exception.

Required code changes:
  * Removed redundant HAVE_SPL macro.
  * Removed _BOOT from nvpairs since it doesn't apply for Linux.
  * Initial header cleanup (removal of empty headers, refactoring).
  * Remove SPL repository clone/build from zimport.sh.
  * Use of DEFINE_RATELIMIT_STATE and DEFINE_SPINLOCK removed due
    to build issues when forcing C99 compilation.
  * Replaced legacy ACCESS_ONCE with READ_ONCE.
  * Include needed headers for `current` and `EXPORT_SYMBOL`.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
TEST_ZIMPORT_SKIP="yes"
Build-ZFS: yes
Build-SPL: no
  • Loading branch information
behlendorf committed May 23, 2018
1 parent 6cb3c60 commit cd73aef
Show file tree
Hide file tree
Showing 204 changed files with 1,055 additions and 1,134 deletions.
389 changes: 299 additions & 90 deletions AUTHORS

Large diffs are not rendered by default.

44 changes: 18 additions & 26 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
The majority of the code in the ZFS on Linux port comes from OpenSolaris
which has been released under the terms of the CDDL open source license.
This includes the core ZFS code, libavl, libnvpair, libefi, libunicode,
and libutil. The original OpenSolaris source can be downloaded from:
The latest released and development versions can be downloaded from:

http://dlc.sun.com/osol/on/downloads/b121/on-src.tar.bz2
* https://github.com/zfsonlinux/zfs/releases

Files which do not originate from OpenSolaris are noted in the file header
and attributed properly. These exceptions include, but are not limited
to, the vdev_disk.c and zvol.c implementation which are licensed under
the CDDL.
The original ZFS source code was obtained from Open Solaris which was
released under the terms of the CDDL open source license. Additional
changes have been included from OpenZFS and the Illumos project which
are similarly licensed. These projects can be found on Github at:

The latest stable and development versions of this port can be downloaded
from the official ZFS on Linux site located at:

http://zfsonlinux.org/

This ZFS on Linux port was produced at the Lawrence Livermore National
Laboratory (LLNL) under Contract No. DE-AC52-07NA27344 (Contract 44)
between the U.S. Department of Energy (DOE) and Lawrence Livermore
National Security, LLC (LLNS) for the operation of LLNL. It has been
approved for release under LLNL-CODE-403049.
* https://github.com/illumos/illumos-gate
* https://github.com/openzfs/openzfs

Unless otherwise noted, all files in this distribution are released
under the Common Development and Distribution License (CDDL).
Exceptions are noted within the associated source files. A few notable
exceptions and their respective licenses include:

Skein Checksum Implementation: module/icp/algs/skein/THIRDPARTYLICENSE
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
Exceptions are noted within the associated source files headers and
by including a THIRDPARTYLICENSE file with the license terms. A few
notable exceptions and their respective licenses include:

* Skein Checksum Implementation: module/icp/algs/skein/THIRDPARTYLICENSE
* 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

This product includes software developed by the OpenSSL Project for use
in the OpenSSL Toolkit (http://www.openssl.org/)

See the file OPENSOLARIS.LICENSE for more information.
See the OPENSOLARIS.LICENSE and DISCLAIMER for more information.

Refer to the git commit log for authoritative copyright attribution.
20 changes: 18 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ endif
if CONFIG_KERNEL
SUBDIRS += module

extradir = @prefix@/src/zfs-$(VERSION)
extradir = $(prefix)/src/zfs-$(VERSION)
extra_HEADERS = zfs.release.in zfs_config.h.in

kerneldir = @prefix@/src/zfs-$(VERSION)/$(LINUX_VERSION)
kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION)
nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS)
endif

Expand Down Expand Up @@ -44,6 +44,22 @@ dist-hook:
sed -i 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
$(distdir)/META

# 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.
if CONFIG_KERNEL
install-data-hook:
mkdir $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
cd $(DESTDIR)$(prefix)/src/spl-$(VERSION) && \
ln -s ../zfs-$(VERSION)/include/spl include && \
ln -s ../zfs-$(VERSION)/$(LINUX_VERSION) $(LINUX_VERSION) && \
ln -s ../zfs-$(VERSION)/zfs_config.h.in spl_config.h.in && \
ln -s ../zfs-$(VERSION)/zfs.release.in spl.release.in && \
cd $(DESTDIR)$(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) && \
ln -s zfs_config.h spl_config.h && \
ln -s zfs.release spl.release
endif

checkstyle: cstyle shellcheck flake8 commitcheck mancheck testscheck

commitcheck:
Expand Down
4 changes: 0 additions & 4 deletions TEST
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
#TEST_PREPARE_WATCHDOG="yes"
#TEST_PREPARE_SHARES="yes"

### SPLAT
#TEST_SPLAT_SKIP="yes"
#TEST_SPLAT_OPTIONS="-acvx"

### ztest
#TEST_ZTEST_SKIP="yes"
#TEST_ZTEST_TIMEOUT=1800
Expand Down
1 change: 1 addition & 0 deletions cmd/mount_zfs/mount_zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <locale.h>
#include <getopt.h>
#include <fcntl.h>
#include <errno.h>

#define ZS_COMMENT 0x00000000 /* comment */
#define ZS_ZFSUTIL 0x00000001 /* caller is zfs(8) */
Expand Down
1 change: 1 addition & 0 deletions cmd/zed/agents/zfs_diagnosis.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include <stddef.h>
#include <string.h>
#include <strings.h>
#include <libuutil.h>
#include <libzfs.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/zed/agents/zfs_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#include <thread_pool.h>
#include <pthread.h>
#include <unistd.h>
#include <errno.h>
#include "zfs_agents.h"
#include "../zed_log.h"

Expand Down
1 change: 1 addition & 0 deletions cmd/zfs/zfs_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

#include <libzfs.h>
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-ctl-table-name.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ dnl #
dnl # 2.6.33 API change,
dnl # Removed .ctl_name from struct ctl_table.
dnl #
AC_DEFUN([SPL_AC_CTL_NAME], [
AC_DEFUN([ZFS_AC_KERNEL_CTL_NAME], [
AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/sysctl.h>
],[
struct ctl_table ctl __attribute__ ((unused));
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-fallocate-pax.m4
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dnl #
dnl # PaX Linux 2.6.38 - 3.x API
dnl #
AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
AC_DEFUN([ZFS_AC_PAX_KERNEL_FILE_FALLOCATE], [
AC_MSG_CHECKING([whether fops->fallocate() exists])
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-group-info.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ dnl #
dnl # 4.9 API change
dnl # group_info changed from 2d array via >blocks to 1d array via ->gid
dnl #
AC_DEFUN([SPL_AC_GROUP_INFO_GID], [
AC_DEFUN([ZFS_AC_KERNEL_GROUP_INFO_GID], [
AC_MSG_CHECKING([whether group_info->gid exists])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/cred.h>
],[
struct group_info *gi = groups_alloc(1);
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-inode-lock.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ dnl # i_mutex is changed to i_rwsem. Instead of directly using
dnl # i_mutex/i_rwsem, we should use inode_lock() and inode_lock_shared()
dnl # We test inode_lock_shared because inode_lock is introduced earlier.
dnl #
AC_DEFUN([SPL_AC_INODE_LOCK], [
AC_DEFUN([ZFS_AC_KERNEL_INODE_LOCK], [
AC_MSG_CHECKING([whether inode_lock_shared() exists])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct inode *inode = NULL;
Expand Down
10 changes: 5 additions & 5 deletions config/kernel-kmem-cache.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ dnl # private allocation flags which are applied when allocating a new slab
dnl # in kmem_getpages(). Unfortunately there is no public API for setting
dnl # non-default flags.
dnl #
AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_ALLOCFLAGS], [
AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/slab.h>
],[
struct kmem_cache cachep __attribute__ ((unused));
Expand All @@ -20,7 +20,7 @@ AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/slab.h>
],[
struct kmem_cache cachep __attribute__ ((unused));
Expand All @@ -40,11 +40,11 @@ dnl # grsecurity API change,
dnl # kmem_cache_create() with SLAB_USERCOPY flag replaced by
dnl # kmem_cache_create_usercopy().
dnl #
AC_DEFUN([SPL_AC_KMEM_CACHE_CREATE_USERCOPY], [
AC_DEFUN([ZFS_AC_KERNEL_KMEM_CACHE_CREATE_USERCOPY], [
AC_MSG_CHECKING([whether kmem_cache_create_usercopy() exists])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/slab.h>
static void ctor(void *foo)
{
Expand Down
14 changes: 7 additions & 7 deletions config/kernel-kuidgid.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ dnl # User namespaces, use kuid_t in place of uid_t
dnl # where available. Not strictly a user namespaces thing
dnl # but it should prevent surprises
dnl #
AC_DEFUN([SPL_AC_KUIDGID_T], [
AC_DEFUN([ZFS_AC_KERNEL_KUIDGID_T], [
AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/uidgid.h>
], [
kuid_t userid = KUIDT_INIT(0);
kgid_t groupid = KGIDT_INIT(0);
kuid_t userid __attribute__ ((unused)) = KUIDT_INIT(0);
kgid_t groupid __attribute__ ((unused)) = KGIDT_INIT(0);
],[
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/uidgid.h>
], [
kuid_t userid = 0;
kgid_t groupid = 0;
kuid_t userid __attribute__ ((unused)) = 0;
kgid_t groupid __attribute__ ((unused)) = 0;
],[
AC_MSG_RESULT(yes; optional)
],[
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-pde-data.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ dnl #
dnl # 3.10 API change,
dnl # PDE is replaced by PDE_DATA
dnl #
AC_DEFUN([SPL_AC_PDE_DATA], [
AC_DEFUN([ZFS_AC_KERNEL_PDE_DATA], [
AC_MSG_CHECKING([whether PDE_DATA() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/proc_fs.h>
], [
PDE_DATA(NULL);
Expand Down
8 changes: 4 additions & 4 deletions config/kernel-rw.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ dnl # 4.14 API change
dnl # kernel_write() which was introduced in 3.9 was updated to take
dnl # the offset as a pointer which is needed by vn_rdwr().
dnl #
AC_DEFUN([SPL_AC_KERNEL_WRITE], [
AC_DEFUN([ZFS_AC_KERNEL_WRITE], [
AC_MSG_CHECKING([whether kernel_write() takes loff_t pointer])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct file *file = NULL;
Expand All @@ -32,11 +32,11 @@ dnl # 4.14 API change
dnl # kernel_read() which has existed for forever was updated to take
dnl # the offset as a pointer which is needed by vn_rdwr().
dnl #
AC_DEFUN([SPL_AC_KERNEL_READ], [
AC_DEFUN([ZFS_AC_KERNEL_READ], [
AC_MSG_CHECKING([whether kernel_read() takes loff_t pointer])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
struct file *file = NULL;
Expand Down
12 changes: 6 additions & 6 deletions config/kernel-rwsem.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ dnl #
dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
dnl #
AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
AC_DEFUN([ZFS_AC_KERNEL_RWSEM_SPINLOCK_IS_RAW], [
AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/rwsem.h>
],[
struct rw_semaphore dummy_semaphore __attribute__ ((unused));
Expand All @@ -30,11 +30,11 @@ dnl # 3.16 API Change
dnl #
dnl # rwsem-spinlock "->activity" changed to "->count"
dnl #
AC_DEFUN([SPL_AC_RWSEM_ACTIVITY], [
AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ACTIVITY], [
AC_MSG_CHECKING([whether struct rw_semaphore has member activity])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/rwsem.h>
],[
struct rw_semaphore dummy_semaphore __attribute__ ((unused));
Expand All @@ -54,12 +54,12 @@ dnl # 4.8 API Change
dnl #
dnl # rwsem "->count" changed to atomic_long_t type
dnl #
AC_DEFUN([SPL_AC_RWSEM_ATOMIC_LONG_COUNT], [
AC_DEFUN([ZFS_AC_KERNEL_RWSEM_ATOMIC_LONG_COUNT], [
AC_MSG_CHECKING(
[whether struct rw_semaphore has atomic_long_t member count])
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/rwsem.h>
],[
DECLARE_RWSEM(dummy_semaphore);
Expand Down
12 changes: 6 additions & 6 deletions config/kernel-sched.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ dnl #
dnl # 3.9 API change,
dnl # Moved things from linux/sched.h to linux/sched/rt.h
dnl #
AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
AC_DEFUN([ZFS_AC_KERNEL_SCHED_RT_HEADER],
[AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/sched.h>
#include <linux/sched/rt.h>
],[
Expand All @@ -21,9 +21,9 @@ dnl #
dnl # 4.11 API change,
dnl # Moved things from linux/sched.h to linux/sched/signal.h
dnl #
AC_DEFUN([SPL_AC_SCHED_SIGNAL_HEADER],
AC_DEFUN([ZFS_AC_KERNEL_SCHED_SIGNAL_HEADER],
[AC_MSG_CHECKING([whether header linux/sched/signal.h exists])
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/sched.h>
#include <linux/sched/signal.h>
],[
Expand All @@ -41,9 +41,9 @@ dnl # The io_schedule_timeout() function is present in all 2.6.32 kernels
dnl # but it was not exported until Linux 3.19. The RHEL 7.x kernels which
dnl # are based on a 3.10 kernel do export this symbol.
dnl #
AC_DEFUN([SPL_AC_IO_SCHEDULE_TIMEOUT], [
AC_DEFUN([ZFS_AC_KERNEL_IO_SCHEDULE_TIMEOUT], [
AC_MSG_CHECKING([whether io_schedule_timeout() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/sched.h>
], [
(void) io_schedule_timeout(1);
Expand Down
6 changes: 3 additions & 3 deletions config/kernel-set-fs-pwd.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ dnl #
dnl # 3.9 API change
dnl # set_fs_pwd takes const struct path *
dnl #
AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
AC_DEFUN([ZFS_AC_KERNEL_SET_FS_PWD_WITH_CONST],
tmp_flags="$EXTRA_KCFLAGS"
EXTRA_KCFLAGS="-Werror"
[AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/spinlock.h>
#include <linux/fs_struct.h>
#include <linux/path.h>
Expand All @@ -20,7 +20,7 @@ AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
[set_fs_pwd() needs const path *])
],[
SPL_LINUX_TRY_COMPILE([
ZFS_LINUX_TRY_COMPILE([
#include <linux/spinlock.h>
#include <linux/fs_struct.h>
#include <linux/path.h>
Expand Down
Loading

0 comments on commit cd73aef

Please sign in to comment.