qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 27/36] sheepdog: QAPIfy "redundancy" create o


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v3 27/36] sheepdog: QAPIfy "redundancy" create option
Date: Mon, 26 Feb 2018 13:28:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 2018-02-23 20:25, Kevin Wolf wrote:
> The "redundancy" 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 <address@hidden>
> Reviewed-by: Max Reitz <address@hidden>
> ---
>  qapi/block-core.json | 45 +++++++++++++++++++++++++
>  block/sheepdog.c     | 94 
> +++++++++++++++++++++++++++++++++++++---------------
>  2 files changed, 112 insertions(+), 27 deletions(-)

[...]

> @@ -1907,35 +1950,32 @@ 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() */
> -    if (copy > SD_MAX_COPIES || copy < 1) {
> -        return -EINVAL;
> -    }
> -    if (!n2) {
> -        inode->copy_policy = 0;
> -        inode->nr_copies = copy;
> -        return 0;
> +    ret = qemu_strtol(n1, NULL, 10, &copy);

(By the way: This was what I was thanking you for in v2 -- I just now
realized I was clever enough not to point to it in my reply...)

> +    if (ret < 0) {
> +        return ret;
>      }

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]