Start to reduce the number of #ifdef EFI_ZFS_BOOT

There's a number of EFI_ZFS_BOOT #ifdefs that aren't needed, or can be
eliminated with some trivial #defines. Remove the EFI_ZFS_BOOT ifdefs
that aren't needed. Replace libzfs.h include which is not safe to
include without EFI_ZFS_BOOT with efizfs.h which is and now
conditionally included libzfs.h. Define efizfs_set_preferred away
and define efi_zfs_probe to NULL when ZFS is compiled out.
This commit is contained in:
Warner Losh 2019-04-20 05:31:56 +00:00
parent c4a350ffea
commit 3d384d51aa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346430
4 changed files with 9 additions and 15 deletions

View File

@ -33,6 +33,8 @@
#define _EFIZFS_H_
#ifdef EFI_ZFS_BOOT
#include <libzfs.h>
typedef STAILQ_HEAD(zfsinfo_list, zfsinfo) zfsinfo_list_t;
typedef struct zfsinfo
@ -50,6 +52,9 @@ bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *);
zfsinfo_list_t *efizfs_get_zfsinfo_list(void);
void efizfs_set_preferred(EFI_HANDLE);
#else
#define efizfs_set_preferred(x)
#define efi_zfs_probe NULL
#endif
#endif

View File

@ -34,12 +34,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <bootstrap.h>
#include <disk.h>
#ifdef EFI_ZFS_BOOT
#include <libzfs.h>
#endif
#include <efi.h>
#include <efilib.h>
#include <efizfs.h>
static int efi_parsedev(struct devdesc **, const char *, const char **);

View File

@ -31,9 +31,7 @@ __FBSDID("$FreeBSD$");
#include <bootstrap.h>
#include <efi.h>
#include <efilib.h>
#ifdef EFI_ZFS_BOOT
#include <libzfs.h>
#endif
#include <efizfs.h>
struct devsw *devsw[] = {
&efipart_fddev,

View File

@ -50,10 +50,7 @@ __FBSDID("$FreeBSD$");
#include <bootstrap.h>
#include <smbios.h>
#ifdef EFI_ZFS_BOOT
#include <libzfs.h>
#include "efizfs.h"
#endif
#include "loader_efi.h"
@ -763,18 +760,14 @@ main(int argc, CHAR16 *argv[])
archsw.arch_copyin = efi_copyin;
archsw.arch_copyout = efi_copyout;
archsw.arch_readin = efi_readin;
#ifdef EFI_ZFS_BOOT
/* Note this needs to be set before ZFS init. */
archsw.arch_zfs_probe = efi_zfs_probe;
#endif
/* Get our loaded image protocol interface structure. */
BS->HandleProtocol(IH, &imgid, (VOID**)&img);
#ifdef EFI_ZFS_BOOT
/* Tell ZFS probe code where we booted from */
/* Tell ZFS probe code where we booted from, if zfs configured */
efizfs_set_preferred(img->DeviceHandle);
#endif
/* Init the time source */
efi_time_init();