From 8630abe45fe3751d8cc345f537ad98962a59ef5e Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 11 Oct 2002 14:58:34 +0000 Subject: Change iov_base's type from `char *' to the standard `void *'. All uses of iov_base which assume its type is `char *' (in order to do pointer arithmetic) have been updated to cast iov_base to `char *'. --- share/man/man9/VOP_READDIR.9 | 2 +- sys/alpha/alpha/mem.c | 2 +- sys/amd64/amd64/mem.c | 2 +- sys/fs/cd9660/cd9660_vnops.c | 2 +- sys/fs/devfs/devfs_vnops.c | 4 ++-- sys/i386/i386/mem.c | 2 +- sys/ia64/ia64/mem.c | 2 +- sys/isofs/cd9660/cd9660_vnops.c | 2 +- sys/kern/kern_physio.c | 3 ++- sys/kern/kern_subr.c | 13 ++++++++----- sys/kern/subr_mchain.c | 6 ++++-- sys/kern/sys_pipe.c | 2 +- sys/kern/uipc_cow.c | 2 +- sys/netncp/ncp_ncp.c | 3 ++- sys/nfs/nfs_common.c | 3 ++- sys/nfsclient/nfs_subs.c | 3 ++- sys/nfsclient/nfs_vnops.c | 28 +++++++++++++++++++--------- sys/opencrypto/cryptosoft.c | 2 +- sys/sys/uio.h | 6 +----- sys/ufs/ufs/ufs_vnops.c | 2 +- usr.bin/wall/ttymsg.c | 2 +- 21 files changed, 54 insertions(+), 39 deletions(-) diff --git a/share/man/man9/VOP_READDIR.9 b/share/man/man9/VOP_READDIR.9 index fe0a1a6b..a49f34d 100644 --- a/share/man/man9/VOP_READDIR.9 +++ b/share/man/man9/VOP_READDIR.9 @@ -123,7 +123,7 @@ vop_readdir(struct vnode *vp, struct uio *uio, struct ucred *cred, * Parse the stuff just read into the uio. */ dpStart = (struct dirent *) - (uio->uio_iov->iov_base - (uio->uio_offset - off)); + ((char *)uio->uio_iov->iov_base - (uio->uio_offset - off)); dpEnd = (struct dirent *) uio->uio_iov->iov_base; /* diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c index 1dec278..9aab3fc 100644 --- a/sys/alpha/alpha/mem.c +++ b/sys/alpha/alpha/mem.c @@ -209,7 +209,7 @@ kmemphys: if (error) break; - iov->iov_base += c; + iov->iov_base = (char *)iov->iov_base + c; iov->iov_len -= c; uio->uio_offset += c; uio->uio_resid -= c; diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index d784e25..5ec6722 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -199,7 +199,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) if (error) break; - iov->iov_base += c; + iov->iov_base = (char *)iov->iov_base + c; iov->iov_len -= c; uio->uio_offset += c; uio->uio_resid -= c; diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index dfa9486..148d5a7 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -696,7 +696,7 @@ cd9660_readlink(ap) return (error); } uio->uio_resid -= symlen; - uio->uio_iov->iov_base += symlen; + uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + symlen; uio->uio_iov->iov_len -= symlen; return (0); } diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 5f7775c..8377be5 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -602,8 +602,8 @@ devfs_readdir(ap) MALLOC(cookiebuf, u_long *, ncookies * sizeof(u_long), M_TEMP, M_WAITOK); cookiep = cookiebuf; - dps = (struct dirent *) - (uio->uio_iov->iov_base - (uio->uio_offset - oldoff)); + dps = (struct dirent *)((char *)uio->uio_iov->iov_base - + (uio->uio_offset - oldoff)); dpe = (struct dirent *) uio->uio_iov->iov_base; for( dp = dps; dp < dpe; diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index d784e25..5ec6722 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -199,7 +199,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) if (error) break; - iov->iov_base += c; + iov->iov_base = (char *)iov->iov_base + c; iov->iov_len -= c; uio->uio_offset += c; uio->uio_resid -= c; diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c index db98aec..152f9b4 100644 --- a/sys/ia64/ia64/mem.c +++ b/sys/ia64/ia64/mem.c @@ -208,7 +208,7 @@ kmemphys: if (error) break; - iov->iov_base += c; + iov->iov_base = (char *)iov->iov_base + c; iov->iov_len -= c; uio->uio_offset += c; uio->uio_resid -= c; diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index dfa9486..148d5a7 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -696,7 +696,7 @@ cd9660_readlink(ap) return (error); } uio->uio_resid -= symlen; - uio->uio_iov->iov_base += symlen; + uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + symlen; uio->uio_iov->iov_len -= symlen; return (0); } diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c index d312188..3525ca0 100644 --- a/sys/kern/kern_physio.c +++ b/sys/kern/kern_physio.c @@ -116,7 +116,8 @@ physio(dev_t dev, struct uio *uio, int ioflag) if (iolen == 0 && !(bp->b_ioflags & BIO_ERROR)) goto doerror; /* EOF */ uio->uio_iov[i].iov_len -= iolen; - uio->uio_iov[i].iov_base += iolen; + uio->uio_iov[i].iov_base = + (char *)uio->uio_iov[i].iov_base + iolen; uio->uio_resid -= iolen; uio->uio_offset += iolen; if( bp->b_ioflags & BIO_ERROR) { diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index ee38f2d..1a44b85 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -192,7 +192,7 @@ uiomove(cp, n, uio) case UIO_NOCOPY: break; } - iov->iov_base += cnt; + iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; uio->uio_offset += cnt; @@ -346,7 +346,7 @@ uiomoveco(cp, n, uio, obj, disposable) case UIO_NOCOPY: break; } - iov->iov_base += cnt; + iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; uio->uio_offset += cnt; @@ -415,7 +415,7 @@ uioread(n, uio, obj, nread) if (error) break; - iov->iov_base += cnt; + iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; uio->uio_offset += cnt; @@ -438,6 +438,7 @@ ureadc(c, uio) register struct uio *uio; { register struct iovec *iov; + register char *iov_base; again: if (uio->uio_iovcnt == 0 || uio->uio_resid == 0) @@ -456,13 +457,15 @@ again: break; case UIO_SYSSPACE: - *iov->iov_base = c; + iov_base = iov->iov_base; + *iov_base = c; + iov->iov_base = iov_base; break; case UIO_NOCOPY: break; } - iov->iov_base++; + iov->iov_base = (char *)iov->iov_base + 1; iov->iov_len--; uio->uio_resid--; uio->uio_offset++; diff --git a/sys/kern/subr_mchain.c b/sys/kern/subr_mchain.c index 82a5a49..cb15ff7 100644 --- a/sys/kern/subr_mchain.c +++ b/sys/kern/subr_mchain.c @@ -278,7 +278,8 @@ mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size) return error; uiop->uio_offset += left; uiop->uio_resid -= left; - uiop->uio_iov->iov_base += left; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + left; uiop->uio_iov->iov_len -= left; size -= left; } @@ -528,7 +529,8 @@ md_get_uio(struct mdchain *mdp, struct uio *uiop, int size) return error; uiop->uio_offset += left; uiop->uio_resid -= left; - uiop->uio_iov->iov_base += left; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + left; uiop->uio_iov->iov_len -= left; size -= left; } diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 7acaf9d..235f862 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -691,7 +691,7 @@ pipe_build_write_buffer(wpipe, uio) */ uio->uio_iov->iov_len -= size; - uio->uio_iov->iov_base += size; + uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + size; if (uio->uio_iov->iov_len == 0) uio->uio_iov++; uio->uio_resid -= size; diff --git a/sys/kern/uipc_cow.c b/sys/kern/uipc_cow.c index f570677..21701e0 100644 --- a/sys/kern/uipc_cow.c +++ b/sys/kern/uipc_cow.c @@ -166,7 +166,7 @@ socow_setup(struct mbuf *m0, struct uio *uio) socow_stats.success++; iov = uio->uio_iov; - iov->iov_base += PAGE_SIZE; + iov->iov_base = (char *)iov->iov_base + PAGE_SIZE; iov->iov_len -= PAGE_SIZE; uio->uio_resid -= PAGE_SIZE; uio->uio_offset += PAGE_SIZE; diff --git a/sys/netncp/ncp_ncp.c b/sys/netncp/ncp_ncp.c index 8d86c02..613c2d0 100644 --- a/sys/netncp/ncp_ncp.c +++ b/sys/netncp/ncp_ncp.c @@ -475,7 +475,8 @@ ncp_write(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *c break; if (error) { backup = len; - uiop->uio_iov->iov_base -= backup; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base - backup; uiop->uio_iov->iov_len += backup; uiop->uio_offset -= backup; uiop->uio_resid += backup; diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c index f613a08..b99c3b0 100644 --- a/sys/nfs/nfs_common.c +++ b/sys/nfs/nfs_common.c @@ -144,7 +144,8 @@ nfsm_mbuftouio(struct mbuf **mrep, struct uio *uiop, int siz, caddr_t *dpos) uiop->uio_iovcnt--; uiop->uio_iov++; } else { - uiop->uio_iov->iov_base += uiosiz; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + uiosiz; uiop->uio_iov->iov_len -= uiosiz; } siz -= uiosiz; diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index c88f51e..2318a04 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -297,7 +297,8 @@ nfsm_uiotombuf(struct uio *uiop, struct mbuf **mq, int siz, caddr_t *bpos) uiop->uio_offset += xfer; uiop->uio_resid -= xfer; } - uiop->uio_iov->iov_base += uiosiz; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + uiosiz; uiop->uio_iov->iov_len -= uiosiz; siz -= uiosiz; } diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index dff0baa..7d739d3 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -1135,7 +1135,9 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, break; } else if (rlen < len) { backup = len - rlen; - uiop->uio_iov->iov_base -= backup; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base - + backup; uiop->uio_iov->iov_len += backup; uiop->uio_offset -= backup; uiop->uio_resid += backup; @@ -2027,7 +2029,8 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) left = DIRBLKSIZ - blksiz; if ((tlen + DIRHDSIZ) > left) { dp->d_reclen += left; - uiop->uio_iov->iov_base += left; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + left; uiop->uio_iov->iov_len -= left; uiop->uio_offset += left; uiop->uio_resid -= left; @@ -2046,13 +2049,15 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) blksiz = 0; uiop->uio_offset += DIRHDSIZ; uiop->uio_resid -= DIRHDSIZ; - uiop->uio_iov->iov_base += DIRHDSIZ; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + DIRHDSIZ; uiop->uio_iov->iov_len -= DIRHDSIZ; nfsm_mtouio(uiop, len); cp = uiop->uio_iov->iov_base; tlen -= len; *cp = '\0'; /* null terminate */ - uiop->uio_iov->iov_base += tlen; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + tlen; uiop->uio_iov->iov_len -= tlen; uiop->uio_offset += tlen; uiop->uio_resid -= tlen; @@ -2091,7 +2096,8 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) if (blksiz > 0) { left = DIRBLKSIZ - blksiz; dp->d_reclen += left; - uiop->uio_iov->iov_base += left; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + left; uiop->uio_iov->iov_len -= left; uiop->uio_offset += left; uiop->uio_resid -= left; @@ -2202,7 +2208,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) left = DIRBLKSIZ - blksiz; if ((tlen + DIRHDSIZ) > left) { dp->d_reclen += left; - uiop->uio_iov->iov_base += left; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + left; uiop->uio_iov->iov_len -= left; uiop->uio_offset += left; uiop->uio_resid -= left; @@ -2221,7 +2228,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) blksiz = 0; uiop->uio_offset += DIRHDSIZ; uiop->uio_resid -= DIRHDSIZ; - uiop->uio_iov->iov_base += DIRHDSIZ; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + DIRHDSIZ; uiop->uio_iov->iov_len -= DIRHDSIZ; cnp->cn_nameptr = uiop->uio_iov->iov_base; cnp->cn_namelen = len; @@ -2229,7 +2237,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) cp = uiop->uio_iov->iov_base; tlen -= len; *cp = '\0'; - uiop->uio_iov->iov_base += tlen; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + tlen; uiop->uio_iov->iov_len -= tlen; uiop->uio_offset += tlen; uiop->uio_resid -= tlen; @@ -2314,7 +2323,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) if (blksiz > 0) { left = DIRBLKSIZ - blksiz; dp->d_reclen += left; - uiop->uio_iov->iov_base += left; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + left; uiop->uio_iov->iov_len -= left; uiop->uio_offset += left; uiop->uio_resid -= left; diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index b6ead2a..09c429b 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -388,7 +388,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf, * we only use it in the while() loop, only if * there are indeed enough data. */ - idat = iov->iov_base + k; + idat = (char *)iov->iov_base + k; while (iov->iov_len >= k + blks && i > 0) { if (crd->crd_flags & CRD_F_ENCRYPT) { diff --git a/sys/sys/uio.h b/sys/sys/uio.h index a6c6a9d..5de0cd1 100644 --- a/sys/sys/uio.h +++ b/sys/sys/uio.h @@ -37,12 +37,8 @@ #ifndef _SYS_UIO_H_ #define _SYS_UIO_H_ -/* - * XXX - * iov_base should be a void *. - */ struct iovec { - char *iov_base; /* Base address. */ + void *iov_base; /* Base address. */ size_t iov_len; /* Length. */ }; diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 1761b70..70d3b1a 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1868,7 +1868,7 @@ ufs_readdir(ap) if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) panic("ufs_readdir: unexpected uio from NFS server"); dpStart = (struct dirent *) - (uio->uio_iov->iov_base - (uio->uio_offset - off)); + ((char *)uio->uio_iov->iov_base - (uio->uio_offset - off)); dpEnd = (struct dirent *) uio->uio_iov->iov_base; for (dp = dpStart, ncookies = 0; dp < dpEnd; diff --git a/usr.bin/wall/ttymsg.c b/usr.bin/wall/ttymsg.c index 01db118..131cf2c 100644 --- a/usr.bin/wall/ttymsg.c +++ b/usr.bin/wall/ttymsg.c @@ -114,7 +114,7 @@ ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout) --iovcnt; } if (wret) { - iov->iov_base += wret; + iov->iov_base = (char *)iov->iov_base + wret; iov->iov_len -= wret; } continue; -- cgit v1.1