On Fri, Nov 07, 2014 at 08:39:23PM +0100, Kevin Wolf wrote: > diff --git a/block/raw_bsd.c b/block/raw_bsd.c > index 401b967..462498e 100644 > --- a/block/raw_bsd.c > +++ b/block/raw_bsd.c > @@ -58,8 +58,52 @@ static int coroutine_fn raw_co_readv(BlockDriverState *bs, > int64_t sector_num, > static int coroutine_fn raw_co_writev(BlockDriverState *bs, int64_t > sector_num, > int nb_sectors, QEMUIOVector *qiov) > { > + void *buf = NULL; > + BlockDriver *drv; > + QEMUIOVector local_qiov; > + int ret; > + > + if (bs->probed && sector_num == 0) { > + /* As long as these conditions are true, we can't get partial writes > to > + * the probe buffer and can just directly check the request. */ > + QEMU_BUILD_BUG_ON(BLOCK_PROBE_BUF_SIZE != 512); > + QEMU_BUILD_BUG_ON(BDRV_SECTOR_SIZE != 512); > + > + buf = qemu_try_blockalign(bs->file, 512); > + if (!buf) { > + ret = -ENOMEM; > + goto fail; > + } > + > + ret = qemu_iovec_to_buf(qiov, 0, buf, 512); > + if (ret != 512) { > + ret = -EINVAL; > + goto fail; > + }
Does this change the return value when nb_sectors == 0? I couldn't find anything that prevents the nb_sectors edge case and I guess we'd return 0 when nb_sectors == 0 && sector_num != 0.
pgpMgjW63D21A.pgp
Description: PGP signature