Remove data member in partition structure

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-07 01:48:38 +01:00
parent 35b86ff407
commit 58548abbc3
8 changed files with 13 additions and 25 deletions

View file

@ -60,9 +60,6 @@ struct grub_partition
/* The index of this partition in the partition table. */ /* The index of this partition in the partition table. */
int index; int index;
/* Partition map type specific data. */
void *data;
/* Parent partition map. */ /* Parent partition map. */
struct grub_partition *parent; struct grub_partition *parent;

View file

@ -342,7 +342,6 @@ grub_disk_close (grub_disk_t disk)
while (disk->partition) while (disk->partition)
{ {
part = disk->partition->parent; part = disk->partition->parent;
grub_free (disk->partition->data);
grub_free (disk->partition); grub_free (disk->partition);
disk->partition = part; disk->partition = part;
} }

View file

@ -106,7 +106,6 @@ acorn_partition_map_iterate (grub_disk_t disk,
return err; return err;
part.partmap = &grub_acorn_partition_map; part.partmap = &grub_acorn_partition_map;
part.data = 0;
for (i = 0; i != LINUX_MAP_ENTRIES; ++i) for (i = 0; i != LINUX_MAP_ENTRIES; ++i)
{ {

View file

@ -99,8 +99,6 @@ amiga_partition_map_iterate (grub_disk_t disk,
return grub_error (GRUB_ERR_BAD_PART_TABLE, return grub_error (GRUB_ERR_BAD_PART_TABLE,
"Amiga partition map not found"); "Amiga partition map not found");
part.data = 0;
/* 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)
{ {

View file

@ -122,17 +122,16 @@ apple_partition_map_iterate (grub_disk_t disk,
goto fail; goto fail;
} }
part.data = 0;
pos = grub_be_to_cpu16 (aheader.blocksize); pos = grub_be_to_cpu16 (aheader.blocksize);
do do
{ {
part.offset = pos / GRUB_DISK_SECTOR_SIZE; part.offset = pos / GRUB_DISK_SECTOR_SIZE;
part.index = pos % GRUB_DISK_SECTOR_SIZE; part.index = pos % GRUB_DISK_SECTOR_SIZE;
if (grub_disk_read (disk, part.offset, part.index, if (grub_disk_read (disk, part.offset, part.index,
sizeof (struct grub_apple_part), &apart)) sizeof (struct grub_apple_part), &apart))
return grub_errno; return grub_errno;
if (grub_be_to_cpu16 (apart.magic) != GRUB_APPLE_PART_MAGIC) if (grub_be_to_cpu16 (apart.magic) != GRUB_APPLE_PART_MAGIC)
{ {

View file

@ -71,15 +71,11 @@ gpt_partition_map_iterate (grub_disk_t disk,
grub_dprintf ("gpt", "Read a valid GPT header\n"); grub_dprintf ("gpt", "Read a valid GPT header\n");
entries = grub_le_to_cpu64 (gpt.partitions); entries = grub_le_to_cpu64 (gpt.partitions);
part.data = grub_malloc (sizeof (entry));
for (i = 0; i < grub_le_to_cpu32 (gpt.maxpart); i++) for (i = 0; i < grub_le_to_cpu32 (gpt.maxpart); i++)
{ {
if (grub_disk_read (disk, entries, last_offset, if (grub_disk_read (disk, entries, last_offset,
sizeof (entry), &entry)) sizeof (entry), &entry))
{ return grub_errno;
grub_free (part.data);
return grub_errno;
}
if (grub_memcmp (&grub_gpt_partition_type_empty, &entry.type, if (grub_memcmp (&grub_gpt_partition_type_empty, &entry.type,
sizeof (grub_gpt_partition_type_empty))) sizeof (grub_gpt_partition_type_empty)))
@ -92,7 +88,6 @@ gpt_partition_map_iterate (grub_disk_t disk,
part.number = i; part.number = i;
part.index = last_offset; part.index = last_offset;
part.partmap = &grub_gpt_partition_map; 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, grub_dprintf ("gpt", "GPT entry %d: start=%lld, length=%lld\n", i,
(unsigned long long) part.start, (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; return GRUB_ERR_NONE;
} }

View file

@ -40,7 +40,6 @@ pc_partition_map_iterate (grub_disk_t disk,
p.offset = 0; p.offset = 0;
ext_offset = 0; ext_offset = 0;
p.data = 0;
p.number = -1; p.number = -1;
p.partmap = &grub_msdos_partition_map; p.partmap = &grub_msdos_partition_map;

View file

@ -130,17 +130,21 @@ setup (const char *dir,
int NESTED_FUNC_ATTR find_usable_region_gpt (grub_disk_t disk __attribute__ ((unused)), int NESTED_FUNC_ATTR find_usable_region_gpt (grub_disk_t disk __attribute__ ((unused)),
const grub_partition_t p) 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 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.start = p->start;
embed_region.end = p->start + p->len; embed_region.end = p->start + p->len;
return 1; return 1;
} }
return 0; return 0;
} }