* include/grub/types.h (UNUSED): Removed since it conflicts with
NetBSD headers. All users changed to direct __attribute__ ((unused)).
Reported by Grégoire Sutre.
* util/getroot.c [__GNU__]: Include <hurd.h>, <hurd/lookup.h>, and
<hurd/fs.h>
[__GNU__] (grub_guess_root_device): Call file_name_lookup and
file_get_storage_info to implement grub_guess_root_device.
* util/hostdisk.c [__FreeBSD_kernel__]: Include sys/disk.h.
(grub_util_biosdisk_open) [__FreeBSD_kernel__]: Add support for
GNU/kFreeBSD. Check if a device is a character device. Use
DIOCGMEDIASIZE to get the size.
(convert_system_partition_to_system_disk) [__FreeBSD_kernel__]: Add
support for GNU/kFreeBSD.
(grub_util_biosdisk_get_grub_dev) [__FreeBSD_kernel__]: Check if OS_DEV
is a character device instead of a block device. Add support for
FreeBSD device names.
* util/getroot.c (find_root_device) [__FreeBSD_kernel__]: Check if ENT
is a character device instead of a block device.
* util/grub-probe.c (probe) [__FreeBSD_kernel__]: Check if DEVICE_NAME
is a character device instead of a block device.
* util/hostdisk.c [__FreeBSD__]: Include sys/disk.h.
(grub_util_biosdisk_open) [__FreeBSD__]: Add support for
FreeBSD. Check if a device is a character device. Use
DIOCGMEDIASIZE to get the size.
(convert_system_partition_to_system_disk) [__FreeBSD__]: Add
support for FreeBSD.
(grub_util_biosdisk_get_grub_dev) [__FreeBSD__]: Check if OS_DEV
is a character device instead of a block device. Add support for
FreeBSD device names.
* util/getroot.c (find_root_device) [__FreeBSD__]: Check if ENT is
a character device instead of a block device.
(grub_util_check_char_device): New function.
* util/grub-probe.c (probe) [__FreeBSD__]: Check if DEVICE_NAME is
a character device instead of a block device.
* include/grub/util/getroot.h (grub_util_check_char_device): New
prototype.
* util/getroot.c: Include <config.h>.
(grub_util_get_grub_dev): Rewrite to use asprintf for mdraid devices,
add support for /dev/md/N devices and handle LVM double dash escaping.
* configure.ac: Change host_os to cygwin for mingw.
(asprintf): New check for function.
* include/grub/symbol.h: Replace #ifndef __CYGWIN__ with
#if ! defined (__CYGWIN__) && ! defined (__MINGW32__).
* include/grub/util/misc.h: #include <config.h> and <grub/types.h>,
declear asprintf if HAVE_ASPRINTF is not set, declear fseeko, ftello,
sync, sleep and grub_util_get_disk_size for mingw.
* util/biosdisk.c (grub_util_biosdisk_open): Use grub_util_get_disk_size
to get size in mingw.
(open_device): Use flag O_BINARY if it's defined.
(find_root_device): Add dummy code for mingw.
* util/grub-mkdevicemap.c (get_floppy_disk_name): Return 0 for mingw.
(get_ide_disk_name): Return //./PHYSICALDRIVE%d for mingw.
(get_scsi_disk_name): Return 0 for mingw.
* util/hostfs.c: #include <grub/util/misc.h>.
(grub_hostfs_open): Use "rb" flag to open file, use
grub_util_get_disk_size to get disk size for mingw.
* util/misc.c: #include <windows.h> and <winioctl.h> in mingw.
(asprintf): New function if HAVE_ASPRINTF is not set.
(sync): New function for mingw.
(sleep): Likewise.
(grub_util_get_disk_size): Likewise.
* util/getroot.c (find_root_device): Skip devices that match
/dev/dm-[0-9]. This lets the real device be found for any type of
abstraction (LVM, EVMS, RAID..).
(grub_guess_root_device): Do not traverse /dev/mapper (for LVM)
and /dev/evms (for EVMS) before traversing /dev. If a /dev/dm-[0-9]
device is found first, find_root_device() will now skip it.
* util/biosdisk.c: [__CYGWIN__] Add includes.
(grub_util_biosdisk_open): Use Linux code also for Cygwin.
(get_os_disk): Move variable declarations to OS specific
parts to avoid warning.
[__GNU__] (get_os_disk): Fix /dev/sdXsN case.
[__CYGWIN__] (get_os_disk): Add Cygwin /dev/sdXN device names.
(grub_util_biosdisk_get_grub_dev): Use Linux code also for
Cygwin.
* util/getroot.c: [__CYGWIN__] Add includes.
(strip_extra_slashes): Fix "/" case.
[__CYGWIN__] (get_win32_path): New function.
[__CYGWIN__] (grub_get_prefix): Add conversion to win32 path.
[__CYGWIN__] (find_root_device): Disable.
[__CYGWIN__] (get_bootsec_serial): New function.
[__CYGWIN__] (find_cygwin_root_device): Likewise.
[__linux__] (grub_guess_root_device): Add early returns to simplify
structure.
[__CYGWIN__] (grub_guess_root_device): Call find_cygwin_root_device.
[__linux__] (grub_util_get_dev_abstraction): Enable LVM and RAID
check for Linux only.
* fs/udf.c (grub_udf_mount): Fix warning about a shadowing a
variable.
* include/grub/i386/loader.h: Change declaration of
grub_linux_boot() to match what grub_loader_set() expects.
* util/getroot.c (grub_guess_root_device): Return const char* to
fix a warning.
* util/grub-probe.c (probe): Fix a warning about uninitialized
abstraction_name variable.
* util/i386/get_disk_name.c (grub_util_get_disk_name): Mark
second argument as unused to fix a warning.
* include/grub/util/getroot.h (grub_util_check_block_device): Export new
function.
* util/getroot.c (grub_util_check_block_device): New function that
returns the given argument if it is a block device and returns NULL else.
* util/grub-probe.c (argument_is_device): New variable.
(probe): Promote device_name from a variable to an argument. Receive
device_name from grub_util_check_block_device() if path is NULL and from
grub_guess_root_device() else. Do not free() device_name anymore.
(options): Introduce new parameter '-d, --device'.
(main): Add description of the new parameter to the help screen.
Rename path variable to argument. Set argument_is_device if the '-d'
option is given. Pass argument to probe() depending on
argument_is_device.
* util/getroot.c (grub_guess_root_device): Inspect /dev/evms before
/dev (like it is done for /dev/mapper). This doesn't provide support
for EVMS, but at least it is now easy to identify the problem when it
arises.
* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum.
(grub_util_get_dev_abstraction): New function prototype.
* util/getroot.c: Include `<grub/util/getroot.h>'
(grub_util_get_grub_dev): Move detection of abstraction type to ...
(grub_util_get_dev_abstraction): ... here (new function).
* util/grub-probe.c: Convert PRINT_* to an enum. Add
`PRINT_ABSTRACTION'.
(probe): Probe for abstraction type when requested.
(main): Understand `--target=abstraction'.
* util/i386/efi/grub-install.in: Add abstraction module to core
image when it is found to be necessary.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Likewise.
* util/update-grub_lib.in (font_path): Return system path without
converting to GRUB path.
* util/update-grub.in: Convert system path returned by font_path()
to a GRUB path. Use `grub-probe -t abstraction' to determine what
abstraction module is needed for loading fonts (if any). Export
that as `GRUB_PRELOAD_MODULES'.
* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print
insmod commands).
* util/getroot.c (grub_guess_root_device): Remove RAID and LVM
code, first search for device in /dev/mapper, then in /dev.
(grub_util_get_grub_dev): New function.
* include/grub/util/getroot.h (grub_util_get_grub_dev): Add
prototype.
* util/grub-probe.c (probe): Remove check for RAID, call
grub_util_get_grub_dev() instead of
grub_util_biosdisk_get_grub_dev().
* util/grub-emu.c (main): Call grub_util_get_grub_dev() instead of
grub_util_biosdisk_get_grub_dev().
* util/i386/pc/grub-setup.c (main): Likewise.
* include/grub/i386/pc/util/biosdisk.h: Moved to ...
* include/grub/util/biosdisk.h: ... here.
* util/i386/pc/biosdisk.c: Moved to ...
* util/biosdisk.c: ... here.
* util/i386/pc/getroot.c: Moved to ...
* util/getroot.c: ... here.
* util/i386/pc/grub-mkdevicemap.c: Moved to ...
* util/grub-mkdevicemap.c: ... here.
* util/i386/pc/grub-probe.c: Moved to ...
* util/grub-probe.c: ... here.