libnvpair: Support prefixed nvlist symbol names as found on NetBSD
NetBSD uses slightly different function names for the same functions. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
a13df3d15a
commit
f20123072a
15
configure.ac
15
configure.ac
@ -2005,8 +2005,19 @@ fi
|
||||
|
||||
if test x"$libzfs_excuse" = x ; then
|
||||
AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
|
||||
[],
|
||||
[libzfs_excuse="need nvpair library"])
|
||||
[have_normal_nvpair=yes],
|
||||
[have_normal_nvpair=no])
|
||||
if test x"$have_normal_nvpair" = xno ; then
|
||||
AC_CHECK_LIB([nvpair], [opensolaris_nvlist_lookup_string],
|
||||
[have_prefixed_nvpair=yes],
|
||||
[have_prefixed_nvpair=no])
|
||||
if test x"$have_prefixed_nvpair" = xyes ; then
|
||||
AC_DEFINE([GRUB_UTIL_NVPAIR_IS_PREFIXED], [1],
|
||||
[Define to 1 if libnvpair symbols are prefixed with opensolaris_.])
|
||||
else
|
||||
libzfs_excuse="need nvpair library"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
|
||||
|
||||
@ -174,20 +174,20 @@ grub_util_find_root_devices_from_poolname (char *poolname)
|
||||
zpool = zpool_open (libzfs, poolname);
|
||||
config = zpool_get_config (zpool, NULL);
|
||||
|
||||
if (nvlist_lookup_nvlist (config, "vdev_tree", &vdev_tree) != 0)
|
||||
if (NVLIST(lookup_nvlist) (config, "vdev_tree", &vdev_tree) != 0)
|
||||
error (1, errno, "nvlist_lookup_nvlist (\"vdev_tree\")");
|
||||
|
||||
if (nvlist_lookup_nvlist_array (vdev_tree, "children", &children, &nvlist_count) != 0)
|
||||
if (NVLIST(lookup_nvlist_array) (vdev_tree, "children", &children, &nvlist_count) != 0)
|
||||
error (1, errno, "nvlist_lookup_nvlist_array (\"children\")");
|
||||
assert (nvlist_count > 0);
|
||||
|
||||
while (nvlist_lookup_nvlist_array (children[0], "children",
|
||||
while (NVLIST(lookup_nvlist_array) (children[0], "children",
|
||||
&children, &nvlist_count) == 0)
|
||||
assert (nvlist_count > 0);
|
||||
|
||||
for (i = 0; i < nvlist_count; i++)
|
||||
{
|
||||
if (nvlist_lookup_string (children[i], "path", &device) != 0)
|
||||
if (NVLIST(lookup_string) (children[i], "path", &device) != 0)
|
||||
error (1, errno, "nvlist_lookup_string (\"path\")");
|
||||
|
||||
struct stat st;
|
||||
|
||||
@ -29,9 +29,15 @@
|
||||
|
||||
typedef void nvlist_t;
|
||||
|
||||
int nvlist_lookup_string (nvlist_t *, const char *, char **);
|
||||
int nvlist_lookup_nvlist (nvlist_t *, const char *, nvlist_t **);
|
||||
int nvlist_lookup_nvlist_array (nvlist_t *, const char *, nvlist_t ***, unsigned int *);
|
||||
#ifdef GRUB_UTIL_NVPAIR_IS_PREFIXED
|
||||
#define NVLIST(x) opensolaris_nvlist_ ## x
|
||||
#else
|
||||
#define NVLIST(x) nvlist_ ## x
|
||||
#endif
|
||||
|
||||
int NVLIST(lookup_string) (nvlist_t *, const char *, char **);
|
||||
int NVLIST(lookup_nvlist) (nvlist_t *, const char *, nvlist_t **);
|
||||
int NVLIST(lookup_nvlist_array) (nvlist_t *, const char *, nvlist_t ***, unsigned int *);
|
||||
|
||||
#endif /* ! HAVE_LIBNVPAIR_H */
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user