On 06/10/2016 10:05 AM, Kevin Wolf wrote: > We already have a byte-based bdrv_pwritev(), but the read counterpart > was still missing. This commit adds it. > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > block/io.c | 20 +++++++++++++------- > include/block/block.h | 1 + > 2 files changed, 14 insertions(+), 7 deletions(-) >
Worth adding a flags argument while at it? But bdrv_pwritev() lacks one, so for symmetry reasons, I'm okay if you don't bother. > +int bdrv_preadv(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov) > +{ > + int ret; > + > + ret = bdrv_prwv_co(bs, offset, qiov, false, 0); > + if (ret < 0) { > + return ret; > + } > + > + return qiov->size; This implies we never have a short read, it's an all-or-none error or success. Matches what we've done elsewhere, so I guess it's right. Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature