Commit 14c9ac05 authored by Stefano Garzarella's avatar Stefano Garzarella Committed by Michael S. Tsirkin

vringh: add vringh_kiov_length() helper

This new helper returns the total number of bytes covered by
a vringh_kiov.
Suggested-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20210315163450.254396-7-sgarzare@redhat.comSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent b8c06ad4
......@@ -199,6 +199,17 @@ static inline void vringh_kiov_cleanup(struct vringh_kiov *kiov)
kiov->iov = NULL;
}
static inline size_t vringh_kiov_length(struct vringh_kiov *kiov)
{
size_t len = 0;
int i;
for (i = kiov->i; i < kiov->used; i++)
len += kiov->iov[i].iov_len;
return len;
}
void vringh_kiov_advance(struct vringh_kiov *kiov, size_t len);
int vringh_getdesc_kern(struct vringh *vrh,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment