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:
parent
66d4bea5cc
commit
fb90b54648
3 changed files with 30 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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], [
|
||||
|
|
|
@ -282,18 +282,26 @@ 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 (statfs (dir, &mnt) != 0)
|
||||
return;
|
||||
#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) && defined(HAVE_STRUCT_STATFS_F_MNTFROMNAME)
|
||||
/* FreeBSD and GNU/kFreeBSD. */
|
||||
{
|
||||
struct statfs mnt;
|
||||
|
||||
if (strcmp (mnt.f_fstypename, "zfs") != 0)
|
||||
return;
|
||||
if (statfs (dir, &mnt) != 0)
|
||||
return;
|
||||
|
||||
*poolname = xstrdup (mnt.f_mntfromname);
|
||||
if (strcmp (mnt.f_fstypename, "zfs") != 0)
|
||||
return;
|
||||
|
||||
*poolname = xstrdup (mnt.f_mntfromname);
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
||||
slash = strchr (*poolname, '/');
|
||||
if (slash)
|
||||
|
|
Loading…
Reference in a new issue