lkml.org 
[lkml]   [2021]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RFC v2 05/10] vringh: add vringh_kiov_length() helper
From
Date

On 2021/1/28 下午10:41, Stefano Garzarella wrote:
> This new helper returns the total number of bytes covered by
> a vringh_kiov.
>
> Suggested-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
> include/linux/vringh.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/include/linux/vringh.h b/include/linux/vringh.h
> index 755211ebd195..84db7b8f912f 100644
> --- a/include/linux/vringh.h
> +++ b/include/linux/vringh.h
> @@ -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,

\
 
 \ /
  Last update: 2021-02-01 07:48    [W:1.101 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site