mirror of
https://passt.top/passt
synced 2024-12-22 05:35:23 +00:00
iov: remove iov_copy()
it was needed by a draft version of vhost-user, it is not needed anymore. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
0c335d751a
commit
7290335b14
39
iov.c
39
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;
|
||||
}
|
||||
|
3
iov.h
3
iov.h
@ -28,7 +28,4 @@ size_t iov_from_buf(const struct iovec *iov, size_t iov_cnt,
|
||||
size_t iov_to_buf(const struct iovec *iov, size_t iov_cnt,
|
||||
size_t offset, void *buf, size_t bytes);
|
||||
size_t iov_size(const struct iovec *iov, size_t iov_cnt);
|
||||
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);
|
||||
#endif /* IOVEC_H */
|
||||
|
Loading…
Reference in New Issue
Block a user