2010-08-04 Robert Millan <rmh@gnu.org>
Support OpenSolaris in ZFS device resolution. * configure.ac: Check for getmntany(). * kern/emu/misc.c [HAVE_GETMNTANY]: Include `<sys/mnttab.h>'. [HAVE_GETMNTANY] (grub_find_zpool_from_mount_point): Add OpenSolaris support.
This commit is contained in:
parent
9dd6fd50b4
commit
62858144fe
3 changed files with 33 additions and 2 deletions
|
@ -1,3 +1,12 @@
|
|||
2010-08-04 Robert Millan <rmh@gnu.org>
|
||||
|
||||
Support OpenSolaris in ZFS device resolution.
|
||||
|
||||
* configure.ac: Check for getmntany().
|
||||
* kern/emu/misc.c [HAVE_GETMNTANY]: Include `<sys/mnttab.h>'.
|
||||
[HAVE_GETMNTANY] (grub_find_zpool_from_mount_point): Add OpenSolaris
|
||||
support.
|
||||
|
||||
2010-08-03 Robert Millan <rmh@gnu.org>
|
||||
|
||||
Fix grub-emu build.
|
||||
|
|
|
@ -247,7 +247,7 @@ else
|
|||
fi
|
||||
|
||||
# Check for functions and headers.
|
||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getfsstat)
|
||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getfsstat getmntany)
|
||||
AC_CHECK_HEADERS(libzfs.h libnvpair.h)
|
||||
|
||||
# For opendisk() and getrawpartition() on NetBSD.
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETMNTANY
|
||||
# include <sys/mnttab.h>
|
||||
#endif
|
||||
|
||||
#include <grub/mm.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/env.h>
|
||||
|
@ -340,7 +344,7 @@ grub_find_zpool_from_mount_point (const char *mnt_point, char **poolname, char *
|
|||
|
||||
*poolname = *poolfs = NULL;
|
||||
|
||||
#ifdef HAVE_GETFSSTAT
|
||||
#if defined(HAVE_GETFSSTAT) /* FreeBSD and GNU/kFreeBSD */
|
||||
{
|
||||
int mnt_count = getfsstat (NULL, 0, MNT_WAIT);
|
||||
if (mnt_count == -1)
|
||||
|
@ -363,6 +367,24 @@ grub_find_zpool_from_mount_point (const char *mnt_point, char **poolname, char *
|
|||
|
||||
free (mnt);
|
||||
}
|
||||
#elif defined(HAVE_GETMNTANY) /* OpenSolaris */
|
||||
{
|
||||
FILE *mnttab = fopen ("/etc/mnttab", "r");
|
||||
struct mnttab mp;
|
||||
struct mnttab mpref =
|
||||
{
|
||||
.mnt_special = NULL,
|
||||
.mnt_mountp = mnt_point,
|
||||
.mnt_fstype = "zfs",
|
||||
.mnt_mntopts = NULL,
|
||||
.mnt_time = NULL,
|
||||
};
|
||||
|
||||
if (getmntany (mnttab, &mp, &mpref) == 0)
|
||||
*poolname = xstrdup (mp.mnt_special);
|
||||
|
||||
fclose (mnttab);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! *poolname)
|
||||
|
|
Loading…
Reference in a new issue