qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC V2 05/10] quorum: Add quorum_getlength().


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC V2 05/10] quorum: Add quorum_getlength().
Date: Wed, 8 Aug 2012 16:30:22 +0100

On Tue, Aug 7, 2012 at 2:44 PM, Benoît Canet <address@hidden> wrote:
> Signed-off-by: Benoit Canet <address@hidden>
> ---
>  block/quorum.c |   17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/block/quorum.c b/block/quorum.c
> index 9da0432..5cd7083 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -118,12 +118,29 @@ static void quorum_close(BlockDriverState *bs)
>      }
>  }
>
> +static int64_t quorum_getlength(BlockDriverState *bs)
> +{
> +    BDRVQuorumState *s = bs->opaque;
> +    int i;
> +    int64_t ret;
> +
> +    /* return the length of the first available quorum file */
> +    for (i = 0, ret = bdrv_getlength(s->bs[i]);
> +         ret == -ENOMEDIUM && i <= 2;
> +         i++, ret = bdrv_getlength(s->bs[i])) {
> +    }

Why is -ENOMEDIUM an expected error value?

IMO a for loop with a body or a do while loop would make this easier to read.



reply via email to

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