summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-09-27 22:40:38 +0000
committerpeter <peter@FreeBSD.org>2001-09-27 22:40:38 +0000
commit2854bb2840809c802db31285bc55e9fc5e73ac20 (patch)
tree0787f81479ebda92d49c697add33a3151d9b4813 /sys/nfsclient
parentdd0c7c11066885a54661583d626cfe224c586ce1 (diff)
downloadFreeBSD-src-2854bb2840809c802db31285bc55e9fc5e73ac20.zip
FreeBSD-src-2854bb2840809c802db31285bc55e9fc5e73ac20.tar.gz
Make nfsm_dissect() have an obvious return value.
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_socket.c8
-rw-r--r--sys/nfsclient/nfs_subs.c54
-rw-r--r--sys/nfsclient/nfs_vfsops.c4
-rw-r--r--sys/nfsclient/nfs_vnops.c36
4 files changed, 52 insertions, 50 deletions
diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c
index 4bf50e4..38c7783 100644
--- a/sys/nfsclient/nfs_socket.c
+++ b/sys/nfsclient/nfs_socket.c
@@ -745,7 +745,7 @@ nfs_reply(struct nfsreq *myrep)
*/
md = mrep;
dpos = mtod(md, caddr_t);
- nfsm_dissect(tl, u_int32_t *, 2*NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, 2 * NFSX_UNSIGNED);
rxid = *tl++;
if (*tl != rpc_reply) {
nfsstats.rpcinvalid++;
@@ -979,7 +979,7 @@ tryagain:
/*
* break down the rpc header and check if ok
*/
- nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, 3 * NFSX_UNSIGNED);
if (*tl++ == rpc_msgdenied) {
if (*tl == rpc_mismatch)
error = EOPNOTSUPP;
@@ -998,10 +998,10 @@ tryagain:
i = fxdr_unsigned(int32_t, *tl); /* len */
if (i > 0)
nfsm_adv(nfsm_rndup(i));
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
/* 0 == ok */
if (*tl == 0) {
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
if (*tl != 0) {
error = fxdr_unsigned(int, *tl);
if ((nmp->nm_flag & NFSMNT_NFSV3) &&
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c
index 2536b17..4b427b5 100644
--- a/sys/nfsclient/nfs_subs.c
+++ b/sys/nfsclient/nfs_subs.c
@@ -461,7 +461,7 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp,
struct nfsnode *np;
int32_t t1;
caddr_t cp2;
- int error = 0, rdev;
+ int rdev;
struct mbuf *md;
enum vtype vtyp;
u_short vmode;
@@ -470,8 +470,9 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp,
md = *mdp;
t1 = (mtod(md, caddr_t) + md->m_len) - *dposp;
- if ((error = nfsm_disct(mdp, dposp, NFSX_FATTR(v3), t1, &cp2)) != 0)
- return (error);
+ cp2 = nfsm_disct(mdp, dposp, NFSX_FATTR(v3), t1);
+ if (cp2 == NULL)
+ return EBADRPC;
fp = (struct nfs_fattr *)cp2;
if (v3) {
vtyp = nfsv3tov_type(fp->fa_type);
@@ -819,9 +820,9 @@ nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f,
int t1;
if (v3) {
- t1 = nfsm_dissect_xx((void **)tl, NFSX_UNSIGNED, md, dpos);
- if (t1)
- return (t1);
+ *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
+ if (*tl == NULL)
+ return EBADRPC;
*f = fxdr_unsigned(int, **tl);
} else
*f = 1;
@@ -835,9 +836,9 @@ nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f,
*v = NFSTOV(ttnp);
}
if (v3) {
- t1 = nfsm_dissect_xx((void **)tl, NFSX_UNSIGNED, md, dpos);
- if (t1)
- return t1;
+ *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))
@@ -857,20 +858,21 @@ int
nfsm_getfh_xx(nfsfh_t **f, int *s, int v3,
u_int32_t **tl, struct mbuf **md, caddr_t *dpos)
{
- int t1;
if (v3) {
- t1 = nfsm_dissect_xx((void **)tl, NFSX_UNSIGNED, md, dpos);
- if (t1)
- return t1;
+ *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
+ if (*tl == NULL)
+ return EBADRPC;
*s = fxdr_unsigned(int, **tl);
- if (*s <= 0 || *s > NFSX_V3FHMAX) {
+ if (*s <= 0 || *s > NFSX_V3FHMAX)
return EBADRPC;
- }
} else
*s = NFSX_V2FH;
- t1 = nfsm_dissect_xx((void **)f, nfsm_rndup(*s), md, dpos);
- return t1;
+ *f = nfsm_dissect_xx(nfsm_rndup(*s), md, dpos);
+ if (*f == NULL)
+ return EBADRPC;
+ else
+ return 0;
}
@@ -895,9 +897,9 @@ nfsm_postop_attr_xx(struct vnode **v, int *f,
int t1;
struct vnode *ttvp = *v;
- t1 = nfsm_dissect_xx((void **)tl, NFSX_UNSIGNED, md, dpos);
- if (t1 != 0)
- return t1;
+ *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
+ if (*tl == NULL)
+ return EBADRPC;
*f = fxdr_unsigned(int, **tl);
if (*f != 0) {
t1 = nfs_loadattrcache(&ttvp, md, dpos, (struct vattr *)0, 1);
@@ -917,13 +919,13 @@ nfsm_wcc_data_xx(struct vnode **v, int *f,
int ttattrf, ttretf = 0;
int t1;
- t1 = nfsm_dissect_xx((void **)tl, NFSX_UNSIGNED, md, dpos);
- if (t1 != 0)
- return t1;
+ *tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos);
+ if (*tl == NULL)
+ return EBADRPC;
if (**tl == nfs_true) {
- t1 = nfsm_dissect_xx((void **)tl, 6 * NFSX_UNSIGNED, md, dpos);
- if (t1 != 0)
- return t1;
+ *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)));
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index cbf03aa..670a5aa 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -267,7 +267,7 @@ nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
m_freem(mrep);
goto nfsmout;
}
- nfsm_dissect(sfp, struct nfs_statfs *, NFSX_STATFS(v3));
+ sfp = nfsm_dissect(struct nfs_statfs *, NFSX_STATFS(v3));
sbp->f_flags = nmp->nm_flag;
sbp->f_iosize = nfs_iosize(nmp);
if (v3) {
@@ -323,7 +323,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct vnode *vp, struct ucred *cred,
nfsm_request(vp, NFSPROC_FSINFO, td, cred);
nfsm_postop_attr(vp, retattr);
if (!error) {
- nfsm_dissect(fsp, struct nfsv3_fsinfo *, NFSX_V3FSINFO);
+ fsp = nfsm_dissect(struct nfsv3_fsinfo *, NFSX_V3FSINFO);
pref = fxdr_unsigned(u_int32_t, fsp->fs_wtpref);
if (pref < nmp->nm_wsize && pref >= NFS_FABLKSIZE)
nmp->nm_wsize = (pref + NFS_FABLKSIZE - 1) &
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index 2473f3d..60a1cc9 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -283,7 +283,7 @@ nfs3_access_otw(struct vnode *vp, int wmode, struct thread *td,
nfsm_request(vp, NFSPROC_ACCESS, td, cred);
nfsm_postop_attr(vp, attrflag);
if (!error) {
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
rmode = fxdr_unsigned(u_int32_t, *tl);
np->n_mode = rmode;
np->n_modeuid = cred->cr_uid;
@@ -1040,7 +1040,7 @@ nfs_readrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
m_freem(mrep);
goto nfsmout;
}
- nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, 2 * NFSX_UNSIGNED);
eof = fxdr_unsigned(int, *(tl + 1));
} else
nfsm_loadattr(vp, (struct vattr *)0);
@@ -1114,7 +1114,7 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
wccflag = NFSV3_WCCCHK;
nfsm_wcc_data(vp, wccflag);
if (!error) {
- nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED
+ tl = nfsm_dissect(u_int32_t *, 2 * NFSX_UNSIGNED
+ NFSX_V3WRITEVERF);
rlen = fxdr_unsigned(int, *tl++);
if (rlen == 0) {
@@ -1985,7 +1985,7 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
if (v3) {
nfsm_postop_attr(vp, attrflag);
if (!error) {
- nfsm_dissect(tl, u_int32_t *,
+ tl = nfsm_dissect(u_int32_t *,
2 * NFSX_UNSIGNED);
dnp->n_cookieverf.nfsuquad[0] = *tl++;
dnp->n_cookieverf.nfsuquad[1] = *tl;
@@ -1994,18 +1994,18 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
goto nfsmout;
}
}
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
more_dirs = fxdr_unsigned(int, *tl);
/* loop thru the dir entries, doctoring them to 4bsd form */
while (more_dirs && bigenough) {
if (v3) {
- nfsm_dissect(tl, u_int32_t *,
+ tl = nfsm_dissect(u_int32_t *,
3 * NFSX_UNSIGNED);
fileno = fxdr_hyper(tl);
len = fxdr_unsigned(int, *(tl + 2));
} else {
- nfsm_dissect(tl, u_int32_t *,
+ tl = nfsm_dissect(u_int32_t *,
2 * NFSX_UNSIGNED);
fileno = fxdr_unsigned(u_quad_t, *tl++);
len = fxdr_unsigned(int, *tl);
@@ -2053,10 +2053,10 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
} else
nfsm_adv(nfsm_rndup(len));
if (v3) {
- nfsm_dissect(tl, u_int32_t *,
+ tl = nfsm_dissect(u_int32_t *,
3 * NFSX_UNSIGNED);
} else {
- nfsm_dissect(tl, u_int32_t *,
+ tl = nfsm_dissect(u_int32_t *,
2 * NFSX_UNSIGNED);
}
if (bigenough) {
@@ -2073,7 +2073,7 @@ nfs_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
* If at end of rpc data, get the eof boolean
*/
if (!more_dirs) {
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
more_dirs = (fxdr_unsigned(int, *tl) == 0);
}
m_freem(mrep);
@@ -2175,14 +2175,14 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
m_freem(mrep);
goto nfsmout;
}
- nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, 3 * NFSX_UNSIGNED);
dnp->n_cookieverf.nfsuquad[0] = *tl++;
dnp->n_cookieverf.nfsuquad[1] = *tl++;
more_dirs = fxdr_unsigned(int, *tl);
/* loop thru the dir entries, doctoring them to 4bsd form */
while (more_dirs && bigenough) {
- nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, 3 * NFSX_UNSIGNED);
fileno = fxdr_hyper(tl);
len = fxdr_unsigned(int, *(tl + 2));
if (len <= 0 || len > NFS_MAXNAMLEN) {
@@ -2229,7 +2229,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
uiop->uio_resid -= tlen;
} else
nfsm_adv(nfsm_rndup(len));
- nfsm_dissect(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, 3 * NFSX_UNSIGNED);
if (bigenough) {
cookie.nfsuquad[0] = *tl++;
cookie.nfsuquad[1] = *tl++;
@@ -2246,7 +2246,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
dpossav1 = dpos;
mdsav1 = md;
nfsm_adv(NFSX_V3FATTR);
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
doit = fxdr_unsigned(int, *tl);
if (doit) {
nfsm_getfh(fhp, fhsize, 1);
@@ -2278,7 +2278,7 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
}
} else {
/* Just skip over the file handle */
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
i = fxdr_unsigned(int, *tl);
nfsm_adv(nfsm_rndup(i));
}
@@ -2289,14 +2289,14 @@ nfs_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
vput(newvp);
newvp = NULLVP;
}
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
more_dirs = fxdr_unsigned(int, *tl);
}
/*
* If at end of rpc data, get the eof boolean
*/
if (!more_dirs) {
- nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED);
+ tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED);
more_dirs = (fxdr_unsigned(int, *tl) == 0);
}
m_freem(mrep);
@@ -2500,7 +2500,7 @@ nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct ucred *cred,
nfsm_request(vp, NFSPROC_COMMIT, td, cred);
nfsm_wcc_data(vp, wccflag);
if (!error) {
- nfsm_dissect(tl, u_int32_t *, NFSX_V3WRITEVERF);
+ tl = nfsm_dissect(u_int32_t *, NFSX_V3WRITEVERF);
if (bcmp((caddr_t)nmp->nm_verf, (caddr_t)tl,
NFSX_V3WRITEVERF)) {
bcopy((caddr_t)tl, (caddr_t)nmp->nm_verf,
OpenPOWER on IntegriCloud