qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 18/27] sheepdog: QAPIfy "redundacy" create optio


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH 18/27] sheepdog: QAPIfy "redundacy" create option
Date: Mon, 12 Feb 2018 17:03:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

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 <address@hidden>
> ---
>  qapi/block-core.json | 45 ++++++++++++++++++++++++++
>  block/sheepdog.c     | 89 
> ++++++++++++++++++++++++++++++++++++----------------
>  2 files changed, 107 insertions(+), 27 deletions(-)

Reviewed-by: Max Reitz <address@hidden>

> 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

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