On 2018-02-08 20:23, Kevin Wolf wrote:
> The "redundacy" option for Sheepdog image creation is currently a string
> that can encode one or two integers depending on its format, which at
> the same time implicitly selects a mode.
> 
> This patch turns it into a QAPI union and converts the string into such
> a QAPI object before interpreting the values.
> 
> Signed-off-by: Kevin Wolf <kw...@redhat.com>
> ---
>  qapi/block-core.json | 45 ++++++++++++++++++++++++++
>  block/sheepdog.c     | 89 
> ++++++++++++++++++++++++++++++++++++----------------
>  2 files changed, 107 insertions(+), 27 deletions(-)

Reviewed-by: Max Reitz <mre...@redhat.com>

> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index f684477328..dc0348f120 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c

[...]

> @@ -1912,35 +1954,28 @@ static int parse_redundancy(BDRVSheepdogState *s, 
> const char *opt)
>          return -EINVAL;
>      }
>  
> -    copy = strtol(n1, NULL, 10);
>      /* FIXME fix error checking by switching to qemu_strtol() */

But this is not the time? ;-)

> -    if (copy > SD_MAX_COPIES || copy < 1) {
> -        return -EINVAL;
> -    }
> -    if (!n2) {
> -        inode->copy_policy = 0;
> -        inode->nr_copies = copy;
> -        return 0;
> -    }
> +    copy = strtol(n1, NULL, 10);
>  

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to