Fix few obvious type discrepancies.
* grub-core/fs/affs.c (grub_affs_read_file): Use grub_off_t for offset. * grub-core/fs/afs.c (grub_afs_read_file): Likewise. * grub-core/fs/fshelp.c (grub_fshelp_find_file): Remove leftover variable. * grub-core/fs/hfs.c (grub_hfs_read_file): Use grub_off_t for offset and connected types. * grub-core/fs/nilfs2.c (grub_nilfs2_read_file): Use grub_off_t for offset. (grub_nilfs2_iterate_dir): Use grub_off_t for fpos. * grub-core/fs/sfs.c (grub_sfs_read_file): Use grub_off_t for offset. * grub-core/fs/ufs.c (grub_ufs_read_file): Use grub_off_t for offset and connected types.
This commit is contained in:
parent
177b960ea4
commit
366e34fa5a
8 changed files with 48 additions and 27 deletions
|
@ -285,26 +285,29 @@ static grub_ssize_t
|
|||
grub_ufs_read_file (struct grub_ufs_data *data,
|
||||
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
||||
unsigned offset, unsigned length),
|
||||
int pos, grub_size_t len, char *buf)
|
||||
grub_off_t pos, grub_size_t len, char *buf)
|
||||
{
|
||||
struct grub_ufs_sblock *sblock = &data->sblock;
|
||||
int i;
|
||||
int blockcnt;
|
||||
grub_off_t i;
|
||||
grub_off_t blockcnt;
|
||||
|
||||
/* Adjust len so it we can't read past the end of the file. */
|
||||
if (len + pos > INODE_SIZE (data))
|
||||
len = INODE_SIZE (data) - pos;
|
||||
|
||||
blockcnt = (len + pos + UFS_BLKSZ (sblock) - 1) / UFS_BLKSZ (sblock);
|
||||
blockcnt = grub_divmod64 ((len + pos + UFS_BLKSZ (sblock) - 1),
|
||||
UFS_BLKSZ (sblock), 0);
|
||||
|
||||
for (i = pos / UFS_BLKSZ (sblock); i < blockcnt; i++)
|
||||
for (i = grub_divmod64 (pos, UFS_BLKSZ (sblock), 0); i < blockcnt; i++)
|
||||
{
|
||||
int blknr;
|
||||
int blockoff = pos % UFS_BLKSZ (sblock);
|
||||
int blockend = UFS_BLKSZ (sblock);
|
||||
grub_disk_addr_t blknr;
|
||||
grub_off_t blockoff;
|
||||
grub_off_t blockend = UFS_BLKSZ (sblock);
|
||||
|
||||
int skipfirst = 0;
|
||||
|
||||
grub_divmod64 (pos, UFS_BLKSZ (sblock), &blockoff);
|
||||
|
||||
blknr = grub_ufs_get_file_block (data, i);
|
||||
if (grub_errno)
|
||||
return -1;
|
||||
|
@ -312,14 +315,14 @@ grub_ufs_read_file (struct grub_ufs_data *data,
|
|||
/* Last block. */
|
||||
if (i == blockcnt - 1)
|
||||
{
|
||||
blockend = (len + pos) % UFS_BLKSZ (sblock);
|
||||
grub_divmod64 (len + pos, UFS_BLKSZ (sblock), &blockend);
|
||||
|
||||
if (!blockend)
|
||||
blockend = UFS_BLKSZ (sblock);
|
||||
}
|
||||
|
||||
/* First block. */
|
||||
if (i == (pos / (int) UFS_BLKSZ (sblock)))
|
||||
if (i == grub_divmod64 (pos, UFS_BLKSZ (sblock), 0))
|
||||
{
|
||||
skipfirst = blockoff;
|
||||
blockend -= skipfirst;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue