From 1fc41abb2fa6dba03aea53f70f98000435814f72 Mon Sep 17 00:00:00 2001 From: kevans Date: Wed, 20 Feb 2019 19:13:09 +0000 Subject: [PATCH] MFC r336084-r336085, r336118: Move zfs impl into libsa r336084: 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@ r336085: Stop using ../zfs/libzfs.h but instead use libzfs.h. While ../zfs/libzfs.h mostly works, there are a few situations where it does not. Eliminate the problem by using plain libzfs.h, like we do for ufs support. This fixes the weird cases, and is easier to understand. It also follows the general style convetion of avoiding ../ in #includes. r336118: Remove dirs that git svn should have removed but didn't. --- stand/Makefile | 3 +-- stand/common/zfs_cmd.c | 2 +- stand/defs.mk | 2 +- stand/efi/boot1/Makefile | 5 ++--- stand/efi/loader/Makefile | 6 ++---- stand/i386/gptzfsboot/Makefile | 8 +------- stand/i386/libi386/Makefile | 1 + stand/i386/libi386/devicename.c | 2 +- stand/i386/loader/Makefile | 4 ++-- stand/i386/loader/conf.c | 2 +- stand/i386/loader/main.c | 2 +- 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/ofw/libofw/Makefile | 1 + stand/ofw/libofw/devicename.c | 2 +- stand/pc98/libpc98/Makefile | 3 ++- stand/sparc64/loader/Makefile | 4 ++-- stand/sparc64/loader/main.c | 2 +- stand/sparc64/zfsloader/Makefile | 1 + stand/userboot/userboot/Makefile | 5 ++--- stand/userboot/userboot/conf.c | 2 +- stand/userboot/userboot/devicename.c | 2 +- stand/userboot/userboot/main.c | 2 +- stand/zfs/Makefile.depend | 13 ------------- stand/zfs32/Makefile | 5 ----- 32 files changed, 34 insertions(+), 72 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 diff --git a/stand/Makefile b/stand/Makefile index c676ded44ce..bc50e1bfb73 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/common/zfs_cmd.c b/stand/common/zfs_cmd.c index ae5a4b1a937..2e6a5e74da8 100644 --- a/stand/common/zfs_cmd.c +++ b/stand/common/zfs_cmd.c @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #ifdef LOADER_ZFS_SUPPORT -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset", diff --git a/stand/defs.mk b/stand/defs.mk index e3c143952ce..1365f181a97 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 02ca9470536..992afd5fc1d 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 09181dfe2fe..e890f743da5 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 928ecf5ba84..4eb37722f4f 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/libi386/Makefile b/stand/i386/libi386/Makefile index 6825d174771..381e458fbec 100644 --- a/stand/i386/libi386/Makefile +++ b/stand/i386/libi386/Makefile @@ -14,6 +14,7 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \ smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c .PATH: ${ZFSSRC} SRCS+= devicename_stubs.c +CFLAGS+= -I${ZFSSRC} BOOT_COMCONSOLE_PORT?= 0x3f8 CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} diff --git a/stand/i386/libi386/devicename.c b/stand/i386/libi386/devicename.c index 9780d598c24..bde216f1e0b 100644 --- a/stand/i386/libi386/devicename.c +++ b/stand/i386/libi386/devicename.c @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "disk.h" #include "libi386.h" -#include "../zfs/libzfs.h" +#include "libzfs.h" static int i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path); diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index f3483146672..3878622f9d6 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/loader/conf.c b/stand/i386/loader/conf.c index 821b239cdb2..1e62e401793 100644 --- a/stand/i386/loader/conf.c +++ b/stand/i386/loader/conf.c @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include "libi386/libi386.h" #if defined(LOADER_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif /* diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c index 9b6bd6486a4..6cb8e258578 100644 --- a/stand/i386/loader/main.c +++ b/stand/i386/loader/main.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "btxv86.h" #ifdef LOADER_ZFS_SUPPORT -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE); diff --git a/stand/i386/zfsboot/Makefile b/stand/i386/zfsboot/Makefile index cb10d96a33d..20e9737bac4 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 a9fa913e7e1..5e7eddc42a7 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 278330bb730..4b6ac44e6ae 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -151,4 +151,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 89c1bfdd9c4..46a12e7d8e5 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 3aa029b9e44..9dfff863d33 100644 --- a/stand/loader.mk +++ b/stand/loader.mk @@ -131,13 +131,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/ofw/libofw/Makefile b/stand/ofw/libofw/Makefile index 5ab94e0bee4..1017988705a 100644 --- a/stand/ofw/libofw/Makefile +++ b/stand/ofw/libofw/Makefile @@ -9,6 +9,7 @@ SRCS= devicename.c ofw_console.c ofw_copy.c ofw_disk.c \ ofw_time.c openfirm.c .PATH: ${ZFSSRC} SRCS+= devicename_stubs.c +CFLAGS+= -I${ZFSSRC} # Pick up the bootstrap header for some interface items CFLAGS+= -I${LDRSRC} diff --git a/stand/ofw/libofw/devicename.c b/stand/ofw/libofw/devicename.c index 1f45a9526c4..786e5549c0f 100644 --- a/stand/ofw/libofw/devicename.c +++ b/stand/ofw/libofw/devicename.c @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "libofw.h" -#include "../zfs/libzfs.h" +#include "libzfs.h" static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **); diff --git a/stand/pc98/libpc98/Makefile b/stand/pc98/libpc98/Makefile index 493fc37d0dd..8dba8c75017 100644 --- a/stand/pc98/libpc98/Makefile +++ b/stand/pc98/libpc98/Makefile @@ -12,8 +12,9 @@ SRCS= bioscd.c biosdisk.c biosmem.c biospnp.c \ comconsole.c devicename.c elf32_freebsd.c \ i386_copy.c i386_module.c nullconsole.c pc98_sys.c pxe.c pxetramp.s \ time.c vidconsole.c -.PATH: ${BOOTSRC}/zfs +.PATH: ${ZFSSRC} SRCS+= devicename_stubs.c +CFLAGS+= -I${ZFSSRC} BOOT_COMCONSOLE_PORT?= 0x238 CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} diff --git a/stand/sparc64/loader/Makefile b/stand/sparc64/loader/Makefile index 3dea514f45c..cf901e39360 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/loader/main.c b/stand/sparc64/loader/main.c index 75c9e3a72a7..c7e880caefe 100644 --- a/stand/sparc64/loader/main.c +++ b/stand/sparc64/loader/main.c @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef LOADER_ZFS_SUPPORT #include -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif #include diff --git a/stand/sparc64/zfsloader/Makefile b/stand/sparc64/zfsloader/Makefile index b4c554b5cb1..f58c727fce7 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 29fa12c5572..1fc71782dfd 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/userboot/userboot/conf.c b/stand/userboot/userboot/conf.c index b8daa7396ca..3a4417f576a 100644 --- a/stand/userboot/userboot/conf.c +++ b/stand/userboot/userboot/conf.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif /* diff --git a/stand/userboot/userboot/devicename.c b/stand/userboot/userboot/devicename.c index ede7ae947d4..5c50b84384d 100644 --- a/stand/userboot/userboot/devicename.c +++ b/stand/userboot/userboot/devicename.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" #endif static int userboot_parsedev(struct disk_devdesc **dev, const char *devspec, const char **path); diff --git a/stand/userboot/userboot/main.c b/stand/userboot/userboot/main.c index 294951f88aa..1bfe002be66 100644 --- a/stand/userboot/userboot/main.c +++ b/stand/userboot/userboot/main.c @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include "libuserboot.h" #if defined(USERBOOT_ZFS_SUPPORT) -#include "../zfs/libzfs.h" +#include "libzfs.h" static void userboot_zfs_probe(void); static int userboot_zfs_found; diff --git a/stand/zfs/Makefile.depend b/stand/zfs/Makefile.depend deleted file mode 100644 index 18be76b0cb6..00000000000 --- 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 32d0074ad34..00000000000 --- a/stand/zfs32/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -DO32=1 - -.include "${.CURDIR}/../zfs/Makefile" -- 2.45.0