|
@@ -84,7 +84,7 @@ void put_ext4(uint64_t off, void *buf, uint32_t size)
|
|
|
|
|
|
if ((startblock + (size >> log2blksz)) >
|
|
if ((startblock + (size >> log2blksz)) >
|
|
(part_offset + fs->total_sect)) {
|
|
(part_offset + fs->total_sect)) {
|
|
- printf("part_offset is %lu\n", part_offset);
|
|
|
|
|
|
+ printf("part_offset is " LBAFU "\n", part_offset);
|
|
printf("total_sector is %llu\n", fs->total_sect);
|
|
printf("total_sector is %llu\n", fs->total_sect);
|
|
printf("error: overflow occurs\n");
|
|
printf("error: overflow occurs\n");
|
|
return;
|
|
return;
|
|
@@ -405,7 +405,7 @@ restart:
|
|
previous_blknr = root_blknr;
|
|
previous_blknr = root_blknr;
|
|
}
|
|
}
|
|
|
|
|
|
- status = ext4fs_devread(first_block_no_of_root
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)first_block_no_of_root
|
|
* fs->sect_perblk,
|
|
* fs->sect_perblk,
|
|
0, fs->blksz, root_first_block_buffer);
|
|
0, fs->blksz, root_first_block_buffer);
|
|
if (status == 0)
|
|
if (status == 0)
|
|
@@ -545,7 +545,7 @@ static int search_dir(struct ext2_inode *parent_inode, char *dirname)
|
|
if (!block_buffer)
|
|
if (!block_buffer)
|
|
goto fail;
|
|
goto fail;
|
|
|
|
|
|
- status = ext4fs_devread(blknr * fs->sect_perblk,
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk,
|
|
0, fs->blksz, (char *)block_buffer);
|
|
0, fs->blksz, (char *)block_buffer);
|
|
if (status == 0)
|
|
if (status == 0)
|
|
goto fail;
|
|
goto fail;
|
|
@@ -783,7 +783,7 @@ static int check_filename(char *filename, unsigned int blknr)
|
|
if (!root_first_block_buffer)
|
|
if (!root_first_block_buffer)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
root_first_block_addr = root_first_block_buffer;
|
|
root_first_block_addr = root_first_block_buffer;
|
|
- status = ext4fs_devread(first_block_no_of_root *
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)first_block_no_of_root *
|
|
fs->sect_perblk, 0,
|
|
fs->sect_perblk, 0,
|
|
fs->blksz, root_first_block_buffer);
|
|
fs->blksz, root_first_block_buffer);
|
|
if (status == 0)
|
|
if (status == 0)
|
|
@@ -895,7 +895,8 @@ long int ext4fs_get_new_blk_no(void)
|
|
fs->first_pass_bbmap++;
|
|
fs->first_pass_bbmap++;
|
|
bgd[i].free_blocks--;
|
|
bgd[i].free_blocks--;
|
|
fs->sb->free_blocks--;
|
|
fs->sb->free_blocks--;
|
|
- status = ext4fs_devread(bgd[i].block_id *
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)
|
|
|
|
+ bgd[i].block_id *
|
|
fs->sect_perblk, 0,
|
|
fs->sect_perblk, 0,
|
|
fs->blksz,
|
|
fs->blksz,
|
|
journal_buffer);
|
|
journal_buffer);
|
|
@@ -957,7 +958,7 @@ restart:
|
|
/* journal backup */
|
|
/* journal backup */
|
|
if (prev_bg_bitmap_index != bg_idx) {
|
|
if (prev_bg_bitmap_index != bg_idx) {
|
|
memset(journal_buffer, '\0', fs->blksz);
|
|
memset(journal_buffer, '\0', fs->blksz);
|
|
- status = ext4fs_devread(bgd[bg_idx].block_id
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)bgd[bg_idx].block_id
|
|
* fs->sect_perblk,
|
|
* fs->sect_perblk,
|
|
0, fs->blksz, journal_buffer);
|
|
0, fs->blksz, journal_buffer);
|
|
if (status == 0)
|
|
if (status == 0)
|
|
@@ -1026,7 +1027,8 @@ int ext4fs_get_new_inode_no(void)
|
|
bgd[i].free_inodes--;
|
|
bgd[i].free_inodes--;
|
|
bgd[i].bg_itable_unused--;
|
|
bgd[i].bg_itable_unused--;
|
|
fs->sb->free_inodes--;
|
|
fs->sb->free_inodes--;
|
|
- status = ext4fs_devread(bgd[i].inode_id *
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)
|
|
|
|
+ bgd[i].inode_id *
|
|
fs->sect_perblk, 0,
|
|
fs->sect_perblk, 0,
|
|
fs->blksz,
|
|
fs->blksz,
|
|
journal_buffer);
|
|
journal_buffer);
|
|
@@ -1067,7 +1069,8 @@ restart:
|
|
/* journal backup */
|
|
/* journal backup */
|
|
if (prev_inode_bitmap_index != ibmap_idx) {
|
|
if (prev_inode_bitmap_index != ibmap_idx) {
|
|
memset(journal_buffer, '\0', fs->blksz);
|
|
memset(journal_buffer, '\0', fs->blksz);
|
|
- status = ext4fs_devread(bgd[ibmap_idx].inode_id
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)
|
|
|
|
+ bgd[ibmap_idx].inode_id
|
|
* fs->sect_perblk,
|
|
* fs->sect_perblk,
|
|
0, fs->blksz, journal_buffer);
|
|
0, fs->blksz, journal_buffer);
|
|
if (status == 0)
|
|
if (status == 0)
|
|
@@ -1129,7 +1132,7 @@ static void alloc_single_indirect_block(struct ext2_inode *file_inode,
|
|
(*no_blks_reqd)++;
|
|
(*no_blks_reqd)++;
|
|
debug("SIPB %ld: %u\n", si_blockno, *total_remaining_blocks);
|
|
debug("SIPB %ld: %u\n", si_blockno, *total_remaining_blocks);
|
|
|
|
|
|
- status = ext4fs_devread(si_blockno * fs->sect_perblk,
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)si_blockno * fs->sect_perblk,
|
|
0, fs->blksz, (char *)si_buffer);
|
|
0, fs->blksz, (char *)si_buffer);
|
|
memset(si_buffer, '\0', fs->blksz);
|
|
memset(si_buffer, '\0', fs->blksz);
|
|
if (status == 0)
|
|
if (status == 0)
|
|
@@ -1193,7 +1196,7 @@ static void alloc_double_indirect_block(struct ext2_inode *file_inode,
|
|
debug("DIPB %ld: %u\n", di_blockno_parent,
|
|
debug("DIPB %ld: %u\n", di_blockno_parent,
|
|
*total_remaining_blocks);
|
|
*total_remaining_blocks);
|
|
|
|
|
|
- status = ext4fs_devread(di_blockno_parent *
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)di_blockno_parent *
|
|
fs->sect_perblk, 0,
|
|
fs->sect_perblk, 0,
|
|
fs->blksz, (char *)di_parent_buffer);
|
|
fs->blksz, (char *)di_parent_buffer);
|
|
|
|
|
|
@@ -1224,7 +1227,7 @@ static void alloc_double_indirect_block(struct ext2_inode *file_inode,
|
|
debug("DICB %ld: %u\n", di_blockno_child,
|
|
debug("DICB %ld: %u\n", di_blockno_child,
|
|
*total_remaining_blocks);
|
|
*total_remaining_blocks);
|
|
|
|
|
|
- status = ext4fs_devread(di_blockno_child *
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)di_blockno_child *
|
|
fs->sect_perblk, 0,
|
|
fs->sect_perblk, 0,
|
|
fs->blksz,
|
|
fs->blksz,
|
|
(char *)di_child_buff);
|
|
(char *)di_child_buff);
|
|
@@ -1447,7 +1450,8 @@ static struct ext4_extent_header *ext4fs_get_extent_block
|
|
block = le32_to_cpu(index[i].ei_leaf_hi);
|
|
block = le32_to_cpu(index[i].ei_leaf_hi);
|
|
block = (block << 32) + le32_to_cpu(index[i].ei_leaf_lo);
|
|
block = (block << 32) + le32_to_cpu(index[i].ei_leaf_lo);
|
|
|
|
|
|
- if (ext4fs_devread(block << log2_blksz, 0, fs->blksz, buf))
|
|
|
|
|
|
+ if (ext4fs_devread((lbaint_t)block << log2_blksz, 0, fs->blksz,
|
|
|
|
+ buf))
|
|
ext_block = (struct ext4_extent_header *)buf;
|
|
ext_block = (struct ext4_extent_header *)buf;
|
|
else
|
|
else
|
|
return 0;
|
|
return 0;
|
|
@@ -1470,7 +1474,8 @@ static int ext4fs_blockgroup
|
|
debug("ext4fs read %d group descriptor (blkno %ld blkoff %u)\n",
|
|
debug("ext4fs read %d group descriptor (blkno %ld blkoff %u)\n",
|
|
group, blkno, blkoff);
|
|
group, blkno, blkoff);
|
|
|
|
|
|
- return ext4fs_devread(blkno << (LOG2_BLOCK_SIZE(data) - log2blksz),
|
|
|
|
|
|
+ return ext4fs_devread((lbaint_t)blkno <<
|
|
|
|
+ (LOG2_BLOCK_SIZE(data) - log2blksz),
|
|
blkoff, sizeof(struct ext2_block_group),
|
|
blkoff, sizeof(struct ext2_block_group),
|
|
(char *)blkgrp);
|
|
(char *)blkgrp);
|
|
}
|
|
}
|
|
@@ -1497,8 +1502,8 @@ int ext4fs_read_inode(struct ext2_data *data, int ino, struct ext2_inode *inode)
|
|
(ino % __le32_to_cpu(sblock->inodes_per_group)) / inodes_per_block;
|
|
(ino % __le32_to_cpu(sblock->inodes_per_group)) / inodes_per_block;
|
|
blkoff = (ino % inodes_per_block) * fs->inodesz;
|
|
blkoff = (ino % inodes_per_block) * fs->inodesz;
|
|
/* Read the inode. */
|
|
/* Read the inode. */
|
|
- status = ext4fs_devread(blkno << (LOG2_BLOCK_SIZE(data) - log2blksz),
|
|
|
|
- blkoff,
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)blkno << (LOG2_BLOCK_SIZE(data) -
|
|
|
|
+ log2blksz), blkoff,
|
|
sizeof(struct ext2_inode), (char *)inode);
|
|
sizeof(struct ext2_inode), (char *)inode);
|
|
if (status == 0)
|
|
if (status == 0)
|
|
return 0;
|
|
return 0;
|
|
@@ -1597,7 +1602,7 @@ long int read_allocated_block(struct ext2_inode *inode, int fileblock)
|
|
if ((__le32_to_cpu(inode->b.blocks.indir_block) <<
|
|
if ((__le32_to_cpu(inode->b.blocks.indir_block) <<
|
|
log2_blksz) != ext4fs_indir1_blkno) {
|
|
log2_blksz) != ext4fs_indir1_blkno) {
|
|
status =
|
|
status =
|
|
- ext4fs_devread(__le32_to_cpu
|
|
|
|
|
|
+ ext4fs_devread((lbaint_t)__le32_to_cpu
|
|
(inode->b.blocks.
|
|
(inode->b.blocks.
|
|
indir_block) << log2_blksz, 0,
|
|
indir_block) << log2_blksz, 0,
|
|
blksz, (char *)ext4fs_indir1_block);
|
|
blksz, (char *)ext4fs_indir1_block);
|
|
@@ -1646,7 +1651,7 @@ long int read_allocated_block(struct ext2_inode *inode, int fileblock)
|
|
if ((__le32_to_cpu(inode->b.blocks.double_indir_block) <<
|
|
if ((__le32_to_cpu(inode->b.blocks.double_indir_block) <<
|
|
log2_blksz) != ext4fs_indir1_blkno) {
|
|
log2_blksz) != ext4fs_indir1_blkno) {
|
|
status =
|
|
status =
|
|
- ext4fs_devread(__le32_to_cpu
|
|
|
|
|
|
+ ext4fs_devread((lbaint_t)__le32_to_cpu
|
|
(inode->b.blocks.
|
|
(inode->b.blocks.
|
|
double_indir_block) << log2_blksz,
|
|
double_indir_block) << log2_blksz,
|
|
0, blksz,
|
|
0, blksz,
|
|
@@ -1686,7 +1691,7 @@ long int read_allocated_block(struct ext2_inode *inode, int fileblock)
|
|
}
|
|
}
|
|
if ((__le32_to_cpu(ext4fs_indir1_block[rblock / perblock]) <<
|
|
if ((__le32_to_cpu(ext4fs_indir1_block[rblock / perblock]) <<
|
|
log2_blksz) != ext4fs_indir2_blkno) {
|
|
log2_blksz) != ext4fs_indir2_blkno) {
|
|
- status = ext4fs_devread(__le32_to_cpu
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)__le32_to_cpu
|
|
(ext4fs_indir1_block
|
|
(ext4fs_indir1_block
|
|
[rblock /
|
|
[rblock /
|
|
perblock]) << log2_blksz, 0,
|
|
perblock]) << log2_blksz, 0,
|
|
@@ -1738,7 +1743,8 @@ long int read_allocated_block(struct ext2_inode *inode, int fileblock)
|
|
if ((__le32_to_cpu(inode->b.blocks.triple_indir_block) <<
|
|
if ((__le32_to_cpu(inode->b.blocks.triple_indir_block) <<
|
|
log2_blksz) != ext4fs_indir1_blkno) {
|
|
log2_blksz) != ext4fs_indir1_blkno) {
|
|
status = ext4fs_devread
|
|
status = ext4fs_devread
|
|
- (__le32_to_cpu(inode->b.blocks.triple_indir_block)
|
|
|
|
|
|
+ ((lbaint_t)
|
|
|
|
+ __le32_to_cpu(inode->b.blocks.triple_indir_block)
|
|
<< log2_blksz, 0, blksz,
|
|
<< log2_blksz, 0, blksz,
|
|
(char *)ext4fs_indir1_block);
|
|
(char *)ext4fs_indir1_block);
|
|
if (status == 0) {
|
|
if (status == 0) {
|
|
@@ -1778,7 +1784,7 @@ long int read_allocated_block(struct ext2_inode *inode, int fileblock)
|
|
perblock_parent]) <<
|
|
perblock_parent]) <<
|
|
log2_blksz)
|
|
log2_blksz)
|
|
!= ext4fs_indir2_blkno) {
|
|
!= ext4fs_indir2_blkno) {
|
|
- status = ext4fs_devread(__le32_to_cpu
|
|
|
|
|
|
+ status = ext4fs_devread((lbaint_t)__le32_to_cpu
|
|
(ext4fs_indir1_block
|
|
(ext4fs_indir1_block
|
|
[rblock /
|
|
[rblock /
|
|
perblock_parent]) <<
|
|
perblock_parent]) <<
|
|
@@ -1823,7 +1829,7 @@ long int read_allocated_block(struct ext2_inode *inode, int fileblock)
|
|
perblock_child]) <<
|
|
perblock_child]) <<
|
|
log2_blksz) != ext4fs_indir3_blkno) {
|
|
log2_blksz) != ext4fs_indir3_blkno) {
|
|
status =
|
|
status =
|
|
- ext4fs_devread(__le32_to_cpu
|
|
|
|
|
|
+ ext4fs_devread((lbaint_t)__le32_to_cpu
|
|
(ext4fs_indir2_block
|
|
(ext4fs_indir2_block
|
|
[(rblock / perblock_child)
|
|
[(rblock / perblock_child)
|
|
% (blksz / 4)]) << log2_blksz, 0,
|
|
% (blksz / 4)]) << log2_blksz, 0,
|