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:
proski 2009-05-13 18:58:38 +00:00
parent 901d2f0c27
commit 238e871fff
29 changed files with 93 additions and 86 deletions

View file

@ -1,3 +1,10 @@
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.
2009-05-10 Robert Millan <rmh.grub@aybabtu.com>
* util/i386/pc/grub-install.in: Update copyright year.

View file

@ -90,7 +90,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
}
/* Read the protective MBR. */
if (grub_disk_read (dev->disk, 0, 0, sizeof (mbr), (char *) &mbr))
if (grub_disk_read (dev->disk, 0, 0, sizeof (mbr), &mbr))
{
grub_device_close (dev);
return grub_errno;
@ -222,7 +222,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
mbr.signature = grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE);
if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), (char *) &mbr))
if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr))
{
grub_device_close (dev);
return grub_errno;

View file

@ -99,7 +99,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
sector = grub_disk_get_size (disk) - 2;
if (grub_disk_read (disk, sector, 0, sizeof (sb), (char *) &sb))
if (grub_disk_read (disk, sector, 0, sizeof (sb), &sb))
return grub_errno;
if (grub_memcmp (sb.vendor, NV_ID_STRING, 6))

View file

@ -171,7 +171,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array)
size = grub_disk_get_size (disk);
sector = NEW_SIZE_SECTORS (size);
if (grub_disk_read (disk, sector, 0, SB_BYTES, (char *) &sb))
if (grub_disk_read (disk, sector, 0, SB_BYTES, &sb))
return grub_errno;
/* Look whether there is a RAID superblock. */

View file

@ -124,7 +124,7 @@ grub_affs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
grub_disk_read (data->disk, block + data->blocksize - 1,
data->blocksize * (GRUB_DISK_SECTOR_SIZE
- GRUB_AFFS_FILE_LOCATION),
sizeof (file), (char *) &file);
sizeof (file), &file);
if (grub_errno)
return 0;
@ -136,7 +136,7 @@ grub_affs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
grub_disk_read (data->disk, block,
GRUB_AFFS_BLOCKPTR_OFFSET
+ (data->htsize - fileblock - 1) * sizeof (pos),
sizeof (pos), (char *) &pos);
sizeof (pos), &pos);
if (grub_errno)
return 0;
@ -175,7 +175,7 @@ grub_affs_mount (grub_disk_t disk)
/* Read the bootblock. */
grub_disk_read (disk, 0, 0, sizeof (struct grub_affs_bblock),
(char *) &data->bblock);
&data->bblock);
if (grub_errno)
goto fail;
@ -195,7 +195,7 @@ grub_affs_mount (grub_disk_t disk)
/* Read the bootblock. */
grub_disk_read (disk, 0, 0, sizeof (struct grub_affs_bblock),
(char *) &data->bblock);
&data->bblock);
if (grub_errno)
goto fail;
@ -209,7 +209,7 @@ grub_affs_mount (grub_disk_t disk)
/* Read the rootblock. */
grub_disk_read (disk, (disk->total_sectors >> 1) + blocksize, 0,
GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock);
GRUB_DISK_SECTOR_SIZE * 16, rootblock);
if (grub_errno)
goto fail;
@ -510,7 +510,7 @@ grub_affs_label (grub_device_t device, char **label)
grub_disk_read (data->disk, disk->total_sectors >> 1,
data->blocksize * (GRUB_DISK_SECTOR_SIZE
- GRUB_AFFS_FILE_LOCATION),
sizeof (file), (char *) &file);
sizeof (file), &file);
if (grub_errno)
return 0;

View file

@ -193,7 +193,7 @@ grub_afs_read_inode (struct grub_afs_data *data,
ino *
(data->sblock.block_size >> GRUB_DISK_SECTOR_BITS),
0, sizeof (struct grub_afs_inode),
(char *) inode);
inode);
}
static grub_disk_addr_t
@ -228,7 +228,7 @@ grub_afs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (grub_disk_read (node->data->disk,
blk * (sb->block_size >> GRUB_DISK_SECTOR_BITS),
0, sizeof (indir),
(char *) indir))
indir))
return 0;
for (j = 0; j < ptrs_per_blk; j++)
@ -264,14 +264,14 @@ grub_afs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
+ idblk) *
(sb->block_size >> GRUB_DISK_SECTOR_BITS),
0, sizeof (indir),
(char *) indir))
indir))
return 0;
if (grub_disk_read (node->data->disk,
(grub_afs_run_to_num (sb, &indir[idptr]) + dblk) *
(sb->block_size >> GRUB_DISK_SECTOR_BITS),
0, sizeof (indir),
(char *) indir))
indir))
return 0;
return grub_afs_run_to_num (sb, &indir[dptr]) + off;
@ -466,13 +466,13 @@ grub_afs_mount (grub_disk_t disk)
/* Read the superblock. */
if (grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_afs_sblock),
(char *) &data->sblock))
&data->sblock))
goto fail;
if (! grub_afs_validate_sblock (&data->sblock))
{
if (grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_afs_sblock),
(char *) &data->sblock))
&data->sblock))
goto fail;
if (! grub_afs_validate_sblock (&data->sblock))

View file

@ -84,7 +84,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
struct HEAD_BCPIO hd;
if (grub_disk_read
(data->disk, 0, data->hofs, sizeof (hd), (char *) &hd))
(data->disk, 0, data->hofs, sizeof (hd), &hd))
return grub_errno;
if (hd.magic != MAGIC_BCPIO)
@ -120,7 +120,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
struct HEAD_USTAR hd;
if (grub_disk_read
(data->disk, 0, data->hofs, sizeof (hd), (char *) &hd))
(data->disk, 0, data->hofs, sizeof (hd), &hd))
return grub_errno;
if (!hd.name[0])

View file

@ -331,7 +331,7 @@ grub_ext2_blockgroup (struct grub_ext2_data *data, int group,
((grub_le_to_cpu32 (data->sblock.first_data_block) + 1)
<< LOG2_EXT2_BLOCK_SIZE (data)),
group * sizeof (struct grub_ext2_block_group),
sizeof (struct grub_ext2_block_group), (char *) blkgrp);
sizeof (struct grub_ext2_block_group), blkgrp);
}
static struct grub_ext4_extent_header *
@ -438,7 +438,7 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (grub_disk_read (data->disk,
grub_le_to_cpu32 (inode->blocks.indir_block)
<< log2_blksz,
0, blksz, (char *) indir))
0, blksz, indir))
return grub_errno;
blknr = grub_le_to_cpu32 (indir[fileblock - INDIRECT_BLOCKS]);
@ -454,13 +454,13 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (grub_disk_read (data->disk,
grub_le_to_cpu32 (inode->blocks.double_indir_block)
<< log2_blksz,
0, blksz, (char *) indir))
0, blksz, indir))
return grub_errno;
if (grub_disk_read (data->disk,
grub_le_to_cpu32 (indir[rblock / perblock])
<< log2_blksz,
0, blksz, (char *) indir))
0, blksz, indir))
return grub_errno;
@ -523,7 +523,7 @@ grub_ext2_read_inode (struct grub_ext2_data *data,
((grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno)
<< LOG2_EXT2_BLOCK_SIZE (data)),
EXT2_INODE_SIZE (data) * blkoff,
sizeof (struct grub_ext2_inode), (char *) inode))
sizeof (struct grub_ext2_inode), inode))
return grub_errno;
return 0;
@ -540,7 +540,7 @@ grub_ext2_mount (grub_disk_t disk)
/* Read the superblock. */
grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_ext2_sblock),
(char *) &data->sblock);
&data->sblock);
if (grub_errno)
goto fail;

View file

@ -183,7 +183,7 @@ grub_fat_mount (grub_disk_t disk)
goto fail;
/* Read the BPB. */
if (grub_disk_read (disk, 0, 0, sizeof (bpb), (char *) &bpb))
if (grub_disk_read (disk, 0, 0, sizeof (bpb), &bpb))
goto fail;
if (grub_strncmp((const char *) bpb.version_specific.fat12_or_fat16.fstype, "FAT12", 5)
@ -294,7 +294,7 @@ grub_fat_mount (grub_disk_t disk)
data->fat_sector,
0,
sizeof (first_fat),
(char *) &first_fat))
&first_fat))
goto fail;
first_fat = grub_le_to_cpu32 (first_fat);

View file

@ -319,7 +319,7 @@ grub_hfs_mount (grub_disk_t disk)
/* Read the superblock. */
if (grub_disk_read (disk, GRUB_HFS_SBLOCK, 0,
sizeof (struct grub_hfs_sblock), (char *) &data->sblock))
sizeof (struct grub_hfs_sblock), &data->sblock))
goto fail;
/* Check if this is a HFS filesystem. */
@ -345,7 +345,7 @@ grub_hfs_mount (grub_disk_t disk)
+ grub_be_to_cpu16 (data->sblock.first_block));
if (grub_disk_read (data->disk, first_block, 0,
sizeof (treehead), (char *) &treehead))
sizeof (treehead), &treehead))
goto fail;
data->ext_root = grub_be_to_cpu32 (treehead.head.root_node);
data->ext_size = grub_be_to_cpu16 (treehead.head.node_size);
@ -355,7 +355,7 @@ grub_hfs_mount (grub_disk_t disk)
* GRUB_HFS_BLKS)
+ grub_be_to_cpu16 (data->sblock.first_block));
if (grub_disk_read (data->disk, first_block, 0,
sizeof (treehead), (char *) &treehead))
sizeof (treehead), &treehead))
goto fail;
data->cat_root = grub_be_to_cpu32 (treehead.head.root_node);
data->cat_size = grub_be_to_cpu16 (treehead.head.node_size);
@ -684,7 +684,7 @@ grub_hfs_iterate_records (struct grub_hfs_data *data, int type, int idx,
return grub_errno;
if (grub_disk_read (data->disk, blk, 0,
sizeof (node), (char *) &node))
sizeof (node), &node))
return grub_errno;
/* Iterate over all records in this node. */

View file

@ -389,7 +389,7 @@ grub_hfsplus_mount (grub_disk_t disk)
/* Read the bootblock. */
grub_disk_read (disk, GRUB_HFSPLUS_SBLOCK, 0, sizeof (volheader),
(char *) &volheader);
&volheader);
if (grub_errno)
goto fail;
@ -416,7 +416,7 @@ grub_hfsplus_mount (grub_disk_t disk)
* (ablk_size >> GRUB_DISK_SECTOR_BITS));
grub_disk_read (disk, data->embedded_offset + GRUB_HFSPLUS_SBLOCK, 0,
sizeof (volheader), (char *) &volheader);
sizeof (volheader), &volheader);
if (grub_errno)
goto fail;
}

View file

@ -309,7 +309,7 @@ grub_jfs_read_inode (struct grub_jfs_data *data, int ino,
if (grub_disk_read (data->disk,
iagblk << (grub_le_to_cpu16 (data->sblock.log2_blksz)
- GRUB_DISK_SECTOR_BITS), 0,
sizeof (struct grub_jfs_iag), (char *) &iag))
sizeof (struct grub_jfs_iag), &iag))
return grub_errno;
inoblk = grub_le_to_cpu32 (iag.inodes[inoext].blk2);
@ -318,7 +318,7 @@ grub_jfs_read_inode (struct grub_jfs_data *data, int ino,
inoblk += inonum;
if (grub_disk_read (data->disk, inoblk, 0,
sizeof (struct grub_jfs_inode), (char *) inode))
sizeof (struct grub_jfs_inode), inode))
return grub_errno;
return 0;
@ -336,7 +336,7 @@ grub_jfs_mount (grub_disk_t disk)
/* Read the superblock. */
if (grub_disk_read (disk, GRUB_JFS_SBLOCK, 0,
sizeof (struct grub_jfs_sblock), (char *) &data->sblock))
sizeof (struct grub_jfs_sblock), &data->sblock))
goto fail;
if (grub_strncmp ((char *) (data->sblock.magic), "JFS1", 4))
@ -351,7 +351,7 @@ grub_jfs_mount (grub_disk_t disk)
/* Read the inode of the first fileset. */
if (grub_disk_read (data->disk, GRUB_JFS_FS1_INODE_BLK, 0,
sizeof (struct grub_jfs_inode), (char *) &data->fileset))
sizeof (struct grub_jfs_inode), &data->fileset))
goto fail;
return data;

View file

@ -267,7 +267,7 @@ grub_minix_read_inode (struct grub_minix_data *data, int ino)
* sizeof (struct grub_minix_inode));
grub_disk_read (data->disk, block, offs,
sizeof (struct grub_minix_inode), (char *) &data->inode);
sizeof (struct grub_minix_inode), &data->inode);
}
else
{
@ -278,7 +278,7 @@ grub_minix_read_inode (struct grub_minix_data *data, int ino)
* sizeof (struct grub_minix2_inode));
grub_disk_read (data->disk, block, offs,
sizeof (struct grub_minix2_inode),(char *) &data->inode2);
sizeof (struct grub_minix2_inode),&data->inode2);
}
return GRUB_ERR_NONE;
@ -419,7 +419,7 @@ grub_minix_mount (grub_disk_t disk)
/* Read the superblock. */
grub_disk_read (disk, GRUB_MINIX_SBLOCK, 0,
sizeof (struct grub_minix_sblock),(char *) &data->sblock);
sizeof (struct grub_minix_sblock),&data->sblock);
if (grub_errno)
goto fail;

View file

@ -800,7 +800,7 @@ grub_ntfs_mount (grub_disk_t disk)
data->disk = disk;
/* Read the BPB. */
if (grub_disk_read (disk, 0, 0, sizeof (bpb), (char *) &bpb))
if (grub_disk_read (disk, 0, 0, sizeof (bpb), &bpb))
goto fail;
if (grub_memcmp ((char *) &bpb.oem_name, "NTFS", 4))

View file

@ -510,7 +510,7 @@ grub_reiserfs_get_item (struct grub_reiserfs_data *data,
block_number * (block_size >> GRUB_DISK_SECTOR_BITS),
(((grub_off_t) block_number * block_size)
& (GRUB_DISK_SECTOR_SIZE - 1)),
block_size, (char *) block_header);
block_size, block_header);
if (grub_errno)
goto fail;
current_level = grub_le_to_cpu16 (block_header->level);
@ -685,7 +685,7 @@ grub_reiserfs_mount (grub_disk_t disk)
if (! data)
goto fail;
grub_disk_read (disk, REISERFS_SUPER_BLOCK_OFFSET / GRUB_DISK_SECTOR_SIZE,
0, sizeof (data->superblock), (char *) &(data->superblock));
0, sizeof (data->superblock), &(data->superblock));
if (grub_errno)
goto fail;
if (grub_memcmp (data->superblock.magic_string,
@ -1028,7 +1028,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
entry_location
+ (((grub_off_t) block_number * block_size)
& (GRUB_DISK_SECTOR_SIZE - 1)),
sizeof (entry_v1_stat), (char *) &entry_v1_stat);
sizeof (entry_v1_stat), &entry_v1_stat);
if (grub_errno)
goto fail;
file->size = (grub_off_t) grub_le_to_cpu64 (entry_v1_stat.size);
@ -1041,7 +1041,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
entry_location
+ (((grub_off_t) block_number * block_size)
& (GRUB_DISK_SECTOR_SIZE - 1)),
sizeof (entry_v2_stat), (char *) &entry_v2_stat);
sizeof (entry_v2_stat), &entry_v2_stat);
if (grub_errno)
goto fail;
file->size = (grub_off_t) grub_le_to_cpu64 (entry_v2_stat.size);
@ -1139,7 +1139,7 @@ grub_reiserfs_read (grub_file_t file, char *buf, grub_size_t len)
grub_disk_read (found.data->disk,
found.block_number * (block_size >> GRUB_DISK_SECTOR_BITS),
grub_le_to_cpu16 (found.header.item_location),
item_size, (char *) indirect_block_ptr);
item_size, indirect_block_ptr);
if (grub_errno)
goto fail;
found.data->disk->read_hook = file->read_hook;

View file

@ -272,7 +272,7 @@ grub_sfs_mount (grub_disk_t disk)
/* Read the rootblock. */
grub_disk_read (disk, 0, 0, sizeof (struct grub_sfs_rblock),
(char *) &data->rblock);
&data->rblock);
if (grub_errno)
goto fail;

View file

@ -390,7 +390,7 @@ grub_udf_read_icb (struct grub_udf_data *data,
if (grub_disk_read (data->disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_file_entry),
(char *) &node->fe))
&node->fe))
return grub_errno;
if ((U16 (node->fe.tag.tag_ident) != GRUB_UDF_TAG_IDENT_FE) &&
@ -520,7 +520,7 @@ grub_udf_mount (grub_disk_t disk)
struct grub_udf_vrs vrs;
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_vrs), (char *) &vrs))
sizeof (struct grub_udf_vrs), &vrs))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
goto fail;
@ -547,7 +547,7 @@ grub_udf_mount (grub_disk_t disk)
struct grub_udf_avdp avdp;
if (grub_disk_read (disk, *sblklist << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_avdp), (char *) &avdp))
sizeof (struct grub_udf_avdp), &avdp))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
goto fail;
@ -574,7 +574,7 @@ grub_udf_mount (grub_disk_t disk)
struct grub_udf_tag tag;
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_tag), (char *) &tag))
sizeof (struct grub_udf_tag), &tag))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
goto fail;
@ -591,7 +591,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_pd),
(char *) &data->pds[data->npd]))
&data->pds[data->npd]))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
goto fail;
@ -607,7 +607,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_lvd),
(char *) &data->lvd))
&data->lvd))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
goto fail;
@ -670,7 +670,7 @@ grub_udf_mount (grub_disk_t disk)
goto fail;
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_fileset), (char *) &root_fs))
sizeof (struct grub_udf_fileset), &root_fs))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
goto fail;

View file

@ -235,7 +235,7 @@ grub_ufs_get_file_block (struct grub_ufs_data *data, unsigned int blk)
{
grub_uint32_t indir[UFS_BLKSZ (sblock) >> 2];
grub_disk_read (data->disk, INODE_INDIRBLOCKS (data, 0) << log2_blksz,
0, sizeof (indir), (char *) indir);
0, sizeof (indir), indir);
return (data->ufs_type == UFS1) ? indir[blk] : indir[blk << 1];
}
blk -= indirsz;
@ -246,12 +246,12 @@ grub_ufs_get_file_block (struct grub_ufs_data *data, unsigned int blk)
grub_uint32_t indir[UFS_BLKSZ (sblock) >> 2];
grub_disk_read (data->disk, INODE_INDIRBLOCKS (data, 1) << log2_blksz,
0, sizeof (indir), (char *) indir);
0, sizeof (indir), indir);
grub_disk_read (data->disk,
((data->ufs_type == UFS1) ?
indir[blk / indirsz] : indir [(blk / indirsz) << 1])
<< log2_blksz,
0, sizeof (indir), (char *) indir);
0, sizeof (indir), indir);
return (data->ufs_type == UFS1) ?
indir[blk % indirsz] : indir[(blk % indirsz) << 1];
@ -362,7 +362,7 @@ grub_ufs_read_inode (struct grub_ufs_data *data, int ino, char *inode)
+ grpino / 4,
(grpino % 4) * sizeof (struct grub_ufs_inode),
sizeof (struct grub_ufs_inode),
(char *) inode);
inode);
}
else
{
@ -378,7 +378,7 @@ grub_ufs_read_inode (struct grub_ufs_data *data, int ino, char *inode)
+ grpino / 2,
(grpino % 2) * sizeof (struct grub_ufs2_inode),
sizeof (struct grub_ufs2_inode),
(char *) inode);
inode);
}
return grub_errno;
@ -532,7 +532,7 @@ grub_ufs_mount (grub_disk_t disk)
while (*sblklist != -1)
{
grub_disk_read (disk, *sblklist, 0, sizeof (struct grub_ufs_sblock),
(char *) &data->sblock);
&data->sblock);
if (grub_errno)
goto fail;

View file

@ -218,7 +218,7 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino,
/* Read the inode. */
if (grub_disk_read (data->disk, block, offset,
sizeof (struct grub_xfs_inode), (char *) inode))
sizeof (struct grub_xfs_inode), inode))
return grub_errno;
if (grub_strncmp ((char *) inode->magic, "IN", 2))
@ -267,7 +267,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
grub_be_to_cpu64 (keys[i - 1 + XFS_INODE_EXTENTS])
<< (node->data->sblock.log2_bsize
- GRUB_DISK_SECTOR_BITS),
0, node->data->sblock.bsize, (char *) leaf))
0, node->data->sblock.bsize, leaf))
return 0;
if (grub_strncmp ((char *) leaf->magic, "BMAP", 4))
@ -583,7 +583,7 @@ grub_xfs_mount (grub_disk_t disk)
/* Read the superblock. */
if (grub_disk_read (disk, 0, 0,
sizeof (struct grub_xfs_sblock), (char *) &data->sblock))
sizeof (struct grub_xfs_sblock), &data->sblock))
goto fail;
if (grub_strncmp ((char *) (data->sblock.magic), "XFSB", 4))

View file

@ -149,12 +149,12 @@ grub_err_t EXPORT_FUNC(grub_disk_read) (grub_disk_t disk,
grub_disk_addr_t sector,
grub_off_t offset,
grub_size_t size,
char *buf);
void *buf);
grub_err_t EXPORT_FUNC(grub_disk_write) (grub_disk_t disk,
grub_disk_addr_t sector,
grub_off_t offset,
grub_size_t size,
const char *buf);
const void *buf);
grub_uint64_t EXPORT_FUNC(grub_disk_get_size) (grub_disk_t disk);

View file

@ -385,7 +385,7 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
/* Read data from the disk. */
grub_err_t
grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_off_t offset, grub_size_t size, char *buf)
grub_off_t offset, grub_size_t size, void *buf)
{
char *tmp_buf;
unsigned real_offset;
@ -511,7 +511,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
}
sector = start_sector + GRUB_DISK_CACHE_SIZE;
buf += len;
buf = (char *) buf + len;
size -= len;
real_offset = 0;
}
@ -525,7 +525,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_err_t
grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_off_t offset, grub_size_t size, const char *buf)
grub_off_t offset, grub_size_t size, const void *buf)
{
unsigned real_offset;
@ -559,7 +559,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
goto finish;
sector++;
buf += len;
buf = (char *) buf + len;
size -= len;
real_offset = 0;
}
@ -577,7 +577,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
while (n--)
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector++);
buf += len;
buf = (char *) buf + len;
size -= len;
}
}

View file

@ -104,7 +104,7 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
if (p)
{
grub_disk_read (disk, p->offset, 446, 64,
(char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
(void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR);
part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR
+ (p->index << 4));
}

View file

@ -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,

View file

@ -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. */

View file

@ -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)

View file

@ -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,

View file

@ -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. */

View file

@ -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");

View file

@ -52,7 +52,7 @@ static grub_err_t grub_pcpart_boot (const grub_device_t dev,
dev->disk->partition = 0;
/* Read the MBR. */
if (grub_disk_read (dev->disk, 0, 0, sizeof (mbr), (char *) &mbr))
if (grub_disk_read (dev->disk, 0, 0, sizeof (mbr), &mbr))
{
dev->disk->partition = part;
return grub_errno;
@ -72,7 +72,7 @@ static grub_err_t grub_pcpart_boot (const grub_device_t dev,
}
/* Write the MBR. */
grub_disk_write (dev->disk, 0, 0, sizeof (mbr), (char *) &mbr);
grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr);
dev->disk->partition = part;
@ -100,7 +100,7 @@ static grub_err_t grub_pcpart_type (const grub_device_t dev,
/* Read the parttable. */
if (grub_disk_read (dev->disk, part->offset, 0,
sizeof (mbr), (char *) &mbr))
sizeof (mbr), &mbr))
{
dev->disk->partition = part;
return grub_errno;
@ -131,7 +131,7 @@ static grub_err_t grub_pcpart_type (const grub_device_t dev,
/* Write the parttable. */
grub_disk_write (dev->disk, part->offset, 0,
sizeof (mbr), (char *) &mbr);
sizeof (mbr), &mbr);
dev->disk->partition = part;