mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-23 15:49:23 +00:00
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:
1 parent
9dd6fd50b4
commit
62858144fe
3 files changed
+33
-2
No files matched your search
+23
-1
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user