2010-09-10 Robert Millan <rmh@gnu.org>

* configure.ac: Check for `struct statfs.f_fstypename' and
	`struct statfs.f_mntfromname'.
	
	* grub-core/kern/emu/misc.c (grub_find_zpool_from_dir): Conditionalize
	kFreeBSD-specific code.
This commit is contained in:
Robert Millan 2010-09-10 14:02:54 +02:00
parent 66d4bea5cc
commit fb90b54648
3 changed files with 30 additions and 6 deletions

View file

@ -1,3 +1,11 @@
2010-09-10 Robert Millan <rmh@gnu.org>
* configure.ac: Check for `struct statfs.f_fstypename' and
`struct statfs.f_mntfromname'.
* grub-core/kern/emu/misc.c (grub_find_zpool_from_dir): Conditionalize
kFreeBSD-specific code.
2010-09-10 Robert Millan <rmh@gnu.org>
* util/grub.d/10_kfreebsd.in: Fix ${kfreebsd_device} initialization

View file

@ -280,6 +280,14 @@ fi
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h)
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
#include <sys/param.h>
#include <sys/mount.h>])
AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
#include <sys/param.h>
#include <sys/mount.h>])
# For opendisk() and getrawpartition() on NetBSD.
# Used in util/deviceiter.c and in util/hostdisk.c.
AC_CHECK_HEADER([util.h], [

View file

@ -282,11 +282,15 @@ grub_get_libzfs_handle (void)
void
grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs)
{
struct statfs mnt;
char *slash;
*poolname = *poolfs = NULL;
#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) && defined(HAVE_STRUCT_STATFS_F_MNTFROMNAME)
/* FreeBSD and GNU/kFreeBSD. */
{
struct statfs mnt;
if (statfs (dir, &mnt) != 0)
return;
@ -294,6 +298,10 @@ grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs)
return;
*poolname = xstrdup (mnt.f_mntfromname);
}
#else
return;
#endif
slash = strchr (*poolname, '/');
if (slash)