2010-08-04 Robert Millan <rmh@gnu.org>

* include/grub/emu/misc.h (grub_find_mount_point_from_dir)
	(grub_find_zpool_from_mount_point): Merge into ...
	(grub_find_zpool_from_dir): ... this.
	* kern/emu/misc.c: Likewise.
	
	* kern/emu/misc.c
	(grub_make_system_path_relative_to_its_root): Replace
	grub_find_mount_point_from_dir() / grub_find_zpool_from_mount_point()
	with grub_find_zpool_from_dir().
	* kern/emu/getroot.c (find_root_device_from_libzfs): Likewise.
This commit is contained in:
Robert Millan 2010-08-04 13:29:13 +02:00
parent 62858144fe
commit 0de22aa997
4 changed files with 25 additions and 24 deletions

View file

@ -1,3 +1,16 @@
2010-08-04 Robert Millan <rmh@gnu.org>
* include/grub/emu/misc.h (grub_find_mount_point_from_dir)
(grub_find_zpool_from_mount_point): Merge into ...
(grub_find_zpool_from_dir): ... this.
* kern/emu/misc.c: Likewise.
* kern/emu/misc.c
(grub_make_system_path_relative_to_its_root): Replace
grub_find_mount_point_from_dir() / grub_find_zpool_from_mount_point()
with grub_find_zpool_from_dir().
* kern/emu/getroot.c (find_root_device_from_libzfs): Likewise.
2010-08-04 Robert Millan <rmh@gnu.org>
Support OpenSolaris in ZFS device resolution.

View file

@ -45,10 +45,8 @@ extern const char *program_name;
void grub_init_all (void);
void grub_fini_all (void);
char *grub_find_mount_point_from_dir (const char *dir)
__attribute__ ((warn_unused_result));
void grub_find_zpool_from_mount_point (const char *mnt_point,
char **poolname, char **poolfs);
void grub_find_zpool_from_dir (const char *dir,
char **poolname, char **poolfs);
char *grub_make_system_path_relative_to_its_root (const char *path)
__attribute__ ((warn_unused_result));

View file

@ -181,15 +181,10 @@ find_root_device_from_libzfs (const char *dir)
char *device;
char *poolname;
char *poolfs;
char *mnt_point;
mnt_point = grub_find_mount_point_from_dir (dir);
grub_find_zpool_from_mount_point (mnt_point, &poolname, &poolfs);
grub_find_zpool_from_dir (dir, &poolname, &poolfs);
if (! poolname)
{
free (mnt_point);
return NULL;
}
return NULL;
{
zpool_handle_t *zpool;

View file

@ -277,8 +277,8 @@ grub_get_libzfs_handle (void)
#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
/* Not ZFS-specific in itself, but for now it's only used by ZFS-related code. */
char *
grub_find_mount_point_from_dir (const char *dir)
static char *
find_mount_point_from_dir (const char *dir)
{
struct stat st;
typeof (st.st_dev) fs;
@ -332,18 +332,18 @@ grub_find_mount_point_from_dir (const char *dir)
}
}
}
#endif
#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
/* ZFS has similar problems to those of btrfs (see above). */
void
grub_find_zpool_from_mount_point (const char *mnt_point, char **poolname, char **poolfs)
grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs)
{
char *slash;
char *mnt_point;
*poolname = *poolfs = NULL;
mnt_point = find_mount_point_from_dir (dir);
#if defined(HAVE_GETFSSTAT) /* FreeBSD and GNU/kFreeBSD */
{
int mnt_count = getfsstat (NULL, 0, MNT_WAIT);
@ -408,7 +408,7 @@ grub_make_system_path_relative_to_its_root (const char *path)
{
struct stat st;
char *p, *buf, *buf2, *buf3;
char *mnt_point, *poolname = NULL, *poolfs = NULL, *ret;
char *poolname = NULL, *poolfs = NULL, *ret;
uintptr_t offset = 0;
dev_t num;
size_t len;
@ -420,12 +420,7 @@ grub_make_system_path_relative_to_its_root (const char *path)
#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
/* For ZFS sub-pool filesystems, could be extended to others (btrfs?). */
mnt_point = grub_find_mount_point_from_dir (p);
if (mnt_point)
{
grub_find_zpool_from_mount_point (mnt_point, &poolname, &poolfs);
free (mnt_point);
}
grub_find_zpool_from_dir (p, &poolname, &poolfs);
#endif
len = strlen (p) + 1;