HAVE_LIBZFS is defined by libzfs test and hence conflicts with manual definition
On NetBSD it ends up detecting zfs but not detecting nvpair and creates
confusion
Split them

Signed-off-by: Vladimir Serbinenko <phco...@gmail.com>
From 5291725d6f64b590ee90d51d11877cc52d52e733 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phco...@gmail.com>
Date: Thu, 24 Aug 2023 23:24:30 +0200
Subject: [PATCH 09/14] Rename HAVE_LIBZFS to USE_LIBZFS

HAVE_LIBZFS is defined by libzfs test and hence conflicts with manual definition
On NetBSD it ends up detecting zfs but not detecting nvpair and creates
confusion
Split them

Signed-off-by: Vladimir Serbinenko <phco...@gmail.com>
---
 configure.ac                   | 6 ++----
 grub-core/osdep/unix/getroot.c | 4 ++--
 util/getroot.c                 | 6 +++---
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index c19779c14..5e6e7d377 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2008,11 +2008,9 @@ fi
 if test x"$libzfs_excuse" = x ; then
   # We need both libzfs and libnvpair for a successful build.
   LIBZFS="-lzfs"
-  AC_DEFINE([HAVE_LIBZFS], [1],
-            [Define to 1 if you have the ZFS library.])
   LIBNVPAIR="-lnvpair"
-  AC_DEFINE([HAVE_LIBNVPAIR], [1],
-            [Define to 1 if you have the NVPAIR library.])
+  AC_DEFINE([USE_LIBZFS], [1],
+            [Define to 1 if ZFS library should be used.])
 fi
 
 AC_SUBST([LIBZFS])
diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c
index cde821eb9..71cdf2e86 100644
--- a/grub-core/osdep/unix/getroot.c
+++ b/grub-core/osdep/unix/getroot.c
@@ -53,7 +53,7 @@
 
 #include <grub/osdep/major.h>
 
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
+#ifdef USE_LIBZFS
 # include <grub/util/libzfs.h>
 # include <grub/util/libnvpair.h>
 #endif
@@ -158,7 +158,7 @@ grub_util_find_root_devices_from_poolname (char *poolname)
   size_t ndevices = 0;
   size_t devices_allocated = 0;
 
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
+#ifdef USE_LIBZFS
   zpool_handle_t *zpool;
   libzfs_handle_t *libzfs;
   nvlist_t *config, *vdev_tree;
diff --git a/util/getroot.c b/util/getroot.c
index 086581998..75a7d5f21 100644
--- a/util/getroot.c
+++ b/util/getroot.c
@@ -47,7 +47,7 @@
 
 #include <sys/types.h>
 
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
+#ifdef USE_LIBZFS
 # include <grub/util/libzfs.h>
 # include <grub/util/libnvpair.h>
 #endif
@@ -456,7 +456,7 @@ grub_util_biosdisk_is_present (const char *os_dev)
   return ret;
 }
 
-#ifdef HAVE_LIBZFS
+#ifdef USE_LIBZFS
 static libzfs_handle_t *__libzfs_handle;
 
 static void
@@ -478,5 +478,5 @@ grub_get_libzfs_handle (void)
 
   return __libzfs_handle;
 }
-#endif /* HAVE_LIBZFS */
+#endif /* USE_LIBZFS */
 
-- 
2.39.2

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to