On 2/7/19 4:24 AM, Vladimir Sementsov-Ogievskiy wrote: > Use new qemu_iovec_init_buf() instead of > qemu_iovec_init_external( ... , 1), which simplifies the code. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > --- > block/qed-table.c | 16 +++------------- > block/qed.c | 31 +++++++++---------------------- > 2 files changed, 12 insertions(+), 35 deletions(-) >
> @@ -921,11 +915,7 @@ static int coroutine_fn
> qed_copy_from_backing_file(BDRVQEDState *s,
> return 0;
> }
>
> - iov = (struct iovec) {
> - .iov_base = qemu_blockalign(s->bs, len),
> - .iov_len = len,
> - };
> - qemu_iovec_init_external(&qiov, &iov, 1);
> + qemu_iovec_init_buf(&qiov, qemu_blockalign(s->bs, len), len);
>
> ret = qed_read_backing_file(s, pos, &qiov, &backing_qiov);
>
> @@ -946,7 +936,7 @@ static int coroutine_fn
> qed_copy_from_backing_file(BDRVQEDState *s,
> }
> ret = 0;
> out:
> - qemu_vfree(iov.iov_base);
> + qemu_vfree(qemu_iovec_get_buf(&qiov));
Matching my comments on 7/17, a separate variable to hold the allocated
buffer may mean that you don't need qemu_iovec_get_buf().
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
