2006-06-05 Yoshinori K. Okuji <okuji@enbug.org>
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.
This commit is contained in:
parent
524a1e6a40
commit
deae281bfe
10 changed files with 131 additions and 58 deletions
12
partmap/pc.c
12
partmap/pc.c
|
@ -55,8 +55,9 @@ grub_partition_parse (const char *str)
|
|||
/* Initialize some of the fields with invalid values. */
|
||||
pcdata->bsd_part = pcdata->dos_type = pcdata->bsd_type = p->index = -1;
|
||||
|
||||
/* Get the DOS partition number. */
|
||||
pcdata->dos_part = grub_strtoul (s, &s, 0);
|
||||
/* Get the DOS partition number. The number is counted from one for
|
||||
the user interface, and from zero internally. */
|
||||
pcdata->dos_part = grub_strtoul (s, &s, 0) - 1;
|
||||
|
||||
if (grub_errno)
|
||||
{
|
||||
|
@ -237,6 +238,7 @@ pc_partition_map_probe (grub_disk_t disk, const char *str)
|
|||
const grub_partition_t partition)
|
||||
{
|
||||
struct grub_pc_partition *partdata = partition->data;
|
||||
|
||||
if ((pcdata->dos_part == partdata->dos_part || pcdata->dos_part == -1)
|
||||
&& pcdata->bsd_part == partdata->bsd_part)
|
||||
{
|
||||
|
@ -283,9 +285,11 @@ pc_partition_map_get_name (const grub_partition_t p)
|
|||
return 0;
|
||||
|
||||
if (pcdata->bsd_part < 0)
|
||||
grub_sprintf (name, "%d", pcdata->dos_part);
|
||||
grub_sprintf (name, "%d", pcdata->dos_part + 1);
|
||||
else if (pcdata->dos_part < 0)
|
||||
grub_sprintf (name, "%c", pcdata->bsd_part + 'a');
|
||||
else
|
||||
grub_sprintf (name, "%d,%c", pcdata->dos_part, pcdata->bsd_part + 'a');
|
||||
grub_sprintf (name, "%d,%c", pcdata->dos_part + 1, pcdata->bsd_part + 'a');
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue