From 0017e6e02da60108ffcc66f5e09fb85687f3346a Mon Sep 17 00:00:00 2001 From: tedu Date: Thu, 18 Dec 2014 20:59:21 +0000 Subject: [PATCH] delete a whole mess of unnecessary caddr_t casts --- sys/nfs/krpc_subr.c | 4 ++-- sys/nfs/nfs_bio.c | 4 ++-- sys/nfs/nfs_subs.c | 6 +++--- sys/nfs/nfs_vfsops.c | 15 +++++++-------- sys/nfs/nfs_vnops.c | 18 +++++++++--------- sys/nfs/nfsm_subs.h | 6 +++--- 6 files changed, 26 insertions(+), 27 deletions(-) diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c index 13ea9f371c4..7227754e969 100644 --- a/sys/nfs/krpc_subr.c +++ b/sys/nfs/krpc_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: krpc_subr.c,v 1.24 2014/11/18 02:37:31 tedu Exp $ */ +/* $OpenBSD: krpc_subr.c,v 1.25 2014/12/18 20:59:21 tedu Exp $ */ /* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */ /* @@ -295,7 +295,7 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, */ nam = m_get(M_WAIT, MT_SONAME); sin = mtod(nam, struct sockaddr_in *); - bcopy((caddr_t)sa, (caddr_t)sin, (nam->m_len = sa->sin_len)); + bcopy(sa, sin, (nam->m_len = sa->sin_len)); /* * Prepend RPC message header. diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 9e7791b1b84..0b17b91972d 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_bio.c,v 1.77 2014/11/14 23:01:44 tedu Exp $ */ +/* $OpenBSD: nfs_bio.c,v 1.78 2014/12/18 20:59:21 tedu Exp $ */ /* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */ /* @@ -132,7 +132,7 @@ nfs_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) if ((vp->v_flag & VROOT) && vp->v_type == VLNK) { return (nfs_readlinkrpc(vp, uio, cred)); } - baddr = (caddr_t)0; + baddr = NULL; switch (vp->v_type) { case VREG: nfsstats.biocache_reads++; diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index 58aabeebb75..581facd066f 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.119 2014/11/18 02:37:31 tedu Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.120 2014/12/18 20:59:21 tedu Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -1093,7 +1093,7 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp, } np->n_attrstamp = time_second; if (vaper != NULL) { - bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); + bcopy(vap, vaper, sizeof(*vap)); if (np->n_flag & NCHG) { if (np->n_flag & NACC) vaper->va_atime = np->n_atim; @@ -1160,7 +1160,7 @@ nfs_getattrcache(struct vnode *vp, struct vattr *vaper) } else np->n_size = vap->va_size; } - bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(struct vattr)); + bcopy(vap, vaper, sizeof(struct vattr)); if (np->n_flag & NCHG) { if (np->n_flag & NACC) vaper->va_atime = np->n_atim; diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 20923b76126..2bad0a91bdd 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.104 2014/12/16 18:30:04 tedu Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.105 2014/12/18 20:59:21 tedu Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -375,7 +375,7 @@ nfs_mount_diskless(struct nfs_dlmount *ndmntp, char *mntname, int mntflag) /* Get mbuf for server sockaddr. */ m = m_get(M_WAIT, MT_SONAME); - bcopy((caddr_t)ndmntp->ndm_args.addr, mtod(m, caddr_t), + bcopy(ndmntp->ndm_args.addr, mtod(m, caddr_t), (m->m_len = ndmntp->ndm_args.addr->sa_len)); error = mountnfs(&ndmntp->ndm_args, mp, m, mntname, @@ -512,7 +512,7 @@ nfs_decode_args(struct nfsmount *nmp, struct nfs_args *argp, if (nmp->nm_sotype == SOCK_DGRAM) while (nfs_connect(nmp, NULL)) { printf("nfs_args: retrying connect\n"); - (void) tsleep((caddr_t)&lbolt, + (void) tsleep(&lbolt, PSOCK, "nfscon", 0); } } @@ -556,11 +556,10 @@ nfs_mount(struct mount *mp, const char *path, void *data, if (error) return (error); if (args.version == 3) { - error = copyin (data, (caddr_t)&args, - sizeof (struct nfs_args3)); + error = copyin(data, &args, sizeof(struct nfs_args3)); args.flags &= ~(NFSMNT_INTERNAL|NFSMNT_NOAC); } else if (args.version == NFS_ARGSVERSION) { - error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args)); + error = copyin(data, &args, sizeof(struct nfs_args)); args.flags &= ~NFSMNT_NOAC; /* XXX - compatibility */ } else return (EPROGMISMATCH); @@ -591,7 +590,7 @@ nfs_mount(struct mount *mp, const char *path, void *data, } if (args.fhsize < 0 || args.fhsize > NFSX_V3FHMAX) return (EINVAL); - error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize); + error = copyin(args.fh, nfh, args.fhsize); if (error) return (error); error = copyinstr(args.hostname, hst, MNAMELEN-1, &len); @@ -642,7 +641,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct mbuf *nam, nmp->nm_acregmax = NFS_MAXATTRTIMO; nmp->nm_acdirmin = NFS_MINATTRTIMO; nmp->nm_acdirmax = NFS_MAXATTRTIMO; - bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize); + bcopy(argp->fh, nmp->nm_fh, argp->fhsize); strncpy(&mp->mnt_stat.f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); bcopy(pth, mp->mnt_stat.f_mntonname, MNAMELEN); bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN); diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index ce5349dcbae..56ab3427fcb 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.158 2014/12/16 18:30:04 tedu Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.159 2014/12/18 20:59:21 tedu Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -1174,13 +1174,13 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, int *iomode, int *must_commit) commit == NFSV3WRITE_UNSTABLE) committed = commit; if ((nmp->nm_flag & NFSMNT_HASWRITEVERF) == 0) { - bcopy((caddr_t)tl, (caddr_t)nmp->nm_verf, + bcopy(tl, nmp->nm_verf, NFSX_V3WRITEVERF); nmp->nm_flag |= NFSMNT_HASWRITEVERF; - } else if (bcmp((caddr_t)tl, - (caddr_t)nmp->nm_verf, NFSX_V3WRITEVERF)) { + } else if (bcmp(tl, + nmp->nm_verf, NFSX_V3WRITEVERF)) { *must_commit = 1; - bcopy((caddr_t)tl, (caddr_t)nmp->nm_verf, + bcopy(tl, nmp->nm_verf, NFSX_V3WRITEVERF); } } else { @@ -2581,7 +2581,7 @@ nfs_lookitup(struct vnode *dvp, char *name, int len, struct ucred *cred, if (*npp) { np = *npp; np->n_fhp = &np->n_fh; - bcopy((caddr_t)nfhp, (caddr_t)np->n_fhp, fhlen); + bcopy(nfhp, np->n_fhp, fhlen); np->n_fhsize = fhlen; newvp = NFSTOV(np); } else if (NFS_CMPFH(dnp, nfhp, fhlen)) { @@ -2649,9 +2649,9 @@ nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct proc *procp) if (!error) { nfsm_dissect(tl, u_int32_t *, NFSX_V3WRITEVERF); - if (bcmp((caddr_t)nmp->nm_verf, (caddr_t)tl, + if (bcmp(nmp->nm_verf, tl, NFSX_V3WRITEVERF)) { - bcopy((caddr_t)tl, (caddr_t)nmp->nm_verf, + bcopy(tl, nmp->nm_verf, NFSX_V3WRITEVERF); error = NFSERR_STALEWRITEVERF; } @@ -2840,7 +2840,7 @@ loop: if (waitfor != MNT_WAIT || passone) continue; bp->b_flags |= B_WANTED; - error = tsleep((caddr_t)bp, slpflag | (PRIBIO + 1), + error = tsleep(bp, slpflag | (PRIBIO + 1), "nfsfsync", slptimeo); splx(s); if (error) { diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index e11eba2ce9c..d68da46fcc1 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsm_subs.h,v 1.43 2009/08/10 09:18:31 blambert Exp $ */ +/* $OpenBSD: nfsm_subs.h,v 1.44 2014/12/18 20:59:21 tedu Exp $ */ /* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */ /* @@ -75,7 +75,7 @@ struct nfsm_info { tl = nfsm_build(&info.nmi_mb, 2 * NFSX_UNSIGNED + NFSX_V3FH); \ *tl++ = nfs_true; \ *tl++ = txdr_unsigned(NFSX_V3FH); \ - bcopy((caddr_t)(f), (caddr_t)tl, NFSX_V3FH); \ + bcopy((f), tl, NFSX_V3FH); \ } #define nfsm_mtofh(d, v, v3, f) { \ @@ -258,7 +258,7 @@ struct nfsm_info { } \ } \ nfsm_dissect(tl, u_int32_t *, NFSX_V3FH); \ - bcopy((caddr_t)tl, (caddr_t)(f), NFSX_V3FH); \ + bcopy(tl, (f), NFSX_V3FH); \ if ((nfsd->nd_flag & ND_NFSV3) == 0) \ nfsm_adv(NFSX_V2FH - NFSX_V3FH); \ } -- 2.20.1