+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.
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;
struct grub_disk raw;
struct grub_pc_partition_mbr mbr;
grub_uint64_t entries;
- int partno = 0;
unsigned int i;
int last_offset = 0;
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");
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)
{