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
This commit is contained in:
Warner Losh 2022-07-24 15:53:56 -06:00
parent 976b977c61
commit 1306a5dc07
2 changed files with 10 additions and 7 deletions

View File

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

View File

@ -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 */