> > +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