2010-08-01 Robert Millan <rmh@gnu.org>

Make it even harder to use uninitialized `libzfs_handle' (and
	make the interface a bit simpler).
	
	* include/grub/util/misc.h (grub_util_init_libzfs)
	(libzfs_handle): Remove.
	(grub_get_libzfs_handle): New prototype.
	
	* util/misc.c [HAVE_LIBZFS] (libzfs_handle): Add `static'
	attribute.
	(grub_util_init_libzfs): Remove.
	(grub_get_libzfs_handle): New function.
	
	* kern/emu/getroot.c (find_root_device_from_libzfs): Use
	grub_get_libzfs_handle() to obtain a libzfs handle instead of
	accessing `libzfs_handle' directly.
This commit is contained in:
Robert Millan 2010-08-01 23:12:24 +02:00
parent c882acc031
commit f7abdefbdd
4 changed files with 27 additions and 12 deletions

View file

@ -197,9 +197,7 @@ find_root_device_from_libzfs (const char *dir)
nvlist_t **nvlist_array;
unsigned int nvlist_count;
grub_util_init_libzfs ();
zpool = zpool_open (libzfs_handle, poolname);
zpool = zpool_open (grub_get_libzfs_handle (), poolname);
nvlist = zpool_get_config (zpool, NULL);
if (nvlist_lookup_nvlist (nvlist, "vdev_tree", &nvlist) != 0)