diff options
Diffstat (limited to 'net/core/iovec.c')
| -rw-r--r-- | net/core/iovec.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/net/core/iovec.c b/net/core/iovec.c index b61869429f4c..827dd6beb49c 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c | |||
| @@ -75,61 +75,6 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a | |||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | /* | 77 | /* |
| 78 | * Copy kernel to iovec. Returns -EFAULT on error. | ||
| 79 | */ | ||
| 80 | |||
| 81 | int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, | ||
| 82 | int offset, int len) | ||
| 83 | { | ||
| 84 | int copy; | ||
| 85 | for (; len > 0; ++iov) { | ||
| 86 | /* Skip over the finished iovecs */ | ||
| 87 | if (unlikely(offset >= iov->iov_len)) { | ||
| 88 | offset -= iov->iov_len; | ||
| 89 | continue; | ||
| 90 | } | ||
| 91 | copy = min_t(unsigned int, iov->iov_len - offset, len); | ||
| 92 | if (copy_to_user(iov->iov_base + offset, kdata, copy)) | ||
| 93 | return -EFAULT; | ||
| 94 | offset = 0; | ||
| 95 | kdata += copy; | ||
| 96 | len -= copy; | ||
| 97 | } | ||
| 98 | |||
| 99 | return 0; | ||
| 100 | } | ||
| 101 | EXPORT_SYMBOL(memcpy_toiovecend); | ||
| 102 | |||
| 103 | /* | ||
| 104 | * Copy iovec to kernel. Returns -EFAULT on error. | ||
| 105 | */ | ||
| 106 | |||
| 107 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
| 108 | int offset, int len) | ||
| 109 | { | ||
| 110 | /* Skip over the finished iovecs */ | ||
| 111 | while (offset >= iov->iov_len) { | ||
| 112 | offset -= iov->iov_len; | ||
| 113 | iov++; | ||
| 114 | } | ||
| 115 | |||
| 116 | while (len > 0) { | ||
| 117 | u8 __user *base = iov->iov_base + offset; | ||
| 118 | int copy = min_t(unsigned int, len, iov->iov_len - offset); | ||
| 119 | |||
| 120 | offset = 0; | ||
| 121 | if (copy_from_user(kdata, base, copy)) | ||
| 122 | return -EFAULT; | ||
| 123 | len -= copy; | ||
| 124 | kdata += copy; | ||
| 125 | iov++; | ||
| 126 | } | ||
| 127 | |||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | EXPORT_SYMBOL(memcpy_fromiovecend); | ||
| 131 | |||
| 132 | /* | ||
| 133 | * And now for the all-in-one: copy and checksum from a user iovec | 78 | * And now for the all-in-one: copy and checksum from a user iovec |
| 134 | * directly to a datagram | 79 | * directly to a datagram |
| 135 | * Calls to csum_partial but the last must be in 32 bit chunks | 80 | * Calls to csum_partial but the last must be in 32 bit chunks |
