aboutgitcodebugslistschat
path: root/iov.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-02-28 12:52:01 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-02-29 06:24:07 +0100
commit64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f (patch)
treebbc7d06c7ccf693f1f563001a779002d4acbabb8 /iov.h
parent2a6f8bcca77ae7391a8943a3791be2fbb98a918b (diff)
downloadpasst-64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f.tar
passt-64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f.tar.gz
passt-64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f.tar.bz2
passt-64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f.tar.lz
passt-64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f.tar.xz
passt-64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f.tar.zst
passt-64b63d9e3e1dc2e4c1f32432cf8954f6cc3f788f.zip
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 <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'iov.h')
-rw-r--r--iov.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/iov.h b/iov.h
index ee35a75..e1becde 100644
--- a/iov.h
+++ b/iov.h
@@ -18,6 +18,8 @@
#include <unistd.h>
#include <string.h>
+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,