
Fix indentation complains from checkpatch.pl
Signed-off-by: Marek Vasut marex@denx.de Cc: Wolfgang Denk wd@denx.de --- fs/ext2/ext2fs.c | 130 ++++++++++++++++++++++++++---------------------------- 1 file changed, 63 insertions(+), 67 deletions(-)
diff --git a/fs/ext2/ext2fs.c b/fs/ext2/ext2fs.c index d55c8c5..5bb8851 100644 --- a/fs/ext2/ext2fs.c +++ b/fs/ext2/ext2fs.c @@ -116,68 +116,64 @@ static int ext2fs_read_block(struct ext2fs_node *node, int fileblock) struct ext2_data *data = node->data; struct ext2_inode *inode = &node->inode; int blknr; - int blksz = EXT2_BLOCK_SIZE (data); - int log2_blksz = LOG2_EXT2_BLOCK_SIZE (data); + int blksz = EXT2_BLOCK_SIZE(data); + int log2_blksz = LOG2_EXT2_BLOCK_SIZE(data); + int size; int status;
- /* Direct blocks. */ + /* Direct blocks. */ if (fileblock < INDIRECT_BLOCKS) { - blknr = __le32_to_cpu (inode->b.blocks.dir_blocks[fileblock]); - } - /* Indirect. */ - else if (fileblock < (INDIRECT_BLOCKS + (blksz / 4))) { + blknr = __le32_to_cpu(inode->b.blocks.dir_blocks[fileblock]); + /* Indirect. */ + } else if (fileblock < (INDIRECT_BLOCKS + (blksz / 4))) { if (indir1_block == NULL) { - indir1_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN, + indir1_block = (uint32_t *)memalign(ARCH_DMA_MINALIGN, blksz); if (indir1_block == NULL) { - printf ("** ext2fs read block (indir 1) malloc failed. **\n"); - return (-1); + printf("EXT2: read block (indir 1) malloc failed!\n"); + return -1; } indir1_size = blksz; indir1_blkno = -1; } + if (blksz != indir1_size) { - free (indir1_block); + free(indir1_block); indir1_block = NULL; indir1_size = 0; indir1_blkno = -1; - indir1_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN, + indir1_block = (uint32_t *)memalign(ARCH_DMA_MINALIGN, blksz); if (indir1_block == NULL) { - printf ("** ext2fs read block (indir 1) malloc failed. **\n"); - return (-1); + printf("EXT2: read block (indir 1) malloc failed!\n"); + return -1; } indir1_size = blksz; } - if ((__le32_to_cpu (inode->b.blocks.indir_block) << - log2_blksz) != indir1_blkno) { - status = ext2fs_devread (__le32_to_cpu(inode->b.blocks.indir_block) << log2_blksz, - 0, blksz, - (char *) indir1_block); + + size = __le32_to_cpu(inode->b.blocks.indir_block) << log2_blksz; + if (size != indir1_blkno) { + status = ext2fs_devread(size, 0, blksz, + (char *)indir1_block); if (status == 0) { - printf ("** ext2fs read block (indir 1) failed. **\n"); - return (0); + printf("EXT2: read block (indir 1) failed!\n"); + return 0; } - indir1_blkno = - __le32_to_cpu (inode->b.blocks. - indir_block) << log2_blksz; + indir1_blkno = size; } - blknr = __le32_to_cpu (indir1_block - [fileblock - INDIRECT_BLOCKS]); - } - /* Double indirect. */ - else if (fileblock < - (INDIRECT_BLOCKS + (blksz / 4 * (blksz / 4 + 1)))) { + blknr =__le32_to_cpu(indir1_block[fileblock - INDIRECT_BLOCKS]); + /* Double indirect. */ + } else + if (fileblock < (INDIRECT_BLOCKS + (blksz / 4 * (blksz / 4 + 1)))) { unsigned int perblock = blksz / 4; - unsigned int rblock = fileblock - (INDIRECT_BLOCKS - + blksz / 4); + unsigned int rblock = fileblock - (INDIRECT_BLOCKS + blksz / 4);
if (indir1_block == NULL) { - indir1_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN, + indir1_block = (uint32_t *)memalign(ARCH_DMA_MINALIGN, blksz); if (indir1_block == NULL) { - printf ("** ext2fs read block (indir 2 1) malloc failed. **\n"); - return (-1); + printf ("EXT2: read block (indir 2 1) malloc failed!\n"); + return -1; } indir1_size = blksz; indir1_blkno = -1; @@ -190,72 +186,72 @@ static int ext2fs_read_block(struct ext2fs_node *node, int fileblock) indir1_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN, blksz); if (indir1_block == NULL) { - printf ("** ext2fs read block (indir 2 1) malloc failed. **\n"); - return (-1); + printf ("** ext2fs read block (indir 2 1) malloc failed!\n"); + return -1; } indir1_size = blksz; } - if ((__le32_to_cpu (inode->b.blocks.double_indir_block) << - log2_blksz) != indir1_blkno) { - status = ext2fs_devread (__le32_to_cpu(inode->b.blocks.double_indir_block) << log2_blksz, - 0, blksz, - (char *) indir1_block); + + size = __le32_to_cpu (inode->b.blocks.double_indir_block) << log2_blksz; + if (size != indir1_blkno) { + status = ext2fs_devread (size, 0, blksz, + (char *)indir1_block); if (status == 0) { - printf ("** ext2fs read block (indir 2 1) failed. **\n"); - return (-1); + printf ("EXT2: read block (indir 2 1) failed!\n"); + return -1; } indir1_blkno = __le32_to_cpu (inode->b.blocks.double_indir_block) << log2_blksz; }
if (indir2_block == NULL) { - indir2_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN, + indir2_block = (uint32_t *)memalign(ARCH_DMA_MINALIGN, blksz); if (indir2_block == NULL) { - printf ("** ext2fs read block (indir 2 2) malloc failed. **\n"); - return (-1); + printf ("EXT2: read block (indir 2 2) malloc failed!\n"); + return -1; } indir2_size = blksz; indir2_blkno = -1; } if (blksz != indir2_size) { - free (indir2_block); + free(indir2_block); indir2_block = NULL; indir2_size = 0; indir2_blkno = -1; - indir2_block = (uint32_t *) memalign(ARCH_DMA_MINALIGN, + indir2_block = (uint32_t *)memalign(ARCH_DMA_MINALIGN, blksz); if (indir2_block == NULL) { - printf ("** ext2fs read block (indir 2 2) malloc failed. **\n"); - return (-1); + printf ("EXT2: read block (indir 2 2) malloc failed!\n"); + return -1; } indir2_size = blksz; } - if ((__le32_to_cpu (indir1_block[rblock / perblock]) << - log2_blksz) != indir2_blkno) { - status = ext2fs_devread (__le32_to_cpu(indir1_block[rblock / perblock]) << log2_blksz, - 0, blksz, - (char *) indir2_block); + + size = __le32_to_cpu(indir1_block[rblock / perblock]) << log2_blksz; + if (size != indir2_blkno) { + status = ext2fs_devread(size, 0, blksz, + (char *)indir2_block); if (status == 0) { - printf ("** ext2fs read block (indir 2 2) failed. **\n"); - return (-1); + printf ("EXT2: read block (indir 2 2) failed!\n"); + return -1; } - indir2_blkno = - __le32_to_cpu (indir1_block[rblock / perblock]) << log2_blksz; + indir2_blkno = size; } - blknr = __le32_to_cpu (indir2_block[rblock % perblock]); + blknr = __le32_to_cpu(indir2_block[rblock % perblock]); } /* Tripple indirect. */ else { - printf ("** ext2fs doesn't support tripple indirect blocks. **\n"); - return (-1); + printf ("EXT2: doesn't support tripple indirect blocks!\n"); + return -1; } -#ifdef DEBUG - printf ("ext2fs_read_block %08x\n", blknr); -#endif - return (blknr); + + debug("Block %08x\n", blknr); + + return blknr; }
+ static int ext2fs_read_file(struct ext2fs_node *node, int pos, unsigned int len, char *buf) {