2006-01-03 Marco Gerards <marco@gnu.org>

* partmap/apple.c (apple_partition_map_iterate): Convert the data
	read from disk from big	endian to host byte order.
This commit is contained in:
marco_g 2006-01-03 16:02:18 +00:00
parent 0090587997
commit 15643b71c0
2 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2006-01-03 Marco Gerards <marco@gnu.org>
* partmap/apple.c (apple_partition_map_iterate): Convert the data
read from disk from big endian to host byte order.
2006-01-03 Hollis Blanchard <hollis@penguinppc.org> 2006-01-03 Hollis Blanchard <hollis@penguinppc.org>
* fs/hfs.c: Include <grub/hfs.h>. Added reference to the official * fs/hfs.c: Include <grub/hfs.h>. Added reference to the official

View file

@ -117,28 +117,30 @@ apple_partition_map_iterate (grub_disk_t disk,
sizeof (struct grub_apple_part), (char *) &apart)) sizeof (struct grub_apple_part), (char *) &apart))
return grub_errno; return grub_errno;
if (apart.magic != GRUB_APPLE_PART_MAGIC) if (grub_be_to_cpu16 (apart.magic) != GRUB_APPLE_PART_MAGIC)
{ {
grub_dprintf ("partition", grub_dprintf ("partition",
"partition %d: bad magic (found 0x%x; wanted 0x%x\n", "partition %d: bad magic (found 0x%x; wanted 0x%x\n",
partno, apart.magic, GRUB_APPLE_PART_MAGIC); partno, grub_be_to_cpu16 (apart.magic),
GRUB_APPLE_PART_MAGIC);
break; break;
} }
part.start = apart.first_phys_block; part.start = grub_be_to_cpu32 (apart.first_phys_block);
part.len = apart.blockcnt; part.len = grub_be_to_cpu32 (apart.blockcnt);
part.offset = pos; part.offset = pos;
part.index = partno; part.index = partno;
grub_dprintf ("partition", grub_dprintf ("partition",
"partition %d: name %s, type %s, start 0x%x, len 0x%x\n", "partition %d: name %s, type %s, start 0x%x, len 0x%x\n",
partno, apart.partname, apart.parttype, partno, apart.partname, apart.parttype,
apart.first_phys_block, apart.blockcnt); grub_be_to_cpu32 (apart.first_phys_block),
grub_be_to_cpu32 (apart.blockcnt));
if (hook (disk, &part)) if (hook (disk, &part))
return grub_errno; return grub_errno;
if (apart.first_phys_block == GRUB_DISK_SECTOR_SIZE * 2) if (grub_be_to_cpu32 (apart.first_phys_block) == GRUB_DISK_SECTOR_SIZE * 2)
return 0; return 0;
pos += sizeof (struct grub_apple_part); pos += sizeof (struct grub_apple_part);