On 2/7/19 4:24 AM, Vladimir Sementsov-Ogievskiy wrote: > Add a possibility of embedded iovec, for cases when we need only one > local iov. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > --- > include/qemu/iov.h | 64 ++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 62 insertions(+), 2 deletions(-) >
> +/*
> + * qemu_iovec_init_buf
> + *
> + * Initialize embedded QEMUIOVector.
> + *
> + * Note: "const" is used over @buf pointer to make it simple to pass
> + * const pointers, appearing in read functions. Then this "const" is
> + * casted away by QEMU_IOVEC_INIT_BUF().
s/casted/cast/ (one of those funny irregular English verbs)
> + */
> +static inline void qemu_iovec_init_buf(QEMUIOVector *qiov,
> + const void *buf, size_t len)
> +{
> + *qiov = (QEMUIOVector) QEMU_IOVEC_INIT_BUF(*qiov, buf, len);
> +}
> +
> +static inline void *qemu_iovec_get_buf(QEMUIOVector *qiov)
> +{
> + /* Only supports embedded iov */
> + assert(qiov->niov == -1 && qiov->iov == &(qiov->local_iov));
The inner () aren't needed here.
> +
> + return qiov->local_iov.iov_base;
> +}
> +
Both minor, so:
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
