iovec: move memcpy_from/toiovecend to lib/iovec.c
Subsystems (5)
PATCH 1/1 iovec: move memcpy_from/toiovecend to lib/iovec.c
ERROR: "memcpy_fromiovecend" [drivers/vhost/vhost_scsi.ko] undefined!
commit 9f977ef7b671f6169eca78bf40f230fe84b7c7e5
vhost-scsi: Include prot_bytes into expected data transfer length
in target-pending makes drivers/vhost/scsi.c call memcpy_fromiovecend(). This function is not available when CONFIG_NET is not enabled.
socket.h already includes uio.h, so no callers need updating.
---
David, could you please ack merging this through
target-pending to avoid dependency issues?
Thanks!
include/linux/socket.h | 4 ---- include/linux/uio.h | 4 ++++ lib/iovec.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ net/core/iovec.c | 55 -------------------------------------------------- 4 files changed, 59 insertions(+), 59 deletions(-)
include/linux/socket.h +0 -4
@@ -305,8 +305,6 @@ struct ucred {/* IPX options */ #define IPX_TYPE 1 -extern int memcpy_fromiovecend (unsigned char *kdata,const struct iovec *iov, -int offset,int len); extern int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset,
@@ -315,8 +313,6 @@ extern unsigned long iov_pages(const struct iovec *iov, int offset, unsigned long nr_segs);extern int verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr_storage *address,int mode); -extern int memcpy_toiovecend (const struct iovec *v,unsigned char *kdata, -int offset,int len);extern int move_addr_to_kernel (void __user *uaddr,int ulen,struct sockaddr_storage *kaddr);extern int put_cmsg (struct msghdr *,int level,int type,int len,void *data);
include/linux/uio.h +4 -0
@@ -89,5 +89,9 @@ static inline size_t iov_iter_count(struct iov_iter *i)int memcpy_fromiovec (unsigned char *kdata,struct iovec *iov,int len);int memcpy_toiovec (struct iovec *iov,unsigned char *kdata,int len); +int memcpy_fromiovecend (unsigned char *kdata,const struct iovec *iov, +int offset,int len); +int memcpy_toiovecend (const struct iovec *v,unsigned char *kdata, +int offset,int len);#endif
lib/iovec.c +55 -0
58 lines not on this page · raw message
net/core/iovec.c +0 -55
61 lines not on this page · raw message
Signature · 1 line
MST
Quoted 7 lines · Michael S. Tsirkin
ERROR: "
memcpy_fromiovecend" [drivers/vhost/vhost_scsi.ko] undefined!commit
9f977ef7b671f6169eca78bf40f230fe84b7c7e5
vhost-scsi: Includeprot_bytesinto expected data transfer length
in target-pending makesdrivers/vhost/scsi.ccallmemcpy_fromiovecend(). This function is not available whenCONFIG_NETis not enabled.
Quoted 6 lines
socket.halready includesuio.h, so no callers need updating.Reported-by Randy Dunlap <[email protected]>Cc Stephen Rothwell <[email protected]>Cc "David S. Miller" <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
Thanks.
Quoted 179 lines
---
David, could you please ack merging this through
target-pending to avoid dependency issues?Thanks!
include/linux/socket.h | 4 ---- include/linux/uio.h | 4 ++++ lib/iovec.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ net/core/iovec.c | 55 -------------------------------------------------- 4 files changed, 59 insertions(+), 59 deletions(-)include/linux/socket.h +0
-4@@ -305,8 +305,6 @@ struct ucred {/* IPX options */ #define IPX_TYPE 1 -extern int memcpy_fromiovecend (unsigned char *kdata,const struct iovec *iov, -int offset,int len); extern int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset,@@ -315,8 +313,6 @@ extern unsigned long iov_pages(const struct iovec *iov, int offset, unsigned long nr_segs);extern int verify_iovec (struct msghdr *m,struct iovec *iov,struct sockaddr_storage *address,int mode); -extern int memcpy_toiovecend (const struct iovec *v,unsigned char *kdata, -int offset,int len);extern int move_addr_to_kernel (void __user *uaddr,int ulen,struct sockaddr_storage *kaddr);extern int put_cmsg (struct msghdr *,int level,int type,int len,void *data);include/linux/uio.h +4
-0@@ -89,5 +89,9 @@ static inline size_t iov_iter_count(struct iov_iter *i)int memcpy_fromiovec (unsigned char *kdata,struct iovec *iov,int len);int memcpy_toiovec (struct iovec *iov,unsigned char *kdata,int len); +int memcpy_fromiovecend (unsigned char *kdata,const struct iovec *iov, +int offset,int len); +int memcpy_toiovecend (const struct iovec *v,unsigned char *kdata, +int offset,int len);#endif lib/iovec.c +55
-0@@ -51,3 +51,58 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)return 0 ; }EXPORT_SYMBOL (memcpy_toiovec); + +/* +* Copy kernel to iovec. Returns -EFAULT on error. +*/ + +int memcpy_toiovecend (const struct iovec *iov,unsigned char *kdata, +int offset,int len) +{ +int copy; +for (; len >0 ; ++iov) { +/* Skip over the finished iovecs */ +if (unlikely (offset >= iov->iov_len)) { + offset -= iov->iov_len; +continue ; + } + copy = min_t(unsigned int, iov->iov_len - offset, len); +if (copy_to_user (iov->iov_base + offset, kdata, copy)) +return -EFAULT ; + offset =0 ; + kdata += copy; + len -= copy; + } + +return 0 ; +} +EXPORT_SYMBOL (memcpy_toiovecend); + +/* +* Copy iovec to kernel. Returns -EFAULT on error. +*/ + +int memcpy_fromiovecend (unsigned char *kdata,const struct iovec *iov, +int offset,int len) +{ +/* Skip over the finished iovecs */ +while (offset >= iov->iov_len) { + offset -= iov->iov_len; + iov++; + } + +while (len >0 ) { +u8 __user *base = iov->iov_base + offset; + int copy = min_t(unsigned int, len, iov->iov_len - offset); + + offset =0 ; +if (copy_from_user (kdata, base, copy)) +return -EFAULT ; + len -= copy; + kdata += copy; + iov++; + } + +return 0 ; +} +EXPORT_SYMBOL (memcpy_fromiovecend);net/core/iovec.c +0
-55@@ -75,61 +75,6 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a }/* -* Copy kernel to iovec. Returns -EFAULT on error. -*/ - -int memcpy_toiovecend (const struct iovec *iov,unsigned char *kdata, -int offset,int len) -{ -int copy; -for (; len >0 ; ++iov) { -/* Skip over the finished iovecs */ -if (unlikely (offset >= iov->iov_len)) { - offset -= iov->iov_len; -continue ; - } - copy = min_t(unsigned int, iov->iov_len - offset, len); -if (copy_to_user (iov->iov_base + offset, kdata, copy)) -return -EFAULT ; - offset =0 ; - kdata += copy; - len -= copy; - } - -return 0 ; -} -EXPORT_SYMBOL (memcpy_toiovecend); - -/* -* Copy iovec to kernel. Returns -EFAULT on error. -*/ - -int memcpy_fromiovecend (unsigned char *kdata,const struct iovec *iov, -int offset,int len) -{ -/* Skip over the finished iovecs */ -while (offset >= iov->iov_len) { - offset -= iov->iov_len; - iov++; - } - -while (len >0 ) { -u8 __user *base = iov->iov_base + offset; - int copy = min_t(unsigned int, len, iov->iov_len - offset); - - offset =0 ; -if (copy_from_user (kdata, base, copy)) -return -EFAULT ; - len -= copy; - kdata += copy; - iov++; - } - -return 0 ; -} -EXPORT_SYMBOL (memcpy_fromiovecend); - -/* * And now for the all-in-one: copy and checksum from a user iovec * directly to a datagram * Calls to csum_partial but the last must be in 32 bit chunks
Signature · 1 line
~Randy
David Miller
maintainerFrom: "Michael S. Tsirkin" <[email protected]>
Date: Thu, 19 Jun 2014 21:22:56 +0300
Quoted 9 lines
ERROR: "
memcpy_fromiovecend" [drivers/vhost/vhost_scsi.ko] undefined!commit
9f977ef7b671f6169eca78bf40f230fe84b7c7e5
vhost-scsi: Includeprot_bytesinto expected data transfer length
in target-pending makesdrivers/vhost/scsi.ccallmemcpy_fromiovecend(). This function is not available whenCONFIG_NETis not enabled.
socket.halready includesuio.h, so no callers need updating.
Quoted 8 lines
Reported-by Randy Dunlap <[email protected]>Cc Stephen Rothwell <[email protected]>Cc "David S. Miller" <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>---
David, could you please ack merging this through
target-pending to avoid dependency issues?
Yep, this looks fine:
Nicholas A. Bellinger
AppliedQuoted 18 lines · David Miller
From: "Michael S. Tsirkin" <[email protected]>
Date: Thu, 19 Jun 2014 21:22:56 +0300Quoted 15 lines
ERROR: "
memcpy_fromiovecend" [drivers/vhost/vhost_scsi.ko] undefined!commit
9f977ef7b671f6169eca78bf40f230fe84b7c7e5
vhost-scsi: Includeprot_bytesinto expected data transfer length
in target-pending makesdrivers/vhost/scsi.ccallmemcpy_fromiovecend(). This function is not available whenCONFIG_NETis not enabled.
socket.halready includesuio.h, so no callers need updating.Reported-by Randy Dunlap <[email protected]>Cc Stephen Rothwell <[email protected]>Cc "David S. Miller" <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>---
Quoted 6 lines
Quoted 2 lines
David, could you please ack merging this through
target-pending to avoid dependency issues?Yep, this looks fine:
Signed-off-by David S. Miller <[email protected]>
Applied to target-pending/queue, and will include in the next PULL request.
Thanks folks.
--nab