From 1306a5dc0747fa2b9ecc7ba2429ef4a3b9f6dcd0 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 24 Jul 2022 15:53:56 -0600 Subject: [PATCH] stand/libsa: zfs use standard ZFS_EARLY stuff Now that the minor issues preventing zfs.c from using CFLAGS_EARLY have been fixed, use that mechanism like everything else that needs the OpenZFS spl headers. This simplifies things somewhat. Update comments to document why zfs.c is still special, though in different ways. Note: We also use the fact that NEED_SOLARIS_BOOLEAN is only defined in an environment where the solaris compat boolean stuff will be defined prior to this point (eg, when we're building zfs.c in libsa), but not in other environments (like when we're building mkimage and stand-alone boot loaders that don't use libsa). These latter uses should be changed to use the same ZFS compile env, but aren't as part of this commit. This has to be done in the same change as the ZFS_EARLY change to not break zfs.c building for one commit affecting bisectabiltiy. Sponsored by: Netflix Reviewed by: tsoome, delphij Differential Revision: https://reviews.freebsd.org/D35894 --- stand/libsa/zfs/Makefile.inc | 15 ++++++++------- sys/cddl/boot/zfs/zfsimpl.h | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/stand/libsa/zfs/Makefile.inc b/stand/libsa/zfs/Makefile.inc index 15a4c8bf3018..d91d83e8bdba 100644 --- a/stand/libsa/zfs/Makefile.inc +++ b/stand/libsa/zfs/Makefile.inc @@ -54,18 +54,19 @@ CFLAGS_EARLY.blake3_impl_hack.c+= ${ZFS_EARLY} CFLAGS_EARLY.list.c+= ${ZFS_EARLY} CFLAGS_EARLY.zfs_zstd.c+= ${ZFS_EARLY} CFLAGS_EARLY.nvlist.c+= ${ZFS_EARLY} +CFLAGS_EARLY.zfs.c += ${ZFS_EARLY} -# Can't use the early flags because there's two conflicting definitions of boolean_t in -# the zfs code that need to be unified, as well as a number of other hacks for pre-openzfs -# code still in the tree that needs to be fixed. +# +# zfs.c is special: we need to define HAS_ZSTD_ZFS to get zfssubr.c to initialize zstd +# properly. We need to have the cddl boot compat directory in the include path for zfssubr.c +# to be found, and we need a couple of other include paths for skein and lz4. Finally we +# temporarily need LDRSRC to pick up disk.h until that layering violation is corrected. +# CFLAGS.zfs.c+= -DHAS_ZSTD_ZFS \ -I${SYSDIR}/cddl/boot/zfs \ -I${LDRSRC} \ -I${SYSDIR}/crypto/skein \ - -I${ZFSOSINC}/spl \ - -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 \ - -I${ZFSOSINC}/zfs \ - -I${OZFS}/include + -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 # # ZSTD coding style has some issues, so suppress clang's warnings. Also, zstd's diff --git a/sys/cddl/boot/zfs/zfsimpl.h b/sys/cddl/boot/zfs/zfsimpl.h index d6e8900f6a97..843565607a49 100644 --- a/sys/cddl/boot/zfs/zfsimpl.h +++ b/sys/cddl/boot/zfs/zfsimpl.h @@ -76,7 +76,9 @@ #define AVL_PCMP(a, b) \ (((uintptr_t)(a) > (uintptr_t)(b)) - ((uintptr_t)(a) < (uintptr_t)(b))) +#if !defined(NEED_SOLARIS_BOOLEAN) /* Only defined when we'll define this elsewhere */ typedef enum { B_FALSE, B_TRUE } boolean_t; +#endif /* CRC64 table */ #define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */