+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.
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));
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;
#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;
}
}
}
-#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);
{
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;
#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;