[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: |
Benoît Canet |
Subject: |
Re: [Qemu-devel] [RFC V2 05/10] quorum: Add quorum_getlength(). |
Date: |
Thu, 9 Aug 2012 11:07:00 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
> > +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?
I put the -ENOMEDIUM test because of the following piece of code.
/**
* Length of a file in bytes. Return < 0 if error or unknown.
*/
int64_t bdrv_getlength(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
if (!drv)
return -ENOMEDIUM;
Still I am not sure it's needed. What is your stance on this ?
>
> IMO a for loop with a body or a do while loop would make this easier to read.
>
Ok
[Qemu-devel] [RFC V2 09/10] quorum: Add quorum_aio_readv., Benoît Canet, 2012/08/07
[Qemu-devel] [RFC V2 07/10] blkverify: Make blkverify_iovec_clone() and blkverify_iovec_compare() public, Benoît Canet, 2012/08/07