[Top][All Lists]
[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.
- [Qemu-devel] [RFC V2 01/10] quorum: Create quorum .c, add QuorumSingleAIOCB and QuorumAIOCB., (continued)
- [Qemu-devel] [RFC V2 01/10] quorum: Create quorum .c, add QuorumSingleAIOCB and QuorumAIOCB., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 03/10] quorum: Add quorum_open()., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 04/10] quorum: Add quorum_close()., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 05/10] quorum: Add quorum_getlength()., Benoît Canet, 2012/08/07
- Re: [Qemu-devel] [RFC V2 05/10] quorum: Add quorum_getlength().,
Stefan Hajnoczi <=
- [Qemu-devel] [RFC V2 08/10] quorum: Add quorum_co_flush()., Benoît Canet, 2012/08/07
- [Qemu-devel] [RFC V2 06/10] quorum: Add quorum_aio_writev and its dependencies., Benoît Canet, 2012/08/07
[Qemu-devel] [RFC V2 09/10] quorum: Add quorum_aio_readv., Benoît Canet, 2012/08/07