diff options
-rw-r--r-- | sys/nfs/nfs_serv.c | 50 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 8 | ||||
-rw-r--r-- | sys/nfs/nfs_vnops.c | 52 | ||||
-rw-r--r-- | sys/nfs/nfsm_subs.h | 9 |
4 files changed, 73 insertions, 46 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 8a77269caa4..b4c231631a5 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.40 2006/04/02 18:35:11 otto Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.41 2007/09/11 13:41:52 blambert Exp $ */ /* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */ /* @@ -151,7 +151,8 @@ nfsrv3_access(nfsd, slp, procp, mrq) nfsm_srvpostop_attr(getret, &va); nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(nfsmode); - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -196,7 +197,8 @@ nfsrv_getattr(nfsd, slp, procp, mrq) return (0); nfsm_build(fp, struct nfs_fattr *, NFSX_FATTR(nfsd->nd_flag & ND_NFSV3)); nfsm_srvfillattr(&va, fp); - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -327,7 +329,8 @@ out: nfsm_build(fp, struct nfs_fattr *, NFSX_V2FATTR); nfsm_srvfillattr(&va, fp); } - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -401,7 +404,8 @@ nfsrv_lookup(nfsd, slp, procp, mrq) nfsm_build(fp, struct nfs_fattr *, NFSX_V2FATTR); nfsm_srvfillattr(&va, fp); } - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -501,7 +505,8 @@ out: nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(len); mb->m_next = mp3; - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -667,7 +672,8 @@ nfsrv_read(nfsd, slp, procp, mrq) *tl++ = nfs_false; } *tl = txdr_unsigned(cnt); - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -850,7 +856,8 @@ nfsrv_write(nfsd, slp, procp, mrq) nfsm_build(fp, struct nfs_fattr *, NFSX_V2FATTR); nfsm_srvfillattr(&va, fp); } - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -1689,7 +1696,8 @@ out: nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft); return (0); } - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -1965,7 +1973,8 @@ out1: nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft); return (0); } - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -2312,7 +2321,8 @@ out: nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft); return (0); } - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -2612,7 +2622,8 @@ again: mp->m_len += bp - bpos; FREE((caddr_t)rbuf, M_TEMP); FREE((caddr_t)cookies, M_TEMP); - nfsm_srvdone; +nfsmout: + return(error); } int @@ -2930,7 +2941,8 @@ invalid: mp->m_len += bp - bpos; FREE((caddr_t)cookies, M_TEMP); FREE((caddr_t)rbuf, M_TEMP); - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -2989,7 +3001,8 @@ nfsrv_commit(nfsd, slp, procp, mrq) *tl = txdr_unsigned(boottime.tv_usec); } else return (0); - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -3065,7 +3078,8 @@ nfsrv_statfs(nfsd, slp, procp, mrq) sfp->sf_bfree = txdr_unsigned(sf->f_bfree); sfp->sf_bavail = txdr_unsigned(sf->f_bavail); } - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -3133,7 +3147,8 @@ nfsrv_fsinfo(nfsd, slp, procp, mrq) sip->fs_properties = txdr_unsigned(NFSV3FSINFO_LINK | NFSV3FSINFO_SYMLINK | NFSV3FSINFO_HOMOGENEOUS | NFSV3FSINFO_CANSETTIME); - nfsm_srvdone; +nfsmout: + return(error); } /* @@ -3200,7 +3215,8 @@ nfsrv_pathconf(nfsd, slp, procp, mrq) */ pc->pc_caseinsensitive = nfs_false; pc->pc_casepreserving = nfs_true; - nfsm_srvdone; +nfsmout: + return(error); } /* diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 06b2abd7af2..3f1d9670b33 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.66 2007/06/20 15:00:43 thib Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.67 2007/09/11 13:41:52 blambert Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -169,7 +169,8 @@ nfs_statfs(mp, sbp, p) &sbp->mount_info.nfs_args, sizeof(struct nfs_args)); } strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); - nfsm_reqdone; + m_freem(mrep); +nfsmout: vrele(vp); crfree(cred); return (error); @@ -231,7 +232,8 @@ nfs_fsinfo(nmp, vp, cred, p) } nmp->nm_flag |= NFSMNT_GOTFSINFO; } - nfsm_reqdone; + m_freem(mrep); +nfsmout: return (error); } diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 97f00d86548..3be7f373bf2 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.75 2007/06/01 23:47:57 deraadt Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.76 2007/09/11 13:41:52 blambert Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -201,7 +201,8 @@ nfs_null(vp, cred, procp) nfsm_reqhead(vp, NFSPROC_NULL, 0); nfsm_request(vp, NFSPROC_NULL, procp, cred); - nfsm_reqdone; + m_freem(mrep); +nfsmout: return (error); } @@ -284,7 +285,8 @@ nfs_access(v) if ((rmode & mode) != mode) error = EACCES; } - nfsm_reqdone; + m_freem(mrep); +nfsmout: return (error); } else return (nfsspec_access(ap)); @@ -453,7 +455,8 @@ nfs_getattr(v) nfsm_request(vp, NFSPROC_GETATTR, ap->a_p, ap->a_cred); if (!error) nfsm_loadattr(vp, ap->a_vap); - nfsm_reqdone; + m_freem(mrep); +nfsmout: return (error); } @@ -586,7 +589,8 @@ nfs_setattrrpc(vp, vap, cred, procp) nfsm_wcc_data(vp, wccflag); } else nfsm_loadattr(vp, (struct vattr *)0); - nfsm_reqdone; + m_freem(mrep); +nfsmout: return (error); } @@ -814,12 +818,13 @@ dorpc: cache_enter(dvp, newvp, cnp); } *vpp = newvp; - nfsm_reqdone; + m_freem(mrep); +nfsmout: if (error) { /* * We get here only because of errors returned by * the RPC. Otherwise we'll have returned above - * (the nfsm_* macros will jump to nfsm_reqdone + * (the nfsm_* macros will jump to nfsmout * on error). */ if (error == ENOENT && (cnp->cn_flags & MAKEENTRY) && @@ -907,7 +912,8 @@ nfs_readlinkrpc(vp, uiop, cred) nfsm_strsiz(len, NFS_MAXPATHLEN); nfsm_mtouio(uiop, len); } - nfsm_reqdone; + m_freem(mrep); +nfsmout: return (error); } @@ -1158,7 +1164,8 @@ nfs_mknodrpc(dvp, vpp, cnp, vap) } if (v3) nfsm_wcc_data(dvp, wccflag); - nfsm_reqdone; + m_freem(mrep); +nfsmout: if (error) { if (newvp) vrele(newvp); @@ -1275,7 +1282,8 @@ again: } if (v3) nfsm_wcc_data(dvp, wccflag); - nfsm_reqdone; + m_freem(mrep); +nfsmout: if (error) { if (v3 && (fmode & O_EXCL) && error == NFSERR_NOTSUPP) { fmode &= ~O_EXCL; @@ -1410,7 +1418,8 @@ nfs_removerpc(dvp, name, namelen, cred, proc) nfsm_request(dvp, NFSPROC_REMOVE, proc, cred); if (v3) nfsm_wcc_data(dvp, wccflag); - nfsm_reqdone; + m_freem(mrep); +nfsmout: VTONFS(dvp)->n_flag |= NMODIFIED; if (!wccflag) VTONFS(dvp)->n_attrstamp = 0; @@ -1533,7 +1542,8 @@ nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, proc) nfsm_wcc_data(fdvp, fwccflag); nfsm_wcc_data(tdvp, twccflag); } - nfsm_reqdone; + m_freem(mrep); +nfsmout: VTONFS(fdvp)->n_flag |= NMODIFIED; VTONFS(tdvp)->n_flag |= NMODIFIED; if (!fwccflag) @@ -1590,7 +1600,8 @@ nfs_link(v) nfsm_postop_attr(vp, attrflag); nfsm_wcc_data(dvp, wccflag); } - nfsm_reqdone; + m_freem(mrep); +nfsmout: pool_put(&namei_pool, cnp->cn_pnbuf); VTONFS(dvp)->n_flag |= NMODIFIED; if (!attrflag) @@ -1654,7 +1665,8 @@ nfs_symlink(v) nfsm_mtofh(dvp, newvp, v3, gotvp); nfsm_wcc_data(dvp, wccflag); } - nfsm_reqdone; + m_freem(mrep); +nfsmout: if (newvp) vrele(newvp); pool_put(&namei_pool, cnp->cn_pnbuf); @@ -1717,7 +1729,8 @@ nfs_mkdir(v) nfsm_mtofh(dvp, newvp, v3, gotvp); if (v3) nfsm_wcc_data(dvp, wccflag); - nfsm_reqdone; + m_freem(mrep); +nfsmout: VTONFS(dvp)->n_flag |= NMODIFIED; if (!wccflag) VTONFS(dvp)->n_attrstamp = 0; @@ -1783,7 +1796,8 @@ nfs_rmdir(v) nfsm_request(dvp, NFSPROC_RMDIR, cnp->cn_proc, cnp->cn_cred); if (v3) nfsm_wcc_data(dvp, wccflag); - nfsm_reqdone; + m_freem(mrep); +nfsmout: pool_put(&namei_pool, cnp->cn_pnbuf); VTONFS(dvp)->n_flag |= NMODIFIED; if (!wccflag) @@ -2511,7 +2525,8 @@ nfs_lookitup(dvp, name, len, cred, procp, npp) } else nfsm_loadattr(newvp, (struct vattr *)0); } - nfsm_reqdone; + m_freem(mrep); +nfsmout: if (npp && *npp == NULL) { if (error) { if (newvp) @@ -2560,7 +2575,8 @@ nfs_commit(vp, offset, cnt, procp) error = NFSERR_STALEWRITEVERF; } } - nfsm_reqdone; + m_freem(mrep); +nfsmout: return (error); } diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index a9a8805135f..f96561b8d45 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsm_subs.h,v 1.16 2006/04/02 18:35:11 otto Exp $ */ +/* $OpenBSD: nfsm_subs.h,v 1.17 2007/09/11 13:41:52 blambert Exp $ */ /* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */ /* @@ -330,9 +330,6 @@ #define nfsm_reqhead(v,a,s) \ mb = mreq = nfsm_reqh((v),(a),(s),&bpos) -#define nfsm_reqdone m_freem(mrep); \ - nfsmout: - #define nfsm_rndup(a) (((a)+3)&(~0x3)) #define nfsm_request(v, t, p, c) \ @@ -362,10 +359,6 @@ goto nfsmout; \ } -#define nfsm_srvdone \ - nfsmout: \ - return(error) - #define nfsm_reply(s) \ { \ nfsd->nd_repstat = error; \ |