Files
Sasha Levin d8f361774a kvm tools: steal iovec handling routines from the kernel
They're hidden inside net/core/iovec.c. It'd be nice to just link to that
but they're not too generic and come with tons of net/ specific code we
don't want. So we just copy over the relevant parts.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:54 +01:00

22 lines
591 B
C

#ifndef KVM_UTIL_IOVEC_H_
#define KVM_UTIL_IOVEC_H_
extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
size_t offset, int len);
extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
size_t offset, int len);
static inline size_t iov_size(const struct iovec *iovec, size_t len)
{
size_t size = 0, i;
for (i = 0; i < len; i++)
size += iovec[i].iov_len;
return size;
}
#endif