/* The index of this partition in the partition table. */
int index;
- /* Partition map type specific data. */
- void *data;
-
/* Parent partition map. */
struct grub_partition *parent;
while (disk->partition)
{
part = disk->partition->parent;
- grub_free (disk->partition->data);
grub_free (disk->partition);
disk->partition = part;
}
return err;
part.partmap = &grub_acorn_partition_map;
- part.data = 0;
for (i = 0; i != LINUX_MAP_ENTRIES; ++i)
{
return grub_error (GRUB_ERR_BAD_PART_TABLE,
"Amiga partition map not found");
- part.data = 0;
-
/* The end of the partition list is marked using "-1". */
while (next != -1)
{
goto fail;
}
- part.data = 0;
pos = grub_be_to_cpu16 (aheader.blocksize);
do
{
- part.offset = pos / GRUB_DISK_SECTOR_SIZE;
- part.index = pos % GRUB_DISK_SECTOR_SIZE;
+ part.offset = pos / GRUB_DISK_SECTOR_SIZE;
+ part.index = pos % GRUB_DISK_SECTOR_SIZE;
- if (grub_disk_read (disk, part.offset, part.index,
- sizeof (struct grub_apple_part), &apart))
- return grub_errno;
+ if (grub_disk_read (disk, part.offset, part.index,
+ sizeof (struct grub_apple_part), &apart))
+ return grub_errno;
if (grub_be_to_cpu16 (apart.magic) != GRUB_APPLE_PART_MAGIC)
{
grub_dprintf ("gpt", "Read a valid GPT header\n");
entries = grub_le_to_cpu64 (gpt.partitions);
- part.data = grub_malloc (sizeof (entry));
for (i = 0; i < grub_le_to_cpu32 (gpt.maxpart); i++)
{
if (grub_disk_read (disk, entries, last_offset,
sizeof (entry), &entry))
- {
- grub_free (part.data);
- return grub_errno;
- }
+ return grub_errno;
if (grub_memcmp (&grub_gpt_partition_type_empty, &entry.type,
sizeof (grub_gpt_partition_type_empty)))
part.number = i;
part.index = last_offset;
part.partmap = &grub_gpt_partition_map;
- grub_memcpy (part.data, &entry, sizeof (entry));
grub_dprintf ("gpt", "GPT entry %d: start=%lld, length=%lld\n", i,
(unsigned long long) part.start,
}
}
- grub_free (part.data);
-
return GRUB_ERR_NONE;
}
p.offset = 0;
ext_offset = 0;
- p.data = 0;
p.number = -1;
p.partmap = &grub_msdos_partition_map;
int NESTED_FUNC_ATTR find_usable_region_gpt (grub_disk_t disk __attribute__ ((unused)),
const grub_partition_t p)
{
- struct grub_gpt_partentry *gptdata = p->data;
+ struct grub_gpt_partentry gptdata;
+
+ disk->partition = p->parent;
+ if (grub_disk_read (disk, p->offset, p->index,
+ sizeof (gptdata), &gptdata))
+ return 0;
/* If there's an embed region, it is in a dedicated partition. */
- if (! memcmp (&gptdata->type, &grub_gpt_partition_type_bios_boot, 16))
+ if (! memcmp (&gptdata.type, &grub_gpt_partition_type_bios_boot, 16))
{
embed_region.start = p->start;
embed_region.end = p->start + p->len;
return 1;
}
-
return 0;
}