Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Aug 2020 02:21:27 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364746 - in head: . cddl/compat/opensolaris/include cddl/contrib/opensolaris/cmd/lockstat cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd...
Message-ID:  <202008250221.07P2LRST044836@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Tue Aug 25 02:21:27 2020
New Revision: 364746
URL: https://svnweb.freebsd.org/changeset/base/364746

Log:
  Merge OpenZFS support in to HEAD.
  
  The primary benefit is maintaining a completely shared
  code base with the community allowing FreeBSD to receive
  new features sooner and with less effort.
  
  I would advise against doing 'zpool upgrade'
  or creating indispensable pools using new
  features until this change has had a month+
  to soak.
  
  Work on merging FreeBSD support in to what was
  at the time "ZFS on Linux" began in August 2018.
  I first publicly proposed transitioning FreeBSD
  to (new) OpenZFS on December 18th, 2018. FreeBSD
  support in OpenZFS was finally completed in December
  2019. A CFT for downstreaming OpenZFS support in
  to FreeBSD was first issued on July 8th. All issues
  that were reported have been addressed or, for
  a couple of less critical matters there are
  pull requests in progress with OpenZFS. iXsystems
  has tested and dogfooded extensively internally.
  The TrueNAS 12 release is based on OpenZFS with
  some additional features that have not yet made
  it upstream.
  
  Improvements include:
    project quotas, encrypted datasets,
    allocation classes, vectorized raidz,
    vectorized checksums, various command line
    improvements, zstd compression.
  
  Thanks to those who have helped along the way:
  Ryan Moeller, Allan Jude, Zack Welch, and many
  others.
  
  Sponsored by:	iXsystems, Inc.
  Differential Revision:	https://reviews.freebsd.org/D25872

Added:
  head/cddl/lib/libicp/
  head/cddl/lib/libicp/Makefile   (contents, props changed)
  head/cddl/lib/libicp_rescue/
  head/cddl/lib/libicp_rescue/Makefile   (contents, props changed)
  head/cddl/lib/libspl/
  head/cddl/lib/libspl/Makefile   (contents, props changed)
  head/cddl/lib/libtpool/
  head/cddl/lib/libtpool/Makefile   (contents, props changed)
  head/cddl/lib/libzutil/
  head/cddl/lib/libzutil/Makefile   (contents, props changed)
  head/cddl/usr.bin/zstream/
  head/cddl/usr.bin/zstream/Makefile   (contents, props changed)
  head/sys/modules/zfs/static_ccompile.h   (contents, props changed)
  head/sys/modules/zfs/zfs_config.h   (contents, props changed)
  head/sys/modules/zfs/zfs_gitrev.h   (contents, props changed)
Deleted:
  head/cddl/compat/opensolaris/include/mnttab.h
  head/cddl/contrib/opensolaris/cmd/zdb/
  head/cddl/contrib/opensolaris/cmd/zfs/
  head/cddl/contrib/opensolaris/cmd/zhack/
  head/cddl/contrib/opensolaris/cmd/zinject/
  head/cddl/contrib/opensolaris/cmd/zlook/
  head/cddl/contrib/opensolaris/cmd/zpool/
  head/cddl/contrib/opensolaris/cmd/zstreamdump/
  head/cddl/contrib/opensolaris/cmd/ztest/
  head/cddl/contrib/opensolaris/lib/libnvpair/
  head/cddl/contrib/opensolaris/lib/libuutil/
  head/cddl/contrib/opensolaris/lib/libzfs/
  head/cddl/contrib/opensolaris/lib/libzfs_core/
  head/cddl/contrib/opensolaris/lib/libzpool/
  head/cddl/usr.bin/zlook/
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_sysevent.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c
  head/sys/cddl/compat/opensolaris/sys/acl.h
  head/sys/cddl/compat/opensolaris/sys/file.h
  head/sys/cddl/compat/opensolaris/sys/kobj.h
  head/sys/cddl/compat/opensolaris/sys/lock.h
  head/sys/cddl/compat/opensolaris/sys/mman.h
  head/sys/cddl/compat/opensolaris/sys/mount.h
  head/sys/cddl/compat/opensolaris/sys/mutex.h
  head/sys/cddl/compat/opensolaris/sys/nvpair.h
  head/sys/cddl/compat/opensolaris/sys/param.h
  head/sys/cddl/compat/opensolaris/sys/proc.h
  head/sys/cddl/compat/opensolaris/sys/stat.h
  head/sys/cddl/compat/opensolaris/sys/systm.h
  head/sys/cddl/compat/opensolaris/sys/time.h
  head/sys/cddl/compat/opensolaris/sys/types.h
  head/sys/cddl/compat/opensolaris/sys/uio.h
  head/sys/cddl/compat/opensolaris/sys/vnode.h
  head/sys/cddl/contrib/opensolaris/common/acl/
  head/sys/cddl/contrib/opensolaris/common/atomic/
  head/sys/cddl/contrib/opensolaris/common/avl/
  head/sys/cddl/contrib/opensolaris/common/nvpair/
  head/sys/cddl/contrib/opensolaris/common/zfs/
  head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/
  head/sys/cddl/contrib/opensolaris/uts/common/os/callb.c
  head/sys/cddl/contrib/opensolaris/uts/common/os/fm.c
  head/sys/cddl/contrib/opensolaris/uts/common/os/nvpair_alloc_system.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/
  head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/
  head/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h
Modified:
  head/Makefile.inc1
  head/cddl/compat/opensolaris/include/fcntl.h
  head/cddl/contrib/opensolaris/cmd/lockstat/sym.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c
  head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c
  head/cddl/lib/Makefile
  head/cddl/lib/drti/Makefile
  head/cddl/lib/libavl/Makefile
  head/cddl/lib/libctf/Makefile
  head/cddl/lib/libdtrace/Makefile
  head/cddl/lib/libnvpair/Makefile
  head/cddl/lib/libuutil/Makefile
  head/cddl/lib/libzfs/Makefile
  head/cddl/lib/libzfs_core/Makefile
  head/cddl/lib/libzpool/Makefile
  head/cddl/lib/libzpool/Makefile.depend
  head/cddl/sbin/zfs/Makefile
  head/cddl/sbin/zpool/Makefile
  head/cddl/usr.bin/Makefile
  head/cddl/usr.bin/ctfconvert/Makefile
  head/cddl/usr.bin/ctfconvert/Makefile.depend
  head/cddl/usr.bin/ctfdump/Makefile
  head/cddl/usr.bin/ctfmerge/Makefile
  head/cddl/usr.bin/zinject/Makefile
  head/cddl/usr.bin/zstreamdump/Makefile
  head/cddl/usr.bin/ztest/Makefile
  head/cddl/usr.sbin/dtrace/Makefile
  head/cddl/usr.sbin/lockstat/Makefile
  head/cddl/usr.sbin/plockstat/Makefile
  head/cddl/usr.sbin/zdb/Makefile
  head/cddl/usr.sbin/zfsd/Makefile.common
  head/cddl/usr.sbin/zfsd/callout.cc
  head/cddl/usr.sbin/zfsd/case_file.cc
  head/cddl/usr.sbin/zfsd/tests/zfsd_unittest.cc
  head/cddl/usr.sbin/zfsd/vdev.cc
  head/cddl/usr.sbin/zfsd/vdev_iterator.cc
  head/cddl/usr.sbin/zfsd/zfsd.cc
  head/cddl/usr.sbin/zfsd/zfsd_event.cc
  head/cddl/usr.sbin/zfsd/zfsd_exception.cc
  head/cddl/usr.sbin/zfsd/zpool_list.cc
  head/cddl/usr.sbin/zhack/Makefile
  head/include/Makefile
  head/lib/libbe/Makefile
  head/lib/libbe/be.c
  head/lib/libbe/tests/Makefile
  head/lib/libproc/Makefile
  head/lib/libproc/proc_bkpt.c
  head/lib/libproc/proc_sym.c
  head/lib/libprocstat/libprocstat.c
  head/lib/libprocstat/zfs/Makefile
  head/lib/libprocstat/zfs_defs.c
  head/libexec/rc/rc.d/zfs
  head/rescue/rescue/Makefile
  head/sbin/bectl/Makefile
  head/sbin/bectl/Makefile.depend
  head/sbin/bectl/bectl.c
  head/sbin/zfsbootcfg/Makefile
  head/share/mk/bsd.libnames.mk
  head/share/mk/src.libnames.mk
  head/sys/cddl/compat/opensolaris/kern/opensolaris.c
  head/sys/cddl/compat/opensolaris/sys/misc.h
  head/sys/cddl/compat/opensolaris/sys/modctl.h
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/ccompile.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
  head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
  head/sys/cddl/dev/fbt/fbt.c
  head/sys/cddl/dev/profile/profile.c
  head/sys/cddl/dev/sdt/sdt.c
  head/sys/cddl/dev/systrace/systrace.c
  head/sys/conf/files
  head/sys/conf/files.amd64
  head/sys/conf/kern.pre.mk
  head/sys/conf/kmod.mk
  head/sys/modules/Makefile
  head/sys/modules/dtrace/dtaudit/Makefile
  head/sys/modules/dtrace/dtmalloc/Makefile
  head/sys/modules/dtrace/dtnfscl/Makefile
  head/sys/modules/dtrace/dtrace/Makefile
  head/sys/modules/dtrace/fasttrap/Makefile
  head/sys/modules/dtrace/fbt/Makefile
  head/sys/modules/dtrace/profile/Makefile
  head/sys/modules/dtrace/prototype/Makefile
  head/sys/modules/dtrace/sdt/Makefile
  head/sys/modules/dtrace/systrace/Makefile
  head/sys/modules/dtrace/systrace_freebsd32/Makefile
  head/sys/modules/dtrace/systrace_linux/Makefile
  head/sys/modules/dtrace/systrace_linux32/Makefile
  head/sys/modules/opensolaris/Makefile
  head/sys/modules/zfs/Makefile
  head/sys/vm/vm.h
  head/tests/sys/cddl/zfs/bin/file_write.c
  head/tools/boot/rootgen.sh
  head/usr.sbin/fstyp/Makefile
  head/usr.sbin/fstyp/zfs.c

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/Makefile.inc1	Tue Aug 25 02:21:27 2020	(r364746)
@@ -2442,7 +2442,7 @@ _btxld=		usr.sbin/btxld
 # Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures
 # resulting from missing bug fixes or ELF Toolchain updates.
 .if ${MK_CDDL} != "no"
-_dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \
+_dtrace_tools= cddl/lib/libctf cddl/lib/libspl cddl/usr.bin/ctfconvert \
     cddl/usr.bin/ctfmerge
 .endif
 
@@ -2756,7 +2756,12 @@ _prebuild_libs=	${_kerberos5_lib_libasn1} \
 		${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
 		${_cddl_lib_libuutil} \
 		${_cddl_lib_libavl} \
+		${_cddl_lib_libicp} \
+		${_cddl_lib_libicp_rescue} \
+		${_cddl_lib_libspl} \
+		${_cddl_lib_libtpool} \
 		${_cddl_lib_libzfs_core} ${_cddl_lib_libzfs} \
+		${_cddl_lib_libzutil} \
 		${_cddl_lib_libctf} \
 		lib/libufs \
 		lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
@@ -2826,21 +2831,34 @@ _cddl_lib_libumem= cddl/lib/libumem
 _cddl_lib_libnvpair= cddl/lib/libnvpair
 _cddl_lib_libavl= cddl/lib/libavl
 _cddl_lib_libuutil= cddl/lib/libuutil
+_cddl_lib_libspl= cddl/lib/libspl
+
+cddl/lib/libuutil__L: cddl/lib/libavl__L cddl/lib/libspl__L
+
 .if ${MK_ZFS} != "no"
+_cddl_lib_libicp= cddl/lib/libicp
+_cddl_lib_libicp_rescue= cddl/lib/libicp_rescue
+_cddl_lib_libtpool= cddl/lib/libtpool
+_cddl_lib_libzutil= cddl/lib/libzutil
 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
 _cddl_lib_libzfs= cddl/lib/libzfs
 
+cddl/lib/libtpool__L: cddl/lib/libspl__L
+
+cddl/lib/libzutil__L: cddl/lib/libavl__L cddl/lib/libtpool__L
+
 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
 
 cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__L lib/libutil__L
 cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L
 cddl/lib/libzfs__L: cddl/lib/libuutil__L cddl/lib/libavl__L lib/libgeom__L
+cddl/lib/libzfs__L: cddl/lib/libnvpair__L cddl/lib/libzutil__L
 
 lib/libbe__L: cddl/lib/libzfs__L
 .endif
 _cddl_lib_libctf= cddl/lib/libctf
 _cddl_lib= cddl/lib
-cddl/lib/libctf__L: lib/libz__L
+cddl/lib/libctf__L: lib/libz__L cddl/lib/libspl__L
 .endif
 # cddl/lib/libdtrace requires lib/libproc and lib/librtld_db
 _prebuild_libs+=	lib/libprocstat lib/libproc lib/librtld_db

Modified: head/cddl/compat/opensolaris/include/fcntl.h
==============================================================================
--- head/cddl/compat/opensolaris/include/fcntl.h	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/compat/opensolaris/include/fcntl.h	Tue Aug 25 02:21:27 2020	(r364746)
@@ -32,7 +32,9 @@
 
 #include_next <fcntl.h>
 
+#ifndef open64
 #define open64(...)	open(__VA_ARGS__)
+#endif
 #define openat64(...)	openat(__VA_ARGS__)
 
 #endif

Modified: head/cddl/contrib/opensolaris/cmd/lockstat/sym.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/lockstat/sym.c	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/contrib/opensolaris/cmd/lockstat/sym.c	Tue Aug 25 02:21:27 2020	(r364746)
@@ -54,6 +54,7 @@
 #endif
 #include <sys/cpuvar.h>
 
+
 typedef struct syment {
 	uintptr_t	addr;
 	char		*name;
@@ -71,6 +72,11 @@ static char maxsymname[64];
 #define	elf_getshdr elf32_getshdr
 #endif
 #endif
+
+#define __sElfN(x)       typedef __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) x
+__sElfN(Sym);
+__sElfN(Shdr);
+#define	elf_getshdr		__elfN(getshdr)
 
 static void
 add_symbol(char *name, uintptr_t addr, size_t size)

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c	Tue Aug 25 02:21:27 2020	(r364746)
@@ -24,6 +24,7 @@
  * Use is subject to license terms.
  */
 
+#include <sys/types.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <dlfcn.h>

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c	Tue Aug 25 02:21:27 2020	(r364746)
@@ -31,6 +31,7 @@
 
 #include <assert.h>
 #include <elf.h>
+#include <sys/types.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <limits.h>

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_print.c	Tue Aug 25 02:21:27 2020	(r364746)
@@ -77,7 +77,6 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <arpa/nameser.h>
 
 #include <dt_module.h>
 #include <dt_printf.h>

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c	Tue Aug 25 02:21:27 2020	(r364746)
@@ -44,11 +44,18 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <arpa/nameser.h>
-
+#include <sys/byteorder.h>
 #include <dt_printf.h>
 #include <dt_string.h>
 #include <dt_impl.h>
+
+#ifndef NS_IN6ADDRSZ
+#define NS_IN6ADDRSZ 16
+#endif
+
+#ifndef NS_INADDRSZ
+#define NS_INADDRSZ 4
+#endif
 
 /*ARGSUSED*/
 static int

Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c
==============================================================================
--- head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c	Tue Aug 25 02:21:27 2020	(r364746)
@@ -29,6 +29,7 @@
  * Utility functions
  */
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

Modified: head/cddl/lib/Makefile
==============================================================================
--- head/cddl/lib/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -6,27 +6,40 @@ SUBDIR=	drti \
 	libavl \
 	libctf \
 	libdtrace \
+	${_libicp} \
+	${_libicp_rescue} \
 	libnvpair \
+	libspl \
+	${_libtpool} \
 	libumem \
 	libuutil \
 	${_libzfs_core} \
 	${_libzfs} \
 	${_libzpool} \
+	${_libzutil}
 
 SUBDIR.${MK_TESTS}+= tests
 
 .if ${MK_ZFS} != "no"
 _libzfs_core=	libzfs_core
+_libicp=	libicp
+_libicp_rescue=	libicp_rescue
 _libzfs=	libzfs
+_libzutil=	libzutil
 .if ${MK_LIBTHR} != "no"
 _libzpool=	libzpool
+_libtpool=	libtpool
 .endif
 .endif
 
+SUBDIR_DEPEND_libctf=		libspl
 SUBDIR_DEPEND_libdtrace=	libctf
+SUBDIR_DEPEND_libtpool=		libspl
+SUBDIR_DEPEND_libuutil=		libavl libspl
 SUBDIR_DEPEND_libzfs_core=	libnvpair
-SUBDIR_DEPEND_libzfs=	libavl libnvpair libumem libuutil libzfs_core
-SUBDIR_DEPEND_libzpool=	libavl libnvpair libumem
+SUBDIR_DEPEND_libzfs=	libavl libnvpair libumem libuutil libzfs_core libzutil
+SUBDIR_DEPEND_libzpool=	libavl libnvpair libumem libicp
+SUBDIR_DEPEND_libzutil=	libavl libtpool
 
 SUBDIR_PARALLEL=
 

Modified: head/cddl/lib/drti/Makefile
==============================================================================
--- head/cddl/lib/drti/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/drti/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -11,7 +11,14 @@ FILESDIR=	${LIBDIR}/dtrace
 CLEANFILES=	${FILES}
 # These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
 .undef LIBRARIES_ONLY
-
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd/spl
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID
 CFLAGS+=	-I${SRCTOP}/sys/cddl/compat/opensolaris \
 		-I${SRCTOP}/cddl/compat/opensolaris/include \
 		-I${OPENSOLARIS_USR_DISTDIR}/head \

Modified: head/cddl/lib/libavl/Makefile
==============================================================================
--- head/cddl/lib/libavl/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/libavl/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -1,12 +1,15 @@
 # $FreeBSD$
 
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/avl
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/avl
 
 PACKAGE=	runtime
 LIB=	avl
 SRCS=	avl.c
 WARNS?=	3
-CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
-
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
 .include <bsd.lib.mk>

Modified: head/cddl/lib/libctf/Makefile
==============================================================================
--- head/cddl/lib/libctf/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/libctf/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -21,6 +21,14 @@ MAN=		ctf.5
 WARNS?=		2
 CFLAGS+=	-DCTF_OLD_VERSIONS
 
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd/spl
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID
+
 CFLAGS+=	-I${SRCTOP}/sys/cddl/compat/opensolaris \
 		-I${SRCTOP}/cddl/compat/opensolaris/include \
 		-I${OPENSOLARIS_USR_DISTDIR}/head \
@@ -28,6 +36,6 @@ CFLAGS+=	-I${SRCTOP}/sys/cddl/compat/opensolaris \
 		-I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \
 		-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
 
-LIBADD+=	z
+LIBADD+=	spl z
 
 .include <bsd.lib.mk>

Modified: head/cddl/lib/libdtrace/Makefile
==============================================================================
--- head/cddl/lib/libdtrace/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/libdtrace/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -66,6 +66,16 @@ FILESMODE=	${NOBINMODE}
 
 WARNS?=		1
 
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd/spl
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID
+
+
 CFLAGS+=	-I${.OBJDIR} -I${.CURDIR} \
 		-I${SRCTOP}/sys/cddl/dev/dtrace/${MACHINE_ARCH} \
 		-I${SRCTOP}/sys/cddl/compat/opensolaris \

Added: head/cddl/lib/libicp/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/lib/libicp/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -0,0 +1,101 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
+
+PACKAGE=	runtime
+LIB=	icp
+LIBADD=
+
+
+.if ${MACHINE_ARCH} == "amd64"
+ASM_SOURCES_C = asm-x86_64/aes/aeskey.c
+ASM_SOURCES_AS = \
+        asm-x86_64/aes/aes_amd64.S \
+        asm-x86_64/aes/aes_aesni.S \
+        asm-x86_64/modes/gcm_pclmulqdq.S \
+        asm-x86_64/modes/aesni-gcm-x86_64.S \
+        asm-x86_64/modes/ghash-x86_64.S \
+        asm-x86_64/sha1/sha1-x86_64.S \
+        asm-x86_64/sha2/sha256_impl.S \
+        asm-x86_64/sha2/sha512_impl.S
+
+CFLAGS+= -D__amd64 -D_SYS_STACK_H -UHAVE_AES
+.else
+ASM_SOURCES_C =
+ASM_SOURCES_AS =
+.endif
+
+
+KERNEL_C = \
+        spi/kcf_spi.c \
+        api/kcf_ctxops.c \
+        api/kcf_digest.c \
+        api/kcf_cipher.c \
+        api/kcf_miscapi.c \
+        api/kcf_mac.c \
+        algs/aes/aes_impl_aesni.c \
+        algs/aes/aes_impl_generic.c \
+        algs/aes/aes_impl_x86-64.c \
+        algs/aes/aes_impl.c \
+        algs/aes/aes_modes.c \
+        algs/edonr/edonr.c \
+        algs/modes/modes.c \
+        algs/modes/cbc.c \
+        algs/modes/gcm_generic.c \
+        algs/modes/gcm_pclmulqdq.c \
+        algs/modes/gcm.c \
+        algs/modes/ctr.c \
+        algs/modes/ccm.c \
+        algs/modes/ecb.c \
+        algs/sha1/sha1.c \
+        algs/sha2/sha2.c \
+        algs/skein/skein.c \
+        algs/skein/skein_block.c \
+        algs/skein/skein_iv.c \
+        illumos-crypto.c \
+        io/aes.c \
+        io/edonr_mod.c \
+        io/sha1_mod.c \
+        io/sha2_mod.c \
+        io/skein_mod.c \
+        os/modhash.c \
+        os/modconf.c \
+        core/kcf_sched.c \
+        core/kcf_prov_lib.c \
+        core/kcf_callprov.c \
+        core/kcf_mech_tabs.c \
+        core/kcf_prov_tabs.c \
+        $(ASM_SOURCES_C)
+
+
+
+
+
+
+SRCS= $(ASM_SOURCES_AS) $(KERNEL_C)
+
+WARNS?=	2
+SHLIB_MAJOR= 3
+CSTD=	c99
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID
+CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
+
+
+CFLAGS.aes_amd64.S+= -DLOCORE
+CFLAGS.aes_aesni.S+= -DLOCORE
+CFLAGS.gcm_pclmulqdq.S+= -DLOCORE
+CFLAGS.aesni-gcm-x86_64.S+= -DLOCORE
+CFLAGS.ghash-x86_64.S+= -DLOCORE
+CFLAGS.sha1-x86_64.S+= -DLOCORE
+CFLAGS.sha256_impl.S+= -DLOCORE
+CFLAGS.sha512_impl.S+= -DLOCORE
+
+.include <bsd.lib.mk>

Added: head/cddl/lib/libicp_rescue/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/lib/libicp_rescue/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -0,0 +1,99 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
+
+PACKAGE=	runtime
+LIB=	icp_rescue
+LIBADD=
+
+
+.if ${MACHINE_ARCH} == "amd64"
+ASM_SOURCES_C = asm-x86_64/aes/aeskey.c
+ASM_SOURCES_AS = \
+        asm-x86_64/aes/aes_amd64.S \
+        asm-x86_64/aes/aes_aesni.S \
+        asm-x86_64/modes/gcm_pclmulqdq.S \
+        asm-x86_64/modes/aesni-gcm-x86_64.S \
+        asm-x86_64/sha1/sha1-x86_64.S \
+        asm-x86_64/sha2/sha256_impl.S \
+        asm-x86_64/sha2/sha512_impl.S
+
+CFLAGS+= -D__amd64 -D_SYS_STACK_H
+.else
+ASM_SOURCES_C =
+ASM_SOURCES_AS =
+.endif
+
+
+KERNEL_C = \
+        spi/kcf_spi.c \
+        api/kcf_ctxops.c \
+        api/kcf_digest.c \
+        api/kcf_cipher.c \
+        api/kcf_miscapi.c \
+        api/kcf_mac.c \
+        algs/aes/aes_impl_aesni.c \
+        algs/aes/aes_impl_generic.c \
+        algs/aes/aes_impl_x86-64.c \
+        algs/aes/aes_impl.c \
+        algs/aes/aes_modes.c \
+        algs/edonr/edonr.c \
+        algs/modes/modes.c \
+        algs/modes/cbc.c \
+        algs/modes/gcm_generic.c \
+        algs/modes/gcm_pclmulqdq.c \
+        algs/modes/gcm.c \
+        algs/modes/ctr.c \
+        algs/modes/ccm.c \
+        algs/modes/ecb.c \
+        algs/sha1/sha1.c \
+        algs/sha2/sha2.c \
+        algs/skein/skein_block.c \
+        illumos-crypto.c \
+        io/aes.c \
+        io/edonr_mod.c \
+        io/sha1_mod.c \
+        io/sha2_mod.c \
+        io/skein_mod.c \
+        os/modhash.c \
+        os/modconf.c \
+        core/kcf_sched.c \
+        core/kcf_prov_lib.c \
+        core/kcf_callprov.c \
+        core/kcf_mech_tabs.c \
+        core/kcf_prov_tabs.c \
+        $(ASM_SOURCES_C)
+
+
+
+
+
+
+SRCS= $(ASM_SOURCES_AS) $(KERNEL_C)
+
+WARNS?=	2
+SHLIB_MAJOR= 3
+CSTD=	c99
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID -UHAVE_AVX -DRESCUE
+CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
+
+
+CFLAGS.aes_amd64.S+= -DLOCORE
+CFLAGS.aes_aesni.S+= -DLOCORE
+CFLAGS.gcm_pclmulqdq.S+= -DLOCORE
+CFLAGS.aesni-gcm-x86_64.S+= -DLOCORE
+CFLAGS.ghash-x86_64.S+= -DLOCORE
+CFLAGS.sha1-x86_64.S+= -DLOCORE
+CFLAGS.sha256_impl.S+= -DLOCORE
+CFLAGS.sha512_impl.S+= -DLOCORE
+CFLAGS.gcm.c+= -UCAN_USE_GCM_ASM
+
+.include <bsd.lib.mk>

Modified: head/cddl/lib/libnvpair/Makefile
==============================================================================
--- head/cddl/lib/libnvpair/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/libnvpair/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -1,36 +1,30 @@
 # $FreeBSD$
 
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/nvpair
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/nvpair
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libnvpair
 
 LIB=	nvpair
 
 PACKAGE=	runtime
-INCS=	libnvpair.h
+# user
 SRCS=	libnvpair.c \
-	nvpair_alloc_system.c \
-	nvpair_json.c \
-	opensolaris_fnvpair.c \
-	opensolaris_nvpair.c \
-	opensolaris_nvpair_alloc_fixed.c
+	libnvpair_json.c \
+	nvpair_alloc_system.c
+# kernel
+SRCS+= nvpair_alloc_fixed.c \
+	nvpair.c \
+	fnvpair.c
 
-WARNS?=	1
-CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+WARNS?=	2
+CFLAGS+= -DIN_BASE -DHAVE_RPC_TYPES
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
 CFLAGS+= -I${SRCTOP}/sys
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
-CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID  -DHAVE_CONFIG_H -DHAVE_XDR_BYTESREC
 
-# This library uses macros to define fprintf behavior for several object types
-# The compiler will see the non-string literal arguments to the fprintf calls and
-# omit warnings for them. Quiesce these warnings in contrib code:
-#
-# cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c:743:12: warning: format
-#   string is not a string literal (potentially insecure) [-Wformat-security]
-#    ARENDER(pctl, nvlist_array, nvl, name, val, nelem);
-#
-CFLAGS+= -Wno-format-security
+
+CFLAGS.nvpair.c+= -UHAVE_RPC_TYPES
 .include <bsd.lib.mk>

Added: head/cddl/lib/libspl/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/lib/libspl/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -0,0 +1,56 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libspl
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libspl/os/freebsd
+.PATH: ${SRCTOP}/sys/contrib/openzfs/include
+
+
+LIB=	spl
+LIBADD=
+PACKAGE=	runtime
+
+SRCS = \
+        assert.c \
+        list.c \
+        mkdirp.c \
+        page.c \
+        strlcat.c \
+        strlcpy.c \
+        timestamp.c \
+        zone.c \
+        include/sys/list.h \
+        include/sys/list_impl.h
+
+SRCS += \
+        getexecname.c \
+        gethostid.c \
+        getmntany.c \
+        mnttab.c
+
+
+.if ${MACHINE_ARCH} == "amd64"
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libspl/asm-x86_64
+SRCS += atomic.S
+.elif ${MACHINE_ARCH} == "i386"
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libspl/asm-i386
+SRCS += atomic.S
+.else
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libspl/asm-generic
+SRCS += atomic.c
+.endif
+
+
+WARNS?=	2
+CSTD=	c99
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID
+CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
+CFLAGS.atomic.S+= -DLOCORE
+
+.include <bsd.lib.mk>

Added: head/cddl/lib/libtpool/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/lib/libtpool/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libtpool
+.PATH: ${SRCTOP}/sys/contrib/openzfs/include
+
+
+LIB=	tpool
+LIBADD=	spl
+PACKAGE=	runtime
+
+INCS=	thread_pool_impl.h
+SRCS=	thread_pool.c
+
+WARNS?=	2
+CSTD=	c99
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
+CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID 
+CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
+
+.include <bsd.lib.mk>

Modified: head/cddl/lib/libuutil/Makefile
==============================================================================
--- head/cddl/lib/libuutil/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/libuutil/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -1,11 +1,10 @@
 # $FreeBSD$
 
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/avl
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libuutil
 
 PACKAGE=	runtime
 LIB=	uutil
-SRCS=	avl.c \
+SRCS=\
 	uu_alloc.c \
 	uu_avl.c \
 	uu_dprintf.c \
@@ -14,14 +13,17 @@ SRCS=	avl.c \
 	uu_misc.c \
 	uu_open.c \
 	uu_pname.c \
-	uu_strtoint.c
+	uu_string.c
 
-WARNS?=	1
-CFLAGS+= -DNATIVE_BUILD
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
+WARNS?=	2
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
 CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+
+LIBADD= avl spl
 
 .include <bsd.lib.mk>

Modified: head/cddl/lib/libzfs/Makefile
==============================================================================
--- head/cddl/lib/libzfs/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/libzfs/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -1,62 +1,102 @@
 # $FreeBSD$
 
-.PATH: ${SRCTOP}/cddl/compat/opensolaris/misc
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils/common
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zcommon
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs/os/freebsd
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libshare
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libshare/os/freebsd
+.PATH: ${SRCTOP}/sys/contrib/openzfs/include
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd/lib
 
 PACKAGE=	runtime
 LIB=	zfs
-LIBADD=	md pthread umem util uutil m avl bsdxml geom nvpair z zfs_core
-SRCS=	deviceid.c \
-	fsshare.c \
-	mkdirp.c \
-	mnttab.c \
-	thread_pool.c \
-	zmount.c \
-	zone.c
+LIBADD=	md pthread umem util uutil m avl bsdxml geom nvpair z zfs_core zutil
 
-SRCS+=	nicenum.c
+INCS=	libzfs.h
+USER_C = \
+        libzfs_changelist.c \
+        libzfs_config.c \
+        libzfs_crypto.c \
+        libzfs_dataset.c \
+        libzfs_diff.c \
+        libzfs_import.c \
+        libzfs_iter.c \
+        libzfs_mount.c \
+        libzfs_pool.c \
+        libzfs_sendrecv.c \
+        libzfs_status.c \
+        libzfs_util.c
 
-SRCS+=	libzfs_changelist.c \
-	libzfs_compat.c \
-	libzfs_config.c \
-	libzfs_dataset.c \
-	libzfs_diff.c \
-	libzfs_import.c \
-	libzfs_iter.c \
-	libzfs_mount.c \
-	libzfs_pool.c \
-	libzfs_sendrecv.c \
-	libzfs_status.c \
-	libzfs_util.c \
-	zfeature_common.c \
-	zfs_comutil.c \
-	zfs_deleg.c \
-	zfs_fletcher.c \
-	zfs_namecheck.c \
-	zfs_prop.c \
-	zpool_prop.c \
-	zprop_common.c \
+# FreeBSD
+USER_C += \
+        libzfs_compat.c \
+        libzfs_ioctl_compat.c \
+        libzfs_zmount.c
 
-WARNS?=	0
-SHLIB_MAJOR= 3
+# libshare
+USER_C += \
+	libshare.c \
+	nfs.c \
+	smb.c
+
+
+KERNEL_C = \
+        algs/sha2/sha2.c \
+        cityhash.c \
+        zfeature_common.c \
+        zfs_comutil.c \
+        zfs_deleg.c \
+        zfs_fletcher.c \
+        zfs_fletcher_superscalar.c \
+        zfs_fletcher_superscalar4.c \
+        zfs_namecheck.c \
+        zfs_prop.c \
+        zfs_uio.c \
+        zpool_prop.c \
+        zprop_common.c
+
+
+KERNEL_C+= 	zstd.c \
+		zfs_zstd.c
+
+
+ARCH_C =
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
+ARCH_C += 	zfs_fletcher_intel.c \
+		zfs_fletcher_sse.c 
+CFLAGS +=  -DHAVE_SSE2
+.endif
+.if ${MACHINE_ARCH} == "amd64"
+ARCH_C +=	zfs_fletcher_avx512.c
+CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F
+.endif
+.if ${MACHINE_ARCH} == "aarch64"
+ARCH_C +=	zfs_fletcher_aarch64_neon.c
+.endif
+
+SRCS= $(USER_C) $(KERNEL_C) $(ARCH_C)
+
+WARNS?=	2
+SHLIB_MAJOR= 4
 CSTD=	c99
-CFLAGS+= -DZFS_NO_ACL
-CFLAGS+= -I${SRCTOP}/sbin/mount
-CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libshare
+CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include
+CFLAGS+= -I${SRCTOP}/sys
 CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
+CFLAGS+= -I${SRCDIR}/sys/contrib/openzfs/module/zstd/include
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID
+CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
+CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
+CFLAGS.zstd.c= -fno-tree-vectorize
+
 
 .include <bsd.lib.mk>

Modified: head/cddl/lib/libzfs_core/Makefile
==============================================================================
--- head/cddl/lib/libzfs_core/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/libzfs_core/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -1,37 +1,28 @@
 # $FreeBSD$
 
-.PATH: ${SRCTOP}/cddl/compat/opensolaris/misc
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs_core
+.PATH: ${SRCTOP}/sys/contrib/openzfs/include
 
+
 LIB=	zfs_core
 LIBADD=	nvpair
 PACKAGE=	runtime
 
 INCS=	libzfs_core.h
-SRCS=	libzfs_core.c \
-	libzfs_core_compat.c \
-	zfs_ioctl_compat.c
+SRCS=	libzfs_core.c 
 
-SRCS+=	libzfs_compat.c
-
-WARNS?=	0
+WARNS?=	2
 CSTD=	c99
-CFLAGS+= -DZFS_NO_ACL
-CFLAGS+= -I${SRCTOP}/sbin/mount
-CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris
+CFLAGS+= -DIN_BASE
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libzfs_core/common
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
+CFLAGS+= -I${SRCTOP}/sys
 CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head
-CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common
-CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
+CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
+CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
+CFLAGS+= -DHAVE_ISSETUGID
+CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
 
 .include <bsd.lib.mk>

Modified: head/cddl/lib/libzpool/Makefile
==============================================================================
--- head/cddl/lib/libzpool/Makefile	Tue Aug 25 02:14:36 2020	(r364745)
+++ head/cddl/lib/libzpool/Makefile	Tue Aug 25 02:21:27 2020	(r364746)
@@ -1,20 +1,17 @@
 # $FreeBSD$
 
-.include "${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/Makefile.files"
 
 # ZFS_COMMON_SRCS
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zfs
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zcommon
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/unicode
 # LUA_SRCS
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua
-# ZFS_SHARED_SRCS
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-# LZ4_COMMON_SRCS
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4
-# KERNEL_SRCS
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
-# LIST_SRCS
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/os
-# ATOMIC_SRCS
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/lua
+
+.PATH: ${SRCTOP}/sys/contrib/openzfs/module/os/linux/zfs
+
+.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzpool
+
 .if exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S)
 .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
 ATOMIC_SRCS=	opensolaris_atomic.S
@@ -23,40 +20,218 @@ ACFLAGS+=	-Wa,--noexecstack
 .PATH: ${SRCTOP}/sys/cddl/compat/opensolaris/kern
 ATOMIC_SRCS=	opensolaris_atomic.c
 .endif
-# UNICODE_SRCS
-.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/unicode
-# LIBCMDUTILS_SRCS
-.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils/common
 
+.if ${MACHINE_ARCH} == "powerpc"
+# Don't waste GOT entries on small data.
+PICFLAG=	-fPIC
+.endif
+
 LIB=		zpool
 
-ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} trim_map.c
-ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/}
-LZ4_COMMON_SRCS= lz4.c
-LUA_SRCS=	${LUA_OBJS:C/.o$/.c/}
-KERNEL_SRCS=	kernel.c taskq.c util.c
-LIST_SRCS=	list.c
-UNICODE_SRCS=	u8_textprep.c
-LIBCMDUTILS_SRCS=nicenum.c
 
-SRCS=		${ZFS_COMMON_SRCS} ${ZFS_SHARED_SRCS} ${LUA_SRCS} \
-		${LZ4_COMMON_SRCS} ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \
-		${UNICODE_SRCS} ${LIBCMDUTILS_SRCS}
 
-WARNS?=		0
-CFLAGS+=	-I${SRCTOP}/sys/cddl/compat/opensolaris
-CFLAGS+=	-I${SRCTOP}/cddl/compat/opensolaris/include
-CFLAGS+=	-I${SRCTOP}/cddl/compat/opensolaris/lib/libumem
-CFLAGS+=	-I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common
-CFLAGS+=	-I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common
-CFLAGS+=	-I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
-CFLAGS+=	-I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua
-CFLAGS+=	-I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs
-CFLAGS+=	-I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4
-CFLAGS+=	-I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common
-CFLAGS+=	-I${SRCTOP}/cddl/contrib/opensolaris/head
-CFLAGS+=	-I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair
-CFLAGS+=	-I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils
+USER_C = \
+	kernel.c \
+	taskq.c \
+	util.c
+
+KERNEL_C = \
+	zfeature_common.c \
+	zfs_comutil.c \
+	zfs_deleg.c \
+	zfs_fletcher.c \
+	zfs_fletcher_superscalar.c \
+	zfs_fletcher_superscalar4.c \
+	zfs_namecheck.c \
+	zfs_prop.c \
+	zfs_uio.c \
+	zpool_prop.c \
+	zprop_common.c \
+	abd.c \
+	abd_os.c \
+	aggsum.c \
+	arc.c \
+	arc_os.c \
+	blkptr.c \
+	bplist.c \
+	bpobj.c \
+	bptree.c \
+	btree.c \
+	bqueue.c \
+	cityhash.c \
+	dbuf.c \
+	dbuf_stats.c \
+	ddt.c \
+	ddt_zap.c \
+	dmu.c \
+	dmu_diff.c \

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008250221.07P2LRST044836>