[U-Boot] [PATCH v4 2/4] mtdparts: show net size in mtdparts list

Ben Gardiner
2010-08-27T15:44:37Z

On Thu, Aug 26, 2010 at 2:57 PM, Scott Wood <scottwood@freescale.com> wrote:
> On Mon, Aug 09, 2010 at 04:43:58PM -0400, Ben Gardiner wrote:
>> diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
>> index 772ad54..500a38e 100644
>> --- a/common/cmd_mtdparts.c
>> +++ b/common/cmd_mtdparts.c
>> @@ -1215,18 +1215,65 @@ static int generate_mtdparts_save(char *buf, u32 buflen)
>> ? ? ? return ret;
>> ?}
>>
>> +#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES)
>> ?/**
>> - * Format and print out a partition list for each device from global device
>> - * list.
>> + * Get the net size (w/o bad blocks) of the given partition.
>> + *
>> + * @param mtd the mtd info
>> + * @param part the partition
>> + * @return the calculated net size of this partition
>> ? */
>> -static void list_partitions(void)
>> +static u32 net_part_size(struct mtd_info *mtd, struct part_info *part)
>
> Don't assume partition size fits in 32 bits. ?part->size is uint64_t.

I understand that (at some point) we need to support part->size
uint64_t but the HEAD of u-boot [1], u-boot-nand-flash/master [2] and
u-boot-nand-flash/next [3] have u32 for part->size. Changing this to
uint64_t would require reformatting the list_partitions size column as
a 64bit hex number -- as would treating the net_size there as a
uint64_t. This would be a change with impact of greater scope than
intended with this patchset.

I hope it will be acceptable to do the net_part_size return as uin64_t
and continue treating both the part->size and net_size as u32?

Best Regards,
Ben Gardiner

[1] http://git.denx.de/?p=u-boot.git;a=blob;f=include/jffs2/load_kernel.h;h=906eb3d3cdbe9f5b539c6341c873ed87de876be5;hb=HEAD#l49
[2] http://git.denx.de/?p=u-boot/u-boot-nand-flash.git;a=blob;f=include/jffs2/load_kernel.h;h=906eb3d3cdbe9f5b539c6341c873ed87de876be5;hb=refs/heads/master#l49
[3] http://git.denx.de/?p=u-boot/u-boot-nand-flash.git;a=blob;f=include/jffs2/load_kernel.h;h=906eb3d3cdbe9f5b539c6341c873ed87de876be5;hb=refs/heads/next#l49

---
Nanometrics Inc.