[U-Boot-Users] [PATCH] add explicit bbt creation to commandline

Jean-Christophe PLAGNIOL-VILLARD
2008-07-06T11:16:20Z

On 16:04 Sun 06 Jul , Harald Welte wrote:
> [PATCH] add explicit bbt creation to commandline ("nand createbbt" command)
>
> This patch adds user-requested BBT creation. It includes the following changes:
>
> - common/cmd_nand.c: move yes/no decision to separate function
> - do_nand: ask for confirmation for "nand erase"
> - do_nand: add command "nand createbbt" to erase NAND and create a new BBT
>
> Signed-off-by: Werner Almesberger <werner@openmoko.org>
> Signed-off-by: Harald Welte <laforge@openmoko.org>
>
> ---
>
> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> index bb46f34..2f41157 100644
> --- a/common/cmd_nand.c
> +++ b/common/cmd_nand.c
> @@ -162,6 +162,17 @@ out:
> return 0;
> }
>
> +static int yes(void)
> +{
> + char c;
> +
> + c = getc();
> + if (c != 'y' && c != 'Y')
> + return 0;
> + c = getc();
> + return c == '\r' || c == '\n';
> +}
> +
It will be good to have it in a re-usable header as inline.

And why not name it as "ask_confirm()"?

Best Regards,
J.