2005-02-12 Hollis Blanchard <hollis@penguinppc.org>
* 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.
This commit is contained in:
parent
aca108aae6
commit
1b14a681e4
4 changed files with 43 additions and 9 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2005-02-12 Hollis Blanchard <hollis@penguinppc.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2005-02-01 Guillem Jover <guillem@hadrons.org>
|
2005-02-01 Guillem Jover <guillem@hadrons.org>
|
||||||
|
|
||||||
* loader/i386/pc/multiboot_normal.c (GRUB_MOD_INIT): Fix module
|
* loader/i386/pc/multiboot_normal.c (GRUB_MOD_INIT): Fix module
|
||||||
|
|
|
@ -56,20 +56,28 @@ grub_partition_t
|
||||||
grub_partition_probe (struct grub_disk *disk, const char *str)
|
grub_partition_probe (struct grub_disk *disk, const char *str)
|
||||||
{
|
{
|
||||||
grub_partition_t part;
|
grub_partition_t part;
|
||||||
|
|
||||||
auto int part_map_probe (const grub_partition_map_t partmap);
|
auto int part_map_probe (const grub_partition_map_t partmap);
|
||||||
|
|
||||||
int part_map_probe (const grub_partition_map_t partmap)
|
int part_map_probe (const grub_partition_map_t partmap)
|
||||||
{
|
{
|
||||||
part = partmap->probe (disk, str);
|
part = partmap->probe (disk, str);
|
||||||
if (part)
|
if (part)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
|
||||||
|
if (grub_errno == GRUB_ERR_BAD_PART_TABLE)
|
||||||
|
{
|
||||||
|
/* Continue to next partition map type. */
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use the first partition map type found. */
|
/* Use the first partition map type found. */
|
||||||
grub_partition_map_iterate (part_map_probe);
|
grub_partition_map_iterate (part_map_probe);
|
||||||
|
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,12 +86,21 @@ grub_partition_iterate (struct grub_disk *disk,
|
||||||
int (*hook) (const grub_partition_t partition))
|
int (*hook) (const grub_partition_t partition))
|
||||||
{
|
{
|
||||||
auto int part_map_iterate (const grub_partition_map_t partmap);
|
auto int part_map_iterate (const grub_partition_map_t partmap);
|
||||||
|
|
||||||
int part_map_iterate (const grub_partition_map_t partmap)
|
int part_map_iterate (const grub_partition_map_t partmap)
|
||||||
{
|
{
|
||||||
return partmap->iterate (disk, hook);
|
grub_err_t err = partmap->iterate (disk, hook);
|
||||||
|
|
||||||
|
if (err == GRUB_ERR_BAD_PART_TABLE)
|
||||||
|
{
|
||||||
|
/* Continue to next partition map type. */
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_partition_map_iterate (part_map_iterate);
|
grub_partition_map_iterate (part_map_iterate);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,10 @@ amiga_partition_map_iterate (grub_disk_t disk,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (next == -1)
|
||||||
|
return grub_error (GRUB_ERR_BAD_PART_TABLE,
|
||||||
|
"Amiga partition map not found.");
|
||||||
|
|
||||||
/* The end of the partition list is marked using "-1". */
|
/* The end of the partition list is marked using "-1". */
|
||||||
while (next != -1)
|
while (next != -1)
|
||||||
|
|
|
@ -108,7 +108,7 @@ apple_partition_map_iterate (grub_disk_t disk,
|
||||||
raw.partition = 0;
|
raw.partition = 0;
|
||||||
|
|
||||||
part.partmap = &grub_apple_partition_map;
|
part.partmap = &grub_apple_partition_map;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (grub_disk_read (&raw, pos / GRUB_DISK_SECTOR_SIZE,
|
if (grub_disk_read (&raw, pos / GRUB_DISK_SECTOR_SIZE,
|
||||||
|
@ -134,6 +134,10 @@ apple_partition_map_iterate (grub_disk_t disk,
|
||||||
partno++;
|
partno++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((pos / GRUB_DISK_SECTOR_SIZE) == 0)
|
||||||
|
return grub_error (GRUB_ERR_BAD_PART_TABLE,
|
||||||
|
"Apple partition map not found.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +182,6 @@ apple_partition_map_probe (grub_disk_t disk, const char *str)
|
||||||
fail:
|
fail:
|
||||||
grub_free (p);
|
grub_free (p);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue