On Fri, Aug 09, 2013 at 07:43:55PM +0200, Charlie Shepherd wrote: > +static int qcow2_open(BlockDriverState *bs, QDict *options, int flags) > +{ > + Coroutine *co; > + struct QOpenCo qo = { > + .bs = bs, > + .options = options, > + .flags = flags, > + .ret = NOT_DONE, > + }; > + > + co = qemu_coroutine_create(qcow2_co_open_entry); > + qemu_coroutine_enter(co, &qo); > + while (qo.ret == NOT_DONE) { > + qemu_aio_wait(); > + }
I think a cleaner approach is a bool qo.done field instead of using a magic NOT_DONE value. This way the return value of qcow2_co_open() can never collide with NOT_DONE. (In block.c we use NOT_DONE but I'd like to start using a separate field to indicate completion in new places.)