[sheepdog] [PATCH] dog/cluster: code optimize for confirmation of cluster_force_recover

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Apr 21 09:21:37 CEST 2014


On Mon, Apr 21, 2014 at 3:52 PM, Ruoyu <liangry at ucweb.com> wrote:
> reuse confirm() is better, no need to handle it from scratch.
>
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  dog/cluster.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)

Looks good to me.
Reviewed-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>

>
> diff --git a/dog/cluster.c b/dog/cluster.c
> index 482a0a7..4af1e7c 100644
> --- a/dog/cluster.c
> +++ b/dog/cluster.c
> @@ -427,21 +427,10 @@ static int cluster_force_recover(int argc, char **argv)
>         int ret;
>         struct sd_req hdr;
>         struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
> -       char str[123] = {'\0'};
>         struct sd_node nodes[SD_MAX_NODES];
>
> -       if (!cluster_cmd_data.force) {
> -               int i, l;
> -               printf(RECOVER_PRINT);
> -               ret = scanf("%s", str);
> -               if (ret < 0)
> -                       return EXIT_SYSFAIL;
> -               l = strlen(str);
> -               for (i = 0; i < l; i++)
> -                       str[i] = tolower(str[i]);
> -               if (strncmp(str, "yes", 3) != 0)
> -                       return EXIT_SUCCESS;
> -       }
> +       if (!cluster_cmd_data.force)
> +               confirm(RECOVER_PRINT);
>
>         sd_init_req(&hdr, SD_OP_FORCE_RECOVER);
>         hdr.data_length = sizeof(nodes);
> --
> 1.8.3.2
>
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list