Skip to content
Permalink
Browse files

Add FreeBSD support to OpenZFS

- Import FreeBSD specific parts

Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Co-authored-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>

Requires-builders: amazon2, debian10, freebsd12, freebsd13, style
  • Loading branch information
mattmacy authored and freqlabs committed Jan 4, 2019
1 parent 652bdc9 commit 771022c52a6ae0bda4008a52b72d231fe60f4353
Showing with 47,012 additions and 63 deletions.
  1. +4 −1 .github/suppressions.txt
  2. +5 −0 .gitignore
  3. +3 −2 Makefile.am
  4. +1 −2 README.md
  5. +2 −2 cmd/Makefile.am
  6. +7 −0 cmd/zpool/Makefile.am
  7. +113 −0 cmd/zpool/os/freebsd/zpool_vdev_os.c
  8. +4 −0 cmd/zpool/zpool_vdev.c
  9. +24 −2 config/Rules.am
  10. +1 −1 config/always-arch.m4
  11. +21 −0 config/always-compiler-options.m4
  12. +24 −22 config/kernel.m4
  13. +1 −1 config/toolchain-simd.m4
  14. +7 −6 config/user.m4
  15. +26 −12 config/zfs-build.m4
  16. +12 −0 configure.ac
  17. +4 −1 contrib/Makefile.am
  18. +4 −1 etc/Makefile.am
  19. +3 −0 include/os/Makefile.am
  20. +1 −0 include/os/freebsd/Makefile.am
  21. +5 −0 include/os/freebsd/linux/Makefile.am
  22. +101 −0 include/os/freebsd/linux/compiler.h
  23. +81 −0 include/os/freebsd/linux/types.h
  24. +1 −0 include/os/freebsd/spl/Makefile.am
  25. +4 −0 include/os/freebsd/spl/acl/Makefile.am
  26. +68 −0 include/os/freebsd/spl/acl/acl_common.h
  27. +8 −0 include/os/freebsd/spl/rpc/Makefile.am
  28. +71 −0 include/os/freebsd/spl/rpc/xdr.h
  29. +77 −0 include/os/freebsd/spl/sys/Makefile.am
  30. +315 −0 include/os/freebsd/spl/sys/acl.h
  31. +61 −0 include/os/freebsd/spl/sys/acl_impl.h
  32. +188 −0 include/os/freebsd/spl/sys/atomic.h
  33. +98 −0 include/os/freebsd/spl/sys/byteorder.h
  34. +215 −0 include/os/freebsd/spl/sys/callb.h
  35. +369 −0 include/os/freebsd/spl/sys/ccompile.h
  36. +103 −0 include/os/freebsd/spl/sys/cmn_err.h
  37. +173 −0 include/os/freebsd/spl/sys/condvar.h
  38. +48 −0 include/os/freebsd/spl/sys/console.h
  39. +192 −0 include/os/freebsd/spl/sys/cred.h
  40. +47 −0 include/os/freebsd/spl/sys/ctype.h
  41. +168 −0 include/os/freebsd/spl/sys/debug.h
  42. +45 −0 include/os/freebsd/spl/sys/dirent.h
  43. +40 −0 include/os/freebsd/spl/sys/disp.h
  44. +484 −0 include/os/freebsd/spl/sys/dkio.h
  45. +268 −0 include/os/freebsd/spl/sys/dklabel.h
  46. +40 −0 include/os/freebsd/spl/sys/dnlc.h
  47. +42 −0 include/os/freebsd/spl/sys/endian.h
  48. +78 −0 include/os/freebsd/spl/sys/extdirent.h
  49. +54 −0 include/os/freebsd/spl/sys/file.h
  50. +3 −0 include/os/freebsd/spl/sys/fm/Makefile.am
  51. +4 −0 include/os/freebsd/spl/sys/fm/fs/Makefile.am
  52. +98 −0 include/os/freebsd/spl/sys/fm/fs/zfs.h
  53. +34 −0 include/os/freebsd/spl/sys/freebsd_rwlock.h
  54. +1 −0 include/os/freebsd/spl/sys/inttypes.h
  55. +697 −0 include/os/freebsd/spl/sys/isa_defs.h
  56. +104 −0 include/os/freebsd/spl/sys/kmem.h
  57. +49 −0 include/os/freebsd/spl/sys/kmem_cache.h
  58. +211 −0 include/os/freebsd/spl/sys/kstat.h
  59. +67 −0 include/os/freebsd/spl/sys/list.h
  60. +53 −0 include/os/freebsd/spl/sys/list_impl.h
  61. +44 −0 include/os/freebsd/spl/sys/lock.h
  62. +58 −0 include/os/freebsd/spl/sys/misc.h
  63. +59 −0 include/os/freebsd/spl/sys/mod_os.h
  64. +1 −0 include/os/freebsd/spl/sys/mode.h
  65. +41 −0 include/os/freebsd/spl/sys/mount.h
  66. +79 −0 include/os/freebsd/spl/sys/mutex.h
  67. +41 −0 include/os/freebsd/spl/sys/param.h
  68. +83 −0 include/os/freebsd/spl/sys/policy.h
  69. +125 −0 include/os/freebsd/spl/sys/proc.h
  70. +139 −0 include/os/freebsd/spl/sys/processor.h
  71. +64 −0 include/os/freebsd/spl/sys/procfs_list.h
  72. +48 −0 include/os/freebsd/spl/sys/random.h
  73. +101 −0 include/os/freebsd/spl/sys/rwlock.h
  74. +45 −0 include/os/freebsd/spl/sys/sdt.h
  75. +84 −0 include/os/freebsd/spl/sys/sid.h
  76. +70 −0 include/os/freebsd/spl/sys/sig.h
  77. +43 −0 include/os/freebsd/spl/sys/simd.h
  78. +409 −0 include/os/freebsd/spl/sys/simd_x86.h
  79. +83 −0 include/os/freebsd/spl/sys/spl_condvar.h
  80. +39 −0 include/os/freebsd/spl/sys/string.h
  81. +1 −0 include/os/freebsd/spl/sys/strings.h
  82. +69 −0 include/os/freebsd/spl/sys/sunddi.h
  83. +469 −0 include/os/freebsd/spl/sys/sysmacros.h
  84. +34 −0 include/os/freebsd/spl/sys/systeminfo.h
  85. +50 −0 include/os/freebsd/spl/sys/systm.h
  86. +121 −0 include/os/freebsd/spl/sys/taskq.h
  87. +34 −0 include/os/freebsd/spl/sys/thread.h
  88. +101 −0 include/os/freebsd/spl/sys/time.h
  89. +38 −0 include/os/freebsd/spl/sys/timer.h
  90. +1 −0 include/os/freebsd/spl/sys/trace.h
  91. +1 −0 include/os/freebsd/spl/sys/trace_zfs.h
  92. +109 −0 include/os/freebsd/spl/sys/types.h
  93. +39 −0 include/os/freebsd/spl/sys/types32.h
  94. +77 −0 include/os/freebsd/spl/sys/uio.h
  95. +99 −0 include/os/freebsd/spl/sys/uuid.h
  96. +38 −0 include/os/freebsd/spl/sys/varargs.h
  97. +130 −0 include/os/freebsd/spl/sys/vfs.h
  98. +61 −0 include/os/freebsd/spl/sys/vm.h
  99. +34 −0 include/os/freebsd/spl/sys/vmsystm.h
  100. +207 −0 include/os/freebsd/spl/sys/vnode.h
  101. +271 −0 include/os/freebsd/spl/sys/vnode_impl.h
  102. +68 −0 include/os/freebsd/spl/sys/zmod.h
  103. +76 −0 include/os/freebsd/spl/sys/zone.h
  104. +1 −0 include/os/freebsd/zfs/Makefile.am
  105. +14 −0 include/os/freebsd/zfs/sys/Makefile.am
  106. +105 −0 include/os/freebsd/zfs/sys/freebsd_crypto.h
  107. +200 −0 include/os/freebsd/zfs/sys/sha2.h
  108. +30 −0 include/os/freebsd/zfs/sys/vdev_os.h
  109. +106 −0 include/os/freebsd/zfs/sys/zfs_context_os.h
  110. +65 −0 include/os/freebsd/zfs/sys/zfs_ctldir.h
  111. +74 −0 include/os/freebsd/zfs/sys/zfs_dir.h
  112. +677 −0 include/os/freebsd/zfs/sys/zfs_ioctl_compat.h
  113. +174 −0 include/os/freebsd/zfs/sys/zfs_vfsops.h
  114. +56 −0 include/os/freebsd/zfs/sys/zfs_vnops.h
  115. +187 −0 include/os/freebsd/zfs/sys/zfs_znode_impl.h
  116. +1 −0 include/os/freebsd/zfs/sys/zpl.h
  117. +8 −1 lib/Makefile.am
  118. +7 −0 lib/libnvpair/Makefile.am
  119. +9 −0 lib/libspl/Makefile.am
  120. +4 −0 lib/libspl/include/os/Makefile.am
  121. +1 −0 lib/libspl/include/os/freebsd/Makefile.am
  122. +12 −0 lib/libspl/include/os/freebsd/sys/Makefile.am
  123. +311 −0 lib/libspl/include/os/freebsd/sys/byteorder.h
  124. +42 −0 lib/libspl/include/os/freebsd/sys/file.h
  125. +85 −0 lib/libspl/include/os/freebsd/sys/mnttab.h
  126. +108 −0 lib/libspl/include/os/freebsd/sys/mount.h
  127. +70 −0 lib/libspl/include/os/freebsd/sys/param.h
  128. +71 −0 lib/libspl/include/os/freebsd/sys/stat.h
  129. +1 −0 lib/libspl/include/os/freebsd/sys/sysmacros.h
  130. +98 −0 lib/libspl/include/os/freebsd/sys/uio.h
  131. +37 −0 lib/libspl/include/os/freebsd/sys/vfs.h
  132. +38 −0 lib/libspl/include/os/freebsd/sys/zfs_context_os.h
  133. +70 −0 lib/libspl/os/freebsd/getexecname.c
  134. +36 −0 lib/libspl/os/freebsd/gethostid.c
  135. +67 −0 lib/libspl/os/freebsd/getmntany.c
  136. +216 −0 lib/libspl/os/freebsd/mnttab.c
  137. +4 −0 lib/libuutil/Makefile.am
  138. +16 −1 lib/libzfs/Makefile.am
  139. +1 −1 lib/libzfs/libzfs_util.c
  140. +323 −0 lib/libzfs/os/freebsd/libzfs_compat.c
  141. +406 −0 lib/libzfs/os/freebsd/libzfs_fsshare.c
  142. +432 −0 lib/libzfs/os/freebsd/libzfs_ioctl_compat.c
  143. +147 −0 lib/libzfs/os/freebsd/libzfs_zmount.c
  144. +5 −1 lib/libzfs_core/Makefile.am
  145. +47 −0 lib/libzfs_core/libzfs_core_compat.h
  146. +5 −0 lib/libzpool/Makefile.am
  147. +12 −1 lib/libzutil/Makefile.am
  148. +74 −0 lib/libzutil/os/freebsd/zutil_compat.c
  149. +132 −0 lib/libzutil/os/freebsd/zutil_device_path_os.c
  150. +239 −0 lib/libzutil/os/freebsd/zutil_import_os.c
  151. +10 −0 module/.gitignore
  152. +381 −0 module/Makefile.bsd
  153. +23 −4 module/Makefile.in
  154. +1,731 −0 module/os/freebsd/spl/acl_common.c
  155. +438 −0 module/os/freebsd/spl/callb.c
  156. +245 −0 module/os/freebsd/spl/list.c
  157. +96 −0 module/os/freebsd/spl/sha224.h
  158. +99 −0 module/os/freebsd/spl/sha256.h
  159. +378 −0 module/os/freebsd/spl/sha256c.c
  160. +96 −0 module/os/freebsd/spl/sha384.h
  161. +101 −0 module/os/freebsd/spl/sha512.h
  162. +508 −0 module/os/freebsd/spl/sha512c.c
  163. +143 −0 module/os/freebsd/spl/sha512t.h
  164. +222 −0 module/os/freebsd/spl/spl_acl.c
  165. +138 −0 module/os/freebsd/spl/spl_atomic.c
  166. +74 −0 module/os/freebsd/spl/spl_cmn_err.c
  167. +37 −0 module/os/freebsd/spl/spl_dtrace.c
  168. +351 −0 module/os/freebsd/spl/spl_kmem.c
  169. +321 −0 module/os/freebsd/spl/spl_kstat.c
  170. +107 −0 module/os/freebsd/spl/spl_misc.c
  171. +429 −0 module/os/freebsd/spl/spl_policy.c
  172. +79 −0 module/os/freebsd/spl/spl_procfs_list.c
  173. +106 −0 module/os/freebsd/spl/spl_string.c
  174. +74 −0 module/os/freebsd/spl/spl_sunddi.c
  175. +259 −0 module/os/freebsd/spl/spl_sysevent.c
  176. +329 −0 module/os/freebsd/spl/spl_taskq.c
  177. +92 −0 module/os/freebsd/spl/spl_uio.c
  178. +278 −0 module/os/freebsd/spl/spl_vfs.c
  179. +71 −0 module/os/freebsd/spl/spl_vm.c
  180. +268 −0 module/os/freebsd/spl/spl_zlib.c
  181. +265 −0 module/os/freebsd/spl/spl_zone.c
  182. +1,134 −0 module/os/freebsd/zfs/abd.c
  183. +230 −0 module/os/freebsd/zfs/arc_os.c
  184. +474 −0 module/os/freebsd/zfs/crypto_os.c
  185. +346 −0 module/os/freebsd/zfs/dmu_os.c
  186. +102 −0 module/os/freebsd/zfs/hkdf.c
  187. +405 −0 module/os/freebsd/zfs/kmod_core.c
  188. +280 −0 module/os/freebsd/zfs/spa_os.c
  189. +114 −0 module/os/freebsd/zfs/spa_stats.c
  190. +685 −0 module/os/freebsd/zfs/sysctl_os.c
  191. +326 −0 module/os/freebsd/zfs/vdev_file.c
  192. +1,195 −0 module/os/freebsd/zfs/vdev_geom.c
  193. +74 −0 module/os/freebsd/zfs/vdev_label_os.c
  194. +2,738 −0 module/os/freebsd/zfs/zfs_acl.c
  195. +1,345 −0 module/os/freebsd/zfs/zfs_ctldir.c
  196. +254 −0 module/os/freebsd/zfs/zfs_debug.c
  197. +951 −0 module/os/freebsd/zfs/zfs_dir.c
  198. +309 −0 module/os/freebsd/zfs/zfs_file_os.c
  199. +52 −0 module/os/freebsd/zfs/zfs_fuid_os.c
  200. +194 −0 module/os/freebsd/zfs/zfs_ioctl_os.c
  201. +70 −0 module/os/freebsd/zfs/zfs_onexit_os.c
  202. +2,453 −0 module/os/freebsd/zfs/zfs_vfsops.c
  203. +6,533 −0 module/os/freebsd/zfs/zfs_vnops.c
  204. +1,987 −0 module/os/freebsd/zfs/zfs_znode.c
  205. +1,884 −0 module/os/freebsd/zfs/zio_crypt.c
  206. +1,476 −0 module/os/freebsd/zfs/zvol_os.c
  207. +10 −1 module/zfs/dmu.c
  208. +1 −0 module/zfs/spa.c
  209. +1 −0 tests/runfiles/Makefile.am
  210. 0 tests/runfiles/freebsd.run
@@ -1,3 +1,6 @@
preprocessorErrorDirective:./module/zfs/vdev_raidz_math_avx512f.c:243
preprocessorErrorDirective:./module/zfs/vdev_raidz_math_sse2.c:266

uninitvar:module/os/freebsd/zfs/vdev_geom.c
uninitvar:module/os/freebsd/zfs/zfs_vfsops.c
uninitvar:module/os/freebsd/spl/spl_zone.c
uninitvar:lib/libzutil/os/freebsd/zutil_import_os.c
@@ -62,4 +62,9 @@ cscope.*
*.patch
*.orig
*.log
*.tmp
venv

*.so
*.so.debug
*.so.full
@@ -104,8 +104,9 @@ commitcheck:
fi

cstyle:
@find ${top_srcdir} -name build -prune -o -name '*.[hc]' \
! -name 'zfs_config.*' ! -name '*.mod.c' -type f \
@find ${top_srcdir} -name build -prune -o -type f -name '*.[hc]' \
! -name 'zfs_config.*' ! -name '*.mod.c' \
! -name 'opt_global.h' ! -name '*_if*.h' \
-exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+

filter_executable = -exec test -x '{}' \; -print
@@ -19,8 +19,6 @@ This repository contains the code for running OpenZFS on Linux and FreeBSD.
Full documentation for installing OpenZFS on your favorite Linux distribution can
be found at the [ZoL Site](https://zfsonlinux.org/).

FreeBSD support is a work in progress. See the [PR](https://github.com/openzfs/zfs/pull/8987).

# Contribute & Develop

We have a separate document with [contribution guidelines](./.github/CONTRIBUTING.md).
@@ -34,3 +32,4 @@ For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197`

# Supported Kernels
* The `META` file contains the officially recognized supported Linux kernel versions.
* Supported FreeBSD versions are 12-STABLE and 13-CURRENT.
@@ -1,10 +1,10 @@
SUBDIRS = zfs zpool zdb zhack zinject zstreamdump ztest
SUBDIRS += fsck_zfs vdev_id raidz_test zgenhostid
SUBDIRS += fsck_zfs vdev_id raidz_test

if USING_PYTHON
SUBDIRS += arcstat arc_summary dbufstat
endif

if BUILD_LINUX
SUBDIRS += mount_zfs zed zvol_id zvol_wait
SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait
endif
@@ -11,6 +11,10 @@ zpool_SOURCES = \
zpool_util.h \
zpool_vdev.c

if BUILD_FREEBSD
zpool_SOURCES += os/freebsd/zpool_vdev_os.c
endif

if BUILD_LINUX
zpool_SOURCES += os/linux/zpool_vdev_os.c
endif
@@ -20,6 +24,9 @@ zpool_LDADD = \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzfs/libzfs.la

if BUILD_FREEBSD
zpool_LDADD += -L/usr/local/lib -lintl -lgeom
endif
zpool_LDADD += -lm $(LIBBLKID)

zpoolconfdir = $(sysconfdir)/zfs/zpool.d
@@ -0,0 +1,113 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018 by Delphix. All rights reserved.
* Copyright (c) 2016, 2017 Intel Corporation.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
*/

/*
* Functions to convert between a list of vdevs and an nvlist representing the
* configuration. Each entry in the list can be one of:
*
* Device vdevs
* disk=(path=..., devid=...)
* file=(path=...)
*
* Group vdevs
* raidz[1|2]=(...)
* mirror=(...)
*
* Hot spares
*
* While the underlying implementation supports it, group vdevs cannot contain
* other group vdevs. All userland verification of devices is contained within
* this file. If successful, the nvlist returned can be passed directly to the
* kernel; we've done as much verification as possible in userland.
*
* Hot spares are a special case, and passed down as an array of disk vdevs, at
* the same level as the root of the vdev tree.
*
* The only function exported by this file is 'make_root_vdev'. The
* function performs several passes:
*
* 1. Construct the vdev specification. Performs syntax validation and
* makes sure each device is valid.
* 2. Check for devices in use. Using libdiskmgt, makes sure that no
* devices are also in use. Some can be overridden using the 'force'
* flag, others cannot.
* 3. Check for replication errors if the 'force' flag is not specified.
* validates that the replication level is consistent across the
* entire pool.
* 4. Call libzfs to label any whole disks with an EFI label.
*/

#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <libintl.h>
#include <libnvpair.h>
#include <libzutil.h>
#include <limits.h>
#include <sys/spa.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <paths.h>
#include <sys/stat.h>
#include <sys/disk.h>
#include <sys/mntent.h>
#include <libgeom.h>

#include "zpool_util.h"
#include <sys/zfs_context.h>

int
check_device(const char *name, boolean_t force, boolean_t isspare,
boolean_t iswholedisk)
{
char path[MAXPATHLEN];

if (strncmp(name, _PATH_DEV, sizeof (_PATH_DEV) - 1) != 0)
snprintf(path, sizeof (path), "%s%s", _PATH_DEV, name);
else
strlcpy(path, name, sizeof (path));

return (check_file(path, force, isspare));
}

boolean_t
check_sector_size_database(char *path, int *sector_size)
{
return (0);
}

void
zpool_vdev_enable_file(struct stat64 *statbuf, boolean_t *wholedisk)
{
if (S_ISCHR(statbuf->st_mode)) {
statbuf->st_mode &= ~S_IFCHR;
statbuf->st_mode |= S_IFBLK;
*wholedisk = B_FALSE;
}
}
@@ -941,6 +941,10 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
if (fd == -1) {
if (errno == EBUSY)
is_exclusive = 1;
#ifdef __FreeBSD__
if (errno == EPERM)
is_exclusive = 1;
#endif
} else {
(void) close(fd);
}
@@ -14,26 +14,48 @@ DEFAULT_INCLUDES += \
-I$(top_srcdir)/lib/libspl/include/os/linux
endif

if BUILD_FREEBSD
DEFAULT_INCLUDES += \
-I$(top_srcdir)/lib/libspl/include/os/freebsd
endif

AM_LIBTOOLFLAGS = --silent

AM_CFLAGS = -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing
AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
AM_CFLAGS += $(DEBUG_CFLAGS)
AM_CFLAGS += $(ASAN_CFLAGS)
AM_CFLAGS += $(CODE_COVERAGE_CFLAGS)
AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) $(NO_FORMAT_ZERO_LENGTH)
if BUILD_FREEBSD
AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
AM_CFLAGS += -I/usr/include -I/usr/local/include
AM_CFLAGS += -D_MACHINE_ENDIAN_H_
endif

AM_CPPFLAGS = -D_GNU_SOURCE
AM_CPPFLAGS += -D_REENTRANT
AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
AM_CPPFLAGS += -DHAVE_LARGE_STACKS=1
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\"
AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
if BUILD_LINUX
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\"
endif
if BUILD_FREEBSD
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-freebsd-user\"
endif

AM_LDFLAGS = $(DEBUG_LDFLAGS)
AM_LDFLAGS += $(ASAN_LDFLAGS)

if BUILD_FREEBSD
AM_LDFLAGS += -fstack-protector-strong -shared
AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
AM_LDFLAGS += -lm
endif
@@ -17,7 +17,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_ARCH], [
i?86)
TARGET_CPU=i386
;;
x86_64)
amd64|x86_64)
TARGET_CPU=x86_64
;;
powerpc*)
@@ -87,6 +87,27 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION], [
AC_SUBST([NO_FORMAT_TRUNCATION])
])

dnl #
dnl # Check if gcc supports -Wno-format-truncation option.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH], [
AC_MSG_CHECKING([whether $CC supports -Wno-format-zero-length])
saved_flags="$CFLAGS"
CFLAGS="$CFLAGS -Werror -Wno-format-zero-length"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_FORMAT_ZERO_LENGTH=-Wno-format-zero-length
AC_MSG_RESULT([yes])
], [
NO_FORMAT_ZERO_LENGTH=
AC_MSG_RESULT([no])
])
CFLAGS="$saved_flags"
AC_SUBST([NO_FORMAT_ZERO_LENGTH])
])


dnl #
dnl # Check if gcc supports -Wno-bool-compare option.
@@ -2,29 +2,31 @@ dnl #
dnl # Default ZFS kernel configuration
dnl #
AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
dnl # Setup the kernel build environment.
ZFS_AC_KERNEL
ZFS_AC_QAT
dnl # Sanity checks for module building and CONFIG_* defines
ZFS_AC_KERNEL_TEST_MODULE
ZFS_AC_KERNEL_CONFIG_DEFINED
dnl # Sequential ZFS_LINUX_TRY_COMPILE tests
ZFS_AC_KERNEL_FPU_HEADER
ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T
ZFS_AC_KERNEL_MISC_MINOR
ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
dnl # Parallel ZFS_LINUX_TEST_SRC / ZFS_LINUX_TEST_RESULT tests
ZFS_AC_KERNEL_TEST_SRC
ZFS_AC_KERNEL_TEST_RESULT
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
])
AM_COND_IF([BUILD_LINUX], [
dnl # Setup the kernel build environment.
ZFS_AC_KERNEL
ZFS_AC_QAT
dnl # Sanity checks for module building and CONFIG_* defines
ZFS_AC_KERNEL_TEST_MODULE
ZFS_AC_KERNEL_CONFIG_DEFINED
dnl # Sequential ZFS_LINUX_TRY_COMPILE tests
ZFS_AC_KERNEL_FPU_HEADER
ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T
ZFS_AC_KERNEL_MISC_MINOR
ZFS_AC_KERNEL_DECLARE_EVENT_CLASS
dnl # Parallel ZFS_LINUX_TEST_SRC / ZFS_LINUX_TEST_RESULT tests
ZFS_AC_KERNEL_TEST_SRC
ZFS_AC_KERNEL_TEST_RESULT
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"
])
AC_SUBST(KERNEL_MAKE)
AC_SUBST(KERNEL_MAKE)
])
])

dnl #
@@ -3,7 +3,7 @@ dnl # Checks if host toolchain supports SIMD instructions
dnl #
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD], [
case "$host_cpu" in
x86_64 | x86 | i686)
amd64 | x86_64 | x86 | i686)
ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE
ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE2
ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE3
@@ -4,25 +4,26 @@ dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_GETTEXT
ZFS_AC_CONFIG_USER_MOUNT_HELPER
ZFS_AC_CONFIG_USER_UDEV
ZFS_AC_CONFIG_USER_SYSTEMD
ZFS_AC_CONFIG_USER_SYSVINIT
ZFS_AC_CONFIG_USER_DRACUT
ZFS_AC_CONFIG_USER_ZLIB
ZFS_AC_CONFIG_USER_LIBUUID
AM_COND_IF([BUILD_LINUX], [
ZFS_AC_CONFIG_USER_UDEV
ZFS_AC_CONFIG_USER_SYSTEMD
ZFS_AC_CONFIG_USER_LIBUUID
ZFS_AC_CONFIG_USER_LIBBLKID
])
ZFS_AC_CONFIG_USER_LIBTIRPC
ZFS_AC_CONFIG_USER_LIBBLKID
ZFS_AC_CONFIG_USER_LIBUDEV
ZFS_AC_CONFIG_USER_LIBSSL
ZFS_AC_CONFIG_USER_LIBAIO
ZFS_AC_CONFIG_USER_RUNSTATEDIR
ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS
ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV
ZFS_AC_CONFIG_USER_ZFSEXEC
ZFS_AC_TEST_FRAMEWORK
AC_CHECK_FUNCS([mlockall strlcat strlcpy])
AC_CHECK_FUNCS([issetugid mlockall strlcat strlcpy])
])

dnl #

0 comments on commit 771022c

Please sign in to comment.
You can’t perform that action at this time.