git: 524c9accdcc6 - main - linux(4): Replace linux32_copyiniov by freebsd32_copyiniov
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Aug 2023 07:37:55 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=524c9accdcc6dddb0bac23ae6120763af3458464 commit 524c9accdcc6dddb0bac23ae6120763af3458464 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2023-08-20 07:36:32 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-08-20 07:36:32 +0000 linux(4): Replace linux32_copyiniov by freebsd32_copyiniov MFC after: 1 month --- sys/amd64/linux32/linux.h | 10 ---------- sys/amd64/linux32/linux32_machdep.c | 30 ------------------------------ sys/compat/linux/linux_socket.c | 5 +++-- 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 382d010f9ed8..395548b3c93f 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -388,16 +388,6 @@ struct l_user_desc { (((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1) #ifdef _KERNEL -struct iovec; -struct uio; - -struct l_iovec32 { - uint32_t iov_base; - l_size_t iov_len; -}; - -int linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt, - struct iovec **iovp, int error); int linux_copyout_rusage(struct rusage *ru, void *uaddr); #endif /* _KERNEL */ diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index e0364f1e00d1..f6b14d8e4653 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -111,36 +111,6 @@ linux_copyout_rusage(struct rusage *ru, void *uaddr) return (copyout(&lru, uaddr, sizeof(struct l_rusage))); } -CTASSERT(sizeof(struct l_iovec32) == 8); - -int -linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt, struct iovec **iovp, - int error) -{ - struct l_iovec32 iov32; - struct iovec *iov; - uint32_t iovlen; - int i; - - *iovp = NULL; - if (iovcnt > UIO_MAXIOV) - return (error); - iovlen = iovcnt * sizeof(struct iovec); - iov = malloc(iovlen, M_IOV, M_WAITOK); - for (i = 0; i < iovcnt; i++) { - error = copyin(&iovp32[i], &iov32, sizeof(struct l_iovec32)); - if (error) { - free(iov, M_IOV); - return (error); - } - iov[i].iov_base = PTRIN(iov32.iov_base); - iov[i].iov_len = iov32.iov_len; - } - *iovp = iov; - return(0); - -} - int linux_readv(struct thread *td, struct linux_readv_args *uap) { diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 834c2c938925..a5ed5c5c62db 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -57,6 +57,7 @@ #endif #ifdef COMPAT_LINUX32 +#include <compat/freebsd32/freebsd32_util.h> #include <machine/../linux32/linux.h> #include <machine/../linux32/linux32_proto.h> #else @@ -1384,7 +1385,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, return (error); #ifdef COMPAT_LINUX32 - error = linux32_copyiniov(PTRIN(msg.msg_iov), msg.msg_iovlen, + error = freebsd32_copyiniov(PTRIN(msg.msg_iov), msg.msg_iovlen, &iov, EMSGSIZE); #else error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE); @@ -1794,7 +1795,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, return (error); #ifdef COMPAT_LINUX32 - error = linux32_copyiniov(PTRIN(msg->msg_iov), msg->msg_iovlen, + error = freebsd32_copyiniov(PTRIN(msg->msg_iov), msg->msg_iovlen, &iov, EMSGSIZE); #else error = copyiniov(msg->msg_iov, msg->msg_iovlen, &iov, EMSGSIZE);