[PATCH] cmd: ubi: add a command to swap volumes

Heiko Schocher hs at denx.de
Sun Aug 22 10:24:50 CEST 2021


Hello Ayoub,

Sorry for late reply, but I was not an cc ... so I missed this EMail...

On 09.07.21 17:57, Ayoub Zaki wrote:
> This commit adds the command ubi swap to swap an ubi volumes.
> The format of the command is: ubi swap <volume_a> <volume_b>.
> To enable this command, the option CMD_UBI_SWAPVOL must be selected.
> 
> Signed-off-by: Ayoub Zaki <ayoub.zaki at embexus.com>
> ---
>  cmd/Kconfig |  8 ++++++++
>  cmd/ubi.c   | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 62 insertions(+)

Reviewed-by: Heiko Schocher <hs at denx.de>

Nitpick:

[...]
> diff --git a/cmd/ubi.c b/cmd/ubi.c
> index cb14e3e1e7..1b8197a4e3 100644
> --- a/cmd/ubi.c
> +++ b/cmd/ubi.c
> @@ -289,6 +289,54 @@ static int ubi_rename_vol(char *oldname, char *newname)
>  	return ubi_rename_volumes(ubi, &list);
>  }
>  
> +static int ubi_swap_vol(char *volume_a, char *volume_b)
> +{
> +	struct ubi_volume *vol_a, *vol_b;
> +	struct ubi_rename_entry a, b;
> +	struct ubi_volume_desc desc_a, desc_b;
> +	struct list_head list;
> +
> +	vol_a = ubi_find_volume(volume_a);
> +	if (!vol_a) {
> +		printf("%s: volume %s doesn't exist\n", __func__, volume_a);
> +		return ENODEV;
> +	}
> +
> +	vol_b = ubi_find_volume(volume_b);
> +	if (!vol_b) {
> +		printf("%s: volume %s doesn't exist\n", __func__, volume_a);

s/volume_a/volume_b

please fix and rebse to current mainle, thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list