* configure.ac: Remove checks for getfsstat() and getmntany().
Add checks for `<sys/param.h>' and `<sys/mount.h>'.
* kern/emu/misc.c [HAVE_GETMNTANY]: Remove `<sys/mnttab.h>'.
[HAVE_SYS_PARAM_H]: Include `<sys/param.h>'.
[HAVE_SYS_MOUNT_H]: Include `<sys/mount.h>'.
[HAVE_LIBZFS && HAVE_LIBNVPAIR] (find_mount_point_from_dir): Remove
function.
(grub_find_zpool_from_dir): Use statfs() instead of indirect matching
via find_mount_point_from_dir() and getfsstat() / getmntany().
* util/grub.d/10_kfreebsd.in: Initialize ${kfreebsd_device} as the
kFreeBSD device name, except on ZFS where the filesystem label is
used.
(kfreebsd_entry): On ZFS root, load `opensolaris.ko', `zfs.ko' and
`/boot/zfs/zpool.cache'.
Set mountfrom kernel variable using ${kfreebsd_device}.
Make it even harder to use uninitialized `libzfs_handle' (and
make the interface a bit simpler).
* include/grub/util/misc.h (grub_util_init_libzfs)
(libzfs_handle): Remove.
(grub_get_libzfs_handle): New prototype.
* util/misc.c [HAVE_LIBZFS] (libzfs_handle): Add `static'
attribute.
(grub_util_init_libzfs): Remove.
(grub_get_libzfs_handle): New function.
* kern/emu/getroot.c (find_root_device_from_libzfs): Use
grub_get_libzfs_handle() to obtain a libzfs handle instead of
accessing `libzfs_handle' directly.
* include/grub/emu/misc.h (grub_find_mount_point_from_dir)
(grub_find_zpool_from_mount_point): New function prototypes.
* kern/emu/getroot.c [HAVE_GETFSSTAT]: Move `<sys/mount.h>' to ...
* kern/emu/misc.c [HAVE_GETFSSTAT]: ... here.
* kern/emu/getroot.c (find_mount_point_from_dir): Move to ...
* kern/emu/misc.c (grub_find_mount_point_from_dir): ... this. Remove
`static' attribute.
* kern/emu/getroot.c (find_root_device_from_libzfs): Split code for
finding zpool from mount point into ...
* kern/emu/misc.c (grub_find_zpool_from_mount_point): ... this.
* kern/emu/misc.c (grub_make_system_path_relative_to_its_root): When
requested path is part of a ZFS pool, use
grub_find_zpool_from_mount_point() to detect its filesystem name,
and generate a path with `/fsname@path' syntax.
and GRUB_CMDLINE_XEN_DEFAULT. Recommend setting
GRUB_GFXPAYLOAD_LINUX=text rather than unsetting it in order to
disable gfxpayload.
(Shell-like scripting): Add real content.
(Serial terminal): Suggest `terminal_input serial; terminal_output
serial' rather than putting the two commands on separate lines,
since console input will be inoperative after the first command.
(menuentry): Document --class, --users, and --hotkey options.
(terminfo): Describe what `visually-ordered UTF-8' means (thanks,
Vladimir Serbinenko).
Prevent accidental use of uninitialized libzfs_handle.
* util/grub-probe.c (main): Move grub_util_init_libzfs() call to ...
* kern/emu/getroot.c (find_root_device_from_libzfs): ... here.
* util/misc.c (grub_util_init_libzfs): Make this function idempotent.
* configure.ac: Check for `libzfs.h' and `libnvpair.h'.
* include/grub/util/libnvpair.h: Include `<config.h>'.
[HAVE_LIBNVPAIR_H]: Include `<libnvpair.h>' instead of
declaring libnvpair prototypes ourselves.
* include/grub/util/libzfs.h: Include `<config.h>'.
[HAVE_LIBZFS_H]: Include `<libzfs.h>' instead of
declaring libzfs prototypes ourselves.
(libzfs_handle): Moved to ...
* include/grub/util/misc.h (libzfs_handle): ... here.
Include `<grub/util/libzfs.h>'.
Enable `grub-probe -t device' resolution on ZFS.
* configure.ac: Check for getfsstat(), libzfs and libnvpair.
* include/grub/util/libnvpair.h: New file.
* include/grub/util/libzfs.h: New file.
* kern/emu/getroot.c: Include `<assert.h>' and `<error.h>'.
[HAVE_LIBZFS && HAVE_LIBNVPAIR]: Include `<grub/util/libzfs.h>' and
`<grub/util/libnvpair.h>'.
[HAVE_GETFSSTAT]: Include `<sys/mount.h>'.
(find_mount_point_from_dir): New static function.
[HAVE_LIBZFS && HAVE_LIBNVPAIR] (find_root_device_from_libzfs): New
function.
[HAVE_LIBZFS && HAVE_LIBNVPAIR] (grub_guess_root_device): Use
find_root_device_from_libzfs() before ressorting to find_root_device().
* include/grub/util/misc.h (grub_util_init_libzfs): New function
prototype.
* util/misc.c: Include `<grub/util/libzfs.h>'.
(grub_util_init_libzfs): New function.
[HAVE_LIBZFS] (libzfs_handle): New global variable.
[HAVE_LIBZFS] (fini_libzfs): New static function.
(grub_util_init_libzfs): New function.
* util/grub-probe.c (main): Call grub_util_init_libzfs().
* term/efi/console.c (grub_efi_console_init): New function.
(grub_efi_console_fini): New function.
(grub_console_term_output): Register init and fini methods.
2010-07-20 Colin Watson <cjwatson@ubuntu.com>
Generate device.map in something closer to the old ordering.
* util/deviceiter.c (struct device): New declaration.
(compare_file_names): Rename to ...
(compare_devices): ... this. Sort by kernel name in preference to
the stable by-id name, but keep the latter as a fallback comparison.
Update header comment.
(grub_util_iterate_devices) [__linux__]: Construct and sort an array
of `struct device' rather than of plain file names.
Also-By: Colin Watson <cjwatson@ubuntu.com>
* disk/raid.c (insert_array): Use md/%s to name mdadm 1.x devices,
removing the homehost if present.
* kern/emu/getroot.c (get_mdadm_name) [__linux__]: New function.
(grub_util_get_grub_dev): Use md/%s to name mdadm 1.x devices,
removing the homehost if present.
(grub_util_get_grub_dev) [__linux__]: Get the array name from mdadm
if possible.
* util/i386/pc/grub-setup.c (main): Handle md/* devices.
* disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Add start_sector
parameter. Set its pointer target to 0.
* disk/mdraid_linux.c (grub_mdraid_detect): Add start_sector
parameter. Set its pointer target to 0 for 0.9 metadata, or to the
`data_offset' value from the superblock for 1.x metadata.
* disk/raid.c (grub_raid_read): Offset reads by the start sector of
data on the device.
(insert_array): Record the start sector of data on the device.
(grub_raid_register): Pass start_sector parameters to
grub_raid_list->detect and insert_array.
* include/grub/raid.h (struct grub_raid_array): Add start_sector
member.
(struct grub_raid): Add start_sector parameter to `detect'.
* disk/mdraid_linux.c (struct grub_raid_super_1x): Remove
__attribute__ ((packed)), leaving a comment.
(grub_mdraid_detect): Split out 0.9 and 1.x detection to ...
(grub_mdraid_detect_09): ... here and ...
(grub_mdraid_detect_1x): ... here.
2010-07-20 Peter Henn <peter.henn@web.de>
* disk/mdraid_linux.c (grub_mdraid_detect): Fix calculation of 1.x
chunk size and disk size, which are already given as sector counts
as distinct from the 0.90 units. Fetch the correct device number
from the role table instead of using the table index.
2010-07-20 Felix Zielcke <fzielcke@z-51.de>
* disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Set array->name to NULL.
* disk/mdraid_linux.c (grub_raid_super_1x): New structure.
(WriteMostly1): New macro.
Set array->name to NULL for metadata format 0.90. Add support for
metadata 1.x. Fix some comments.
* disk/raid.c (): Add support for name based RAID arrays. Fix a
few comments.
* util/getroot.c (grub_util_get_grub_dev): Add support for
/dev/md/name style devices.
Also-By: Peter Henn <peter.henn@web.de>
Also-By: Colin Watson <cjwatson@ubuntu.com>
__attribute__ ((packed)), leaving a comment.
(grub_mdraid_detect): Split out 0.9 and 1.x detection to ...
(grub_mdraid_detect_09): ... here and ...
(grub_mdraid_detect_1x): ... here.
* disk/raid.c (insert_array): Check for grub_xasprintf returning
NULL.
parameter. Set its pointer target to 0.
* disk/mdraid_linux.c (grub_mdraid_detect): Add start_sector
parameter. Set its pointer target to 0 for 0.9 metadata, or to the
`data_offset' value from the superblock for 1.x metadata.
* disk/raid.c (grub_raid_read): Offset reads by the start sector of
data on the device.
(insert_array): Record the start sector of data on the device.
(grub_raid_register): Pass start_sector parameters to
grub_raid_list->detect and insert_array.
* include/grub/raid.h (struct grub_raid_array): Add start_sector
member.
(struct grub_raid): Add start_sector parameter to `detect'.
removing the homehost if present.
* kern/emu/getroot.c (get_mdadm_name) [__linux__]: New function.
(grub_util_get_grub_dev): Use md/%s to name mdadm 1.x devices,
removing the homehost if present.
(grub_util_get_grub_dev) [__linux__]: Get the array name from mdadm
if possible.
* util/i386/pc/grub-setup.c (main): Handle md/* devices.