diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c index 6bfb012c0519..89ceefd7afa2 100644 --- a/sys/nfs/nfs_nqlease.c +++ b/sys/nfs/nfs_nqlease.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_nqlease.c,v 1.27 1998/08/09 21:19:50 perry Exp $ */ +/* $NetBSD: nfs_nqlease.c,v 1.28 1999/03/06 05:34:41 fair Exp $ */ /* * Copyright (c) 1992, 1993 @@ -711,7 +711,7 @@ nqnfsrv_getlease(nfsd, slp, procp, mrq) nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(cache); *tl++ = txdr_unsigned(nfsd->nd_duration); - txdr_hyper(&frev, tl); + txdr_hyper(frev, tl); nfsm_build(fp, struct nfs_fattr *, NFSX_V3FATTR); nfsm_srvfillattr(&va, fp); nfsm_srvdone; @@ -832,7 +832,7 @@ nqnfs_getlease(vp, rwflag, cred, p) cachable = fxdr_unsigned(int, *tl++); reqtime += fxdr_unsigned(int, *tl++); if (reqtime > time.tv_sec) { - fxdr_hyper(tl, &frev); + frev = fxdr_hyper(tl); nqnfs_clientlease(nmp, np, rwflag, cachable, reqtime, frev); nfsm_loadattr(vp, (struct vattr *)0); } else diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 73a9e6ee0f59..293955719eca 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_serv.c,v 1.47 1999/03/05 07:27:58 mycroft Exp $ */ +/* $NetBSD: nfs_serv.c,v 1.48 1999/03/06 05:34:41 fair Exp $ */ /* * Copyright (c) 1989, 1993 @@ -606,7 +606,7 @@ nfsrv_read(nfsd, slp, procp, mrq) nfsm_srvmtofh(fhp); if (v3) { nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - fxdr_hyper(tl, &off); + off = fxdr_hyper(tl); } else { nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); off = (off_t)fxdr_unsigned(u_int32_t, *tl); @@ -777,7 +777,7 @@ nfsrv_write(nfsd, slp, procp, mrq) nfsm_srvmtofh(fhp); if (v3) { nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED); - fxdr_hyper(tl, &off); + off = fxdr_hyper(tl); tl += 3; stable = fxdr_unsigned(int, *tl++); } else { @@ -972,7 +972,7 @@ nfsrv_writegather(ndp, slp, procp, mrq) nfsm_srvmtofh(&nfsd->nd_fh); if (v3) { nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED); - fxdr_hyper(tl, &nfsd->nd_off); + nfsd->nd_off = fxdr_hyper(tl); tl += 3; nfsd->nd_stable = fxdr_unsigned(int, *tl++); } else { @@ -2497,9 +2497,9 @@ nfsrv_readdir(nfsd, slp, procp, mrq) nfsm_srvmtofh(fhp); if (v3) { nfsm_dissect(tl, u_int32_t *, 5 * NFSX_UNSIGNED); - fxdr_hyper(tl, &toff); + toff = fxdr_hyper(tl); tl += 2; - fxdr_hyper(tl, &verf); + verf = fxdr_hyper(tl); tl += 2; } else { nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -2592,7 +2592,7 @@ again: if (v3) { nfsm_srvpostop_attr(getret, &at); nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - txdr_hyper(&at.va_filerev, tl); + txdr_hyper(at.va_filerev, tl); tl += 2; } else nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -2631,7 +2631,7 @@ again: if (v3) { nfsm_srvpostop_attr(getret, &at); nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - txdr_hyper(&at.va_filerev, tl); + txdr_hyper(at.va_filerev, tl); } mp = mp2 = mb; bp = bpos; @@ -2689,7 +2689,7 @@ again: nfsm_clget; /* Finish off the record */ - txdr_hyper(cookiep, &jar); + txdr_hyper(*cookiep, &jar); if (v3) { *tl = jar.nfsuquad[0]; bp += NFSX_UNSIGNED; @@ -2759,9 +2759,9 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq) fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); nfsm_dissect(tl, u_int32_t *, 6 * NFSX_UNSIGNED); - fxdr_hyper(tl, &toff); + toff = fxdr_hyper(tl); tl += 2; - fxdr_hyper(tl, &verf); + verf = fxdr_hyper(tl); tl += 2; siz = fxdr_unsigned(int, *tl++); cnt = fxdr_unsigned(int, *tl); @@ -2865,7 +2865,7 @@ again: 2 * NFSX_UNSIGNED); nfsm_srvpostop_attr(getret, &at); nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - txdr_hyper(&at.va_filerev, tl); + txdr_hyper(at.va_filerev, tl); tl += 2; *tl++ = nfs_false; *tl = nfs_true; @@ -2901,7 +2901,7 @@ again: nfsm_reply(cnt); nfsm_srvpostop_attr(getret, &at); nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - txdr_hyper(&at.va_filerev, tl); + txdr_hyper(at.va_filerev, tl); mp = mp2 = mb; bp = bpos; be = bp + M_TRAILINGSPACE(mp); @@ -2954,7 +2954,7 @@ again: fl.fl_fhsize = txdr_unsigned(NFSX_V3FH); fl.fl_fhok = nfs_true; fl.fl_postopok = nfs_true; - txdr_hyper(cookiep, fl.fl_off.nfsuquad); + txdr_hyper(*cookiep, fl.fl_off.nfsuquad); nfsm_clget; *tl = nfs_true; @@ -3069,7 +3069,7 @@ nfsrv_commit(nfsd, slp, procp, mrq) * XXX At this time VOP_FSYNC() does not accept offset and byte * count parameters, so these arguments are useless (someday maybe). */ - fxdr_hyper(tl, &off); + off = fxdr_hyper(tl); tl += 2; cnt = fxdr_unsigned(int, *tl); error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, @@ -3148,16 +3148,16 @@ nfsrv_statfs(nfsd, slp, procp, mrq) nfsm_build(sfp, struct nfs_statfs *, NFSX_STATFS(v3)); if (v3) { tval = (u_quad_t)((quad_t)sf->f_blocks * (quad_t)sf->f_bsize); - txdr_hyper(&tval, &sfp->sf_tbytes); + txdr_hyper(tval, &sfp->sf_tbytes); tval = (u_quad_t)((quad_t)sf->f_bfree * (quad_t)sf->f_bsize); - txdr_hyper(&tval, &sfp->sf_fbytes); + txdr_hyper(tval, &sfp->sf_fbytes); tval = (u_quad_t)((quad_t)sf->f_bavail * (quad_t)sf->f_bsize); - txdr_hyper(&tval, &sfp->sf_abytes); + txdr_hyper(tval, &sfp->sf_abytes); tval = (u_quad_t)sf->f_files; - txdr_hyper(&tval, &sfp->sf_tfiles); + txdr_hyper(tval, &sfp->sf_tfiles); tval = (u_quad_t)sf->f_ffree; - txdr_hyper(&tval, &sfp->sf_ffiles); - txdr_hyper(&tval, &sfp->sf_afiles); + txdr_hyper(tval, &sfp->sf_ffiles); + txdr_hyper(tval, &sfp->sf_afiles); sfp->sf_invarsec = 0; } else { sfp->sf_tsize = txdr_unsigned(NFS_MAXDGRAMDATA); @@ -3236,7 +3236,7 @@ nfsrv_fsinfo(nfsd, slp, procp, mrq) sip->fs_wtpref = txdr_unsigned(pref); sip->fs_wtmult = txdr_unsigned(NFS_FABLKSIZE); sip->fs_dtpref = txdr_unsigned(pref); - txdr_hyper(&maxfsize, &sip->fs_maxfilesize); + txdr_hyper(maxfsize, &sip->fs_maxfilesize); sip->fs_timedelta.nfsv3_sec = 0; sip->fs_timedelta.nfsv3_nsec = txdr_unsigned(1); sip->fs_properties = txdr_unsigned(NFSV3FSINFO_LINK | diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index f1a2b3cef00c..e52867af6e41 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_socket.c,v 1.49 1999/02/12 01:37:06 thorpej Exp $ */ +/* $NetBSD: nfs_socket.c,v 1.50 1999/03/06 05:34:41 fair Exp $ */ /* * Copyright (c) 1989, 1991, 1993, 1995 @@ -1067,7 +1067,7 @@ tryagain: cachable = fxdr_unsigned(int, *tl++); reqtime += fxdr_unsigned(int, *tl++); if (reqtime > time.tv_sec) { - fxdr_hyper(tl, &frev); + frev = fxdr_hyper(tl); nqnfs_clientlease(nmp, np, nqlflag, cachable, reqtime, frev); } @@ -1227,7 +1227,7 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp) *tl++ = txdr_unsigned(nd->nd_flag & ND_LEASE); *tl++ = txdr_unsigned(cache); *tl++ = txdr_unsigned(nd->nd_duration); - txdr_hyper(frev, tl); + txdr_hyper(*frev, tl); } else { nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); *tl = 0; diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index e8188cf2f2cf..ebeafd8f2255 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_subs.c,v 1.65 1999/02/27 00:47:34 wrstuden Exp $ */ +/* $NetBSD: nfs_subs.c,v 1.66 1999/03/06 05:34:41 fair Exp $ */ /* * Copyright (c) 1989, 1993 @@ -1600,12 +1600,12 @@ nfs_loadattrcache(vpp, fp, vaper) vap->va_nlink = fxdr_unsigned(u_short, fp->fa_nlink); vap->va_uid = fxdr_unsigned(uid_t, fp->fa_uid); vap->va_gid = fxdr_unsigned(gid_t, fp->fa_gid); - fxdr_hyper(&fp->fa3_size, &vap->va_size); + vap->va_size = fxdr_hyper(&fp->fa3_size); if (vtyp == VDIR) vap->va_blocksize = NFS_DIRFRAGSIZ; else vap->va_blocksize = NFS_FABLKSIZE; - fxdr_hyper(&fp->fa3_used, &vap->va_bytes); + vap->va_bytes = fxdr_hyper(&fp->fa3_used); vap->va_fileid = fxdr_unsigned(int32_t, fp->fa3_fileid.nfsuquad[1]); fxdr_nfsv3time(&fp->fa3_atime, &vap->va_atime); @@ -2103,7 +2103,7 @@ nfsm_srvwcc(nfsd, before_ret, before_vap, after_ret, after_vap, mbp, bposp) } else { nfsm_build(tl, u_int32_t *, 7 * NFSX_UNSIGNED); *tl++ = nfs_true; - txdr_hyper(&(before_vap->va_size), tl); + txdr_hyper(before_vap->va_size, tl); tl += 2; txdr_nfsv3time(&(before_vap->va_mtime), tl); tl += 2; @@ -2153,8 +2153,8 @@ nfsm_srvfattr(nfsd, vap, fp) if (nfsd->nd_flag & ND_NFSV3) { fp->fa_type = vtonfsv3_type(vap->va_type); fp->fa_mode = vtonfsv3_mode(vap->va_mode); - txdr_hyper(&vap->va_size, &fp->fa3_size); - txdr_hyper(&vap->va_bytes, &fp->fa3_used); + txdr_hyper(vap->va_size, &fp->fa3_size); + txdr_hyper(vap->va_bytes, &fp->fa3_used); fp->fa3_rdev.specdata1 = txdr_unsigned(major(vap->va_rdev)); fp->fa3_rdev.specdata2 = txdr_unsigned(minor(vap->va_rdev)); fp->fa3_fsid.nfsuquad[0] = 0; diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 2c4b40b99d51..5d9241f9c21a 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_vfsops.c,v 1.82 1999/03/05 07:27:58 mycroft Exp $ */ +/* $NetBSD: nfs_vfsops.c,v 1.83 1999/03/06 05:34:41 fair Exp $ */ /* * Copyright (c) 1989, 1993, 1995 @@ -176,15 +176,15 @@ nfs_statfs(mp, sbp, p) sbp->f_iosize = min(nmp->nm_rsize, nmp->nm_wsize); if (v3) { sbp->f_bsize = NFS_FABLKSIZE; - fxdr_hyper(&sfp->sf_tbytes, &tquad); + tquad = fxdr_hyper(&sfp->sf_tbytes); sbp->f_blocks = (long)((quad_t)tquad / (quad_t)NFS_FABLKSIZE); - fxdr_hyper(&sfp->sf_fbytes, &tquad); + tquad = fxdr_hyper(&sfp->sf_fbytes); sbp->f_bfree = (long)((quad_t)tquad / (quad_t)NFS_FABLKSIZE); - fxdr_hyper(&sfp->sf_abytes, &tquad); + tquad = fxdr_hyper(&sfp->sf_abytes); sbp->f_bavail = (long)((quad_t)tquad / (quad_t)NFS_FABLKSIZE); - fxdr_hyper(&sfp->sf_tfiles, &tquad); + tquad = fxdr_hyper(&sfp->sf_tfiles); sbp->f_files = (long)tquad; - fxdr_hyper(&sfp->sf_ffiles, &tquad); + tquad = fxdr_hyper(&sfp->sf_ffiles); sbp->f_ffree = (long)tquad; } else { sbp->f_bsize = fxdr_unsigned(int32_t, sfp->sf_bsize); @@ -262,7 +262,7 @@ nfs_fsinfo(nmp, vp, cred, p) } /* XXX */ nmp->nm_maxfilesize = (u_int64_t)0x80000000 * DEV_BSIZE - 1; - fxdr_hyper(&fsp->fs_maxfilesize, &maxfsize); + maxfsize = fxdr_hyper(&fsp->fs_maxfilesize); if (maxfsize > 0 && maxfsize < nmp->nm_maxfilesize) nmp->nm_maxfilesize = maxfsize; nmp->nm_iflag |= NFSMNT_GOTFSINFO; diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 7b114ec36041..70c46b6a74fc 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_vnops.c,v 1.97 1998/08/09 21:19:52 perry Exp $ */ +/* $NetBSD: nfs_vnops.c,v 1.98 1999/03/06 05:34:42 fair Exp $ */ /* * Copyright (c) 1989, 1993 @@ -730,7 +730,7 @@ nfs_setattrrpc(vp, vap, cred, procp) if (vap->va_size != VNOVAL) { nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); *tl++ = nfs_true; - txdr_hyper(&vap->va_size, tl); + txdr_hyper(vap->va_size, tl); } else { nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); *tl = nfs_false; @@ -1069,7 +1069,7 @@ nfs_readrpc(vp, uiop, cred) nfsm_fhtom(vp, v3); nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED * 3); if (v3) { - txdr_hyper(&uiop->uio_offset, tl); + txdr_hyper(uiop->uio_offset, tl); *(tl + 2) = txdr_unsigned(len); } else { *tl++ = txdr_unsigned(uiop->uio_offset); @@ -1136,7 +1136,7 @@ nfs_writerpc(vp, uiop, cred, iomode, must_commit) nfsm_fhtom(vp, v3); if (v3) { nfsm_build(tl, u_int32_t *, 5 * NFSX_UNSIGNED); - txdr_hyper(&uiop->uio_offset, tl); + txdr_hyper(uiop->uio_offset, tl); tl += 2; *tl++ = txdr_unsigned(len); *tl++ = txdr_unsigned(*iomode); @@ -2142,7 +2142,7 @@ nfs_readdirrpc(vp, uiop, cred) if (v3) { nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED); - fxdr_hyper(tl, &fileno); + fileno = fxdr_hyper(tl); len = fxdr_unsigned(int, *(tl + 2)); } else { nfsm_dissect(tl, u_int32_t *, @@ -2328,7 +2328,7 @@ nfs_readdirplusrpc(vp, uiop, cred) /* loop thru the dir entries, doctoring them to 4bsd form */ while (more_dirs && bigenough) { nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED); - fxdr_hyper(tl, &fileno); + fileno = fxdr_hyper(tl); len = fxdr_unsigned(int, *(tl + 2)); if (len <= 0 || len > NFS_MAXNAMLEN) { error = EBADRPC; @@ -2641,7 +2641,7 @@ nfs_commit(vp, offset, cnt, cred, procp) nfsm_reqhead(vp, NFSPROC_COMMIT, NFSX_FH(1)); nfsm_fhtom(vp, 1); nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); - txdr_hyper(&offset, tl); + txdr_hyper(offset, tl); tl += 2; *tl = txdr_unsigned(cnt); nfsm_request(vp, NFSPROC_COMMIT, procp, cred); diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index 61f15c9d787f..36434f3f16c4 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -1,4 +1,4 @@ -/* $NetBSD: nfsm_subs.h,v 1.18 1998/08/09 21:19:53 perry Exp $ */ +/* $NetBSD: nfsm_subs.h,v 1.19 1999/03/06 05:34:41 fair Exp $ */ /* * Copyright (c) 1989, 1993 @@ -422,7 +422,7 @@ nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ if (*tl == nfs_true) { \ nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); \ - fxdr_hyper(tl, &(a)->va_size); \ + (a)->va_size = fxdr_hyper(tl); \ } \ nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \ switch (fxdr_unsigned(int, *tl)) { \ diff --git a/sys/nfs/xdr_subs.h b/sys/nfs/xdr_subs.h index abda2663412d..cae77792fdbc 100644 --- a/sys/nfs/xdr_subs.h +++ b/sys/nfs/xdr_subs.h @@ -1,4 +1,4 @@ -/* $NetBSD: xdr_subs.h,v 1.12 1997/10/10 01:53:34 fvdl Exp $ */ +/* $NetBSD: xdr_subs.h,v 1.13 1999/03/06 05:34:40 fair Exp $ */ /* * Copyright (c) 1989, 1993 @@ -97,13 +97,14 @@ ((struct nfsv3_time *)(t))->nfsv3_nsec = htonl((f)->tv_nsec); \ } -#define fxdr_hyper(f, t) { \ - ((int32_t *)(t))[_QUAD_HIGHWORD] = ntohl(((int32_t *)(f))[0]); \ - ((int32_t *)(t))[_QUAD_LOWWORD] = ntohl(((int32_t *)(f))[1]); \ -} -#define txdr_hyper(f, t) { \ - ((int32_t *)(t))[0] = htonl(((int32_t *)(f))[_QUAD_HIGHWORD]); \ - ((int32_t *)(t))[1] = htonl(((int32_t *)(f))[_QUAD_LOWWORD]); \ +#define fxdr_hyper(f) \ + ((((u_quad_t)ntohl(((u_int32_t *)(f))[0])) << 32) | \ + (u_quad_t)(ntohl(((u_int32_t *)(f))[1]))) + + +#define txdr_hyper(f, t) { \ + ((u_int32_t *)(t))[0] = htonl((u_int32_t)((f) >> 32)); \ + ((u_int32_t *)(t))[1] = htonl((u_int32_t)((f) & 0xffffffff)); \ } #endif