summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
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
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')
-rw-r--r--sys/nfsserver/nfs_serv.c10
-rw-r--r--sys/nfsserver/nfs_srvsubs.c140
-rw-r--r--sys/nfsserver/nfsm_subs.h28
3 files changed, 82 insertions, 96 deletions
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)
OpenPOWER on IntegriCloud