fastboot: getvar: fix partition-size return value
PATCH v2 1/1 fastboot: getvar: fix partition-size return value
The size returned by 'getvar partition-size' should be in bytes, not in blocks as fastboot uses that value to generate empty partition when running format [1].
Note that the function was already returning the proper size in bytes for NAND devices (see struct part_info details).
---
Changelog v1->v2:
- removed change for FASTBOOT_FLASH_NAND as not necessary (and therefore not building)
--- drivers/fastboot/fb_getvar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/fastboot/fb_getvar.c +2 -2
@@ -95,7 +95,7 @@ static const struct {* * @param[in] part_name Info for which partition name to look for * @param[in,out] response Pointer to fastboot response buffer -* @param[out] size If not NULL, will contain partition size (in blocks) +* @param[out] size If not NULL, will contain partition size * @return Partition number or negative value on error */ static int getvar_get_part_info(const char *part_name, char *response,
@@ -109,7 +109,7 @@ static int getvar_get_part_info(const char *part_name, char *response, r =fastboot_mmc_get_part_info (part_name, &dev_desc, &part_info, response);if (r >=0 && size) - *size = part_info.size; + *size = part_info.size * part_info.blksz;# elif CONFIG_IS_ENABLED (FASTBOOT_FLASH_NAND )struct part_info *part_info;
Signature · 1 line
2.28.0
PATCH v2 1/1 fastboot: getvar: fix partition-size return value
Hi Gary,
Quoted 5 lines · Gary Bisson
The size returned by 'getvar partition-size' should be in bytes, not in blocks as fastboot uses that value to generate empty partition when running format [1].
Quoted 8 lines
Note that the function was already returning the proper size in bytes for NAND devices (see struct
part_infodetails).Signed-off-by Gary Bisson <[email protected]>---
Thank you for the patch, all look good! As I understand from the changelog, v2 fixes sunxi build error found by Lukasz? Other than that:
Quoted 32 lines
Changelog
v1->v2:
- removed change forFASTBOOT_FLASH_NANDas not necessary (and therefore not building)--- drivers/fastboot/fb_getvar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/fastboot/fb_getvar.c +2
-3@@ -95,7 +95,7 @@ static const struct {* * @param[in] part_name Info for which partition name to look for * @param[in,out] response Pointer to fastboot response buffer -* @param[out] size If not NULL, will contain partition size (in blocks) +* @param[out] size If not NULL, will contain partition size * @return Partition number or negative value on error */ static int getvar_get_part_info(const char *part_name, char *response,@@ -109,7 +109,7 @@ static int getvar_get_part_info(const char *part_name, char *response, r =fastboot_mmc_get_part_info (part_name, &dev_desc, &part_info, response);if (r >=0 && size) - *size = part_info.size; + *size = part_info.size * part_info.blksz;# elif CONFIG_IS_ENABLED (FASTBOOT_FLASH_NAND )struct part_info *part_info; --2.28.0
PATCH v2 1/1 fastboot: getvar: fix partition-size return value
Hi Sam,
Quoted 12 lines · Sam Protsenko
Hi Gary,
Quoted 8 lines · Gary Bisson
The size returned by 'getvar partition-size' should be in bytes, not in blocks as fastboot uses that value to generate empty partition when running format [1].
Note that the function was already returning the proper size in bytes for NAND devices (see struct
part_infodetails).
Quoted 8 lines
Quoted 5 lines
Signed-off-by Gary Bisson <[email protected]>---
Thank you for the patch, all look good! As I understand from the changelog, v2 fixes sunxi build error found by Lukasz?
Indeed it does. The part_info struct for NAND devices was already returning a size in bytes instead of blocks.
Quoted 3 lines
Other than that:
Reviewed-by Sam Protsenko <[email protected]>
Thanks,
Gary