2009-05-13 Pavel Roskin <proski@gnu.org>
* kernel/disk.c (grub_disk_read): Use void pointer for the buffer. (grub_disk_write): Use const void pointer for the buffer. Adjust all callers. Remove unnecessary casts.
This commit is contained in:
parent
901d2f0c27
commit
238e871fff
29 changed files with 93 additions and 86 deletions
|
@ -61,7 +61,7 @@ acorn_partition_map_find (grub_disk_t disk, struct linux_part *m,
|
|||
|
||||
err = grub_disk_read (disk, 0xC00 / GRUB_DISK_SECTOR_SIZE, 0,
|
||||
sizeof (struct grub_acorn_boot_block),
|
||||
(char *) &boot);
|
||||
&boot);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -81,7 +81,7 @@ acorn_partition_map_find (grub_disk_t disk, struct linux_part *m,
|
|||
|
||||
return grub_disk_read (disk, *sector, 0,
|
||||
sizeof (struct linux_part) * LINUX_MAP_ENTRIES,
|
||||
(char *) m);
|
||||
m);
|
||||
|
||||
fail:
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE,
|
||||
|
|
|
@ -89,7 +89,7 @@ amiga_partition_map_iterate (grub_disk_t disk,
|
|||
for (pos = 0; pos < 15; pos++)
|
||||
{
|
||||
/* Read the RDSK block which is a descriptor for the entire disk. */
|
||||
if (grub_disk_read (&raw, pos, 0, sizeof (rdsk), (char *) &rdsk))
|
||||
if (grub_disk_read (&raw, pos, 0, sizeof (rdsk), &rdsk))
|
||||
return grub_errno;
|
||||
|
||||
if (grub_strcmp ((char *) rdsk.magic, "RDSK") == 0)
|
||||
|
@ -110,7 +110,7 @@ amiga_partition_map_iterate (grub_disk_t disk,
|
|||
struct grub_amiga_partition apart;
|
||||
|
||||
/* Read the RDSK block which is a descriptor for the entire disk. */
|
||||
if (grub_disk_read (&raw, next, 0, sizeof (apart), (char *) &apart))
|
||||
if (grub_disk_read (&raw, next, 0, sizeof (apart), &apart))
|
||||
return grub_errno;
|
||||
|
||||
/* Calculate the first block and the size of the partition. */
|
||||
|
|
|
@ -114,7 +114,7 @@ apple_partition_map_iterate (grub_disk_t disk,
|
|||
|
||||
part.partmap = &grub_apple_partition_map;
|
||||
|
||||
if (grub_disk_read (&raw, 0, 0, sizeof (aheader), (char *) &aheader))
|
||||
if (grub_disk_read (&raw, 0, 0, sizeof (aheader), &aheader))
|
||||
return grub_errno;
|
||||
|
||||
if (grub_be_to_cpu16 (aheader.magic) != GRUB_APPLE_HEADER_MAGIC)
|
||||
|
@ -130,7 +130,7 @@ apple_partition_map_iterate (grub_disk_t disk,
|
|||
{
|
||||
if (grub_disk_read (&raw, pos / GRUB_DISK_SECTOR_SIZE,
|
||||
pos % GRUB_DISK_SECTOR_SIZE,
|
||||
sizeof (struct grub_apple_part), (char *) &apart))
|
||||
sizeof (struct grub_apple_part), &apart))
|
||||
return grub_errno;
|
||||
|
||||
if (grub_be_to_cpu16 (apart.magic) != GRUB_APPLE_PART_MAGIC)
|
||||
|
|
|
@ -55,7 +55,7 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
raw.partition = 0;
|
||||
|
||||
/* Read the protective MBR. */
|
||||
if (grub_disk_read (&raw, 0, 0, sizeof (mbr), (char *) &mbr))
|
||||
if (grub_disk_read (&raw, 0, 0, sizeof (mbr), &mbr))
|
||||
return grub_errno;
|
||||
|
||||
/* Check if it is valid. */
|
||||
|
@ -67,7 +67,7 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found");
|
||||
|
||||
/* Read the GPT header. */
|
||||
if (grub_disk_read (&raw, 1, 0, sizeof (gpt), (char *) &gpt))
|
||||
if (grub_disk_read (&raw, 1, 0, sizeof (gpt), &gpt))
|
||||
return grub_errno;
|
||||
|
||||
if (grub_memcmp (gpt.magic, grub_gpt_magic, sizeof (grub_gpt_magic)))
|
||||
|
@ -79,7 +79,7 @@ gpt_partition_map_iterate (grub_disk_t disk,
|
|||
for (i = 0; i < grub_le_to_cpu32 (gpt.maxpart); i++)
|
||||
{
|
||||
if (grub_disk_read (&raw, entries, last_offset,
|
||||
sizeof (entry), (char *) &entry))
|
||||
sizeof (entry), &entry))
|
||||
return grub_errno;
|
||||
|
||||
if (grub_memcmp (&grub_gpt_partition_type_empty, &entry.type,
|
||||
|
|
|
@ -114,7 +114,7 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
struct grub_pc_partition_entry *e;
|
||||
|
||||
/* Read the MBR. */
|
||||
if (grub_disk_read (&raw, p.offset, 0, sizeof (mbr), (char *) &mbr))
|
||||
if (grub_disk_read (&raw, p.offset, 0, sizeof (mbr), &mbr))
|
||||
goto finish;
|
||||
|
||||
/* Check if it is valid. */
|
||||
|
@ -166,7 +166,7 @@ pc_partition_map_iterate (grub_disk_t disk,
|
|||
+ GRUB_PC_PARTITION_BSD_LABEL_SECTOR),
|
||||
0,
|
||||
sizeof (label),
|
||||
(char *) &label))
|
||||
&label))
|
||||
goto finish;
|
||||
|
||||
/* Check if it is valid. */
|
||||
|
|
|
@ -103,7 +103,7 @@ sun_partition_map_iterate (grub_disk_t disk,
|
|||
p->data = 0;
|
||||
p->partmap = &grub_sun_partition_map;
|
||||
if (grub_disk_read (&raw, 0, 0, sizeof (struct grub_sun_block),
|
||||
(char *) &block) == GRUB_ERR_NONE)
|
||||
&block) == GRUB_ERR_NONE)
|
||||
{
|
||||
if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.magic))
|
||||
grub_error (GRUB_ERR_BAD_PART_TABLE, "not a sun partition table");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue