From e16c26f81a77523a2b03bbf32e83d87e5f64703c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 10:25:07 -0800 Subject: [PATCH 1/4] Refresh linux-have-libefi --- .topdeps | 4 +--- .topmsg | 17 ++--------------- zfs/lib/libzfs/libzfs_pool.c | 3 +++ zfs/zcmd/zpool/zpool_vdev.c | 7 ++++++- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.topdeps b/.topdeps index 607c231780..7f16cbcdd5 100644 --- a/.topdeps +++ b/.topdeps @@ -1,3 +1 @@ -gcc-branch -fix-branch -feature-branch +zfs-branch diff --git a/.topmsg b/.topmsg index e9722e1075..28f81782d4 100644 --- a/.topmsg +++ b/.topmsg @@ -1,19 +1,6 @@ From: Brian Behlendorf -Subject: [PATCH] zfs branch +Subject: [PATCH] linux have libefi -Merged result of all changes which are relevant to both Solaris -and Linux builds of the ZFS code. These are changes where there -is a reasonable chance they will be accepted upstream. - -Additionally, since this is effectively the root of the linux -ZFS tree the core linux build system is added here. This -includes autogen.sh, configure.ac, m4 macros, some scripts/*, -and makefiles for all the core ZFS components. Linux-only -features which require tweaks to the build system should appear -on the relevant topic branches. All autotools products which -result from autogen.sh are commited to the linux-configure-branch. - -This branch also contains the META, ChangeLog, AUTHORS, -README, and GIT files. +Use libefi if HAVE_LIBEFI defined Signed-off-by: Brian Behlendorf diff --git a/zfs/lib/libzfs/libzfs_pool.c b/zfs/lib/libzfs/libzfs_pool.c index ae4b19adba..113abc9d34 100644 --- a/zfs/lib/libzfs/libzfs_pool.c +++ b/zfs/lib/libzfs/libzfs_pool.c @@ -46,6 +46,7 @@ #include "zfs_namecheck.h" #include "zfs_prop.h" #include "libzfs_impl.h" +#include "zfs_config.h" static int read_efi_label(nvlist_t *config, diskaddr_t *sb); @@ -2808,6 +2809,7 @@ read_efi_label(nvlist_t *config, diskaddr_t *sb) * determine where a partition starts on a disk in the current * configuration */ +#ifdef HAVE_LIBEFI static diskaddr_t find_start_block(nvlist_t *config) { @@ -3060,3 +3062,4 @@ out: libzfs_fini(hdl); return (ret); } +#endif /* HAVE_LIBEFI */ diff --git a/zfs/zcmd/zpool/zpool_vdev.c b/zfs/zcmd/zpool/zpool_vdev.c index 10007c1492..f8d16136ee 100644 --- a/zfs/zcmd/zpool/zpool_vdev.c +++ b/zfs/zcmd/zpool/zpool_vdev.c @@ -360,6 +360,7 @@ check_file(const char *file, boolean_t force, boolean_t isspare) static boolean_t is_whole_disk(const char *arg) { +#ifdef HAVE_LIBEFI struct dk_gpt *label; int fd; char path[MAXPATHLEN]; @@ -375,6 +376,9 @@ is_whole_disk(const char *arg) efi_free(label); (void) close(fd); return (B_TRUE); +#else + return (B_FALSE); +#endif } /* @@ -884,6 +888,7 @@ check_replication(nvlist_t *config, nvlist_t *newroot) static int make_disks(zpool_handle_t *zhp, nvlist_t *nv) { +#ifdef HAVE_LIBEFI nvlist_t **child; uint_t c, children; char *type, *path, *diskname; @@ -971,7 +976,7 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv) for (c = 0; c < children; c++) if ((ret = make_disks(zhp, child[c])) != 0) return (ret); - +#endif return (0); } From 06418073d424b5902cd908e25ab6807b8e80e9d4 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 15 Dec 2008 10:54:53 -0800 Subject: [PATCH 2/4] Move libefi check to libefi topic branch --- config/user.m4 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/user.m4 b/config/user.m4 index 80a15ae082..6417a5e654 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -2,4 +2,11 @@ dnl # dnl # Default ZFS user configuration dnl # AC_DEFUN([ZFS_AC_CONFIG_USER], [ + ZFS_AC_CONFIG_USER_LIBEFI +]) + +AC_DEFUN([ZFS_AC_CONFIG_USER_LIBEFI], [ + AC_CHECK_LIB([efi], [efi_alloc_and_init], + [AC_DEFINE([HAVE_LIBEFI], 1, + [Define to 1 if 'libefi' library available])]) ]) From 35f607040f154dfd7a73e58edd7a934815988239 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 16 Dec 2008 15:33:00 -0800 Subject: [PATCH 3/4] Wrap additional new efi code in HAVE_LIBEFI macros --- lib/libzfs/libzfs_pool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 113abc9d34..55e6e6b4ec 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -310,6 +310,7 @@ bootfs_name_valid(const char *pool, char *bootfs) static boolean_t pool_uses_efi(nvlist_t *config) { +#ifdef HAVE_LIBEFI nvlist_t **child; uint_t c, children; @@ -321,6 +322,7 @@ pool_uses_efi(nvlist_t *config) if (pool_uses_efi(child[c])) return (B_TRUE); } +#endif return (B_FALSE); } @@ -2773,6 +2775,7 @@ zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj, */ #define NEW_START_BLOCK 256 +#ifdef HAVE_LIBEFI /* * Read the EFI label from the config, if a label does not exist then * pass back the error to the caller. If the caller has passed a non-NULL @@ -2809,7 +2812,6 @@ read_efi_label(nvlist_t *config, diskaddr_t *sb) * determine where a partition starts on a disk in the current * configuration */ -#ifdef HAVE_LIBEFI static diskaddr_t find_start_block(nvlist_t *config) { From 426ed71564efa7cfbe6a694d5b98c166a109216a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 11 Mar 2009 22:17:38 -0700 Subject: [PATCH 4/4] Pull unused function under HAVE_LIBEFI ifdef. --- lib/libzfs/libzfs_pool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 92642b7f4d..43dff1a8b2 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -48,7 +48,9 @@ #include "libzfs_impl.h" #include "zfs_config.h" +#ifdef HAVE_LIBEFI static int read_efi_label(nvlist_t *config, diskaddr_t *sb); +#endif #if defined(__i386) || defined(__amd64) #define BOOTCMD "installgrub(1M)"