2008-02-23 Robert Millan <rmh@aybabtu.com>
* partmap/gpt.c (grub_gpt_magic): Add `0x' qualifier to each member, since they were intended to be in hex. This didn't break previously because of a bug in gpt_partition_map_iterate() (see below). (gpt_partition_map_iterate): Replace `grub_memcmp' with `! grub_memcmp' when checking the validity of GPT header. Remove `partno', since it always provides the same information as `i'.
This commit is contained in:
parent
f6f4cfb011
commit
2dc33c03b0
2 changed files with 14 additions and 6 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2008-02-23 Robert Millan <rmh@aybabtu.com>
|
||||
|
||||
* partmap/gpt.c (grub_gpt_magic): Add `0x' qualifier to each member,
|
||||
since they were intended to be in hex. This didn't break previously
|
||||
because of a bug in gpt_partition_map_iterate() (see below).
|
||||
|
||||
(gpt_partition_map_iterate): Replace `grub_memcmp' with `! grub_memcmp'
|
||||
when checking the validity of GPT header.
|
||||
Remove `partno', since it always provides the same information as `i'.
|
||||
|
||||
2008-02-21 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
|
||||
* include/grub/efi/time.h: Fix a wrong comment.
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
static grub_uint8_t grub_gpt_magic[8] =
|
||||
{
|
||||
45, 46, 49, 20, 50, 41, 52, 54
|
||||
0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54
|
||||
};
|
||||
|
||||
static const grub_gpt_part_type_t grub_gpt_partition_type_empty = GRUB_GPT_PARTITION_TYPE_EMPTY;
|
||||
|
@ -51,7 +51,6 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
struct grub_disk raw;
|
||||
struct grub_pc_partition_mbr mbr;
|
||||
grub_uint64_t entries;
|
||||
int partno = 0;
|
||||
unsigned int i;
|
||||
int last_offset = 0;
|
||||
|
||||
|
@ -75,7 +74,7 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
if (grub_disk_read (&raw, 1, 0, sizeof (gpt), (char *) &gpt))
|
||||
return grub_errno;
|
||||
|
||||
if (! grub_memcmp (gpt.magic, grub_gpt_magic, sizeof (grub_gpt_magic)))
|
||||
if (grub_memcmp (gpt.magic, grub_gpt_magic, sizeof (grub_gpt_magic)))
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no valid GPT header");
|
||||
|
||||
grub_dprintf ("gpt", "Read a valid GPT header\n");
|
||||
|
@ -95,18 +94,17 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
part.len = (grub_le_to_cpu64 (entry.end)
|
||||
- grub_le_to_cpu64 (entry.start) + 1);
|
||||
part.offset = entries;
|
||||
part.index = partno;
|
||||
part.index = i;
|
||||
part.partmap = &grub_gpt_partition_map;
|
||||
part.data = &entry;
|
||||
|
||||
grub_dprintf ("gpt", "GPT entry %d: start=%lld, length=%lld\n",
|
||||
partno, part.start, part.len);
|
||||
i, part.start, part.len);
|
||||
|
||||
if (hook (disk, &part))
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
partno++;
|
||||
last_offset += grub_le_to_cpu32 (gpt.partentry_size);
|
||||
if (last_offset == GRUB_DISK_SECTOR_SIZE)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue