From b8902de147f46c9dcf7f54711b47d6b512fc5c1c Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 8 Jul 2018 07:42:49 +0000 Subject: [PATCH] Move ZFS files into libsa Move the libzfs stuff into libsa. There's no need for it to be a separate library. The separate library adds to the issues of build ordering that we see from time to time. Move the filesystem support into libsa, like all the other filesystem support rather than making zfs the odd-duck out. Discussed with: allanjude@ --- stand/Makefile | 3 +-- stand/defs.mk | 2 +- stand/efi/boot1/Makefile | 5 ++--- stand/efi/loader/Makefile | 6 ++---- stand/i386/gptzfsboot/Makefile | 8 +------- stand/i386/loader/Makefile | 4 ++-- stand/i386/zfsboot/Makefile | 7 +------ stand/i386/zfsloader/Makefile | 1 + stand/libsa/Makefile | 5 +++++ stand/{zfs/Makefile => libsa/zfs/Makefile.inc} | 7 ------- stand/{ => libsa}/zfs/devicename_stubs.c | 0 stand/{ => libsa}/zfs/libzfs.h | 0 stand/{ => libsa}/zfs/zfs.c | 0 stand/{ => libsa}/zfs/zfsimpl.c | 0 stand/loader.mk | 7 ------- stand/sparc64/loader/Makefile | 4 ++-- stand/sparc64/zfsloader/Makefile | 1 + stand/userboot/userboot/Makefile | 5 ++--- stand/zfs/Makefile.depend | 13 ------------- stand/zfs32/Makefile | 5 ----- stand/zfs32/Makefile.depend | 13 ------------- 21 files changed, 21 insertions(+), 75 deletions(-) rename stand/{zfs/Makefile => libsa/zfs/Makefile.inc} (74%) rename stand/{ => libsa}/zfs/devicename_stubs.c (100%) rename stand/{ => libsa}/zfs/libzfs.h (100%) rename stand/{ => libsa}/zfs/zfs.c (100%) rename stand/{ => libsa}/zfs/zfsimpl.c (100%) delete mode 100644 stand/zfs/Makefile.depend delete mode 100644 stand/zfs32/Makefile delete mode 100644 stand/zfs32/Makefile.depend diff --git a/stand/Makefile b/stand/Makefile index c676ded44ce2..bc50e1bfb736 100644 --- a/stand/Makefile +++ b/stand/Makefile @@ -6,7 +6,7 @@ # others we don't. LIB32LIST is a list of libraries, which if # included, need to be built 32-bit as well. .if ${MACHINE_ARCH} == "amd64" -LIB32LIST=libsa ficl liblua zfs +LIB32LIST=libsa ficl liblua .endif S.yes+= libsa @@ -17,7 +17,6 @@ S.${MK_LOADER_LUA}+= liblua S.${MK_LOADER_LUA}+= lua S.${MK_FDT}+= fdt S.${MK_LOADER_OFW}+= ofw -S.${MK_ZFS}+= zfs S.yes+= defaults S.yes+= man diff --git a/stand/defs.mk b/stand/defs.mk index e3c143952ced..1365f181a977 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -28,7 +28,7 @@ LUASRC= ${SRCTOP}/contrib/lua/src SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot -ZFSSRC= ${BOOTSRC}/zfs +ZFSSRC= ${SASRC}/zfs BOOTOBJ= ${OBJTOP}/stand diff --git a/stand/efi/boot1/Makefile b/stand/efi/boot1/Makefile index 02ca94705361..992afd5fc1d2 100644 --- a/stand/efi/boot1/Makefile +++ b/stand/efi/boot1/Makefile @@ -30,7 +30,6 @@ CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS+= -DEFI_ZFS_BOOT -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 @@ -72,8 +71,8 @@ LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} -LDADD+= ${LIBEFI} ${LIBZFSBOOT} ${LIBSA} +DPADD+= ${LIBEFI} ${LIBSA} +LDADD+= ${LIBEFI} ${LIBSA} DPADD+= ${LDSCRIPT} diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index 09181dfe2fe9..e890f743da5a 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -25,7 +25,6 @@ SRCS= autoload.c \ vers.c .if ${MK_ZFS} != "no" -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a CFLAGS+= -I${ZFSSRC} CFLAGS+= -DEFI_ZFS_BOOT HAVE_ZFS= yes @@ -120,8 +119,7 @@ loader.efi: ${PROG} LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a -DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \ - ${LDSCRIPT} -LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} ${LDSCRIPT} +LDADD= ${LDR_INTERP} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSA} .include diff --git a/stand/i386/gptzfsboot/Makefile b/stand/i386/gptzfsboot/Makefile index 928ecf5ba840..4eb37722f4f4 100644 --- a/stand/i386/gptzfsboot/Makefile +++ b/stand/i386/gptzfsboot/Makefile @@ -43,12 +43,6 @@ CFLAGS.clang+= -Wno-tentative-definition-incomplete-type NO_WCAST_ALIGN= -.if ${MACHINE} == "amd64" -LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a -.endif - CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS+=${LD_FLAGS_BIN} @@ -75,7 +69,7 @@ gptzfsboot.bin: gptzfsboot.out gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \ ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} zfsboot.o: ${ZFSSRC}/zfsimpl.c diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index f34831466720..3878622f9d6f 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -71,8 +71,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} -LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} +DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} +LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBI386} ${LIBSA32} .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -DLOADER_PREFER_AMD64 diff --git a/stand/i386/zfsboot/Makefile b/stand/i386/zfsboot/Makefile index cb10d96a33dd..20e9737bac43 100644 --- a/stand/i386/zfsboot/Makefile +++ b/stand/i386/zfsboot/Makefile @@ -37,11 +37,6 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings CFLAGS.gcc+= --param max-inline-insns-single=100 -.if ${MACHINE} == "amd64" -LIBZFSBOOT=${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT=${BOOTOBJ}/zfs/libzfsboot.a -.endif LD_FLAGS+=${LD_FLAGS_BIN} @@ -82,7 +77,7 @@ zfsboot.bin: zfsboot.out ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} SRCS= zfsboot.c diff --git a/stand/i386/zfsloader/Makefile b/stand/i386/zfsloader/Makefile index a9fa913e7e13..5e7eddc42a75 100644 --- a/stand/i386/zfsloader/Makefile +++ b/stand/i386/zfsloader/Makefile @@ -3,5 +3,6 @@ LOADER= zfsloader NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 HAVE_ZFS= yes +CFLAGS+= -DBOOTPROG=\"zfsloader\" .include "${.CURDIR}/../loader/Makefile" diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index 9f490699a9d7..7af5382dfe0a 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -155,4 +155,9 @@ SRCS+= explicit_bzero.c .include "${SASRC}/geli/Makefile.inc" .endif +# Maybe ZFS +.if ${MK_ZFS} == "yes" +.include "${SASRC}/zfs/Makefile.inc" +.endif + .include diff --git a/stand/zfs/Makefile b/stand/libsa/zfs/Makefile.inc similarity index 74% rename from stand/zfs/Makefile rename to stand/libsa/zfs/Makefile.inc index 89c1bfdd9c41..46a12e7d8e5a 100644 --- a/stand/zfs/Makefile +++ b/stand/libsa/zfs/Makefile.inc @@ -1,20 +1,13 @@ # $FreeBSD$ -.include - -LIB= zfsboot - .PATH: ${ZFSSRC} SRCS+= zfs.c skein.c skein_block.c # Do not unroll skein loops, reduce code size CFLAGS+= -DSKEIN_LOOP=111 .PATH: ${SYSDIR}/crypto/skein -CFLAGS+= -DBOOTPROG=\"zfsloader\" CFLAGS+= -I${LDRSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/crypto/skein CFLAGS+= -Wformat -Wall - -.include diff --git a/stand/zfs/devicename_stubs.c b/stand/libsa/zfs/devicename_stubs.c similarity index 100% rename from stand/zfs/devicename_stubs.c rename to stand/libsa/zfs/devicename_stubs.c diff --git a/stand/zfs/libzfs.h b/stand/libsa/zfs/libzfs.h similarity index 100% rename from stand/zfs/libzfs.h rename to stand/libsa/zfs/libzfs.h diff --git a/stand/zfs/zfs.c b/stand/libsa/zfs/zfs.c similarity index 100% rename from stand/zfs/zfs.c rename to stand/libsa/zfs/zfs.c diff --git a/stand/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c similarity index 100% rename from stand/zfs/zfsimpl.c rename to stand/libsa/zfs/zfsimpl.c diff --git a/stand/loader.mk b/stand/loader.mk index 4e4a3768105e..35c427c90b71 100644 --- a/stand/loader.mk +++ b/stand/loader.mk @@ -129,13 +129,6 @@ CFLAGS+= -DLOADER_ZFS_SUPPORT CFLAGS+= -I${ZFSSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs SRCS+= zfs_cmd.c -.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1 -# Have to override to use 32-bit version of zfs library... -# kinda lame to select that there XXX -LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a -.else -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a -.endif .endif LIBFICL= ${BOOTOBJ}/ficl/libficl.a diff --git a/stand/sparc64/loader/Makefile b/stand/sparc64/loader/Makefile index 3dea514f45cc..cf901e39360a 100644 --- a/stand/sparc64/loader/Makefile +++ b/stand/sparc64/loader/Makefile @@ -44,7 +44,7 @@ LDFLAGS+= -static LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a CFLAGS+= -I${BOOTSRC}/ofw/libofw/ -DPADD= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} -LDADD= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} +DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} +LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA} .include diff --git a/stand/sparc64/zfsloader/Makefile b/stand/sparc64/zfsloader/Makefile index b4c554b5cb15..f58c727fce74 100644 --- a/stand/sparc64/zfsloader/Makefile +++ b/stand/sparc64/zfsloader/Makefile @@ -3,5 +3,6 @@ PROG= zfsloader NEWVERSWHAT= "ZFS enabled bootstrap loader" sparc64 HAVE_ZFS= yes +CFLAGS+= -DBOOTPROG=\"zfsloader\" .include "${.CURDIR}/../loader/Makefile" diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile index 29fa12c55723..1fc71782dfdf 100644 --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -41,14 +41,13 @@ NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT -LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a HAVE_ZFS=yes .endif # Always add MI sources .include "${BOOTSRC}/loader.mk" CFLAGS+= -I. -DPADD+= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBSA} -LDADD+= ${LDR_INTERP} ${LIBZFSBOOT} ${LIBSA} +DPADD+= ${LDR_INTERP} ${LIBSA} +LDADD+= ${LDR_INTERP} ${LIBSA} .include diff --git a/stand/zfs/Makefile.depend b/stand/zfs/Makefile.depend deleted file mode 100644 index 18be76b0cb6f..000000000000 --- a/stand/zfs/Makefile.depend +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/stand/zfs32/Makefile b/stand/zfs32/Makefile deleted file mode 100644 index 32d0074ad340..000000000000 --- a/stand/zfs32/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -DO32=1 - -.include "${.CURDIR}/../zfs/Makefile" diff --git a/stand/zfs32/Makefile.depend b/stand/zfs32/Makefile.depend deleted file mode 100644 index 18be76b0cb6f..000000000000 --- a/stand/zfs32/Makefile.depend +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif