diff options
author | Bret Lambert <blambert@cvs.openbsd.org> | 2008-06-13 22:11:33 +0000 |
---|---|---|
committer | Bret Lambert <blambert@cvs.openbsd.org> | 2008-06-13 22:11:33 +0000 |
commit | 861a9e713d14af49c11838f0bf3432f2fd339c32 (patch) | |
tree | 51cf4dd20c910d9a9898dd0ba82b8db1b11afef3 | |
parent | 2adb7e0071a80e874ffda0ecf9c3e4646467bc54 (diff) |
Kill one-liner macro which obfuscated mbuf pointer assignment.
Rescue nfsm_reqhead macro name and rename nfsm_reqh.
End of one-liners from nfsm_subs.h.
ok thib@
-rw-r--r-- | sys/nfs/nfs_subs.c | 6 | ||||
-rw-r--r-- | sys/nfs/nfs_var.h | 4 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 6 | ||||
-rw-r--r-- | sys/nfs/nfs_vnops.c | 64 | ||||
-rw-r--r-- | sys/nfs/nfsm_subs.h | 5 |
5 files changed, 38 insertions, 47 deletions
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index 15abca807b6..2430df74d7d 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.81 2008/06/13 17:24:13 thib Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.82 2008/06/13 22:11:32 blambert Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -525,9 +525,7 @@ struct pool nfsreqpl; * (just used to decide if a cluster is a good idea) */ struct mbuf * -nfsm_reqh(vp, procid, hsiz) - struct vnode *vp; - u_long procid; +nfsm_reqhead(hsiz) int hsiz; { struct mbuf *mb; diff --git a/sys/nfs/nfs_var.h b/sys/nfs/nfs_var.h index ba4b43c4aad..178c45ab577 100644 --- a/sys/nfs/nfs_var.h +++ b/sys/nfs/nfs_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_var.h,v 1.40 2008/06/13 03:49:26 blambert Exp $ */ +/* $OpenBSD: nfs_var.h,v 1.41 2008/06/13 22:11:32 blambert Exp $ */ /* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */ /* @@ -237,7 +237,7 @@ void nfsrv_updatecache(struct nfsrv_descript *, int, struct mbuf *); void nfsrv_cleancache(void); /* nfs_subs.c */ -struct mbuf *nfsm_reqh(struct vnode *, u_long, int); +struct mbuf *nfsm_reqhead(int); u_int32_t nfs_get_xid(void); void nfsm_rpchead(struct nfsreq *, struct ucred *, int, struct mbuf *, int); void *nfsm_build(struct mbuf **, u_int); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 86e90cddc9d..3a57d09f6bb 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.74 2008/06/12 20:24:06 blambert Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.75 2008/06/13 22:11:32 blambert Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -131,7 +131,7 @@ nfs_statfs(mp, sbp, p) if (v3 && (nmp->nm_flag & NFSMNT_GOTFSINFO) == 0) (void)nfs_fsinfo(nmp, vp, cred, p); nfsstats.rpccnt[NFSPROC_FSSTAT]++; - nfsm_reqhead(vp, NFSPROC_FSSTAT, NFSX_FH(v3)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3)); nfsm_fhtom(vp, v3); nfsm_request(vp, NFSPROC_FSSTAT, p, cred); if (v3) @@ -194,7 +194,7 @@ nfs_fsinfo(nmp, vp, cred, p) struct mbuf *mreq, *mrep, *md, *mb; nfsstats.rpccnt[NFSPROC_FSINFO]++; - nfsm_reqhead(vp, NFSPROC_FSINFO, NFSX_FH(1)); + mb = mreq = nfsm_reqhead(NFSX_FH(1)); nfsm_fhtom(vp, 1); nfsm_request(vp, NFSPROC_FSINFO, p, cred); nfsm_postop_attr(vp, retattr); diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 5bf6eaa983d..2799dc87fd4 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.91 2008/06/13 17:21:13 thib Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.92 2008/06/13 22:11:32 blambert Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -220,7 +220,7 @@ nfs_null(vp, cred, procp) int error = 0; struct mbuf *mreq, *mrep, *md, *mb; - nfsm_reqhead(vp, NFSPROC_NULL, 0); + mb = mreq = nfsm_reqhead(0); nfsm_request(vp, NFSPROC_NULL, procp, cred); m_freem(mrep); nfsmout: @@ -293,7 +293,7 @@ nfs_access(v) */ if (v3) { nfsstats.rpccnt[NFSPROC_ACCESS]++; - nfsm_reqhead(vp, NFSPROC_ACCESS, NFSX_FH(v3) + NFSX_UNSIGNED); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_UNSIGNED); nfsm_fhtom(vp, v3); tl = nfsm_build(&mb, NFSX_UNSIGNED); if (ap->a_mode & VREAD) @@ -510,7 +510,7 @@ nfs_getattr(v) if (nfs_getattrcache(vp, ap->a_vap) == 0) return (0); nfsstats.rpccnt[NFSPROC_GETATTR]++; - nfsm_reqhead(vp, NFSPROC_GETATTR, NFSX_FH(v3)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3)); nfsm_fhtom(vp, v3); nfsm_request(vp, NFSPROC_GETATTR, ap->a_p, ap->a_cred); if (!error) @@ -620,7 +620,7 @@ nfs_setattrrpc(vp, vap, cred, procp) int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_SETATTR]++; - nfsm_reqhead(vp, NFSPROC_SETATTR, NFSX_FH(v3) + NFSX_SATTR(v3)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_SATTR(v3)); nfsm_fhtom(vp, v3); if (v3) { nfsm_v3attrbuild(&mb, vap, TRUE); @@ -770,8 +770,7 @@ dorpc: nfsstats.lookupcache_misses++; nfsstats.rpccnt[NFSPROC_LOOKUP]++; len = cnp->cn_namelen; - nfsm_reqhead(dvp, NFSPROC_LOOKUP, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN); nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_proc, cnp->cn_cred); @@ -959,7 +958,7 @@ nfs_readlinkrpc(vp, uiop, cred) int v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_READLINK]++; - nfsm_reqhead(vp, NFSPROC_READLINK, NFSX_FH(v3)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3)); nfsm_fhtom(vp, v3); nfsm_request(vp, NFSPROC_READLINK, uiop->uio_procp, cred); if (v3) @@ -1001,7 +1000,7 @@ nfs_readrpc(vp, uiop) while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_READ]++; len = (tsiz > nmp->nm_rsize) ? nmp->nm_rsize : tsiz; - nfsm_reqhead(vp, NFSPROC_READ, NFSX_FH(v3) + NFSX_UNSIGNED * 3); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_UNSIGNED * 3); nfsm_fhtom(vp, v3); tl = nfsm_build(&mb, NFSX_UNSIGNED * 3); if (v3) { @@ -1067,8 +1066,8 @@ nfs_writerpc(vp, uiop, iomode, must_commit) while (tsiz > 0) { nfsstats.rpccnt[NFSPROC_WRITE]++; len = (tsiz > nmp->nm_wsize) ? nmp->nm_wsize : tsiz; - nfsm_reqhead(vp, NFSPROC_WRITE, - NFSX_FH(v3) + 5 * NFSX_UNSIGNED + nfsm_rndup(len)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + 5 * NFSX_UNSIGNED + + nfsm_rndup(len)); nfsm_fhtom(vp, v3); if (v3) { tl = nfsm_build(&mb, 5 * NFSX_UNSIGNED); @@ -1182,8 +1181,8 @@ nfs_mknodrpc(dvp, vpp, cnp, vap) return (EOPNOTSUPP); } nfsstats.rpccnt[NFSPROC_MKNOD]++; - nfsm_reqhead(dvp, NFSPROC_MKNOD, NFSX_FH(v3) + 4 * NFSX_UNSIGNED + - + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + 4 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN); if (v3) { @@ -1294,8 +1293,8 @@ nfs_create(v) #endif again: nfsstats.rpccnt[NFSPROC_CREATE]++; - nfsm_reqhead(dvp, NFSPROC_CREATE, NFSX_FH(v3) + 2 * NFSX_UNSIGNED + - nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + 2 * NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen) + NFSX_SATTR(v3)); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN); if (v3) { @@ -1466,8 +1465,8 @@ nfs_removerpc(dvp, name, namelen, cred, proc) int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_REMOVE]++; - nfsm_reqhead(dvp, NFSPROC_REMOVE, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_UNSIGNED + + nfsm_rndup(namelen)); nfsm_fhtom(dvp, v3); nfsm_strtom(name, namelen, NFS_MAXNAMLEN); nfsm_request(dvp, NFSPROC_REMOVE, proc, cred); @@ -1585,9 +1584,8 @@ nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, proc) int v3 = NFS_ISV3(fdvp); nfsstats.rpccnt[NFSPROC_RENAME]++; - nfsm_reqhead(fdvp, NFSPROC_RENAME, - (NFSX_FH(v3) + NFSX_UNSIGNED)*2 + nfsm_rndup(fnamelen) + - nfsm_rndup(tnamelen)); + mb = mreq = nfsm_reqhead((NFSX_FH(v3) + NFSX_UNSIGNED)*2 + + nfsm_rndup(fnamelen) + nfsm_rndup(tnamelen)); nfsm_fhtom(fdvp, v3); nfsm_strtom(fnameptr, fnamelen, NFS_MAXNAMLEN); nfsm_fhtom(tdvp, v3); @@ -1645,8 +1643,8 @@ nfs_link(v) v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_LINK]++; - nfsm_reqhead(vp, NFSPROC_LINK, - NFSX_FH(v3)*2 + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mb = mreq = nfsm_reqhead(2 * NFSX_FH(v3) + NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen)); nfsm_fhtom(vp, v3); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN); @@ -1693,7 +1691,7 @@ nfs_symlink(v) nfsstats.rpccnt[NFSPROC_SYMLINK]++; slen = strlen(ap->a_target); - nfsm_reqhead(dvp, NFSPROC_SYMLINK, NFSX_FH(v3) + 2*NFSX_UNSIGNED + + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + 2 * NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen) + nfsm_rndup(slen) + NFSX_SATTR(v3)); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN); @@ -1754,8 +1752,8 @@ nfs_mkdir(v) len = cnp->cn_namelen; nfsstats.rpccnt[NFSPROC_MKDIR]++; - nfsm_reqhead(dvp, NFSPROC_MKDIR, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len) + NFSX_SATTR(v3)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_UNSIGNED + + nfsm_rndup(len) + NFSX_SATTR(v3)); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN); if (v3) { @@ -1829,8 +1827,8 @@ nfs_rmdir(v) return (EINVAL); } nfsstats.rpccnt[NFSPROC_RMDIR]++; - nfsm_reqhead(dvp, NFSPROC_RMDIR, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_UNSIGNED + + nfsm_rndup(cnp->cn_namelen)); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN); nfsm_request(dvp, NFSPROC_RMDIR, cnp->cn_proc, cnp->cn_cred); @@ -2066,8 +2064,7 @@ nfs_readdirrpc(struct vnode *vp, */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIR]++; - nfsm_reqhead(vp, NFSPROC_READDIR, NFSX_FH(v3) + - NFSX_READDIR(v3)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_READDIR(v3)); nfsm_fhtom(vp, v3); if (v3) { tl = nfsm_build(&mb, 5 * NFSX_UNSIGNED); @@ -2255,8 +2252,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, */ while (more_dirs && bigenough) { nfsstats.rpccnt[NFSPROC_READDIRPLUS]++; - nfsm_reqhead(vp, NFSPROC_READDIRPLUS, - NFSX_FH(1) + 6 * NFSX_UNSIGNED); + mb = mreq = nfsm_reqhead(NFSX_FH(1) + 6 * NFSX_UNSIGNED); nfsm_fhtom(vp, 1); tl = nfsm_build(&mb, 6 * NFSX_UNSIGNED); *tl++ = cookie.nfsuquad[0]; @@ -2524,8 +2520,8 @@ nfs_lookitup(dvp, name, len, cred, procp, npp) int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_LOOKUP]++; - nfsm_reqhead(dvp, NFSPROC_LOOKUP, - NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); + mb = mreq = nfsm_reqhead(NFSX_FH(v3) + NFSX_UNSIGNED + + nfsm_rndup(len)); nfsm_fhtom(dvp, v3); nfsm_strtom(name, len, NFS_MAXNAMLEN); nfsm_request(dvp, NFSPROC_LOOKUP, procp, cred); @@ -2595,7 +2591,7 @@ nfs_commit(vp, offset, cnt, procp) if ((nmp->nm_flag & NFSMNT_HASWRITEVERF) == 0) return (0); nfsstats.rpccnt[NFSPROC_COMMIT]++; - nfsm_reqhead(vp, NFSPROC_COMMIT, NFSX_FH(1)); + mb = mreq = nfsm_reqhead(NFSX_FH(1)); nfsm_fhtom(vp, 1); tl = nfsm_build(&mb, 3 * NFSX_UNSIGNED); txdr_hyper(offset, tl); diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index dafb4478639..43d29ac281e 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsm_subs.h,v 1.28 2008/06/13 03:49:26 blambert Exp $ */ +/* $OpenBSD: nfsm_subs.h,v 1.29 2008/06/13 22:11:32 blambert Exp $ */ /* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */ /* @@ -224,9 +224,6 @@ goto nfsmout; \ } -#define nfsm_reqhead(v,a,s) \ - mb = mreq = nfsm_reqh((v),(a),(s)) - #define nfsm_rndup(a) (((a)+3)&(~0x3)) #define nfsm_request(v, t, p, c) \ |