+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.
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.
#include <limits.h>
#endif
+#ifdef HAVE_GETMNTANY
+# include <sys/mnttab.h>
+#endif
+
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/env.h>
*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)
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)