mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 01:34:00 +08:00
vringh: add vringh_kiov_length() helper
This new helper returns the total number of bytes covered by a vringh_kiov. Suggested-by: Jason Wang <jasowang@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://lore.kernel.org/r/20210315163450.254396-7-sgarzare@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
b8c06ad4d6
commit
14c9ac05ce
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user