svn commit: r346430 - in head/stand/efi: include libefi loader
Warner Losh
imp at FreeBSD.org
Sat Apr 20 05:31:58 UTC 2019
Author: imp
Date: Sat Apr 20 05:31:56 2019
New Revision: 346430
URL: https://svnweb.freebsd.org/changeset/base/346430
Log:
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.
Modified:
head/stand/efi/include/efizfs.h
head/stand/efi/libefi/devicename.c
head/stand/efi/loader/conf.c
head/stand/efi/loader/main.c
Modified: head/stand/efi/include/efizfs.h
==============================================================================
--- head/stand/efi/include/efizfs.h Sat Apr 20 04:16:51 2019 (r346429)
+++ head/stand/efi/include/efizfs.h Sat Apr 20 05:31:56 2019 (r346430)
@@ -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
Modified: head/stand/efi/libefi/devicename.c
==============================================================================
--- head/stand/efi/libefi/devicename.c Sat Apr 20 04:16:51 2019 (r346429)
+++ head/stand/efi/libefi/devicename.c Sat Apr 20 05:31:56 2019 (r346430)
@@ -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 **);
Modified: head/stand/efi/loader/conf.c
==============================================================================
--- head/stand/efi/loader/conf.c Sat Apr 20 04:16:51 2019 (r346429)
+++ head/stand/efi/loader/conf.c Sat Apr 20 05:31:56 2019 (r346430)
@@ -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,
Modified: head/stand/efi/loader/main.c
==============================================================================
--- head/stand/efi/loader/main.c Sat Apr 20 04:16:51 2019 (r346429)
+++ head/stand/efi/loader/main.c Sat Apr 20 05:31:56 2019 (r346430)
@@ -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();
More information about the svn-src-all
mailing list