From 64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 28 Feb 2024 12:52:01 +1100 Subject: iov: Add helper to find skip over first n bytes of an io vector Several of the IOV functions in iov.c, and also tap_send_frames_passt() needs to determine which buffer element a byte offset into an IO vector lies in. Split this out into a helper function iov_skip_bytes(). Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- iov.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'iov.h') diff --git a/iov.h b/iov.h index ee35a75..e1becde 100644 --- a/iov.h +++ b/iov.h @@ -18,6 +18,8 @@ #include #include +size_t iov_skip_bytes(const struct iovec *iov, size_t n, + size_t vec_offset, size_t *buf_offset); size_t iov_from_buf(const struct iovec *iov, size_t iov_cnt, size_t offset, const void *buf, size_t bytes); size_t iov_to_buf(const struct iovec *iov, size_t iov_cnt, -- cgit v1.2.3