| #include <linux/uaccess.h> |
| #include <linux/export.h> |
| * Copy kernel to iovec. Returns -EFAULT on error. |
| int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, |
| /* Skip over the finished iovecs */ |
| if (unlikely(offset >= iov->iov_len)) { |
| copy = min_t(unsigned int, iov->iov_len - offset, len); |
| if (copy_to_user(iov->iov_base + offset, kdata, copy)) |
| EXPORT_SYMBOL(memcpy_toiovecend); |
| * Copy iovec to kernel. Returns -EFAULT on error. |
| int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, |
| /* Skip over the finished iovecs */ |
| while (offset >= iov->iov_len) { |
| u8 __user *base = iov->iov_base + offset; |
| int copy = min_t(unsigned int, len, iov->iov_len - offset); |
| if (copy_from_user(kdata, base, copy)) |
| EXPORT_SYMBOL(memcpy_fromiovecend); |