[U-Boot] [PATCH] fix ext2 inode size and calculations

Wolfgang Denk wd at denx.de
Tue Jun 9 20:16:44 CEST 2009


Dear "Weirich, Bernhard",

In message <CE92B8B581B4584FB8CA86B51EDE8AC51640BAEBCE at wupexchange.riedel.net> you wrote:
> Fixed two endianness problems with old patch from 2009-01-30.

Please include Signed-off-by: message from the previous patch which
your work is based on.

> 
> From: unsik Kim <donari75 at gmail.com>
> Signed-off-by: Bernhard Weirich <bernhard.weirich at riedel.net>
> 
> --- fs/ext2/ext2fs.c	2009-06-09 18:03:20.000000000 +0200
> +++ fs/ext2/ext2fs.c	2009-06-09 18:04:26.000000000 +0200
> @@ -110,7 +110,7 @@
>  	uint32_t inode_table_id;
>  	uint16_t free_blocks;
>  	uint16_t free_inodes;
> -	uint16_t pad;
> +    uint16_t used_dir_cnt;

Please use only TAB for indentation.

>  	uint32_t reserved[3];
>  };
>  
> @@ -182,14 +182,23 @@
>  
>  static int ext2fs_blockgroup
>  	(struct ext2_data *data, int group, struct ext2_block_group *blkgrp) {
> +    unsigned int blkno;
> +    unsigned int blkoff;
> +    unsigned int desc_per_blk;
> +
> +    desc_per_blk = EXT2_BLOCK_SIZE(data) / sizeof(struct ext2_block_group);
> +
> +    blkno = __le32_to_cpu(data->sblock.first_data_block) + 1 +
> +    group / desc_per_blk;
> +    blkoff = (group % desc_per_blk) * sizeof(struct ext2_block_group);
>  #ifdef DEBUG
> -	printf ("ext2fs read blockgroup\n");
> +    printf ("ext2fs read %d group descriptor (blkno %d blkoff %d)\n",
> +        group, blkno, blkoff);
>  #endif
> -	return (ext2fs_devread
> -		(((__le32_to_cpu (data->sblock.first_data_block) +
> -		   1) << LOG2_EXT2_BLOCK_SIZE (data)),
> -		 group * sizeof (struct ext2_block_group),
> -		 sizeof (struct ext2_block_group), (char *) blkgrp));
> +    return (ext2fs_devread
> +        (blkno << LOG2_EXT2_BLOCK_SIZE(data),
> +         blkoff, sizeof(struct ext2_block_group), (char *)blkgrp));
> +
>  }

Please fix indentation eveywhere. See
http://www.denx.de/wiki/U-Boot/CodingStyle for details.

>  #ifdef DEBUG
> -	printf ("ext2fs read inode blkno %d blkoff %d\n", blkno, blkoff);
> +    printf("id: %d, ino: %d, ipg: %d, ipb: %d, ins: %d\n", __le32_to_cpu(blkgrp.inode_table_id), ino, inodes_per_block, __le32_to_cpu(sblock->inodes_per_group), __le16_to_cpu(sblock->inode_size));

Line too long.


Thanks!

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Intel told us the Pentium would have "RISK" features...


More information about the U-Boot mailing list