Remove data member in partition structure
This commit is contained in:
parent
35b86ff407
commit
58548abbc3
8 changed files with 13 additions and 25 deletions
|
@ -60,9 +60,6 @@ struct grub_partition
|
|||
/* 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;
|
||||
|
||||
|
|
|
@ -342,7 +342,6 @@ grub_disk_close (grub_disk_t disk)
|
|||
while (disk->partition)
|
||||
{
|
||||
part = disk->partition->parent;
|
||||
grub_free (disk->partition->data);
|
||||
grub_free (disk->partition);
|
||||
disk->partition = part;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ acorn_partition_map_iterate (grub_disk_t disk,
|
|||
return err;
|
||||
|
||||
part.partmap = &grub_acorn_partition_map;
|
||||
part.data = 0;
|
||||
|
||||
for (i = 0; i != LINUX_MAP_ENTRIES; ++i)
|
||||
{
|
||||
|
|
|
@ -99,8 +99,6 @@ amiga_partition_map_iterate (grub_disk_t disk,
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -122,17 +122,16 @@ apple_partition_map_iterate (grub_disk_t disk,
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -71,15 +71,11 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
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)))
|
||||
|
@ -92,7 +88,6 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
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,
|
||||
|
@ -110,8 +105,6 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
}
|
||||
}
|
||||
|
||||
grub_free (part.data);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
|
||||
p.offset = 0;
|
||||
ext_offset = 0;
|
||||
p.data = 0;
|
||||
p.number = -1;
|
||||
p.partmap = &grub_msdos_partition_map;
|
||||
|
||||
|
|
|
@ -130,17 +130,21 @@ setup (const char *dir,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue