diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1998-08-19 22:27:00 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1998-08-19 22:27:00 +0000 |
commit | 4f33eb81fbef9647018f71c9bf4d7ed43e4c2d08 (patch) | |
tree | b45b211bdf0335b68592edffed8941bea472efad | |
parent | 1f1c73524add8181e3f63eebdebc2fb3aa31e62d (diff) |
Change fxdr_hyper to return a u_quad_t. This minimizes the evil clobbering
of lvalues that ANSI abhors.
And it fixes df on NFS version 3 mounts on Sparcs.
-rw-r--r-- | sys/nfs/nfs_nqlease.c | 4 | ||||
-rw-r--r-- | sys/nfs/nfs_serv.c | 18 | ||||
-rw-r--r-- | sys/nfs/nfs_socket.c | 4 | ||||
-rw-r--r-- | sys/nfs/nfs_subs.c | 6 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 8 | ||||
-rw-r--r-- | sys/nfs/nfs_vnops.c | 6 | ||||
-rw-r--r-- | sys/nfs/nfsm_subs.h | 4 | ||||
-rw-r--r-- | sys/nfs/xdr_subs.h | 11 |
8 files changed, 31 insertions, 30 deletions
diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c index 7c1d6c28791..d3462d48426 100644 --- a/sys/nfs/nfs_nqlease.c +++ b/sys/nfs/nfs_nqlease.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_nqlease.c,v 1.12 1997/11/06 05:59:01 csapuntz Exp $ */ +/* $OpenBSD: nfs_nqlease.c,v 1.13 1998/08/19 22:26:51 csapuntz Exp $ */ /* $NetBSD: nfs_nqlease.c,v 1.14 1996/02/18 14:06:50 fvdl Exp $ */ /* @@ -851,7 +851,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 31beaa583cd..409b47e8077 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.15 1998/02/22 01:21:31 niklas Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.16 1998/08/19 22:26:52 csapuntz Exp $ */ /* $NetBSD: nfs_serv.c,v 1.25 1996/03/02 15:55:52 jtk Exp $ */ /* @@ -550,7 +550,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); @@ -721,7 +721,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 { @@ -916,7 +916,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 { @@ -2394,9 +2394,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); @@ -2656,9 +2656,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); @@ -2952,7 +2952,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, diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index 8753bf36f15..e07444cc080 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_socket.c,v 1.12 1997/07/28 19:54:17 deraadt Exp $ */ +/* $OpenBSD: nfs_socket.c,v 1.13 1998/08/19 22:26:53 csapuntz Exp $ */ /* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */ /* @@ -1064,7 +1064,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); } diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index 8f1e32fc370..5d2c5ad2243 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.22 1997/11/06 05:59:03 csapuntz Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.23 1998/08/19 22:26:55 csapuntz Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -1277,9 +1277,9 @@ nfs_loadattrcache(vpp, mdp, dposp, 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); 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); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index ecc18ab19ba..7bb452ae54e 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.24 1998/02/08 22:41:45 tholo Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.25 1998/08/19 22:26:56 csapuntz Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -153,11 +153,11 @@ 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)(tquad / ((u_quad_t)NFS_FABLKSIZE)); - fxdr_hyper(&sfp->sf_fbytes, &tquad); + tquad = fxdr_hyper(&sfp->sf_fbytes); sbp->f_bfree = (long)(tquad / ((u_quad_t)NFS_FABLKSIZE)); - fxdr_hyper(&sfp->sf_abytes, &tquad); + tquad = fxdr_hyper(&sfp->sf_abytes); sbp->f_bavail = (long)(tquad / ((u_quad_t)NFS_FABLKSIZE)); sbp->f_files = (fxdr_unsigned(int32_t, sfp->sf_tfiles.nfsuquad[1]) & 0x7fffffff); diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 98d0dc709f5..9aeb227b2e2 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.21 1998/08/06 19:35:00 csapuntz Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.22 1998/08/19 22:26:57 csapuntz Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -2073,7 +2073,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 *, @@ -2253,7 +2253,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; diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index 8b3a165d4a8..9d4b420a546 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsm_subs.h,v 1.7 1997/02/24 13:50:04 niklas Exp $ */ +/* $OpenBSD: nfsm_subs.h,v 1.8 1998/08/19 22:26:58 csapuntz Exp $ */ /* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */ /* @@ -415,7 +415,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 d5f6c40da5c..eb828d93d80 100644 --- a/sys/nfs/xdr_subs.h +++ b/sys/nfs/xdr_subs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xdr_subs.h,v 1.4 1996/03/31 13:16:27 mickey Exp $ */ +/* $OpenBSD: xdr_subs.h,v 1.5 1998/08/19 22:26:59 csapuntz Exp $ */ /* $NetBSD: xdr_subs.h,v 1.11 1996/02/18 11:54:12 fvdl Exp $ */ /* @@ -81,10 +81,11 @@ ((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 fxdr_hyper(f) \ + ((((u_quad_t)ntohl(((int32_t *)(f))[0])) << 32) | \ + (u_quad_t)(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]); \ |