desc_per_blk = EXT2_BLOCK_SIZE(data) / sizeof(struct ext2_block_group);
- blkno = __le32_to_cpu(data->sblock.first_data_block) + 1 +
+ blkno = le32_to_cpu(data->sblock.first_data_block) + 1 +
group / desc_per_blk;
blkoff = (group % desc_per_blk) * sizeof(struct ext2_block_group);
/* It is easier to calculate if the first inode is 0. */
ino--;
- status = ext4fs_blockgroup(data, ino / __le32_to_cpu
+ status = ext4fs_blockgroup(data, ino / le32_to_cpu
(sblock->inodes_per_group), &blkgrp);
if (status == 0)
return 0;
inodes_per_block = EXT2_BLOCK_SIZE(data) / fs->inodesz;
- blkno = __le32_to_cpu(blkgrp.inode_table_id) +
- (ino % __le32_to_cpu(sblock->inodes_per_group)) / inodes_per_block;
+ blkno = le32_to_cpu(blkgrp.inode_table_id) +
+ (ino % le32_to_cpu(sblock->inodes_per_group)) / inodes_per_block;
blkoff = (ino % inodes_per_block) * fs->inodesz;
/* Read the inode. */
status = ext4fs_devread((lbaint_t)blkno << (LOG2_BLOCK_SIZE(data) -
/* Direct blocks. */
if (fileblock < INDIRECT_BLOCKS)
- blknr = __le32_to_cpu(inode->b.blocks.dir_blocks[fileblock]);
+ blknr = le32_to_cpu(inode->b.blocks.dir_blocks[fileblock]);
/* Indirect. */
else if (fileblock < (INDIRECT_BLOCKS + (blksz / 4))) {
}
ext4fs_indir1_size = blksz;
}
- if ((__le32_to_cpu(inode->b.blocks.indir_block) <<
+ if ((le32_to_cpu(inode->b.blocks.indir_block) <<
log2_blksz) != ext4fs_indir1_blkno) {
status =
- ext4fs_devread((lbaint_t)__le32_to_cpu
+ ext4fs_devread((lbaint_t)le32_to_cpu
(inode->b.blocks.
indir_block) << log2_blksz, 0,
blksz, (char *)ext4fs_indir1_block);
return 0;
}
ext4fs_indir1_blkno =
- __le32_to_cpu(inode->b.blocks.
+ le32_to_cpu(inode->b.blocks.
indir_block) << log2_blksz;
}
- blknr = __le32_to_cpu(ext4fs_indir1_block
+ blknr = le32_to_cpu(ext4fs_indir1_block
[fileblock - INDIRECT_BLOCKS]);
}
/* Double indirect. */
}
ext4fs_indir1_size = blksz;
}
- 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) {
status =
- ext4fs_devread((lbaint_t)__le32_to_cpu
+ ext4fs_devread((lbaint_t)le32_to_cpu
(inode->b.blocks.
double_indir_block) << log2_blksz,
0, blksz,
return -1;
}
ext4fs_indir1_blkno =
- __le32_to_cpu(inode->b.blocks.double_indir_block) <<
+ le32_to_cpu(inode->b.blocks.double_indir_block) <<
log2_blksz;
}
}
ext4fs_indir2_size = blksz;
}
- if ((__le32_to_cpu(ext4fs_indir1_block[rblock / perblock]) <<
+ if ((le32_to_cpu(ext4fs_indir1_block[rblock / perblock]) <<
log2_blksz) != ext4fs_indir2_blkno) {
- status = ext4fs_devread((lbaint_t)__le32_to_cpu
+ status = ext4fs_devread((lbaint_t)le32_to_cpu
(ext4fs_indir1_block
[rblock /
perblock]) << log2_blksz, 0,
return -1;
}
ext4fs_indir2_blkno =
- __le32_to_cpu(ext4fs_indir1_block[rblock
+ le32_to_cpu(ext4fs_indir1_block[rblock
/
perblock]) <<
log2_blksz;
}
- blknr = __le32_to_cpu(ext4fs_indir2_block[rblock % perblock]);
+ blknr = le32_to_cpu(ext4fs_indir2_block[rblock % perblock]);
}
/* Tripple indirect. */
else {
}
ext4fs_indir1_size = blksz;
}
- 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) {
status = ext4fs_devread
((lbaint_t)
- __le32_to_cpu(inode->b.blocks.triple_indir_block)
+ le32_to_cpu(inode->b.blocks.triple_indir_block)
<< log2_blksz, 0, blksz,
(char *)ext4fs_indir1_block);
if (status == 0) {
return -1;
}
ext4fs_indir1_blkno =
- __le32_to_cpu(inode->b.blocks.triple_indir_block) <<
+ le32_to_cpu(inode->b.blocks.triple_indir_block) <<
log2_blksz;
}
}
ext4fs_indir2_size = blksz;
}
- if ((__le32_to_cpu(ext4fs_indir1_block[rblock /
+ if ((le32_to_cpu(ext4fs_indir1_block[rblock /
perblock_parent]) <<
log2_blksz)
!= ext4fs_indir2_blkno) {
- status = ext4fs_devread((lbaint_t)__le32_to_cpu
+ status = ext4fs_devread((lbaint_t)le32_to_cpu
(ext4fs_indir1_block
[rblock /
perblock_parent]) <<
return -1;
}
ext4fs_indir2_blkno =
- __le32_to_cpu(ext4fs_indir1_block[rblock /
+ le32_to_cpu(ext4fs_indir1_block[rblock /
perblock_parent])
<< log2_blksz;
}
}
ext4fs_indir3_size = blksz;
}
- if ((__le32_to_cpu(ext4fs_indir2_block[rblock
+ if ((le32_to_cpu(ext4fs_indir2_block[rblock
/
perblock_child]) <<
log2_blksz) != ext4fs_indir3_blkno) {
status =
- ext4fs_devread((lbaint_t)__le32_to_cpu
+ ext4fs_devread((lbaint_t)le32_to_cpu
(ext4fs_indir2_block
[(rblock / perblock_child)
% (blksz / 4)]) << log2_blksz, 0,
return -1;
}
ext4fs_indir3_blkno =
- __le32_to_cpu(ext4fs_indir2_block[(rblock /
+ le32_to_cpu(ext4fs_indir2_block[(rblock /
perblock_child) %
(blksz /
4)]) <<
log2_blksz;
}
- blknr = __le32_to_cpu(ext4fs_indir3_block
+ blknr = le32_to_cpu(ext4fs_indir3_block
[rblock % perblock_child]);
}
debug("read_allocated_block %ld\n", blknr);
return 0;
}
/* Search the file. */
- while (fpos < __le32_to_cpu(diro->inode.size)) {
+ while (fpos < le32_to_cpu(diro->inode.size)) {
struct ext2_dirent dirent;
status = ext4fs_read_file(diro, fpos,
return 0;
fdiro->data = diro->data;
- fdiro->ino = __le32_to_cpu(dirent.inode);
+ fdiro->ino = le32_to_cpu(dirent.inode);
filename[dirent.namelen] = '\0';
type = FILETYPE_REG;
} else {
status = ext4fs_read_inode(diro->data,
- __le32_to_cpu
+ le32_to_cpu
(dirent.inode),
&fdiro->inode);
if (status == 0) {
}
fdiro->inode_read = 1;
- if ((__le16_to_cpu(fdiro->inode.mode) &
+ if ((le16_to_cpu(fdiro->inode.mode) &
FILETYPE_INO_MASK) ==
FILETYPE_INO_DIRECTORY) {
type = FILETYPE_DIRECTORY;
- } else if ((__le16_to_cpu(fdiro->inode.mode)
+ } else if ((le16_to_cpu(fdiro->inode.mode)
& FILETYPE_INO_MASK) ==
FILETYPE_INO_SYMLINK) {
type = FILETYPE_SYMLINK;
- } else if ((__le16_to_cpu(fdiro->inode.mode)
+ } else if ((le16_to_cpu(fdiro->inode.mode)
& FILETYPE_INO_MASK) ==
FILETYPE_INO_REG) {
type = FILETYPE_REG;
} else {
if (fdiro->inode_read == 0) {
status = ext4fs_read_inode(diro->data,
- __le32_to_cpu(
+ le32_to_cpu(
dirent.inode),
&fdiro->inode);
if (status == 0) {
break;
}
printf("%10u %s\n",
- __le32_to_cpu(fdiro->inode.size),
+ le32_to_cpu(fdiro->inode.size),
filename);
}
free(fdiro);
}
- fpos += __le16_to_cpu(dirent.direntlen);
+ fpos += le16_to_cpu(dirent.direntlen);
}
return 0;
}
if (status == 0)
return 0;
}
- symlink = zalloc(__le32_to_cpu(diro->inode.size) + 1);
+ symlink = zalloc(le32_to_cpu(diro->inode.size) + 1);
if (!symlink)
return 0;
- if (__le32_to_cpu(diro->inode.size) < sizeof(diro->inode.b.symlink)) {
+ if (le32_to_cpu(diro->inode.size) < sizeof(diro->inode.b.symlink)) {
strncpy(symlink, diro->inode.b.symlink,
- __le32_to_cpu(diro->inode.size));
+ le32_to_cpu(diro->inode.size));
} else {
status = ext4fs_read_file(diro, 0,
- __le32_to_cpu(diro->inode.size),
+ le32_to_cpu(diro->inode.size),
symlink, &actread);
if ((status < 0) || (actread == 0)) {
free(symlink);
return 0;
}
}
- symlink[__le32_to_cpu(diro->inode.size)] = '\0';
+ symlink[le32_to_cpu(diro->inode.size)] = '\0';
return symlink;
}
if (status == 0)
goto fail;
}
- *len = __le32_to_cpu(fdiro->inode.size);
+ *len = le32_to_cpu(fdiro->inode.size);
ext4fs_file = fdiro;
return 0;
goto fail;
/* Make sure this is an ext2 filesystem. */
- if (__le16_to_cpu(data->sblock.magic) != EXT2_MAGIC)
+ if (le16_to_cpu(data->sblock.magic) != EXT2_MAGIC)
goto fail;
/*
goto fail;
}
- if (__le32_to_cpu(data->sblock.revision_level == 0))
+ if (le32_to_cpu(data->sblock.revision_level == 0))
fs->inodesz = 128;
else
- fs->inodesz = __le16_to_cpu(data->sblock.inode_size);
+ fs->inodesz = le16_to_cpu(data->sblock.inode_size);
debug("EXT2 rev %d, inode_size %d\n",
- __le32_to_cpu(data->sblock.revision_level), fs->inodesz);
+ le32_to_cpu(data->sblock.revision_level), fs->inodesz);
data->diropen.data = data;
data->diropen.ino = 2;
/* get the block no */
inodeno--;
- blkno = __le32_to_cpu(bgd[ibmap_idx].inode_table_id) +
- (inodeno % __le32_to_cpu(inode_per_grp)) / inodes_per_block;
+ blkno = le32_to_cpu(bgd[ibmap_idx].inode_table_id) +
+ (inodeno % le32_to_cpu(inode_per_grp)) / inodes_per_block;
/* get the offset of the inode */
blkoff = ((inodeno) % inodes_per_block) * fs->inodesz;
{
int i;
int blockcnt;
- unsigned int filesize = __le32_to_cpu(file_inode->size);
+ unsigned int filesize = le32_to_cpu(file_inode->size);
struct ext_filesystem *fs = get_fs();
int log2blksz = fs->dev_desc->log2blksz;
int log2_fs_blocksize = LOG2_BLOCK_SIZE(ext4fs_root) - log2blksz;
goto fail;
ibmap_idx = inodeno / ext4fs_root->sblock.inodes_per_group;
inodeno--;
- itable_blkno = __le32_to_cpu(fs->bgd[ibmap_idx].inode_table_id) +
- (inodeno % __le32_to_cpu(sblock->inodes_per_group)) /
+ itable_blkno = le32_to_cpu(fs->bgd[ibmap_idx].inode_table_id) +
+ (inodeno % le32_to_cpu(sblock->inodes_per_group)) /
inodes_per_block;
blkoff = (inodeno % inodes_per_block) * fs->inodesz;
ext4fs_devread((lbaint_t)itable_blkno * fs->sect_perblk, 0, fs->blksz,
}
ibmap_idx = parent_inodeno / ext4fs_root->sblock.inodes_per_group;
parent_inodeno--;
- parent_itable_blkno = __le32_to_cpu(fs->bgd[ibmap_idx].inode_table_id) +
+ parent_itable_blkno = le32_to_cpu(fs->bgd[ibmap_idx].inode_table_id) +
(parent_inodeno %
- __le32_to_cpu(sblock->inodes_per_group)) / inodes_per_block;
+ le32_to_cpu(sblock->inodes_per_group)) / inodes_per_block;
blkoff = (parent_inodeno % inodes_per_block) * fs->inodesz;
if (parent_itable_blkno != itable_blkno) {
memset(temp_ptr, '\0', fs->blksz);