diff options
author | iedowse <iedowse@FreeBSD.org> | 2001-12-18 01:22:09 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2001-12-18 01:22:09 +0000 |
commit | 6e9f1df98f816467a63dc5b41cea58f28843e390 (patch) | |
tree | 9270c37106f68890c1fcce6d366590e69faa1848 | |
parent | bba76f2085975aeba776356b2556c99b8c882bd5 (diff) | |
download | FreeBSD-src-6e9f1df98f816467a63dc5b41cea58f28843e390.zip FreeBSD-src-6e9f1df98f816467a63dc5b41cea58f28843e390.tar.gz |
Avoid passing the variable `tl' to functions that just use it for
temporary storage. In the old NFS code it wasn't at all clear if
the value of `tl' was used across or after macro calls, but I'm
fairly confident that the convention was to keep its use local.
Each ex-macro function now uses a local version of this variable,
so all of the double-indirection goes away.
The only exception to the `local use' rule for `tl' is nfsm_clget(),
which is left unchanged by this commit.
Reviewed by: peter
-rw-r--r-- | sys/nfs/nfs_common.c | 11 | ||||
-rw-r--r-- | sys/nfs/nfs_common.h | 9 | ||||
-rw-r--r-- | sys/nfsclient/nfs_subs.c | 161 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 3 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 10 | ||||
-rw-r--r-- | sys/nfsclient/nfsm_subs.h | 44 | ||||
-rw-r--r-- | sys/nfsserver/nfs_serv.c | 10 | ||||
-rw-r--r-- | sys/nfsserver/nfs_srvsubs.c | 140 | ||||
-rw-r--r-- | sys/nfsserver/nfsm_subs.h | 28 |
9 files changed, 197 insertions, 219 deletions
diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c index 029096a..d4a957e 100644 --- a/sys/nfs/nfs_common.c +++ b/sys/nfs/nfs_common.c @@ -286,20 +286,21 @@ nfsm_dissect_xx(int s, struct mbuf **md, caddr_t *dpos) } int -nfsm_strsiz_xx(int *s, int m, u_int32_t **tl, struct mbuf **mb, caddr_t *bpos) +nfsm_strsiz_xx(int *s, int m, struct mbuf **mb, caddr_t *bpos) { + u_int32_t *tl; - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, mb, bpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, mb, bpos); + if (tl == NULL) return EBADRPC; - *s = fxdr_unsigned(int32_t, **tl); + *s = fxdr_unsigned(int32_t, *tl); if (*s > m) return EBADRPC; return 0; } int -nfsm_adv_xx(int s, u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_adv_xx(int s, struct mbuf **md, caddr_t *dpos) { int t1; diff --git a/sys/nfs/nfs_common.h b/sys/nfs/nfs_common.h index 889054d..3b3ab85 100644 --- a/sys/nfs/nfs_common.h +++ b/sys/nfs/nfs_common.h @@ -66,9 +66,8 @@ void *nfsm_build_xx(int s, struct mbuf **mb, caddr_t *bpos); /* Interpretation phase macros */ void *nfsm_dissect_xx(int s, struct mbuf **md, caddr_t *dpos); -int nfsm_strsiz_xx(int *s, int m, u_int32_t **tl, struct mbuf **md, - caddr_t *dpos); -int nfsm_adv_xx(int s, u_int32_t **tl, struct mbuf **md, caddr_t *dpos); +int nfsm_strsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); +int nfsm_adv_xx(int s, struct mbuf **md, caddr_t *dpos); /* Error check helpers */ #define nfsm_dcheck(t1, mrep) \ @@ -102,7 +101,7 @@ do { \ #define nfsm_strsiz(s,m) \ do { \ int t1; \ - t1 = nfsm_strsiz_xx(&(s), (m), &tl, &md, &dpos); \ + t1 = nfsm_strsiz_xx(&(s), (m), &md, &dpos); \ nfsm_dcheck(t1, mrep); \ } while(0) @@ -119,7 +118,7 @@ do {\ #define nfsm_adv(s) \ do { \ int t1; \ - t1 = nfsm_adv_xx((s), &tl, &md, &dpos); \ + t1 = nfsm_adv_xx((s), &md, &dpos); \ nfsm_dcheck(t1, mrep); \ } while (0) diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index e20f11f..c23ecc5 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -811,23 +811,24 @@ loop: int nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) + struct mbuf **md, caddr_t *dpos) { struct nfsnode *ttnp; struct vnode *ttvp; nfsfh_t *ttfhp; + u_int32_t *tl; int ttfhsize; int t1; if (v3) { - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - *f = fxdr_unsigned(int, **tl); + *f = fxdr_unsigned(int, *tl); } else *f = 1; if (*f) { - t1 = nfsm_getfh_xx(&ttfhp, &ttfhsize, (v3), tl, md, dpos); + t1 = nfsm_getfh_xx(&ttfhp, &ttfhsize, (v3), md, dpos); if (t1 != 0) return t1; t1 = nfs_nget(d->v_mount, ttfhp, ttfhsize, &ttnp); @@ -836,13 +837,13 @@ nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f, *v = NFSTOV(ttnp); } if (v3) { - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; if (*f) - *f = fxdr_unsigned(int, **tl); - else if (fxdr_unsigned(int, **tl)) - nfsm_adv_xx(NFSX_V3FATTR, tl, md, dpos); + *f = fxdr_unsigned(int, *tl); + else if (fxdr_unsigned(int, *tl)) + nfsm_adv_xx(NFSX_V3FATTR, md, dpos); } if (*f) { ttvp = *v; @@ -855,15 +856,15 @@ nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f, } int -nfsm_getfh_xx(nfsfh_t **f, int *s, int v3, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_getfh_xx(nfsfh_t **f, int *s, int v3, struct mbuf **md, caddr_t *dpos) { + u_int32_t *tl; if (v3) { - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - *s = fxdr_unsigned(int, **tl); + *s = fxdr_unsigned(int, *tl); if (*s <= 0 || *s > NFSX_V3FHMAX) return EBADRPC; } else @@ -877,8 +878,8 @@ nfsm_getfh_xx(nfsfh_t **f, int *s, int v3, int -nfsm_loadattr_xx(struct vnode **v, struct vattr *va, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md, + caddr_t *dpos) { int t1; @@ -891,16 +892,17 @@ nfsm_loadattr_xx(struct vnode **v, struct vattr *va, } int -nfsm_postop_attr_xx(struct vnode **v, int *f, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md, + caddr_t *dpos) { + u_int32_t *tl; int t1; struct vnode *ttvp = *v; - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - *f = fxdr_unsigned(int, **tl); + *f = fxdr_unsigned(int, *tl); if (*f != 0) { t1 = nfs_loadattrcache(&ttvp, md, dpos, (struct vattr *)0, 1); if (t1 != 0) { @@ -913,24 +915,24 @@ nfsm_postop_attr_xx(struct vnode **v, int *f, } int -nfsm_wcc_data_xx(struct vnode **v, int *f, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md, caddr_t *dpos) { + u_int32_t *tl; int ttattrf, ttretf = 0; int t1; - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - if (**tl == nfs_true) { - *tl = nfsm_dissect_xx(6 * NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + if (*tl == nfs_true) { + tl = nfsm_dissect_xx(6 * NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; if (*f) ttretf = (VTONFS(*v)->n_mtime == - fxdr_unsigned(u_int32_t, *((*tl) + 2))); + fxdr_unsigned(u_int32_t, *(tl + 2))); } - t1 = nfsm_postop_attr_xx(v, &ttattrf, tl, md, dpos); + t1 = nfsm_postop_attr_xx(v, &ttattrf, md, dpos); if (t1) return t1; if (*f) @@ -941,19 +943,19 @@ nfsm_wcc_data_xx(struct vnode **v, int *f, } int -nfsm_strtom_xx(const char *a, int s, int m, - u_int32_t **tl, struct mbuf **mb, caddr_t *bpos) +nfsm_strtom_xx(const char *a, int s, int m, struct mbuf **mb, caddr_t *bpos) { + u_int32_t *tl; int t1; if (s > m) return ENAMETOOLONG; t1 = nfsm_rndup(s) + NFSX_UNSIGNED; if (t1 <= M_TRAILINGSPACE(*mb)) { - *tl = nfsm_build_xx(t1, mb, bpos); - *(*tl)++ = txdr_unsigned(s); - *((*tl) + ((t1 >> 2) - 2)) = 0; - bcopy(a, *tl, s); + tl = nfsm_build_xx(t1, mb, bpos); + *tl++ = txdr_unsigned(s); + *(tl + ((t1 >> 2) - 2)) = 0; + bcopy(a, tl, s); } else { t1 = nfsm_strtmbuf(mb, bpos, a, s); if (t1 != 0) @@ -963,19 +965,19 @@ nfsm_strtom_xx(const char *a, int s, int m, } int -nfsm_fhtom_xx(struct vnode *v, int v3, - u_int32_t **tl, struct mbuf **mb, caddr_t *bpos) +nfsm_fhtom_xx(struct vnode *v, int v3, struct mbuf **mb, caddr_t *bpos) { + u_int32_t *tl; int t1; caddr_t cp; if (v3) { t1 = nfsm_rndup(VTONFS(v)->n_fhsize) + NFSX_UNSIGNED; if (t1 < M_TRAILINGSPACE(*mb)) { - *tl = nfsm_build_xx(t1, mb, bpos); - *(*tl)++ = txdr_unsigned(VTONFS(v)->n_fhsize); - *((*tl) + ((t1 >> 2) - 2)) = 0; - bcopy(VTONFS(v)->n_fhp, *tl, VTONFS(v)->n_fhsize); + tl = nfsm_build_xx(t1, mb, bpos); + *tl++ = txdr_unsigned(VTONFS(v)->n_fhsize); + *(tl + ((t1 >> 2) - 2)) = 0; + bcopy(VTONFS(v)->n_fhp, tl, VTONFS(v)->n_fhsize); } else { t1 = nfsm_strtmbuf(mb, bpos, (const char *)VTONFS(v)->n_fhp, @@ -991,66 +993,67 @@ nfsm_fhtom_xx(struct vnode *v, int v3, } void -nfsm_v3attrbuild_xx(struct vattr *va, int full, - u_int32_t **tl, struct mbuf **mb, caddr_t *bpos) +nfsm_v3attrbuild_xx(struct vattr *va, int full, struct mbuf **mb, + caddr_t *bpos) { + u_int32_t *tl; if (va->va_mode != (mode_t)VNOVAL) { - *tl = nfsm_build_xx(2 * NFSX_UNSIGNED, mb, bpos); - *(*tl)++ = nfs_true; - **tl = txdr_unsigned(va->va_mode); + tl = nfsm_build_xx(2 * NFSX_UNSIGNED, mb, bpos); + *tl++ = nfs_true; + *tl = txdr_unsigned(va->va_mode); } else { - *tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); - **tl = nfs_false; + tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); + *tl = nfs_false; } if (full && va->va_uid != (uid_t)VNOVAL) { - *tl = nfsm_build_xx(2 * NFSX_UNSIGNED, mb, bpos); - *(*tl)++ = nfs_true; - **tl = txdr_unsigned(va->va_uid); + tl = nfsm_build_xx(2 * NFSX_UNSIGNED, mb, bpos); + *tl++ = nfs_true; + *tl = txdr_unsigned(va->va_uid); } else { - *tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); - **tl = nfs_false; + tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); + *tl = nfs_false; } if (full && va->va_gid != (gid_t)VNOVAL) { - *tl = nfsm_build_xx(2 * NFSX_UNSIGNED, mb, bpos); - *(*tl)++ = nfs_true; - **tl = txdr_unsigned(va->va_gid); + tl = nfsm_build_xx(2 * NFSX_UNSIGNED, mb, bpos); + *tl++ = nfs_true; + *tl = txdr_unsigned(va->va_gid); } else { - *tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); - **tl = nfs_false; + tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); + *tl = nfs_false; } if (full && va->va_size != VNOVAL) { - *tl = nfsm_build_xx(3 * NFSX_UNSIGNED, mb, bpos); - *(*tl)++ = nfs_true; - txdr_hyper(va->va_size, *tl); + tl = nfsm_build_xx(3 * NFSX_UNSIGNED, mb, bpos); + *tl++ = nfs_true; + txdr_hyper(va->va_size, tl); } else { - *tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); - **tl = nfs_false; + tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); + *tl = nfs_false; } if (va->va_atime.tv_sec != VNOVAL) { if (va->va_atime.tv_sec != time_second) { - *tl = nfsm_build_xx(3 * NFSX_UNSIGNED, mb, bpos); - *(*tl)++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); - txdr_nfsv3time(&va->va_atime, *tl); + tl = nfsm_build_xx(3 * NFSX_UNSIGNED, mb, bpos); + *tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); + txdr_nfsv3time(&va->va_atime, tl); } else { - *tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); - **tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); + tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); + *tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); } } else { - *tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); - **tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); + tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); + *tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); } if (va->va_mtime.tv_sec != VNOVAL) { if (va->va_mtime.tv_sec != time_second) { - *tl = nfsm_build_xx(3 * NFSX_UNSIGNED, mb, bpos); - *(*tl)++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); - txdr_nfsv3time(&va->va_mtime, *tl); + tl = nfsm_build_xx(3 * NFSX_UNSIGNED, mb, bpos); + *tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); + txdr_nfsv3time(&va->va_mtime, tl); } else { - *tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); - **tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); + tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); + *tl = txdr_unsigned(NFSV3SATTRTIME_TOSERVER); } } else { - *tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); - **tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); + tl = nfsm_build_xx(NFSX_UNSIGNED, mb, bpos); + *tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); } } diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index f49d56a..f441c1b1 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -237,7 +237,6 @@ nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) { struct vnode *vp; struct nfs_statfs *sfp; - u_int32_t *tl; caddr_t bpos, dpos; struct nfsmount *nmp = VFSTONFS(mp); int error = 0, v3 = (nmp->nm_flag & NFSMNT_NFSV3), retattr; @@ -309,7 +308,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct vnode *vp, struct ucred *cred, struct thread *td) { struct nfsv3_fsinfo *fsp; - u_int32_t *tl, pref, max; + u_int32_t pref, max; caddr_t bpos, dpos; int error = 0, retattr; struct mbuf *mreq, *mrep, *md, *mb; diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index be9f533b..9d40b89 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -552,7 +552,6 @@ nfs_getattr(struct vop_getattr_args *ap) { struct vnode *vp = ap->a_vp; struct nfsnode *np = VTONFS(vp); - u_int32_t *tl; caddr_t bpos, dpos; int error = 0; struct mbuf *mreq, *mrep, *md, *mb; @@ -747,7 +746,6 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode **vpp = ap->a_vpp; int flags = cnp->cn_flags; struct vnode *newvp; - u_int32_t *tl; struct nfsmount *nmp; caddr_t bpos, dpos; struct mbuf *mreq, *mrep, *md, *mb; @@ -978,7 +976,6 @@ nfs_readlink(struct vop_readlink_args *ap) int nfs_readlinkrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) { - u_int32_t *tl; caddr_t bpos, dpos; int error = 0, len, attrflag; struct mbuf *mreq, *mrep, *md, *mb; @@ -1476,7 +1473,6 @@ static int nfs_removerpc(struct vnode *dvp, const char *name, int namelen, struct ucred *cred, struct thread *td) { - u_int32_t *tl; caddr_t bpos, dpos; int error = 0, wccflag = NFSV3_WCCRATTR; struct mbuf *mreq, *mrep, *md, *mb; @@ -1597,7 +1593,6 @@ nfs_renamerpc(struct vnode *fdvp, const char *fnameptr, int fnamelen, struct vnode *tdvp, const char *tnameptr, int tnamelen, struct ucred *cred, struct thread *td) { - u_int32_t *tl; caddr_t bpos, dpos; int error = 0, fwccflag = NFSV3_WCCRATTR, twccflag = NFSV3_WCCRATTR; struct mbuf *mreq, *mrep, *md, *mb; @@ -1638,7 +1633,6 @@ nfs_link(struct vop_link_args *ap) struct vnode *vp = ap->a_vp; struct vnode *tdvp = ap->a_tdvp; struct componentname *cnp = ap->a_cnp; - u_int32_t *tl; caddr_t bpos, dpos; int error = 0, wccflag = NFSV3_WCCRATTR, attrflag = 0; struct mbuf *mreq, *mrep, *md, *mb; @@ -1694,7 +1688,6 @@ nfs_symlink(struct vop_symlink_args *ap) struct vattr *vap = ap->a_vap; struct componentname *cnp = ap->a_cnp; struct nfsv2_sattr *sp; - u_int32_t *tl; caddr_t bpos, dpos; int slen, error = 0, wccflag = NFSV3_WCCRATTR, gotvp; struct mbuf *mreq, *mrep, *md, *mb; @@ -1787,7 +1780,6 @@ nfs_mkdir(struct vop_mkdir_args *ap) struct vattr *vap = ap->a_vap; struct componentname *cnp = ap->a_cnp; struct nfsv2_sattr *sp; - u_int32_t *tl; int len; struct nfsnode *np = (struct nfsnode *)0; struct vnode *newvp = (struct vnode *)0; @@ -1864,7 +1856,6 @@ nfs_rmdir(struct vop_rmdir_args *ap) struct vnode *vp = ap->a_vp; struct vnode *dvp = ap->a_dvp; struct componentname *cnp = ap->a_cnp; - u_int32_t *tl; caddr_t bpos, dpos; int error = 0, wccflag = NFSV3_WCCRATTR; struct mbuf *mreq, *mrep, *md, *mb; @@ -2416,7 +2407,6 @@ static int nfs_lookitup(struct vnode *dvp, const char *name, int len, struct ucred *cred, struct thread *td, struct nfsnode **npp) { - u_int32_t *tl; struct vnode *newvp = (struct vnode *)0; struct nfsnode *np, *dnp = VTONFS(dvp); caddr_t bpos, dpos; diff --git a/sys/nfsclient/nfsm_subs.h b/sys/nfsclient/nfsm_subs.h index 2795482..f626dd4 100644 --- a/sys/nfsclient/nfsm_subs.h +++ b/sys/nfsclient/nfsm_subs.h @@ -92,12 +92,12 @@ struct mbuf *nfsm_rpchead(struct ucred *cr, int nmflag, int procid, /* *********************************** */ /* Request generation phase macros */ -int nfsm_fhtom_xx(struct vnode *v, int v3, u_int32_t **tl, - struct mbuf **mb, caddr_t *bpos); -void nfsm_v3attrbuild_xx(struct vattr *va, int full, u_int32_t **tl, - struct mbuf **mb, caddr_t *bpos); -int nfsm_strtom_xx(const char *a, int s, int m, u_int32_t **tl, - struct mbuf **mb, caddr_t *bpos); +int nfsm_fhtom_xx(struct vnode *v, int v3, struct mbuf **mb, + caddr_t *bpos); +void nfsm_v3attrbuild_xx(struct vattr *va, int full, struct mbuf **mb, + caddr_t *bpos); +int nfsm_strtom_xx(const char *a, int s, int m, struct mbuf **mb, + caddr_t *bpos); #define nfsm_bcheck(t1, mreq) \ do { \ @@ -111,13 +111,13 @@ do { \ #define nfsm_fhtom(v, v3) \ do { \ int32_t t1; \ - t1 = nfsm_fhtom_xx((v), (v3), &tl, &mb, &bpos); \ + t1 = nfsm_fhtom_xx((v), (v3), &mb, &bpos); \ nfsm_bcheck(t1, mreq); \ } while (0) /* If full is true, set all fields, otherwise just set mode and time fields */ #define nfsm_v3attrbuild(a, full) \ - nfsm_v3attrbuild_xx(a, full, &tl, &mb, &bpos) + nfsm_v3attrbuild_xx(a, full, &mb, &bpos) #define nfsm_uiotom(p, s) \ do { \ @@ -129,7 +129,7 @@ do { \ #define nfsm_strtom(a, s, m) \ do { \ int t1; \ - t1 = nfsm_strtom_xx((a), (s), (m), &tl, &mb, &bpos); \ + t1 = nfsm_strtom_xx((a), (s), (m), &mb, &bpos); \ nfsm_bcheck(t1, mreq); \ } while (0) @@ -151,41 +151,41 @@ do { \ /* Reply interpretation phase macros */ int nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos); -int nfsm_getfh_xx(nfsfh_t **f, int *s, int v3, u_int32_t **tl, - struct mbuf **md, caddr_t *dpos); -int nfsm_loadattr_xx(struct vnode **v, struct vattr *va, u_int32_t **tl, - struct mbuf **md, caddr_t *dpos); -int nfsm_postop_attr_xx(struct vnode **v, int *f, u_int32_t **tl, - struct mbuf **md, caddr_t *dpos); -int nfsm_wcc_data_xx(struct vnode **v, int *f, u_int32_t **tl, struct mbuf **md, caddr_t *dpos); +int nfsm_getfh_xx(nfsfh_t **f, int *s, int v3, struct mbuf **md, + caddr_t *dpos); +int nfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md, + caddr_t *dpos); +int nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md, + caddr_t *dpos); +int nfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md, + caddr_t *dpos); #define nfsm_mtofh(d, v, v3, f) \ do { \ int32_t t1; \ - t1 = nfsm_mtofh_xx((d), &(v), (v3), &(f), &tl, &md, &dpos); \ + t1 = nfsm_mtofh_xx((d), &(v), (v3), &(f), &md, &dpos); \ nfsm_dcheck(t1, mrep); \ } while (0) #define nfsm_getfh(f, s, v3) \ do { \ int32_t t1; \ - t1 = nfsm_getfh_xx(&(f), &(s), (v3), &tl, &md, &dpos); \ + t1 = nfsm_getfh_xx(&(f), &(s), (v3), &md, &dpos); \ nfsm_dcheck(t1, mrep); \ } while (0) #define nfsm_loadattr(v, a) \ do { \ int32_t t1; \ - t1 = nfsm_loadattr_xx(&v, a, &tl, &md, &dpos); \ + t1 = nfsm_loadattr_xx(&v, a, &md, &dpos); \ nfsm_dcheck(t1, mrep); \ } while (0) #define nfsm_postop_attr(v, f) \ do { \ int32_t t1; \ - t1 = nfsm_postop_attr_xx(&v, &f, &tl, &md, &dpos); \ + t1 = nfsm_postop_attr_xx(&v, &f, &md, &dpos); \ nfsm_dcheck(t1, mrep); \ } while (0) @@ -196,7 +196,7 @@ do { \ #define nfsm_wcc_data(v, f) \ do { \ int32_t t1; \ - t1 = nfsm_wcc_data_xx(&v, &f, &tl, &md, &dpos); \ + t1 = nfsm_wcc_data_xx(&v, &f, &md, &dpos); \ nfsm_dcheck(t1, mrep); \ } while (0) diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index d0c290c..9452fcd 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -244,7 +244,6 @@ nfsrv_getattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct vnode *vp = NULL; nfsfh_t nfh; fhandle_t *fhp; - u_int32_t *tl; caddr_t bpos; int error = 0, rdonly; struct mbuf *mb, *mreq; @@ -449,7 +448,6 @@ nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct vnode *vp, *dirp = NULL; nfsfh_t nfh; fhandle_t *fhp; - u_int32_t *tl; caddr_t bpos; int error = 0, len, dirattr_ret = 1; int v3 = (nfsd->nd_flag & ND_NFSV3), pubflag; @@ -2055,7 +2053,6 @@ nfsrv_remove(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, caddr_t dpos = nfsd->nd_dpos; struct ucred *cred = &nfsd->nd_cr; struct nameidata nd; - u_int32_t *tl; caddr_t bpos; int error = 0, len, dirfor_ret = 1, diraft_ret = 1; int v3 = (nfsd->nd_flag & ND_NFSV3); @@ -2153,7 +2150,6 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct sockaddr *nam = nfsd->nd_nam; caddr_t dpos = nfsd->nd_dpos; struct ucred *cred = &nfsd->nd_cr; - u_int32_t *tl; caddr_t bpos; int error = 0, len, len2, fdirfor_ret = 1, fdiraft_ret = 1; int tdirfor_ret = 1, tdiraft_ret = 1; @@ -2382,7 +2378,6 @@ nfsrv_link(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, caddr_t dpos = nfsd->nd_dpos; struct ucred *cred = &nfsd->nd_cr; struct nameidata nd; - u_int32_t *tl; caddr_t bpos; int error = 0, rdonly, len, dirfor_ret = 1, diraft_ret = 1; int getret = 1, v3 = (nfsd->nd_flag & ND_NFSV3); @@ -2506,7 +2501,6 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct vattr va, dirfor, diraft; struct nameidata nd; struct vattr *vap = &va; - u_int32_t *tl; struct nfsv2_sattr *sp; char *bpos, *pathcp = (char *)0; struct uio io; @@ -2830,7 +2824,6 @@ nfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct sockaddr *nam = nfsd->nd_nam; caddr_t dpos = nfsd->nd_dpos; struct ucred *cred = &nfsd->nd_cr; - u_int32_t *tl; caddr_t bpos; int error = 0, len, dirfor_ret = 1, diraft_ret = 1; int v3 = (nfsd->nd_flag & ND_NFSV3); @@ -3748,7 +3741,6 @@ nfsrv_statfs(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct ucred *cred = &nfsd->nd_cr; struct statfs *sf; struct nfs_statfs *sfp; - u_int32_t *tl; caddr_t bpos; int error = 0, rdonly, getret = 1; int v3 = (nfsd->nd_flag & ND_NFSV3); @@ -3825,7 +3817,6 @@ nfsrv_fsinfo(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct sockaddr *nam = nfsd->nd_nam; caddr_t dpos = nfsd->nd_dpos; struct ucred *cred = &nfsd->nd_cr; - u_int32_t *tl; struct nfsv3_fsinfo *sip; caddr_t bpos; int error = 0, rdonly, getret = 1, pref; @@ -3901,7 +3892,6 @@ nfsrv_pathconf(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct sockaddr *nam = nfsd->nd_nam; caddr_t dpos = nfsd->nd_dpos; struct ucred *cred = &nfsd->nd_cr; - u_int32_t *tl; struct nfsv3_pathconf *pc; caddr_t bpos; int error = 0, rdonly, getret = 1; diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c index dc329c2..0165a80 100644 --- a/sys/nfsserver/nfs_srvsubs.c +++ b/sys/nfsserver/nfs_srvsubs.c @@ -1202,55 +1202,54 @@ nfsrv_setcred(struct ucred *incred, struct ucred *outcred) */ void -nfsm_srvfhtom_xx(fhandle_t *f, int v3, - u_int32_t **tl, struct mbuf **mb, caddr_t *bpos) +nfsm_srvfhtom_xx(fhandle_t *f, int v3, struct mbuf **mb, caddr_t *bpos) { - u_int32_t *cp; + u_int32_t *tl; if (v3) { - *tl = nfsm_build_xx(NFSX_UNSIGNED + NFSX_V3FH, mb, bpos); - *(*tl)++ = txdr_unsigned(NFSX_V3FH); - bcopy(f, (*tl), NFSX_V3FH); + tl = nfsm_build_xx(NFSX_UNSIGNED + NFSX_V3FH, mb, bpos); + *tl++ = txdr_unsigned(NFSX_V3FH); + bcopy(f, tl, NFSX_V3FH); } else { - cp = nfsm_build_xx(NFSX_V2FH, mb, bpos); - bcopy(f, cp, NFSX_V2FH); + tl = nfsm_build_xx(NFSX_V2FH, mb, bpos); + bcopy(f, tl, NFSX_V2FH); } } void -nfsm_srvpostop_fh_xx(fhandle_t *f, - u_int32_t **tl, struct mbuf **mb, caddr_t *bpos) +nfsm_srvpostop_fh_xx(fhandle_t *f, struct mbuf **mb, caddr_t *bpos) { + u_int32_t *tl; - *tl = nfsm_build_xx(2 * NFSX_UNSIGNED + NFSX_V3FH, mb, bpos); - *(*tl)++ = nfs_true; - *(*tl)++ = txdr_unsigned(NFSX_V3FH); - bcopy(f, (*tl), NFSX_V3FH); + tl = nfsm_build_xx(2 * NFSX_UNSIGNED + NFSX_V3FH, mb, bpos); + *tl++ = nfs_true; + *tl++ = txdr_unsigned(NFSX_V3FH); + bcopy(f, tl, NFSX_V3FH); } int -nfsm_srvstrsiz_xx(int *s, int m, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_srvstrsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos) { + u_int32_t *tl; - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - *s = fxdr_unsigned(int32_t, **tl); + *s = fxdr_unsigned(int32_t, *tl); if (*s > m || *s <= 0) return EBADRPC; return 0; } int -nfsm_srvnamesiz_xx(int *s, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_srvnamesiz_xx(int *s, struct mbuf **md, caddr_t *dpos) { + u_int32_t *tl; - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - *s = fxdr_unsigned(int32_t, **tl); + *s = fxdr_unsigned(int32_t, *tl); if (*s > NFS_MAXNAMLEN) return NFSERR_NAMETOL; if (*s <= 0) @@ -1279,26 +1278,27 @@ nfsm_clget_xx(u_int32_t **tl, struct mbuf *mb, struct mbuf **mp, } int -nfsm_srvmtofh_xx(fhandle_t *f, struct nfsrv_descript *nfsd, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_srvmtofh_xx(fhandle_t *f, struct nfsrv_descript *nfsd, struct mbuf **md, + caddr_t *dpos) { + u_int32_t *tl; int fhlen; if (nfsd->nd_flag & ND_NFSV3) { - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - fhlen = fxdr_unsigned(int, **tl); + fhlen = fxdr_unsigned(int, *tl); if (fhlen != 0 && fhlen != NFSX_V3FH) return EBADRPC; } else { fhlen = NFSX_V2FH; } if (fhlen != 0) { - *tl = nfsm_dissect_xx(fhlen, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(fhlen, md, dpos); + if (tl == NULL) return EBADRPC; - bcopy((caddr_t)*tl, (caddr_t)(f), fhlen); + bcopy((caddr_t)tl, (caddr_t)(f), fhlen); } else { bzero((caddr_t)(f), NFSX_V3FH); } @@ -1306,69 +1306,69 @@ nfsm_srvmtofh_xx(fhandle_t *f, struct nfsrv_descript *nfsd, } int -nfsm_srvsattr_xx(struct vattr *a, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos) +nfsm_srvsattr_xx(struct vattr *a, struct mbuf **md, caddr_t *dpos) { + u_int32_t *tl; - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - if (**tl == nfs_true) { - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + if (*tl == nfs_true) { + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - (a)->va_mode = nfstov_mode(**tl); + (a)->va_mode = nfstov_mode(*tl); } - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - if (**tl == nfs_true) { - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + if (*tl == nfs_true) { + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - (a)->va_uid = fxdr_unsigned(uid_t, **tl); + (a)->va_uid = fxdr_unsigned(uid_t, *tl); } - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - if (**tl == nfs_true) { - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + if (*tl == nfs_true) { + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - (a)->va_gid = fxdr_unsigned(gid_t, **tl); + (a)->va_gid = fxdr_unsigned(gid_t, *tl); } - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - if (**tl == nfs_true) { - *tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + if (*tl == nfs_true) { + tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - (a)->va_size = fxdr_hyper(*tl); + (a)->va_size = fxdr_hyper(tl); } - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - switch (fxdr_unsigned(int, **tl)) { + switch (fxdr_unsigned(int, *tl)) { case NFSV3SATTRTIME_TOCLIENT: - *tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - fxdr_nfsv3time(*tl, &(a)->va_atime); + fxdr_nfsv3time(tl, &(a)->va_atime); break; case NFSV3SATTRTIME_TOSERVER: getnanotime(&(a)->va_atime); break; } - *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - switch (fxdr_unsigned(int, **tl)) { + switch (fxdr_unsigned(int, *tl)) { case NFSV3SATTRTIME_TOCLIENT: - *tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos); - if (*tl == NULL) + tl = nfsm_dissect_xx(2 * NFSX_UNSIGNED, md, dpos); + if (tl == NULL) return EBADRPC; - fxdr_nfsv3time(*tl, &(a)->va_mtime); + fxdr_nfsv3time(tl, &(a)->va_mtime); break; case NFSV3SATTRTIME_TOSERVER: getnanotime(&(a)->va_mtime); diff --git a/sys/nfsserver/nfsm_subs.h b/sys/nfsserver/nfsm_subs.h index d39b207..f81127b 100644 --- a/sys/nfsserver/nfsm_subs.h +++ b/sys/nfsserver/nfsm_subs.h @@ -76,19 +76,16 @@ /* ************************************* */ /* Dissection phase macros */ -int nfsm_srvstrsiz_xx(int *s, int m, u_int32_t **tl, struct mbuf **md, - caddr_t *dpos); -int nfsm_srvnamesiz_xx(int *s, u_int32_t **tl, struct mbuf **md, - caddr_t *dpos); +int nfsm_srvstrsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); +int nfsm_srvnamesiz_xx(int *s, struct mbuf **md, caddr_t *dpos); int nfsm_srvmtofh_xx(fhandle_t *f, struct nfsrv_descript *nfsd, - u_int32_t **tl, struct mbuf **md, caddr_t *dpos); -int nfsm_srvsattr_xx(struct vattr *a, u_int32_t **tl, struct mbuf **md, - caddr_t *dpos); + struct mbuf **md, caddr_t *dpos); +int nfsm_srvsattr_xx(struct vattr *a, struct mbuf **md, caddr_t *dpos); #define nfsm_srvstrsiz(s, m) \ do { \ int t1; \ - t1 = nfsm_srvstrsiz_xx(&(s), (m), &tl, &md, &dpos); \ + t1 = nfsm_srvstrsiz_xx(&(s), (m), &md, &dpos); \ if (t1) { \ error = t1; \ nfsm_reply(0); \ @@ -98,7 +95,7 @@ do { \ #define nfsm_srvnamesiz(s) \ do { \ int t1; \ - t1 = nfsm_srvnamesiz_xx(&(s), &tl, &md, &dpos); \ + t1 = nfsm_srvnamesiz_xx(&(s), &md, &dpos); \ if (t1) { \ error = t1; \ nfsm_reply(0); \ @@ -108,7 +105,7 @@ do { \ #define nfsm_srvmtofh(f) \ do { \ int t1; \ - t1 = nfsm_srvmtofh_xx((f), nfsd, &tl, &md, &dpos); \ + t1 = nfsm_srvmtofh_xx((f), nfsd, &md, &dpos); \ if (t1) { \ error = t1; \ nfsm_reply(0); \ @@ -119,7 +116,7 @@ do { \ #define nfsm_srvsattr(a) \ do { \ int t1; \ - t1 = nfsm_srvsattr_xx((a), &tl, &md, &dpos); \ + t1 = nfsm_srvsattr_xx((a), &md, &dpos); \ if (t1) { \ error = t1; \ m_freem(mrep); \ @@ -153,18 +150,17 @@ do { \ /* ************************************* */ /* Reply phase macros - add additional reply info */ -void nfsm_srvfhtom_xx(fhandle_t *f, int v3, u_int32_t **tl, struct mbuf **mb, - caddr_t *bpos); -void nfsm_srvpostop_fh_xx(fhandle_t *f, u_int32_t **tl, struct mbuf **mb, +void nfsm_srvfhtom_xx(fhandle_t *f, int v3, struct mbuf **mb, caddr_t *bpos); +void nfsm_srvpostop_fh_xx(fhandle_t *f, struct mbuf **mb, caddr_t *bpos); void nfsm_clget_xx(u_int32_t **tl, struct mbuf *mb, struct mbuf **mp, char **bp, char **be, caddr_t bpos); #define nfsm_srvfhtom(f, v3) \ - nfsm_srvfhtom_xx((f), (v3), &tl, &mb, &bpos) + nfsm_srvfhtom_xx((f), (v3), &mb, &bpos) #define nfsm_srvpostop_fh(f) \ - nfsm_srvpostop_fh_xx((f), &tl, &mb, &bpos) + nfsm_srvpostop_fh_xx((f), &mb, &bpos) #define nfsm_srvwcc_data(br, b, ar, a) \ nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos) |