Support Apple partition map with sector size different from 512 bytes.
* partmap/apple.c (grub_apple_header): New field 'blocksize'.
(apple_partition_map_iterate): Respect 'aheader.blocksize'
and 'apart.partmap_size'.
* kernel/disk.c (grub_disk_read): Use void pointer for the
buffer.
(grub_disk_write): Use const void pointer for the buffer.
Adjust all callers. Remove unnecessary casts.
* partmap/apple.c (GRUB_APPLE_HEADER_MAGIC): New macro.
(struct grub_apple_header): New struct. Describes the layout of
the partmap header.
(apple_partition_map_iterate): Check the header magic as well as the
partition magic (which was already being checked).
Count partitions from 1 instead of 0 in the string representation
of partitions. Still use 0-based internally.
* partmap/sun.c (grub_sun_is_valid): A cosmetic change.
(sun_partition_map_iterate): Use grub_partition_t instead of
struct grub_partition *. Cast DESC->START_CYLINDER to
grub_uint64_t after converting the endian.
(sun_partition_map_probe): Subtract 1 for PARTNUM.
(sun_partition_map_get_name): Add 1 to P->INDEX.
* partmap/pc.c (grub_partition_parse): Subtract 1 for
PCDATA->DOS_PART.
(pc_partition_map_get_name): Add 1 into PCDATA->DOS_PART.
* partmap/gpt.c (gpt_partition_map_iterate): Initialize PARTNO to
zero instead of one.
(gpt_partition_map_probe): Subtract 1 for PARTNUM.
(gpt_partition_map_get_name): Add 1 into P->INDEX.
* partmap/apple.c (apple_partition_map_iterate): Change the type
of POS to unsigned.
(apple_partition_map_probe): Subtract 1 for PARTNUM.
(apple_partition_map_get_name): Add 1 into P->INDEX.
* partmap/amiga.c (amiga_partition_map_iterate): Change the type
of POS to unsigned.
(amiga_partition_map_iterate): Cast NEXT to grub_off_t to
calculate the offset of a partition.
(amiga_partition_map_probe): Subtract 1 for PARTNUM.
(amiga_partition_map_get_name): Add 1 into P->INDEX.
* partmap/acorn.c (acorn_partition_map_find): Change the type of
SECTOR to grub_disk_addr_t.
(acorn_partition_map_iterate): Likewise.
(acorn_partition_map_probe): Subtract 1 for PARTNUM.
Change the type of SECTOR to grub_disk_addr_t. Declare P on the
top.
(acorn_partition_map_get_name): Add 1 into P->INDEX.
* kern/i386/pc/init.c (make_install_device): Add 1 into
GRUB_INSTALL_DOS_PART.
* fs/iso9660.c (grub_iso9660_mount): Fixed a reversed
conditional.
* normal/misc.c: New file.
* DISTLIST: Added normal/misc.c.
* partmap/amiga.c (amiga_partition_map_iterate): Add an argument
DISK to HOOK. Call HOOK with DISK.
* partmap/apple.c (apple_partition_map_iterate): Likewise.
* partmap/pc.c (pc_partition_map_iterate): Likewise.
* partmap/sun.c (sun_partition_map_iterate): Likewise.
* normal/menu_entry.c (struct screen): Added a new member
"completion_shown".
(completion_buffer): New global variable.
(make_screen): Set SCREEN->COMPLETION_SHOWN to zero.
(store_completion): New function.
(complete): Likewise.
(clear_completions): Likewise.
(grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero,
call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is
a tab, call complete.
* normal/completion.c (disk_dev): Removed.
(print_simple_completion): Likewise.
(print_partition_completion): Likewise.
(print_func): New global variable.
(add_completion): Do not take the arguments WHAT or PRINT any
longer. Added a new argument TYPE. Instead of printing directly,
call PRINT_FUNC if not NULL.
All callers changed.
(complete_device): Use a local variable DEV instead of
DISK_DEV. Do not move CURRENT_WORD to the end of a device name.
(grub_normal_do_completion): Take a new argument HOOK. Do not
initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an
empty string, return NULL instead.
All callers changed.
* normal/cmdline.c (print_completion): New function.
* kern/partition.c (grub_partition_iterate): Add an argument DISK
to HOOK.
All callers changed.
* kern/disk.c (grub_print_partinfo): Removed.
* include/grub/partition.h (struct grub_partition_map): Add a new
argument DISK into HOOK of ITERATE.
(grub_partition_iterate): Add a new argument DISK to HOOK.
* include/grub/normal.h (enum grub_completion_type): New enum.
(grub_completion_type_t): New type.
(GRUB_COMPLETION_TYPE_COMMAND): New constant.
(GRUB_COMPLETION_TYPE_DEVICE): Likewise.
(GRUB_COMPLETION_TYPE_PARTITION): Likewise.
(GRUB_COMPLETION_TYPE_FILE): Likewise.
(grub_normal_do_completion): Added a new argument HOOK.
(grub_normal_print_device_info): New prototype.
* include/grub/disk.h (grub_print_partinfo): Removed.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c.
(normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* commands/ls.c (grub_ls_list_disks): Use
grub_normal_print_device_info instead of grub_print_partinfo. Free
PNAME.
(grub_ls_list_files): Use grub_normal_print_device_info instead of
duplicating the code.
* disk/powerpc/ieee1275/ofdisk.c (grub_ofdisk_open): dprintf the
device path and resulting ihandle.
(grub_ofdisk_close): dprintf the ihandle being closed.
(grub_ofdisk_read): dprintf function parameters.
* kern/mm.c (grub_mm_init_region): Likewise.
* loader/powerpc/ieee1275/linux.c: Remove extra whitespace.
(grub_linux_boot): dprintf the Linux entry point, initrd address and
size, and boot arguments.
(grub_rescue_cmd_linux): dprintf each ELF segment's address and size
before loading into memory.
(grub_rescue_cmd_initrd): dprintf the initrd's address and size
before loading into memory.
* kern/partition.c (grub_partition_probe): Clear `grub_errno' and
return 0 if `grub_errno' is GRUB_ERR_BAD_PART_TABLE.
(part_map_iterate): Clear `grub_errno' and return 0 if
`partmap->iterate' returns GRUB_ERR_BAD_PART_TABLE.
* partmap/amiga.c (amiga_partition_map_iterate): Return
GRUB_ERR_BAD_PART_TABLE if no partition map magic is found.
* partmap/apple.c (apple_partition_map_iterate): Likewise.
Modulize the partition map support and add support for the amiga
partition map.
* commands/ls.c: Include <grub/partition.h> instead of
<grub/machine/partition.h>.
* kern/disk.c: Likewise.
* kern/rescue.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* normal/cmdline.c: Likewise.
* kern/powerpc/ieee1275/init.c: Likewise.
(grub_machine_init): Call `grub_pc_partition_map_init',
`grub_amiga_partition_map_init' and
`grub_apple_partition_map_init'.
* conf/i386-pc.rmk (kernel_img_SOURCES): Remove
`disk/i386/pc/partition.c'. Add `kern/partition.c'.
(kernel_img_HEADERS): Remove `machine/partition.h'. Add
`partition.h' and `pc_partition.h'.
(grub_setup_SOURCES): Remove
`disk/i386/pc/partition.c'. Add `kern/partition.c',
`partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'.
(grub_emu_SOURCES): Likewise.
(pkgdata_MODULES): Add `amiga.mod', `apple.mod' and `pc.mod'.
(amiga_mod_SOURCES, amiga_mod_CFLAGS, apple_mod_SOURCES)
(apple_mod_CFLAGS, pc_mod_SOURCES, pc_mod_CFLAGS): New variables.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Remove
`disk/powerpc/ieee1275/partition.c'. Add `kern/partition.c',
`partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'.
(grubof_SOURCES): Likewise.
* disk/i386/pc/partition.c: File removed.
* disk/powerpc/ieee1275/partition.c: Likewise.
* include/grub/powerpc/ieee1275/partition.h: Likewise.
* include/grub/i386/pc/partition.h: Likewise.
* kern/partition.c: New file.
* partmap/amiga.c: Likewise.
* partmap/apple.c: Likewise.
* partmap/pc.c: Likewise.
* include/grub/partition.h: Likewise..
* include/grub/pc_partition.h: Likewise.
* util/grub-emu.c: Include <grub/partition.h> instead of
<grub/machine/partition.h>.
(main): Call `grub_pc_partition_map_init',
`grub_amiga_partition_map_init' and
`grub_apple_partition_map_init' and deinitialize afterwards.
* util/i386/pc/biosdisk.c: Include `#include
<grub/partition.h>' and `include <grub/pc_partition.h>' instead of
`<grub/machine/partition.h>'.
* util/i386/pc/grub-setup.c: Likewise.
* util/i386/pc/biosdisk.c: Likewise.
(grub_util_biosdisk_get_grub_dev): Only access the PC specific
partition information in case of a PC partition.
* util/i386/pc/grub-setup.c: Include `#include
<grub/partition.h>' and `include <grub/pc_partition.h>' instead of
`<grub/machine/partition.h>'.
(setup): Only access the PC specific partition information in case
of a PC partition.