]> git.proxmox.com Git - mirror_qemu.git/commit - util/iov.c
util/iov: Make qiov_slice() public
authorHanna Czenczek <hreitz@redhat.com>
Tue, 11 Apr 2023 17:34:15 +0000 (19:34 +0200)
committerHanna Czenczek <hreitz@redhat.com>
Mon, 5 Jun 2023 11:11:02 +0000 (13:11 +0200)
commit3d06cea8256d54a6b0238934c31012f7f17100f5
tree960690d14da50c72b6c09b8320e324a99a353d76
parent848a6caa88b9f082c89c9b41afa975761262981d
util/iov: Make qiov_slice() public

We want to inline qemu_iovec_init_extended() in block/io.c for padding
requests, and having access to qiov_slice() is useful for this.  As a
public function, it is renamed to qemu_iovec_slice().

(We will need to count the number of I/O vector elements of a slice
there, and then later process this slice.  Without qiov_slice(), we
would need to call qemu_iovec_subvec_niov(), and all further
IOV-processing functions may need to skip prefixing elements to
accomodate for a qiov_offset.  Because qemu_iovec_subvec_niov()
internally calls qiov_slice(), we can just have the block/io.c code call
qiov_slice() itself, thus get the number of elements, and also create an
iovec array with the superfluous prefixing elements stripped, so the
following processing functions no longer need to skip them.)

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-Id: <20230411173418.19549-2-hreitz@redhat.com>
include/qemu/iov.h
util/iov.c