summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2004-02-04 08:14:47 +0000
committersilby <silby@FreeBSD.org>2004-02-04 08:14:47 +0000
commit35af001226a7c26bdef63bfb05ed4596ab82306e (patch)
tree7c4c1e11bc21dffb33f99fcc9520af7824d2d413 /sys
parentdbee7341f26a062b44799fd4001a83ef164a1eb3 (diff)
downloadFreeBSD-src-35af001226a7c26bdef63bfb05ed4596ab82306e.zip
FreeBSD-src-35af001226a7c26bdef63bfb05ed4596ab82306e.tar.gz
Style fixes
Submitted by: bde
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_subr.c58
-rw-r--r--sys/kern/uipc_mbuf.c6
2 files changed, 29 insertions, 35 deletions
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index e2c9efe..1040aba 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -485,39 +485,39 @@ copyinstrfrom(const void * __restrict src, void * __restrict dst, size_t len,
}
int
-iov_to_uio(struct iovec *iovp, u_int iovcnt, struct uio *auio)
+iov_to_uio(struct iovec *iovp, u_int iovcnt, struct uio *uio)
{
- int error = 0, i;
+ struct iovec *iov;
u_int iovlen;
- struct iovec *iov = NULL;
-
- /* note: can't use iovlen until iovcnt is validated */
- iovlen = iovcnt * sizeof (struct iovec);
- if (iovcnt > UIO_MAXIOV) {
- error = EINVAL;
- goto done;
- }
- MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK);
- auio->uio_iov = iov;
- auio->uio_iovcnt = iovcnt;
- auio->uio_segflg = UIO_USERSPACE;
- auio->uio_offset = -1;
- if ((error = copyin(iovp, iov, iovlen)))
- goto done;
- auio->uio_resid = 0;
- for (i = 0; i < iovcnt; i++) {
- if (iov->iov_len > INT_MAX - auio->uio_resid) {
- error = EINVAL;
- goto done;
- }
- auio->uio_resid += iov->iov_len;
- iov++;
- }
+ int error, i;
+
+ /* note: can't use iovlen until iovcnt is validated */
+ iovlen = iovcnt * sizeof (struct iovec);
+ if (iovcnt > UIO_MAXIOV) {
+ error = EINVAL;
+ goto done;
+ }
+ MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK);
+ uio->uio_iov = iov;
+ uio->uio_iovcnt = iovcnt;
+ uio->uio_segflg = UIO_USERSPACE;
+ uio->uio_offset = -1;
+ if ((error = copyin(iovp, iov, iovlen)))
+ goto done;
+ uio->uio_resid = 0;
+ for (i = 0; i < iovcnt; i++) {
+ if (iov->iov_len > INT_MAX - uio->uio_resid) {
+ error = EINVAL;
+ goto done;
+ }
+ uio->uio_resid += iov->iov_len;
+ iov++;
+ }
done:
- if (error && auio->uio_iov) {
- FREE(auio->uio_iov, M_IOV);
- auio->uio_iov = NULL;
+ if (error && uio->uio_iov) {
+ FREE(uio->uio_iov, M_IOV);
+ uio->uio_iov = NULL;
}
return (error);
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 4a53f17..d36f9fb 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1041,22 +1041,17 @@ m_uiotombuf(struct uio *uio, int how, int len)
total = min(uio->uio_resid, len);
else
total = uio->uio_resid;
-
if (total > MHLEN)
m_final = m_getcl(how, MT_DATA, M_PKTHDR);
else
m_final = m_gethdr(how, MT_DATA);
-
if (m_final == NULL)
goto nospace;
-
m_new = m_final;
-
while (progress < total) {
length = total - progress;
if (length > MCLBYTES)
length = MCLBYTES;
-
if (m_new == NULL) {
if (length > MLEN)
m_new = m_getcl(how, MT_DATA, 0);
@@ -1065,7 +1060,6 @@ m_uiotombuf(struct uio *uio, int how, int len)
if (m_new == NULL)
goto nospace;
}
-
error = uiomove(mtod(m_new, void *), length, uio);
if (error)
goto nospace;
OpenPOWER on IntegriCloud