2010-09-10 Robert Millan <rmh@gnu.org>
Solaris support in grub_find_zpool_from_dir(). Thanks Seth Goldberg for referring to getextmntent() facility. * configure.ac: Check for getextmntent(), `sys/mnttab.h' and `sys/mkdev.h'. * grub-core/kern/emu/misc.c [HAVE_SYS_MNTTAB_H]: Include `<sys/mnttab.h>'. [HAVE_SYS_MKDEV_H]: Include `<sys/mkdev.h>'. [HAVE_GETEXTMNTENT] (grub_find_zpool_from_dir): Add getextmntent() method for finding zpool name.
This commit is contained in:
parent
905f7773e5
commit
c38fe9f48e
3 changed files with 52 additions and 4 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2010-09-10 Robert Millan <rmh@gnu.org>
|
||||
|
||||
Solaris support in grub_find_zpool_from_dir(). Thanks
|
||||
Seth Goldberg for referring to getextmntent() facility.
|
||||
|
||||
* configure.ac: Check for getextmntent(), `sys/mnttab.h' and
|
||||
`sys/mkdev.h'.
|
||||
* grub-core/kern/emu/misc.c [HAVE_SYS_MNTTAB_H]: Include
|
||||
`<sys/mnttab.h>'.
|
||||
[HAVE_SYS_MKDEV_H]: Include `<sys/mkdev.h>'.
|
||||
[HAVE_GETEXTMNTENT] (grub_find_zpool_from_dir): Add getextmntent()
|
||||
method for finding zpool name.
|
||||
|
||||
2010-09-10 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
grub-fstest needs the host and hostfs modules while other utilities
|
||||
|
|
|
@ -277,8 +277,8 @@ else
|
|||
fi
|
||||
|
||||
# Check for functions and headers.
|
||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
|
||||
AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h)
|
||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent)
|
||||
AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h)
|
||||
|
||||
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
|
||||
#include <sys/param.h>
|
||||
|
|
|
@ -61,6 +61,15 @@
|
|||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MNTTAB_H
|
||||
# include <stdio.h> /* Needed by sys/mnttab.h. */
|
||||
# include <sys/mnttab.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MKDEV_H
|
||||
# include <sys/mkdev.h> /* makedev */
|
||||
#endif
|
||||
|
||||
int verbosity;
|
||||
|
||||
void
|
||||
|
@ -299,10 +308,36 @@ grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs)
|
|||
|
||||
*poolname = xstrdup (mnt.f_mntfromname);
|
||||
}
|
||||
#else
|
||||
return;
|
||||
#elif defined(HAVE_GETEXTMNTENT)
|
||||
/* Solaris. */
|
||||
{
|
||||
struct stat st;
|
||||
struct extmnttab mnt;
|
||||
|
||||
if (stat (dir, &st) != 0)
|
||||
return;
|
||||
|
||||
FILE *mnttab = fopen ("/etc/mnttab", "r");
|
||||
if (! mnttab)
|
||||
return;
|
||||
|
||||
while (getextmntent (mnttab, &mnt, sizeof (mnt)) == 0)
|
||||
{
|
||||
if (makedev (mnt.mnt_major, mnt.mnt_minor) == st.st_dev
|
||||
&& !strcmp (mnt.mnt_fstype, "zfs"))
|
||||
{
|
||||
*poolname = xstrdup (mnt.mnt_special);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose (mnttab);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! *poolname)
|
||||
return;
|
||||
|
||||
slash = strchr (*poolname, '/');
|
||||
if (slash)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue