Skip to content

Commit

Permalink
10000 loader: stop using ../zfs/libzfs.h but instead use libzfs.h
Browse files Browse the repository at this point in the history
Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
  • Loading branch information
tsoome authored and richlowe committed Nov 30, 2018
1 parent f2aacf2 commit 3d4c071
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 101 deletions.
7 changes: 5 additions & 2 deletions usr/src/boot/sys/boot/i386/libi386/Makefile
Expand Up @@ -16,8 +16,11 @@

include $(SRC)/Makefile.master

CFLAGS= -Os -I../../../../include -I../../..
CPPFLAGS= -D_STANDALONE -DLOADER_ZFS_SUPPORT
CFLAGS= -Os
CPPFLAGS= -nostdinc -I../../../../include -I../../..
CPPFLAGS += -I../../../../lib/libz
CPPFLAGS += -I../../zfs
CPPFLAGS += -D_STANDALONE

all install: libi386.a

Expand Down
2 changes: 1 addition & 1 deletion usr/src/boot/sys/boot/i386/libi386/devicename.c
Expand Up @@ -32,7 +32,7 @@
#include "bootstrap.h"
#include "disk.h"
#include "libi386.h"
#include "../zfs/libzfs.h"
#include "libzfs.h"

static int i386_parsedev(struct i386_devdesc **, const char *, const char **);

Expand Down
8 changes: 4 additions & 4 deletions usr/src/boot/sys/boot/i386/libi386/multiboot.c
@@ -1,4 +1,4 @@
/*-
/*
* Copyright (c) 2014 Roger Pau Monné <royger@FreeBSD.org>
* All rights reserved.
*
Expand Down Expand Up @@ -50,9 +50,9 @@

#include "bootstrap.h"
#include <sys/multiboot.h>
#include "../zfs/libzfs.h"
#include "../i386/libi386/libi386.h"
#include "../i386/btx/lib/btxv86.h"
#include "libzfs.h"
#include "libi386.h"
#include "../btx/lib/btxv86.h"

#define SUPPORT_DHCP
#include <bootp.h>
Expand Down
2 changes: 1 addition & 1 deletion usr/src/boot/sys/boot/i386/loader/Makefile
Expand Up @@ -25,7 +25,7 @@ LOADER= loader
NEWVERSWHAT= "ZFS enabled bootstrap loader" x86

# Set by loader Makefile
CPPFLAGS += -DLOADER_ZFS_SUPPORT -I../../zfs
CPPFLAGS += -I../../zfs
CPPFLAGS += -I../libi386
LIBZFSBOOT= ../../zfs/$(MACH)/libzfsboot.a
LIBI386= ../libi386/libi386.a
Expand Down
19 changes: 6 additions & 13 deletions usr/src/boot/sys/boot/i386/loader/conf.c
@@ -1,4 +1,4 @@
/*-
/*
* Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
* All rights reserved.
*
Expand All @@ -25,14 +25,11 @@
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <stand.h>
#include <bootstrap.h>
#include "libi386/libi386.h"
#if defined(LOADER_ZFS_SUPPORT)
#include "../zfs/libzfs.h"
#endif
#include "libi386.h"
#include "libzfs.h"

/*
* We could use linker sets for some or all of these, but
Expand All @@ -57,19 +54,15 @@ struct devsw *devsw[] = {
#if defined(LOADER_FIREWIRE_SUPPORT)
&fwohci,
#endif
#if defined(LOADER_ZFS_SUPPORT)
&zfs_dev,
#endif
NULL
};

struct fs_ops *file_system[] = {
#ifdef LOADER_GZIP_SUPPORT
&gzipfs_fsops,
#endif
#if defined(LOADER_ZFS_SUPPORT)
&zfs_fsops,
#endif
&ufs_fsops,
&dosfs_fsops,
#if 0
Expand All @@ -91,7 +84,7 @@ struct fs_ops *file_system[] = {
};

/* Exported for i386 only */
/*
/*
* Sort formats so that those that can detect based on arguments
* rather than reading the file go first.
*/
Expand All @@ -118,8 +111,8 @@ struct file_format *file_formats[] = {
NULL
};

/*
* Consoles
/*
* Consoles
*
* We don't prototype these in libi386.h because they require
* data structures from bootstrap.h as well.
Expand Down
21 changes: 3 additions & 18 deletions usr/src/boot/sys/boot/i386/loader/main.c
@@ -1,4 +1,4 @@
/*-
/*
* Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
* All rights reserved.
*
Expand Down Expand Up @@ -46,10 +46,7 @@
#include "libi386/libi386.h"
#include "libi386/smbios.h"
#include "btxv86.h"

#ifdef LOADER_ZFS_SUPPORT
#include "../zfs/libzfs.h"
#endif
#include "libzfs.h"

CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE);
CTASSERT(offsetof(struct bootargs, bootinfo) == BA_BOOTINFO);
Expand All @@ -69,9 +66,7 @@ static void extract_currdev(void);
static int isa_inb(int port);
static void isa_outb(int port, int value);
void exit(int code);
#ifdef LOADER_ZFS_SUPPORT
static void i386_zfs_probe(void);
#endif

/* XXX debugging */
extern char end[];
Expand Down Expand Up @@ -99,16 +94,12 @@ main(void)
*/
bios_getmem();

#if defined(LOADER_BZIP2_SUPPORT) || defined(LOADER_FIREWIRE_SUPPORT) || \
defined(LOADER_GPT_SUPPORT) || defined(LOADER_ZFS_SUPPORT)
if (high_heap_size > 0) {
heap_top = PTOV(high_heap_base + high_heap_size);
heap_bottom = PTOV(high_heap_base);
if (high_heap_base < memtop_copyin)
memtop_copyin = high_heap_base;
} else
#endif
{
} else {
heap_top = (void *)PTOV(bios_basemem);
heap_bottom = (void *)end;
}
Expand Down Expand Up @@ -161,9 +152,7 @@ main(void)
archsw.arch_isainb = isa_inb;
archsw.arch_isaoutb = isa_outb;
archsw.arch_loadaddr = i386_loadaddr;
#ifdef LOADER_ZFS_SUPPORT
archsw.arch_zfs_probe = i386_zfs_probe;
#endif

/*
* March through the device switch probing for things.
Expand Down Expand Up @@ -211,9 +200,7 @@ static void
extract_currdev(void)
{
struct i386_devdesc new_currdev;
#ifdef LOADER_ZFS_SUPPORT
struct zfs_boot_args *zargs;
#endif
int biosdev = -1;

/* Assume we are booting from a BIOS disk by default */
Expand All @@ -235,7 +222,6 @@ extract_currdev(void)
new_currdev.d_kind.biosdisk.partition = 0;
biosdev = -1;
}
#ifdef LOADER_ZFS_SUPPORT
} else if ((kargs->bootflags & KARGS_FLAGS_ZFS) != 0) {
zargs = NULL;
/* check for new style extended argument */
Expand All @@ -253,7 +239,6 @@ extract_currdev(void)
new_currdev.d_kind.zfs.root_guid = 0;
}
new_currdev.dd.d_dev = &zfs_dev;
#endif
} else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) {
/* The passed-in boot device is bad */
new_currdev.d_kind.biosdisk.slice = -1;
Expand Down
2 changes: 1 addition & 1 deletion usr/src/boot/sys/boot/ofw/libofw/devicename.c
Expand Up @@ -30,7 +30,7 @@

#include "bootstrap.h"
#include "libofw.h"
#include "../zfs/libzfs.h"
#include "libzfs.h"

static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **);

Expand Down
4 changes: 0 additions & 4 deletions usr/src/boot/sys/boot/sparc64/loader/Makefile
Expand Up @@ -14,7 +14,6 @@ SRCS= locore.S main.c metadata.c vers.c
LOADER_DISK_SUPPORT?= yes
LOADER_UFS_SUPPORT?= yes
LOADER_CD9660_SUPPORT?= yes
LOADER_ZFS_SUPPORT?= no
LOADER_NET_SUPPORT?= yes
LOADER_NFS_SUPPORT?= yes
LOADER_TFTP_SUPPORT?= yes
Expand All @@ -34,12 +33,9 @@ CFLAGS+= -DLOADER_UFS_SUPPORT
.if ${LOADER_CD9660_SUPPORT} == "yes"
CFLAGS+= -DLOADER_CD9660_SUPPORT
.endif
.if ${LOADER_ZFS_SUPPORT} == "yes"
CFLAGS+= -DLOADER_ZFS_SUPPORT
CFLAGS+= -I${.CURDIR}/../../zfs
CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs
LIBZFSBOOT= ${.OBJDIR}/../../zfs/libzfsboot.a
.endif
.if ${LOADER_GZIP_SUPPORT} == "yes"
CFLAGS+= -DLOADER_GZIP_SUPPORT
.endif
Expand Down
16 changes: 1 addition & 15 deletions usr/src/boot/sys/boot/sparc64/loader/main.c
Expand Up @@ -50,10 +50,8 @@
#include <sys/linker.h>
#include <sys/queue.h>
#include <sys/types.h>
#ifdef LOADER_ZFS_SUPPORT
#include <sys/vtoc.h>
#include "../zfs/libzfs.h"
#endif
#include "libzfs.h"

#include <vm/vm.h>
#include <machine/asi.h>
Expand Down Expand Up @@ -139,9 +137,7 @@ static vm_offset_t heapva;
static char bootpath[64];
static phandle_t root;

#ifdef LOADER_ZFS_SUPPORT
static struct zfs_devdesc zfs_currdev;
#endif

/*
* Machine dependent structures that the machine independent
Expand All @@ -154,9 +150,7 @@ struct devsw *devsw[] = {
#ifdef LOADER_NET_SUPPORT
&netdev,
#endif
#ifdef LOADER_ZFS_SUPPORT
&zfs_dev,
#endif
NULL
};

Expand All @@ -173,9 +167,7 @@ struct file_format *file_formats[] = {
};

struct fs_ops *file_system[] = {
#ifdef LOADER_ZFS_SUPPORT
&zfs_fsops,
#endif
#ifdef LOADER_UFS_SUPPORT
&ufs_fsops,
#endif
Expand Down Expand Up @@ -731,7 +723,6 @@ tlb_init_sun4u(void)
panic("%s: can't allocate TLB store", __func__);
}

#ifdef LOADER_ZFS_SUPPORT
static void
sparc64_zfs_probe(void)
{
Expand Down Expand Up @@ -809,7 +800,6 @@ sparc64_zfs_probe(void)
zfs_currdev.dd.d_dev = &zfs_dev;
}
}
#endif /* LOADER_ZFS_SUPPORT */

int
main(int (*openfirm)(void *))
Expand All @@ -827,9 +817,7 @@ main(int (*openfirm)(void *))
archsw.arch_copyout = ofw_copyout;
archsw.arch_readin = sparc64_readin;
archsw.arch_autoload = sparc64_autoload;
#ifdef LOADER_ZFS_SUPPORT
archsw.arch_zfs_probe = sparc64_zfs_probe;
#endif

if (init_heap() == (vm_offset_t)-1)
OF_exit();
Expand Down Expand Up @@ -859,13 +847,11 @@ main(int (*openfirm)(void *))
if ((*dp)->dv_init != 0)
(*dp)->dv_init();

#ifdef LOADER_ZFS_SUPPORT
if (zfs_currdev.pool_guid != 0) {
(void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev),
sizeof(bootpath) - 1);
bootpath[sizeof(bootpath) - 1] = '\0';
} else
#endif

/*
* Sun compatible bootable CD-ROMs have a disk label placed before
Expand Down
5 changes: 2 additions & 3 deletions usr/src/boot/sys/boot/userboot/userboot/Makefile
Expand Up @@ -52,16 +52,15 @@ LIBSTAND= ${.OBJDIR}/../libstand/libstand.a
.endif

.if ${MK_ZFS} != "no"
CFLAGS+= -DUSERBOOT_ZFS_SUPPORT
LIBZFSBOOT= ${.OBJDIR}/../zfs/libzfsboot.a
.endif

# Always add MI sources
# Always add MI sources
.PATH: ${.CURDIR}/../../common
.include "${.CURDIR}/../../common/Makefile.inc"
CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I.
DPADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND}
DPADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND}
LDADD+= ${LIBFICL} ${LIBZFSBOOT} ${LIBSTAND}

.include <bsd.lib.mk>
20 changes: 6 additions & 14 deletions usr/src/boot/sys/boot/userboot/userboot/conf.c
@@ -1,4 +1,4 @@
/*-
/*
* Copyright (c) 1997
* Matthias Drochner. All rights reserved.
*
Expand Down Expand Up @@ -28,19 +28,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $
* $NetBSD: conf.c,v 1.2 1997/03/22 09:03:29 thorpej Exp $
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <stand.h>

#include "libuserboot.h"

#if defined(USERBOOT_ZFS_SUPPORT)
#include "../zfs/libzfs.h"
#endif
#include "libzfs.h"

/*
* We could use linker sets for some or all of these, but
Expand All @@ -55,26 +51,22 @@ __FBSDID("$FreeBSD$");
struct devsw *devsw[] = {
&host_dev,
&userboot_disk,
#if defined(USERBOOT_ZFS_SUPPORT)
&zfs_dev,
#endif
NULL
};

struct fs_ops *file_system[] = {
&host_fsops,
&ufs_fsops,
&cd9660_fsops,
#if defined(USERBOOT_ZFS_SUPPORT)
&zfs_fsops,
#endif
&gzipfs_fsops,
&bzipfs_fsops,
NULL
};

/* Exported for i386 only */
/*
/*
* Sort formats so that those that can detect based on arguments
* rather than reading the file go first.
*/
Expand All @@ -91,8 +83,8 @@ struct file_format *file_formats[] = {
NULL
};

/*
* Consoles
/*
* Consoles
*
* We don't prototype these in libuserboot.h because they require
* data structures from bootstrap.h as well.
Expand Down

0 comments on commit 3d4c071

Please sign in to comment.