* [PATCH v2] fastboot: getvar: fix partition-size return value
@ 2020-08-27 8:51 Gary Bisson
2020-09-01 10:31 ` Sam Protsenko
0 siblings, 1 reply; 3+ messages in thread
From: Gary Bisson @ 2020-08-27 8:51 UTC (permalink / raw)
To: u-boot
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).
[1]
https://android.googlesource.com/platform/system/core/+/refs/heads/android10-release/fastboot/fastboot.cpp#1500
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
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(-)
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index 52da34b1e37..d43f2cfee66 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] fastboot: getvar: fix partition-size return value
2020-08-27 8:51 [PATCH v2] fastboot: getvar: fix partition-size return value Gary Bisson
@ 2020-09-01 10:31 ` Sam Protsenko
2020-09-01 12:51 ` Gary Bisson
0 siblings, 1 reply; 3+ messages in thread
From: Sam Protsenko @ 2020-09-01 10:31 UTC (permalink / raw)
To: u-boot
Hi Gary,
On Thu, 27 Aug 2020 at 11:51, Gary Bisson
<gary.bisson@boundarydevices.com> wrote:
>
> 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).
>
> [1]
> https://android.googlesource.com/platform/system/core/+/refs/heads/android10-release/fastboot/fastboot.cpp#1500
>
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
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:
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
> 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(-)
>
> diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
> index 52da34b1e37..d43f2cfee66 100644
> --- a/drivers/fastboot/fb_getvar.c
> +++ b/drivers/fastboot/fb_getvar.c
> @@ -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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] fastboot: getvar: fix partition-size return value
2020-09-01 10:31 ` Sam Protsenko
@ 2020-09-01 12:51 ` Gary Bisson
0 siblings, 0 replies; 3+ messages in thread
From: Gary Bisson @ 2020-09-01 12:51 UTC (permalink / raw)
To: u-boot
Hi Sam,
On Tue, Sep 01, 2020 at 01:31:46PM +0300, Sam Protsenko wrote:
> Hi Gary,
>
> On Thu, 27 Aug 2020 at 11:51, Gary Bisson
> <gary.bisson@boundarydevices.com> wrote:
> >
> > 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).
> >
> > [1]
> > https://android.googlesource.com/platform/system/core/+/refs/heads/android10-release/fastboot/fastboot.cpp#1500
> >
> > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> > ---
>
> 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.
> Other than that:
>
> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Thanks,
Gary
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-01 12:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-27 8:51 [PATCH v2] fastboot: getvar: fix partition-size return value Gary Bisson
2020-09-01 10:31 ` Sam Protsenko
2020-09-01 12:51 ` Gary Bisson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox