aboutgitcodebugslistschat
path: root/iov.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2023-08-24 18:44:52 +0200
committerLaurent Vivier <lvivier@redhat.com>2024-03-12 11:54:26 +0100
commit1bf4abe4021192a4bcd5d400b699552f2a6d5777 (patch)
tree6b7c39bd1213fe6e9fe5e06139f25837b2ed7302 /iov.c
parent37f457a76c8f412a0a2ceb79c77b91eea24ef341 (diff)
downloadpasst-1bf4abe4021192a4bcd5d400b699552f2a6d5777.tar
passt-1bf4abe4021192a4bcd5d400b699552f2a6d5777.tar.gz
passt-1bf4abe4021192a4bcd5d400b699552f2a6d5777.tar.bz2
passt-1bf4abe4021192a4bcd5d400b699552f2a6d5777.tar.lz
passt-1bf4abe4021192a4bcd5d400b699552f2a6d5777.tar.xz
passt-1bf4abe4021192a4bcd5d400b699552f2a6d5777.tar.zst
passt-1bf4abe4021192a4bcd5d400b699552f2a6d5777.zip
vhost-user: use guest buffer directly in vu_handle_tx()
Check the buffer address is correctly in the mmap'ed memory. Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Diffstat (limited to 'iov.c')
-rw-r--r--iov.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/iov.c b/iov.c
index 52a7c01..3f9e229 100644
--- a/iov.c
+++ b/iov.c
@@ -156,42 +156,3 @@ size_t iov_size(const struct iovec *iov, size_t iov_cnt)
return len;
}
-
-/**
- * iov_copy - Copy data from one scatter/gather I/O vector (struct iovec) to
- * another.
- *
- * @dst_iov: Pointer to the destination array of struct iovec describing
- * the scatter/gather I/O vector to copy to.
- * @dst_iov_cnt: Number of elements in the destination iov array.
- * @iov: Pointer to the source array of struct iovec describing
- * the scatter/gather I/O vector to copy from.
- * @iov_cnt: Number of elements in the source iov array.
- * @offset: Offset within the source iov from where copying should start.
- * @bytes: Total number of bytes to copy from iov to dst_iov.
- *
- * Returns: The number of elements successfully copied to the destination
- * iov array.
- */
-/* cppcheck-suppress unusedFunction */
-unsigned iov_copy(struct iovec *dst_iov, size_t dst_iov_cnt,
- const struct iovec *iov, size_t iov_cnt,
- size_t offset, size_t bytes)
-{
- unsigned int i, j;
-
- i = iov_skip_bytes(iov, iov_cnt, offset, &offset);
-
- /* copying data */
- for (j = 0; i < iov_cnt && j < dst_iov_cnt && bytes; i++) {
- size_t len = MIN(bytes, iov[i].iov_len - offset);
-
- dst_iov[j].iov_base = (char *)iov[i].iov_base + offset;
- dst_iov[j].iov_len = len;
- j++;
- bytes -= len;
- offset = 0;
- }
-
- return j;
-}