Support multiple fallback entries, and provide an API to support
executing default+fallback menu entries. Renamed the `terminal' menu
viewer to `text'.
* include/grub/normal.h (grub_normal_text_menu_viewer): New global
variable declaration.
(grub_menu_execute_callback): New structure declaration.
(grub_menu_execute_callback_t): New typedef.
(grub_menu_execute_with_fallback): New function declaration.
(grub_menu_get_entry): Likewise.
(grub_menu_get_timeout): Likewise.
(grub_menu_set_timeout): Likewise.
* normal/main.c (GRUB_MOD_INIT(normal)): Refer to new variable name.
* normal/menu.c (grub_wait_after_message): Moved to
`normal/menu_text.c'.
(draw_border): Likewise.
(print_message): Likewise.
(print_entry): Likewise.
(print_entries): Likewise.
(grub_menu_init_page): Likewise.
(get_entry_number): Likewise.
(print_timeout): Likewise.
(run_menu): Likewise.
(grub_menu_execute_entry): Likewise.
(show_text_menu): Likewise.
(get_and_remove_first_entry_number): New function.
(grub_menu_execute_with_fallback): Likewise.
(get_entry): Renamed to ...
(grub_menu_get_entry): .. this and made it global.
(get_timeout): Renamed to ...
(grub_menu_get_timeout): ... this and made it global.
(set_timeout): Renamed to ...
(grub_menu_set_timeout): ... this and made it global.
(grub_normal_terminal_menu_viewer): Renamed to ...
(grub_normal_text_menu_viewer): ... this.
* normal/menu_text.c: New file. Extracted text-menu-specific code
from normal/menu.c.
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add `normal/menu_text.c'.
(normal_mod_SOURCES): Likewise.
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/i386-pc.rmk, (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* normal/main.c: Add include to grub/menu_viewer.h.
(free_menu_entry_classes): Added.
(grub_normal_menu_addentry): Added class property handling.
(grub_normal_execute): Changed to use new menu viewer for menu viewing.
(GRUB_MOD_INIT(normal)): Added register for text based menu viewer.
* normal/menu_viewer.c: New file.
* normal/menu.c (run_menu_entry): Renamed to ...
(grub_menu_execute_entry): ... this and made it as global.
(grub_menu_run): Renamed to ...
(show_text_menu): ... this and made it local.
(show_text_menu): Adapt to new function names.
(grub_normal_terminal_menu_viewer): New global variable.
* include/grub/menu.h: New file.
* include/grub/menu_viewer.h: New file.
* include/grub/normal.h: Added include to grub/menu.h.
(grub_menu_entry): Moved to include/grub/menu.h.
(grub_menu_entry_t): Likewise.
(grub_menu): Likewise.
(grub_menu_t): Likewise.
(grub_normal_terminal_menu_viewer): Added.
(grub_menu_execute_entry): Likewise.
(grub_menu_run): Removed.
* DISTLIST: Added include/grub/menu.h.
Added include/grub/menu_viewer.h.
Added normal/menu_viewer.c.
2009-01-31 Vesa Jääskeläinen <chaac@nic.fi>
* normal/execute.c (grub_script_execute_menuentry): Changed to use
arglist for menutitle arguments.
* normal/main.c (grub_normal_menu_addentry): Likewise.
* normal/parser.y (menuentry): Likewise.
* normal/script.c (grub_script_create_cmdmenu): Likewise.
* include/grub/script.h (grub_script_cmd_menuentry): Likewise.
(grub_script_create_cmdmenu): Likewise.
* include/grub/normal.h (grub_normal_menu_addentry): Likewise.
* conf/i386-pc.rmk (normal_mod_SOURCES): Adapt Colin D Bennett's
changes.
* conf/x86_64-efi.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-coreboot.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-efi.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-ieee1275.rmk (normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (normal_mod_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (normal_mod_SOURCES): Likewise.
* conf/common.rmk (grub_probe_SOURCES): Add disk/mdraid_linux.c.
(grub_fstest_SOURCES): Add disk/raid5_recover.c, disk/raid6_recover.c,
disk/mdraid_linux.c and disk/dmraid_nvidia.c and lib/crc.c.
(pkglib_MODULES): Add raid5rec.mod, raid6rec.mod, mdraid.mod and
dm_nv.mod.
(raid5rec_mod_SOURCES): New macro.
(raid5rec_mod_CFLAGS): Likewise.
(raid5rec_mod_LDFLAGS): Likewise.
(raid6rec_mod_SOURCES): Likewise.
(raid6rec_mod_CFLAGS): Likewise.
(raid6rec_mod_LDFLAGS): Likewise.
(mdraid_mod_SOURCES): Likewise.
(mdraid_mod_CFLAGS): Likewise.
(mdraid_mod_LDFLAGS): Likewise.
(dm_nv_mod_SOURCES): Likewise.
(dm_nv_mod_CFLAGS): Likewise.
(dm_nv_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add disk/mdraid_linux.c.
(grub_emu_SOURCES): Add disk/raid5_recover.c, disk/raid6_recover.c,
disk/mdraid_linux.c and disk/dmraid_nvidia.c.
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add disk/raid5_recover.c,
disk/raid6_recover.c, disk/mdraid_linux.c and disk/dmraid_nvidia.c.
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
* disk/raid5_recover.c: New file.
* disk/raid6_recover.c: Likewise.
* disk/mdraid_linux.c: Likewise.
* disk/dmraid_nvidia.c: Likewise.
* disk/i386/pc/biosdisk.c: Set total_sectors of cdrom device to
ULONG_MAX.
* disk/raid.c (grub_raid_open): Use the size of the smallest disk to
calculate the size of raid device.
(grub_raid_read): Simplify raid0 code. Support raid4, raid6 and four
different layout of raid5.
(grub_raid_scan_device): Remove code specific to mdraid.
(grub_raid_list): New variable.
(free_array): New function.
(grub_raid_register): Likewise.
(grub_raid_unregister): Likewise.
(grub_raid_rescan): Likewise.
(GRUB_MOD_INIT): Don't iterate device here.
(GRUB_MOD_FINI): Use free_array to release resource.
* include/grub/raid.h: Remove macro and structure specific to mdraid.
(grub_raid5_recover_func_t): New function variable type.
(grub_raid6_recover_func_t): Likewise.
(grub_raid5_recover_func): New variable.
(grub_raid6_recover_func): Likewise.
(grub_raid_register): New function.
(grub_raid_unregister): Likewise.
(grub_raid_rescan): Likewise.
(grub_raid_block_xor): Likewise.
* util/grub-fstest.c: Add #include <grub/raid.h> and <grub/lib/crc.h>.
(CMD_CRC): New macro.
(part): Removed.
(read_file): Handle device as well as file.
(cmd_crc): New function.
(fstest): Handle multiple disks.
(options): Remove part, raw and long, add root and diskcount.
(usage): Add crc, remove -p, -r, -l, add -r and -c.
(main): Find the first non option entry and ignore subsequence options,
add handling for the new options, support multiple disks.
* util/grub-probe.c (probe): Add mdraid to abstraction_name.
High resolution timer support. Implemented for x86 CPUs using TSC.
Extracted generic grub_millisleep() so it's linked in only as needed.
This requires a Pentium compatible CPU; if the RDTSC instruction is
not supported, then it falls back on the generic grub_get_time_ms()
implementation that uses the machine's RTC.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/time.c',
`kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and
`kern/generic/millisleep.c'.
* conf/i386-efi.rmk (kernel_mod_SOURCES): Add `kern/i386/tsc.c',
`kern/generic/rtc_get_time_ms.c' and `kern/generic/millisleep.c'.
* conf/x86_64-efi.rml (kernel_mod_SOURCES): Add
`kern/generic/millisleep.c' and `kern/generic/rtc_get_time_ms.c'.
* conf/sparc64-ieee1275.rmk (kernel_elf_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (kernel_elf_SOURCES): Add
`kern/generic/millisleep.c'.
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Likewise.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Add `kern/time.c'.
* kern/generic/rtc_get_time_ms.c: New file.
* kern/generic/millisleep.c: New file.
* kern/misc.c: Don't include
<kern/time.h> anymore.
(grub_millisleep_generic): Removed.
* commands/sleep.c (grub_interruptible_millisleep): Uses
grub_get_time_ms() instead of grub_get_rtc().
* include/grub/i386/tsc.h (grub_get_tsc): New file. New inline
function.
(grub_cpu_is_cpuid_supported): New inline function.
(grub_cpu_is_tsc_supported): New inline function.
(grub_tsc_init): New function prototype.
(grub_tsc_get_time_ms): New function prototype.
* kern/i386/tsc.c (grub_get_time_ms): New file.
* include/grub/time.h: Include <grub/types.h.
(grub_millisleep_generic): Removed.
(grub_get_time_ms): New prototype.
(grub_install_get_time_ms): New prototype.
(grub_rtc_get_time_ms): New prototype.
* kern/time.c (grub_get_time_ms): New function.
(grub_install_get_time_ms): New function.
* kern/i386/efi/init.c: Include <grub/cpu/tsc.h>. Don't include
<grub/time.h> anymore.
(grub_millisleep): Removed.
(grub_machine_init): Call grub_tsc_init.
* kern/i386/linuxbios/init.c (grub_machine_init): Install the RTC
get_time_ms() implementation.
* kern/sparc64/ieee1275/init.c (grub_millisleep): Removed.
(ieee1275_get_time_ms): New function.
(grub_machine_init): Install get_time_ms() implementation.
* kern/i386/pc/init.c: Include <grub/cpu/tsc.h>.
(grub_machine_init): Call grub_tsc_init().
(grub_millisleep): Removed.
* kern/ieee1275/init.c (grub_millisleep): Removed.
(grub_machine_init): Install ieee1275_get_time_ms()
implementation.
(ieee1275_get_time_ms): New function.
(grub_get_rtc): Now calls ieee1275_get_time_ms(), which does the
real work.