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 *'.
This commit is contained in:
Mike Barcroft 2002-10-11 14:58:34 +00:00
parent 890b32ee41
commit 2b7f24d210
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104908
21 changed files with 54 additions and 39 deletions

View File

@ -123,7 +123,7 @@ vop_readdir(struct vnode *vp, struct uio *uio, struct ucred *cred,
* Parse the stuff just read into the uio. * Parse the stuff just read into the uio.
*/ */
dpStart = (struct dirent *) 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; dpEnd = (struct dirent *) uio->uio_iov->iov_base;
/* /*

View File

@ -209,7 +209,7 @@ mmrw(dev_t dev, struct uio *uio, int flags)
if (error) if (error)
break; break;
iov->iov_base += c; iov->iov_base = (char *)iov->iov_base + c;
iov->iov_len -= c; iov->iov_len -= c;
uio->uio_offset += c; uio->uio_offset += c;
uio->uio_resid -= c; uio->uio_resid -= c;

View File

@ -199,7 +199,7 @@ mmrw(dev_t dev, struct uio *uio, int flags)
if (error) if (error)
break; break;
iov->iov_base += c; iov->iov_base = (char *)iov->iov_base + c;
iov->iov_len -= c; iov->iov_len -= c;
uio->uio_offset += c; uio->uio_offset += c;
uio->uio_resid -= c; uio->uio_resid -= c;

View File

@ -696,7 +696,7 @@ cd9660_readlink(ap)
return (error); return (error);
} }
uio->uio_resid -= symlen; 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; uio->uio_iov->iov_len -= symlen;
return (0); return (0);
} }

View File

@ -602,8 +602,8 @@ devfs_readdir(ap)
MALLOC(cookiebuf, u_long *, ncookies * sizeof(u_long), MALLOC(cookiebuf, u_long *, ncookies * sizeof(u_long),
M_TEMP, M_WAITOK); M_TEMP, M_WAITOK);
cookiep = cookiebuf; cookiep = cookiebuf;
dps = (struct dirent *) dps = (struct dirent *)((char *)uio->uio_iov->iov_base -
(uio->uio_iov->iov_base - (uio->uio_offset - oldoff)); (uio->uio_offset - oldoff));
dpe = (struct dirent *) uio->uio_iov->iov_base; dpe = (struct dirent *) uio->uio_iov->iov_base;
for( dp = dps; for( dp = dps;
dp < dpe; dp < dpe;

View File

@ -199,7 +199,7 @@ mmrw(dev_t dev, struct uio *uio, int flags)
if (error) if (error)
break; break;
iov->iov_base += c; iov->iov_base = (char *)iov->iov_base + c;
iov->iov_len -= c; iov->iov_len -= c;
uio->uio_offset += c; uio->uio_offset += c;
uio->uio_resid -= c; uio->uio_resid -= c;

View File

@ -208,7 +208,7 @@ mmrw(dev_t dev, struct uio *uio, int flags)
if (error) if (error)
break; break;
iov->iov_base += c; iov->iov_base = (char *)iov->iov_base + c;
iov->iov_len -= c; iov->iov_len -= c;
uio->uio_offset += c; uio->uio_offset += c;
uio->uio_resid -= c; uio->uio_resid -= c;

View File

@ -696,7 +696,7 @@ cd9660_readlink(ap)
return (error); return (error);
} }
uio->uio_resid -= symlen; 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; uio->uio_iov->iov_len -= symlen;
return (0); return (0);
} }

View File

@ -116,7 +116,8 @@ physio(dev_t dev, struct uio *uio, int ioflag)
if (iolen == 0 && !(bp->b_ioflags & BIO_ERROR)) if (iolen == 0 && !(bp->b_ioflags & BIO_ERROR))
goto doerror; /* EOF */ goto doerror; /* EOF */
uio->uio_iov[i].iov_len -= iolen; 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_resid -= iolen;
uio->uio_offset += iolen; uio->uio_offset += iolen;
if( bp->b_ioflags & BIO_ERROR) { if( bp->b_ioflags & BIO_ERROR) {

View File

@ -192,7 +192,7 @@ uiomove(cp, n, uio)
case UIO_NOCOPY: case UIO_NOCOPY:
break; break;
} }
iov->iov_base += cnt; iov->iov_base = (char *)iov->iov_base + cnt;
iov->iov_len -= cnt; iov->iov_len -= cnt;
uio->uio_resid -= cnt; uio->uio_resid -= cnt;
uio->uio_offset += cnt; uio->uio_offset += cnt;
@ -346,7 +346,7 @@ uiomoveco(cp, n, uio, obj, disposable)
case UIO_NOCOPY: case UIO_NOCOPY:
break; break;
} }
iov->iov_base += cnt; iov->iov_base = (char *)iov->iov_base + cnt;
iov->iov_len -= cnt; iov->iov_len -= cnt;
uio->uio_resid -= cnt; uio->uio_resid -= cnt;
uio->uio_offset += cnt; uio->uio_offset += cnt;
@ -415,7 +415,7 @@ uioread(n, uio, obj, nread)
if (error) if (error)
break; break;
iov->iov_base += cnt; iov->iov_base = (char *)iov->iov_base + cnt;
iov->iov_len -= cnt; iov->iov_len -= cnt;
uio->uio_resid -= cnt; uio->uio_resid -= cnt;
uio->uio_offset += cnt; uio->uio_offset += cnt;
@ -438,6 +438,7 @@ ureadc(c, uio)
register struct uio *uio; register struct uio *uio;
{ {
register struct iovec *iov; register struct iovec *iov;
register char *iov_base;
again: again:
if (uio->uio_iovcnt == 0 || uio->uio_resid == 0) if (uio->uio_iovcnt == 0 || uio->uio_resid == 0)
@ -456,13 +457,15 @@ ureadc(c, uio)
break; break;
case UIO_SYSSPACE: case UIO_SYSSPACE:
*iov->iov_base = c; iov_base = iov->iov_base;
*iov_base = c;
iov->iov_base = iov_base;
break; break;
case UIO_NOCOPY: case UIO_NOCOPY:
break; break;
} }
iov->iov_base++; iov->iov_base = (char *)iov->iov_base + 1;
iov->iov_len--; iov->iov_len--;
uio->uio_resid--; uio->uio_resid--;
uio->uio_offset++; uio->uio_offset++;

View File

@ -278,7 +278,8 @@ mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size)
return error; return error;
uiop->uio_offset += left; uiop->uio_offset += left;
uiop->uio_resid -= 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; uiop->uio_iov->iov_len -= left;
size -= left; size -= left;
} }
@ -528,7 +529,8 @@ md_get_uio(struct mdchain *mdp, struct uio *uiop, int size)
return error; return error;
uiop->uio_offset += left; uiop->uio_offset += left;
uiop->uio_resid -= 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; uiop->uio_iov->iov_len -= left;
size -= left; size -= left;
} }

View File

@ -691,7 +691,7 @@ pipe_build_write_buffer(wpipe, uio)
*/ */
uio->uio_iov->iov_len -= size; 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) if (uio->uio_iov->iov_len == 0)
uio->uio_iov++; uio->uio_iov++;
uio->uio_resid -= size; uio->uio_resid -= size;

View File

@ -166,7 +166,7 @@ socow_setup(struct mbuf *m0, struct uio *uio)
socow_stats.success++; socow_stats.success++;
iov = uio->uio_iov; iov = uio->uio_iov;
iov->iov_base += PAGE_SIZE; iov->iov_base = (char *)iov->iov_base + PAGE_SIZE;
iov->iov_len -= PAGE_SIZE; iov->iov_len -= PAGE_SIZE;
uio->uio_resid -= PAGE_SIZE; uio->uio_resid -= PAGE_SIZE;
uio->uio_offset += PAGE_SIZE; uio->uio_offset += PAGE_SIZE;

View File

@ -475,7 +475,8 @@ ncp_write(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *c
break; break;
if (error) { if (error) {
backup = len; 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_iov->iov_len += backup;
uiop->uio_offset -= backup; uiop->uio_offset -= backup;
uiop->uio_resid += backup; uiop->uio_resid += backup;

View File

@ -144,7 +144,8 @@ nfsm_mbuftouio(struct mbuf **mrep, struct uio *uiop, int siz, caddr_t *dpos)
uiop->uio_iovcnt--; uiop->uio_iovcnt--;
uiop->uio_iov++; uiop->uio_iov++;
} else { } 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; uiop->uio_iov->iov_len -= uiosiz;
} }
siz -= uiosiz; siz -= uiosiz;

View File

@ -297,7 +297,8 @@ nfsm_uiotombuf(struct uio *uiop, struct mbuf **mq, int siz, caddr_t *bpos)
uiop->uio_offset += xfer; uiop->uio_offset += xfer;
uiop->uio_resid -= 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; uiop->uio_iov->iov_len -= uiosiz;
siz -= uiosiz; siz -= uiosiz;
} }

View File

@ -1135,7 +1135,9 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
break; break;
} else if (rlen < len) { } else if (rlen < len) {
backup = len - rlen; 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_iov->iov_len += backup;
uiop->uio_offset -= backup; uiop->uio_offset -= backup;
uiop->uio_resid += backup; uiop->uio_resid += backup;
@ -2027,7 +2029,8 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
left = DIRBLKSIZ - blksiz; left = DIRBLKSIZ - blksiz;
if ((tlen + DIRHDSIZ) > left) { if ((tlen + DIRHDSIZ) > left) {
dp->d_reclen += 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_iov->iov_len -= left;
uiop->uio_offset += left; uiop->uio_offset += left;
uiop->uio_resid -= left; uiop->uio_resid -= left;
@ -2046,13 +2049,15 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
blksiz = 0; blksiz = 0;
uiop->uio_offset += DIRHDSIZ; uiop->uio_offset += DIRHDSIZ;
uiop->uio_resid -= 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; uiop->uio_iov->iov_len -= DIRHDSIZ;
nfsm_mtouio(uiop, len); nfsm_mtouio(uiop, len);
cp = uiop->uio_iov->iov_base; cp = uiop->uio_iov->iov_base;
tlen -= len; tlen -= len;
*cp = '\0'; /* null terminate */ *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_iov->iov_len -= tlen;
uiop->uio_offset += tlen; uiop->uio_offset += tlen;
uiop->uio_resid -= tlen; uiop->uio_resid -= tlen;
@ -2091,7 +2096,8 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
if (blksiz > 0) { if (blksiz > 0) {
left = DIRBLKSIZ - blksiz; left = DIRBLKSIZ - blksiz;
dp->d_reclen += 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_iov->iov_len -= left;
uiop->uio_offset += left; uiop->uio_offset += left;
uiop->uio_resid -= left; uiop->uio_resid -= left;
@ -2202,7 +2208,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
left = DIRBLKSIZ - blksiz; left = DIRBLKSIZ - blksiz;
if ((tlen + DIRHDSIZ) > left) { if ((tlen + DIRHDSIZ) > left) {
dp->d_reclen += 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_iov->iov_len -= left;
uiop->uio_offset += left; uiop->uio_offset += left;
uiop->uio_resid -= left; uiop->uio_resid -= left;
@ -2221,7 +2228,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
blksiz = 0; blksiz = 0;
uiop->uio_offset += DIRHDSIZ; uiop->uio_offset += DIRHDSIZ;
uiop->uio_resid -= 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; uiop->uio_iov->iov_len -= DIRHDSIZ;
cnp->cn_nameptr = uiop->uio_iov->iov_base; cnp->cn_nameptr = uiop->uio_iov->iov_base;
cnp->cn_namelen = len; 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; cp = uiop->uio_iov->iov_base;
tlen -= len; tlen -= len;
*cp = '\0'; *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_iov->iov_len -= tlen;
uiop->uio_offset += tlen; uiop->uio_offset += tlen;
uiop->uio_resid -= tlen; uiop->uio_resid -= tlen;
@ -2314,7 +2323,8 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
if (blksiz > 0) { if (blksiz > 0) {
left = DIRBLKSIZ - blksiz; left = DIRBLKSIZ - blksiz;
dp->d_reclen += 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_iov->iov_len -= left;
uiop->uio_offset += left; uiop->uio_offset += left;
uiop->uio_resid -= left; uiop->uio_resid -= left;

View File

@ -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 * we only use it in the while() loop, only if
* there are indeed enough data. * there are indeed enough data.
*/ */
idat = iov->iov_base + k; idat = (char *)iov->iov_base + k;
while (iov->iov_len >= k + blks && i > 0) { while (iov->iov_len >= k + blks && i > 0) {
if (crd->crd_flags & CRD_F_ENCRYPT) { if (crd->crd_flags & CRD_F_ENCRYPT) {

View File

@ -37,12 +37,8 @@
#ifndef _SYS_UIO_H_ #ifndef _SYS_UIO_H_
#define _SYS_UIO_H_ #define _SYS_UIO_H_
/*
* XXX
* iov_base should be a void *.
*/
struct iovec { struct iovec {
char *iov_base; /* Base address. */ void *iov_base; /* Base address. */
size_t iov_len; /* Length. */ size_t iov_len; /* Length. */
}; };

View File

@ -1868,7 +1868,7 @@ ufs_readdir(ap)
if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1)
panic("ufs_readdir: unexpected uio from NFS server"); panic("ufs_readdir: unexpected uio from NFS server");
dpStart = (struct dirent *) 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; dpEnd = (struct dirent *) uio->uio_iov->iov_base;
for (dp = dpStart, ncookies = 0; for (dp = dpStart, ncookies = 0;
dp < dpEnd; dp < dpEnd;

View File

@ -114,7 +114,7 @@ ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout)
--iovcnt; --iovcnt;
} }
if (wret) { if (wret) {
iov->iov_base += wret; iov->iov_base = (char *)iov->iov_base + wret;
iov->iov_len -= wret; iov->iov_len -= wret;
} }
continue; continue;