summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver/nfs_srvsubs.c
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-12-18 01:22:09 +0000
committeriedowse <iedowse@FreeBSD.org>2001-12-18 01:22:09 +0000
commit6e9f1df98f816467a63dc5b41cea58f28843e390 (patch)
tree9270c37106f68890c1fcce6d366590e69faa1848 /sys/nfsserver/nfs_srvsubs.c
parentbba76f2085975aeba776356b2556c99b8c882bd5 (diff)
downloadFreeBSD-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
Diffstat (limited to 'sys/nfsserver/nfs_srvsubs.c')
-rw-r--r--sys/nfsserver/nfs_srvsubs.c140
1 files changed, 70 insertions, 70 deletions
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);
OpenPOWER on IntegriCloud