diff options
author | phk <phk@FreeBSD.org> | 1994-10-02 17:27:07 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1994-10-02 17:27:07 +0000 |
commit | 42a70cf15d0f6b56dfc6a6a731adc52eaaa456f0 (patch) | |
tree | 872dcb4237f95fe1c61b19e3e868408388109a43 /sys/nfsclient | |
parent | b1b8768e6a30f06704cfedaeae8f3397ad760a4e (diff) | |
download | FreeBSD-src-42a70cf15d0f6b56dfc6a6a731adc52eaaa456f0.zip FreeBSD-src-42a70cf15d0f6b56dfc6a6a731adc52eaaa456f0.tar.gz |
Prototyping and general gcc-shutting up. Gcc has one warning now which looks
bad, I will get to it eventually, unless somebody beats me to it.
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs.h | 51 | ||||
-rw-r--r-- | sys/nfsclient/nfs_bio.c | 65 | ||||
-rw-r--r-- | sys/nfsclient/nfs_nfsiod.c | 53 | ||||
-rw-r--r-- | sys/nfsclient/nfs_node.c | 11 | ||||
-rw-r--r-- | sys/nfsclient/nfs_socket.c | 41 | ||||
-rw-r--r-- | sys/nfsclient/nfs_subs.c | 41 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 51 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 46 | ||||
-rw-r--r-- | sys/nfsclient/nfsargs.h | 51 | ||||
-rw-r--r-- | sys/nfsclient/nfsm_subs.h | 45 | ||||
-rw-r--r-- | sys/nfsclient/nfsnode.h | 9 | ||||
-rw-r--r-- | sys/nfsclient/nfsstats.h | 51 |
12 files changed, 387 insertions, 128 deletions
diff --git a/sys/nfsclient/nfs.h b/sys/nfsclient/nfs.h index acabf8f..844acdc 100644 --- a/sys/nfsclient/nfs.h +++ b/sys/nfsclient/nfs.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs.h 8.1 (Berkeley) 6/10/93 - * $Id: nfs.h,v 1.3 1994/08/04 06:03:46 davidg Exp $ + * $Id: nfs.h,v 1.4 1994/08/21 06:50:08 paul Exp $ */ #ifndef _NFS_NFS_H_ @@ -291,7 +291,7 @@ struct nfsd { int nd_repstat; /* Reply status value */ struct ucred nd_cr; /* Credentials for req. */ int nd_nqlflag; /* Leasing flag */ - int nd_duration; /* Lease duration */ + u_long nd_duration; /* Lease duration */ int nd_authlen; /* Authenticator len */ u_char nd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ struct proc *nd_procp; /* Proc ptr */ @@ -302,6 +302,53 @@ struct nfsd { #define NFSD_REQINPROG 0x04 #define NFSD_NEEDAUTH 0x08 #define NFSD_AUTHFAIL 0x10 + +int nfs_reply __P((struct nfsreq *)); +int nfs_getreq __P((struct nfsd *,int)); +int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *)); +int nfs_rephead __P((int,struct nfsd *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *)); +int nfs_sndlock __P((int *,struct nfsreq *)); +int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); +int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int)); +int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *)); +int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int)); +int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *)); +int nfs_asyncio __P((struct buf *,struct ucred *)); +int nfs_doio __P((struct buf *,struct ucred *,struct proc *)); +int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *)); +int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *)); +int nfs_readdirlookrpc __P((struct vnode *,register struct uio *,struct ucred *)); +int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); +int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,struct ucred *,struct nfssvc_sock *,struct mbuf *,int *)); +int nfsrv_access __P((struct vnode *,int,struct ucred *,int,struct proc *)); +int netaddr_match __P((int,union nethostaddr *,struct mbuf *)); +int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *)); +int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *)); +int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct proc *)); +void nfsm_adj __P((struct mbuf *,int,int)); +int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *)); +void nfsrv_initcache __P((void)); +int nfs_rcvlock __P((struct nfsreq *)); +int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,int *,char **,int *)); +int nfs_msg __P((struct proc *,char *,char *)); +int nfs_adv __P((struct mbuf **,caddr_t *,int,int)); +int nfsrv_getstream __P((struct nfssvc_sock *,int)); +void nfs_nhinit __P((void)); +void nfs_timer __P((void*)); +struct nfsnode ** nfs_hash __P((nfsv2fh_t *)); +int nfssvc_iod __P((struct proc *)); +int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *)); +int nfssvc_addsock __P((struct file *,struct mbuf *)); +int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *)); +int nfsrv_getcache __P((struct mbuf *,struct nfsd *,struct mbuf **)); +void nfsrv_updatecache __P((struct mbuf *,struct nfsd *,int,struct mbuf *)); +int mountnfs __P((struct nfs_args *,struct mount *,struct mbuf *,char *,char *,struct vnode **)); +int nfs_connect __P((struct nfsmount *,struct nfsreq *)); +int nfs_getattrcache __P((struct vnode *,struct vattr *)); +int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long)); +int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *)); +int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *)); +void nfsrv_init __P((int)); #endif /* KERNEL */ #endif diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index fe28e7c..deede73 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -34,12 +34,13 @@ * SUCH DAMAGE. * * @(#)nfs_bio.c 8.5 (Berkeley) 1/4/94 - * $Id: nfs_bio.c,v 1.4 1994/08/08 09:11:41 davidg Exp $ + * $Id: nfs_bio.c,v 1.5 1994/08/18 22:35:35 wollman Exp $ */ #include <sys/param.h> #include <sys/systm.h> #include <sys/resourcevar.h> +#include <sys/signalvar.h> #include <sys/proc.h> #include <sys/buf.h> #include <sys/vnode.h> @@ -118,20 +119,24 @@ nfs_bioread(vp, uio, ioflag, cred) if (np->n_flag & NMODIFIED) { if ((nmp->nm_flag & NFSMNT_MYWRITE) == 0 || vp->v_type != VREG) { - if (error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1)) + error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + if (error) return (error); } np->n_attrstamp = 0; np->n_direofoffset = 0; - if (error = VOP_GETATTR(vp, &vattr, cred, p)) + error = VOP_GETATTR(vp, &vattr, cred, p); + if (error) return (error); np->n_mtime = vattr.va_mtime.ts_sec; } else { - if (error = VOP_GETATTR(vp, &vattr, cred, p)) + error = VOP_GETATTR(vp, &vattr, cred, p); + if (error) return (error); if (np->n_mtime != vattr.va_mtime.ts_sec) { np->n_direofoffset = 0; - if (error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1)) + error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + if (error) return (error); np->n_mtime = vattr.va_mtime.ts_sec; } @@ -156,14 +161,16 @@ nfs_bioread(vp, uio, ioflag, cred) np->n_direofoffset = 0; cache_purge(vp); } - if (error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1)) + error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + if (error) return (error); np->n_brev = np->n_lrev; } } else if (vp->v_type == VDIR && (np->n_flag & NMODIFIED)) { np->n_direofoffset = 0; cache_purge(vp); - if (error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1)) + error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + if (error) return (error); } } @@ -178,6 +185,10 @@ nfs_bioread(vp, uio, ioflag, cred) case VDIR: error = nfs_readdirrpc(vp, uio, cred); break; + default: + printf(" NQNFSNONCACHE: type %x unexpected\n", + vp->v_type); + break; }; return (error); } @@ -232,7 +243,8 @@ again: if ((bp->b_flags & (B_DONE | B_DELWRI)) == 0) { bp->b_flags |= B_READ; not_readin = 0; - if (error = nfs_doio(bp, cred, p)) { + error = nfs_doio(bp, cred, p); + if (error) { brelse(bp); return (error); } @@ -273,7 +285,8 @@ again: return (EINTR); if ((bp->b_flags & B_DONE) == 0) { bp->b_flags |= B_READ; - if (error = nfs_doio(bp, cred, p)) { + error = nfs_doio(bp, cred, p); + if (error) { brelse(bp); return (error); } @@ -290,7 +303,8 @@ again: return (EINTR); if ((bp->b_flags & B_DONE) == 0) { bp->b_flags |= B_READ; - if (error = nfs_doio(bp, cred, p)) { + error = nfs_doio(bp, cred, p); + if (error) { brelse(bp); return (error); } @@ -320,6 +334,9 @@ again: n = min(uio->uio_resid, NFS_DIRBLKSIZ - bp->b_resid); got_buf = 1; break; + default: + printf(" nfsbioread: type %x unexpected\n",vp->v_type); + break; }; if (n > 0) { @@ -336,7 +353,10 @@ again: case VDIR: uio->uio_offset = bp->b_blkno; break; - }; + default: + printf(" nfsbioread: type %x unexpected\n",vp->v_type); + break; + } if (got_buf) brelse(bp); } while (error == 0 && uio->uio_resid > 0 && n > 0); @@ -383,12 +403,14 @@ nfs_write(ap) if (ioflag & (IO_APPEND | IO_SYNC)) { if (np->n_flag & NMODIFIED) { np->n_attrstamp = 0; - if (error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1)) + error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + if (error) return (error); } if (ioflag & IO_APPEND) { np->n_attrstamp = 0; - if (error = VOP_GETATTR(vp, &vattr, cred, p)) + error = VOP_GETATTR(vp, &vattr, cred, p); + if (error) return (error); uio->uio_offset = np->n_size; } @@ -428,7 +450,8 @@ nfs_write(ap) return (error); if (np->n_lrev != np->n_brev || (np->n_flag & NQNFSNONCACHE)) { - if (error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1)) + error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + if (error) return (error); np->n_brev = np->n_lrev; } @@ -483,13 +506,15 @@ again: if (np->n_lrev != np->n_brev || (np->n_flag & NQNFSNONCACHE)) { brelse(bp); - if (error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1)) + error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + if (error) return (error); np->n_brev = np->n_lrev; goto again; } } - if (error = uiomove((char *)bp->b_data + on, n, uio)) { + error = uiomove((char *)bp->b_data + on, n, uio); + if (error) { bp->b_flags |= B_ERROR; brelse(bp); return (error); @@ -522,7 +547,8 @@ again: */ if ((np->n_flag & NQNFSNONCACHE) || (ioflag & IO_SYNC)) { bp->b_proc = p; - if (error = VOP_BWRITE(bp)) + error = VOP_BWRITE(bp); + if (error) return (error); } else if ((n + on) == biosize && (nmp->nm_flag & NFSMNT_NQNFS) == 0) { @@ -666,7 +692,7 @@ nfs_asyncio(bp, cred) int nfs_doio(bp, cr, p) register struct buf *bp; - struct cred *cr; + struct ucred *cr; struct proc *p; { register struct uio *uiop; @@ -748,6 +774,9 @@ nfs_doio(bp, cr, p) */ bp->b_blkno = uiop->uio_offset; break; + default: + printf("nfs_doio: type %x unexpected\n",vp->v_type); + break; }; if (error) { bp->b_flags |= B_ERROR; diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c index ef134f6..5645e45 100644 --- a/sys/nfsclient/nfs_nfsiod.c +++ b/sys/nfsclient/nfs_nfsiod.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_syscalls.c 8.3 (Berkeley) 1/4/94 - * $Id$ + * $Id: nfs_syscalls.c,v 1.3 1994/08/02 07:52:15 davidg Exp $ */ #include <sys/param.h> @@ -123,10 +123,12 @@ getfh(p, uap, retval) /* * Must be super user */ - if (error = suser(p->p_ucred, &p->p_acflag)) + error = suser(p->p_ucred, &p->p_acflag); + if(error) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->fname, p); - if (error = namei(&nd)) + error = namei(&nd); + if (error) return (error); vp = nd.ni_vp; bzero((caddr_t)&fh, sizeof(fh)); @@ -173,7 +175,8 @@ nfssvc(p, uap, retval) /* * Must be super user */ - if (error = suser(p->p_ucred, &p->p_acflag)) + error = suser(p->p_ucred, &p->p_acflag); + if(error) return (error); while (nfssvc_sockhead.ns_flag & SLP_INIT) { nfssvc_sockhead.ns_flag |= SLP_WANTINIT; @@ -182,11 +185,13 @@ nfssvc(p, uap, retval) if (uap->flag & NFSSVC_BIOD) error = nfssvc_iod(p); else if (uap->flag & NFSSVC_MNTD) { - if (error = copyin(uap->argp, (caddr_t)&ncd, sizeof (ncd))) + error = copyin(uap->argp, (caddr_t)&ncd, sizeof (ncd)); + if (error) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, ncd.ncd_dirp, p); - if (error = namei(&nd)) + error = namei(&nd); + if (error) return (error); if ((nd.ni_vp->v_flag & VROOT) == 0) error = EINVAL; @@ -201,24 +206,29 @@ nfssvc(p, uap, retval) error = nqnfs_clientd(nmp, p->p_ucred, &ncd, uap->flag, uap->argp, p); } else if (uap->flag & NFSSVC_ADDSOCK) { - if (error = copyin(uap->argp, (caddr_t)&nfsdarg, - sizeof(nfsdarg))) + error = copyin(uap->argp, (caddr_t)&nfsdarg, sizeof(nfsdarg)); + if (error) return (error); - if (error = getsock(p->p_fd, nfsdarg.sock, &fp)) + error = getsock(p->p_fd, nfsdarg.sock, &fp); + if (error) return (error); /* * Get the client address for connected sockets. */ if (nfsdarg.name == NULL || nfsdarg.namelen == 0) nam = (struct mbuf *)0; - else if (error = sockargs(&nam, nfsdarg.name, nfsdarg.namelen, - MT_SONAME)) - return (error); + else { + error = sockargs(&nam, nfsdarg.name, nfsdarg.namelen, + MT_SONAME); + if (error) + return (error); + } error = nfssvc_addsock(fp, nam); } else { - if (error = copyin(uap->argp, (caddr_t)nsd, sizeof (*nsd))) + error = copyin(uap->argp, (caddr_t)nsd, sizeof (*nsd)); + if (error) return (error); - if ((uap->flag & NFSSVC_AUTHIN) && (nfsd = nsd->nsd_nfsd) && + if ((uap->flag & NFSSVC_AUTHIN) && ((nfsd = nsd->nsd_nfsd)) && (nfsd->nd_slp->ns_flag & SLP_VALID)) { slp = nfsd->nd_slp; @@ -264,7 +274,8 @@ nfssvc(p, uap, retval) nuidp->nu_uid = nsd->nsd_uid; insque(nuidp, (struct nfsuid *)slp); nuh = &slp->ns_uidh[NUIDHASH(nsd->nsd_uid)]; - if (nuidp->nu_hnext = *nuh) + nuidp->nu_hnext = *nuh; + if (nuidp->nu_hnext) nuidp->nu_hnext->nu_hprev = nuidp; nuidp->nu_hprev = (struct nfsuid *)0; *nuh = nuidp; @@ -319,7 +330,8 @@ nfssvc_addsock(fp, mynam) siz = NFS_MAXPACKET + sizeof (u_long); else siz = NFS_MAXPACKET; - if (error = soreserve(so, siz, siz)) { + error = soreserve(so, siz, siz); + if (error) { m_freem(mynam); return (error); } @@ -473,7 +485,8 @@ nfssvc_nfsd(nsd, argp, p) * nam2 == NULL for connection based protocols to disable * recent request caching. */ - if (nam2 = nd->nd_nam) { + nam2 = nd->nd_nam; + if (nam2) { nam = nam2; cacherep = RC_CHECKIT; } else { @@ -702,7 +715,8 @@ nfsrv_zapsock(slp) struct mbuf *m; slp->ns_flag &= ~SLP_ALLFLAGS; - if (fp = slp->ns_fp) { + fp = slp->ns_fp; + if (fp) { slp->ns_fp = (struct file *)0; so = slp->ns_so; so->so_upcall = NULL; @@ -743,7 +757,8 @@ nfs_getauth(nmp, rep, cred, auth_type, auth_str, auth_len) nmp->nm_flag |= NFSMNT_WANTAUTH; (void) tsleep((caddr_t)&nmp->nm_authtype, PSOCK, "nfsauth1", 2 * hz); - if (error = nfs_sigintr(nmp, rep, rep->r_procp)) { + error = nfs_sigintr(nmp, rep, rep->r_procp); + if (error) { nmp->nm_flag &= ~NFSMNT_WANTAUTH; return (error); } diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c index 00e42c2..974edde 100644 --- a/sys/nfsclient/nfs_node.c +++ b/sys/nfsclient/nfs_node.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_node.c 8.2 (Berkeley) 12/30/93 - * $Id: nfs_node.c,v 1.3 1994/08/02 07:52:06 davidg Exp $ + * $Id: nfs_node.c,v 1.4 1994/08/10 19:48:23 davidg Exp $ */ #include <sys/param.h> @@ -123,7 +123,8 @@ loop: *npp = np; return(0); } - if (error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &nvp)) { + error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &nvp); + if (error) { *npp = 0; return (error); } @@ -135,7 +136,8 @@ loop: * Insert the nfsnode in the hash queue for its new file handle */ np->n_flag = 0; - if (nq = *nhpp) + nq = *nhpp; + if (nq) nq->n_back = &np->n_forw; np->n_forw = nq; np->n_back = nhpp; @@ -210,7 +212,8 @@ nfs_reclaim(ap) /* * Remove the nfsnode from its hash chain. */ - if (nq = np->n_forw) + nq = np->n_forw; + if (nq) nq->n_back = np->n_back; *np->n_back = nq; diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index a7b3dfc..4cc719f 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_socket.c 8.3 (Berkeley) 1/12/94 - * $Id$ + * $Id: nfs_socket.c,v 1.3 1994/08/02 07:52:11 davidg Exp $ */ /* @@ -228,8 +228,9 @@ nfs_connect(nmp, rep) nmp->nm_so = (struct socket *)0; saddr = mtod(nmp->nm_nam, struct sockaddr *); - if (error = socreate(saddr->sa_family, - &nmp->nm_so, nmp->nm_sotype, nmp->nm_soproto)) + error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype, + nmp->nm_soproto); + if (error) goto bad; so = nmp->nm_so; nmp->nm_soflags = so->so_proto->pr_flags; @@ -263,7 +264,8 @@ nfs_connect(nmp, rep) goto bad; } } else { - if (error = soconnect(so, nmp->nm_nam)) + error = soconnect(so, nmp->nm_nam); + if (error) goto bad; /* @@ -324,7 +326,8 @@ nfs_connect(nmp, rep) rcvreserve = (nmp->nm_rsize + NFS_MAXPKTHDR + sizeof (u_long)) * 2; } - if (error = soreserve(so, sndreserve, rcvreserve)) + error = soreserve(so, sndreserve, rcvreserve); + if (error) goto bad; so->so_rcv.sb_flags |= SB_NOINTR; so->so_snd.sb_flags |= SB_NOINTR; @@ -362,7 +365,7 @@ nfs_reconnect(rep) int error; nfs_disconnect(nmp); - while (error = nfs_connect(nmp, rep)) { + while ((error = nfs_connect(nmp, rep))) { if (error == EINTR || error == ERESTART) return (EINTR); (void) tsleep((caddr_t)&lbolt, PSOCK, "nfscon", 0); @@ -511,7 +514,8 @@ nfs_receive(rep, aname, mp) * until we have an entire rpc request/reply. */ if (sotype != SOCK_DGRAM) { - if (error = nfs_sndlock(&rep->r_nmp->nm_flag, rep)) + error = nfs_sndlock(&rep->r_nmp->nm_flag, rep); + if (error) return (error); tryagain: /* @@ -527,8 +531,10 @@ tryagain: nfs_sndunlock(&rep->r_nmp->nm_flag); return (EINTR); } - if ((so = rep->r_nmp->nm_so) == NULL) { - if (error = nfs_reconnect(rep)) { + so = rep->r_nmp->nm_so; + if (!so) { + error = nfs_reconnect(rep); + if (error) { nfs_sndunlock(&rep->r_nmp->nm_flag); return (error); } @@ -537,7 +543,8 @@ tryagain: while (rep->r_flags & R_MUSTRESEND) { m = m_copym(rep->r_mreq, 0, M_COPYALL, M_WAIT); nfsstats.rpcretries++; - if (error = nfs_send(so, rep->r_nmp->nm_nam, m, rep)) { + error = nfs_send(so, rep->r_nmp->nm_nam, m, rep); + if (error) { if (error == EINTR || error == ERESTART || (error = nfs_reconnect(rep))) { nfs_sndunlock(&rep->r_nmp->nm_flag); @@ -708,7 +715,8 @@ nfs_reply(myrep) * Also necessary for connection based protocols to avoid * race conditions during a reconnect. */ - if (error = nfs_rcvlock(myrep)) + error = nfs_rcvlock(myrep); + if (error) return (error); /* Already received, bye bye */ if (myrep->r_mrep != NULL) { @@ -1236,7 +1244,7 @@ nfs_rephead(siz, nd, err, cache, frev, mrq, mbp, bposp) */ void nfs_timer(arg) - void *arg; + void *arg; /* never used */ { register struct nfsreq *rep; register struct mbuf *m; @@ -1620,7 +1628,8 @@ nfsrv_rcv(so, arg, waitflag) /* * Now try and parse record(s) out of the raw stream data. */ - if (error = nfsrv_getstream(slp, waitflag)) { + error = nfsrv_getstream(slp, waitflag); + if (error) { if (error == EPERM) slp->ns_flag |= SLP_DISCONN; else @@ -1786,7 +1795,8 @@ nfsrv_dorec(slp, nd) if ((slp->ns_flag & SLP_VALID) == 0 || (m = slp->ns_rec) == (struct mbuf *)0) return (ENOBUFS); - if (slp->ns_rec = m->m_nextpkt) + slp->ns_rec = m->m_nextpkt; + if (slp->ns_rec) m->m_nextpkt = (struct mbuf *)0; else slp->ns_recend = (struct mbuf *)0; @@ -1799,7 +1809,8 @@ nfsrv_dorec(slp, nd) nd->nd_md = nd->nd_mrep = m; } nd->nd_dpos = mtod(nd->nd_md, caddr_t); - if (error = nfs_getreq(nd, TRUE)) { + error = nfs_getreq(nd, TRUE); + if (error) { m_freem(nd->nd_nam); return (error); } diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index cb52f5d..ee8200c 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_subs.c,v 1.3 1994/08/02 07:52:13 davidg Exp $ + * $Id: nfs_subs.c,v 1.5 1994/09/22 22:10:44 wollman Exp $ */ /* @@ -57,6 +57,8 @@ #include <sys/syscall.h> #endif +#include <vm/vm.h> + #include <nfs/rpcv2.h> #include <nfs/nfsv2.h> #include <nfs/nfsnode.h> @@ -643,7 +645,7 @@ nfs_init() * Initialize reply list and start timer */ nfsreqh.r_prev = nfsreqh.r_next = &nfsreqh; - nfs_timer(); + nfs_timer(0); /* * Set up lease_check and lease_updatetime so that other parts @@ -702,7 +704,8 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) dpos = *dposp; t1 = (mtod(md, caddr_t) + md->m_len) - dpos; isnq = (VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS); - if (error = nfsm_disct(&md, &dpos, NFSX_FATTR(isnq), t1, &cp2)) + error = nfsm_disct(&md, &dpos, NFSX_FATTR(isnq), t1, &cp2); + if (error) return (error); fp = (struct nfsv2_fattr *)cp2; vtyp = nfstov_type(fp->fa_type); @@ -735,11 +738,13 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) } if (vp->v_type == VCHR || vp->v_type == VBLK) { vp->v_op = spec_nfsv2nodeop_p; - if (nvp = checkalias(vp, (dev_t)rdev, vp->v_mount)) { + nvp = checkalias(vp, (dev_t)rdev, vp->v_mount); + if (nvp) { /* * Discard unneeded vnode, but save its nfsnode. */ - if (nq = np->n_forw) + nq = np->n_forw; + if (nq) nq->n_back = np->n_back; *np->n_back = nq; nvp->v_data = vp->v_data; @@ -752,7 +757,8 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) */ np->n_vnode = nvp; nhpp = (struct nfsnode **)nfs_hash(&np->n_fh); - if (nq = *nhpp) + nq = *nhpp; + if (nq) nq->n_back = &np->n_forw; np->n_forw = nq; np->n_back = nhpp; @@ -947,16 +953,20 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, p) if (len > 0) { if (rem >= len) *dposp += len; - else if (error = nfs_adv(mdp, dposp, len, rem)) - goto out; + else { + error = nfs_adv(mdp, dposp, len, rem); + if (error) + goto out; + } } ndp->ni_pathlen = tocp - cnp->cn_pnbuf; cnp->cn_nameptr = cnp->cn_pnbuf; /* * Extract and set starting directory. */ - if (error = nfsrv_fhtovp(fhp, FALSE, &dp, ndp->ni_cnd.cn_cred, slp, - nam, &rdonly)) + error = nfsrv_fhtovp(fhp, FALSE, &dp, ndp->ni_cnd.cn_cred, slp, + nam, &rdonly); + if (error) goto out; if (dp->v_type != VDIR) { vrele(dp); @@ -972,7 +982,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, p) * And call lookup() to do the real work */ cnp->cn_proc = p; - if (error = lookup(ndp)) + error = lookup(ndp); + if (error) goto out; /* * Check for encountering a symbolic link @@ -1057,7 +1068,7 @@ nfsm_adj(mp, len, nul) } count -= m->m_len; } - while (m = m->m_next) + for (m = m->m_next;m;m = m->m_next) m->m_len = 0; } @@ -1085,9 +1096,11 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp) int error, exflags; *vpp = (struct vnode *)0; - if ((mp = getvfs(&fhp->fh_fsid)) == NULL) + mp = getvfs(&fhp->fh_fsid); + if (!mp) return (ESTALE); - if (error = VFS_FHTOVP(mp, &fhp->fh_fid, nam, vpp, &exflags, &credanon)) + error = VFS_FHTOVP(mp, &fhp->fh_fid, nam, vpp, &exflags, &credanon); + if (error) return (error); /* * Check/setup credentials. diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 8b8012f..375cfc5 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_vfsops.c,v 1.3 1994/08/20 16:03:19 davidg Exp $ + * $Id: nfs_vfsops.c,v 1.4 1994/09/21 03:47:22 wollman Exp $ */ #include <sys/param.h> @@ -49,6 +49,7 @@ #include <sys/buf.h> #include <sys/mbuf.h> #include <sys/socket.h> +#include <sys/socketvar.h> #include <sys/systm.h> #include <net/if.h> @@ -122,7 +123,8 @@ nfs_statfs(mp, sbp, p) nmp = VFSTONFS(mp); isnq = (nmp->nm_flag & NFSMNT_NQNFS); - if (error = nfs_nget(mp, &nmp->nm_fh, &np)) + error = nfs_nget(mp, &nmp->nm_fh, &np); + if (error) return (error); vp = NFSTOV(np); nfsstats.rpccnt[NFSPROC_STATFS]++; @@ -201,9 +203,11 @@ nfs_mountroot() * Do enough of ifconfig(8) so that the critical net interface can * talk to the server. */ - if (error = socreate(nd->myif.ifra_addr.sa_family, &so, SOCK_DGRAM, 0)) + error = socreate(nd->myif.ifra_addr.sa_family, &so, SOCK_DGRAM, 0); + if (error) panic("nfs_mountroot: socreate: %d", error); - if (error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, p)) + error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, p); + if (error) panic("nfs_mountroot: SIOCAIFADDR: %d", error); soclose(so); @@ -217,10 +221,11 @@ nfs_mountroot() sin = mask; sin.sin_family = AF_INET; sin.sin_len = sizeof(sin); - if (error = rtrequest(RTM_ADD, (struct sockaddr *)&sin, + error = rtrequest(RTM_ADD, (struct sockaddr *)&sin, (struct sockaddr *)&nd->mygateway, (struct sockaddr *)&mask, - RTF_UP | RTF_GATEWAY, (struct rtentry **)0)) + RTF_UP | RTF_GATEWAY, (struct rtentry **)0); + if (error) panic("nfs_mountroot: RTM_ADD: %d", error); } @@ -307,7 +312,8 @@ nfs_mountdiskless(path, which, mountflag, sin, args, vpp) bcopy((caddr_t)sin, mtod(m, caddr_t), sin->sin_len); m->m_len = sin->sin_len; nfsargs_ntoh(args); - if (error = mountnfs(args, mp, m, which, path, vpp)) + error = mountnfs(args, mp, m, which, path, vpp); + if (error) panic("nfs_mountroot: mount %s on %s: %d", path, which, error); return (mp); @@ -361,19 +367,23 @@ nfs_mount(mp, path, data, ndp, p) u_int len; nfsv2fh_t nfh; - if (error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args))) + error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args)); + if (error) return (error); - if (error = copyin((caddr_t)args.fh, (caddr_t)&nfh, sizeof (nfsv2fh_t))) + error = copyin((caddr_t)args.fh, (caddr_t)&nfh, sizeof (nfsv2fh_t)); + if (error) return (error); - if (error = copyinstr(path, pth, MNAMELEN-1, &len)) + error = copyinstr(path, pth, MNAMELEN-1, &len); + if (error) return (error); bzero(&pth[len], MNAMELEN - len); - if (error = copyinstr(args.hostname, hst, MNAMELEN-1, &len)) + error = copyinstr(args.hostname, hst, MNAMELEN-1, &len); + if (error) return (error); bzero(&hst[len], MNAMELEN - len); /* sockargs() call must be after above copyin() calls */ - if (error = sockargs(&nam, (caddr_t)args.addr, - args.addrlen, MT_SONAME)) + error = sockargs(&nam, (caddr_t)args.addr, args.addrlen, MT_SONAME); + if (error) return (error); args.fh = &nfh; error = mountnfs(&args, mp, nam, pth, hst, &vp); @@ -515,7 +525,8 @@ mountnfs(argp, mp, nam, pth, hst, vpp) * this problem, because one can identify root inodes by their * number == ROOTINO (2). */ - if (error = nfs_nget(mp, &nmp->nm_fh, &np)) + error = nfs_nget(mp, &nmp->nm_fh, &np); + if (error) goto bad; *vpp = NFSTOV(np); @@ -562,7 +573,8 @@ nfs_unmount(mp, mntflags, p) * the remote root. See comment in mountnfs(). The VFS unmount() * has done vput on this vnode, otherwise we would get deadlock! */ - if (error = nfs_nget(mp, &nmp->nm_fh, &np)) + error = nfs_nget(mp, &nmp->nm_fh, &np); + if (error) return(error); vp = NFSTOV(np); if (vp->v_usecount > 2) { @@ -576,7 +588,8 @@ nfs_unmount(mp, mntflags, p) nmp->nm_flag |= NFSMNT_DISMINPROG; while (nmp->nm_inprog != NULLVP) (void) tsleep((caddr_t)&lbolt, PSOCK, "nfsdism", 0); - if (error = vflush(mp, vp, flags)) { + error = vflush(mp, vp, flags); + if (error) { vput(vp); nmp->nm_flag &= ~NFSMNT_DISMINPROG; return (error); @@ -617,7 +630,8 @@ nfs_root(mp, vpp) int error; nmp = VFSTONFS(mp); - if (error = nfs_nget(mp, &nmp->nm_fh, &np)) + error = nfs_nget(mp, &nmp->nm_fh, &np); + if (error) return (error); vp = NFSTOV(np); vp->v_type = VDIR; @@ -659,7 +673,8 @@ loop: continue; if (vget(vp, 1)) goto loop; - if (error = VOP_FSYNC(vp, cred, waitfor, p)) + error = VOP_FSYNC(vp, cred, waitfor, p); + if (error) allerror = error; vput(vp); } diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 3949870..8c4189a 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94 - * $Id: nfs_vnops.c,v 1.6 1994/09/21 03:47:25 wollman Exp $ + * $Id: nfs_vnops.c,v 1.7 1994/09/22 19:38:28 wollman Exp $ */ /* @@ -365,11 +365,13 @@ nfs_open(ap) return (error); np->n_attrstamp = 0; np->n_direofoffset = 0; - if (error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p)) + error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p); + if (error) return (error); np->n_mtime = vattr.va_mtime.ts_sec; } else { - if (error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p)) + error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p); + if (error) return (error); if (np->n_mtime != vattr.va_mtime.ts_sec) { np->n_direofoffset = 0; @@ -698,13 +700,14 @@ nfsmout: m_freem(mrep); return (EISDIR); } - if (error = nfs_nget(dvp->v_mount, fhp, &np)) { + error = nfs_nget(dvp->v_mount, fhp, &np); + if (error) { m_freem(mrep); return (error); } newvp = NFSTOV(np); - if (error = - nfs_loadattrcache(&newvp, &md, &dpos, (struct vattr *)0)) { + error = nfs_loadattrcache(&newvp, &md, &dpos, (struct vattr*)0); + if (error) { vrele(newvp); m_freem(mrep); return (error); @@ -719,13 +722,15 @@ nfsmout: VREF(dvp); newvp = dvp; } else { - if (error = nfs_nget(dvp->v_mount, fhp, &np)) { + error = nfs_nget(dvp->v_mount, fhp, &np); + if (error) { m_freem(mrep); return (error); } newvp = NFSTOV(np); } - if (error = nfs_loadattrcache(&newvp, &md, &dpos, (struct vattr *)0)) { + error = nfs_loadattrcache(&newvp, &md, &dpos, (struct vattr *)0); + if (error) { vrele(newvp); m_freem(mrep); return (error); @@ -970,7 +975,8 @@ nfs_mknod(ap) vput(dvp); return (EOPNOTSUPP); } - if (error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) { + error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc); + if (error) { VOP_ABORTOP(dvp, cnp); vput(dvp); return (error); @@ -1030,7 +1036,8 @@ nfs_create(ap) struct mbuf *mreq, *mrep, *md, *mb, *mb2; struct vattr vattr; - if (error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) { + error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc); + if (error) { VOP_ABORTOP(dvp, cnp); vput(dvp); return (error); @@ -1415,7 +1422,8 @@ nfs_mkdir(ap) struct mbuf *mreq, *mrep, *md, *mb, *mb2; struct vattr vattr; - if (error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) { + error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc); + if (error) { VOP_ABORTOP(dvp, cnp); vput(dvp); return (error); @@ -1793,12 +1801,14 @@ nfs_readdirlookrpc(vp, uiop, cred) newvp = vp; np = VTONFS(vp); } else { - if (error = nfs_nget(vp->v_mount, fhp, &np)) + error = nfs_nget(vp->v_mount, fhp, &np); + if (error) doit = 0; newvp = NFSTOV(np); } - if (error = nfs_loadattrcache(&newvp, &md, &dpos, - (struct vattr *)0)) + error = nfs_loadattrcache(&newvp, &md, &dpos, + (struct vattr *)0); + if (error) doit = 0; nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); fileno = fxdr_unsigned(u_long, *tl++); @@ -1941,7 +1951,8 @@ nfs_sillyrename(dvp, vp, cnp) goto bad; } } - if (error = nfs_renameit(dvp, cnp, sp)) + error = nfs_renameit(dvp, cnp, sp); + if (error) goto bad; nfs_lookitup(sp, &np->n_fh, cnp->cn_proc); np->n_sillyrename = sp; @@ -2222,7 +2233,7 @@ nfs_print(ap) register struct vnode *vp = ap->a_vp; register struct nfsnode *np = VTONFS(vp); - printf("tag VT_NFS, fileid %d fsid 0x%x", + printf("tag VT_NFS, fileid %ld fsid 0x%lx", np->n_vattr.va_fileid, np->n_vattr.va_fsid); if (vp->v_type == VFIFO) fifo_printinfo(vp); @@ -2346,7 +2357,8 @@ nfsspec_access(ap) if (cred->cr_uid == 0) return (0); vap = &vattr; - if (error = VOP_GETATTR(ap->a_vp, vap, cred, ap->a_p)) + error = VOP_GETATTR(ap->a_vp, vap, cred, ap->a_p); + if (error) return (error); /* * Access check is based on only one of owner, group, public. diff --git a/sys/nfsclient/nfsargs.h b/sys/nfsclient/nfsargs.h index acabf8f..844acdc 100644 --- a/sys/nfsclient/nfsargs.h +++ b/sys/nfsclient/nfsargs.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs.h 8.1 (Berkeley) 6/10/93 - * $Id: nfs.h,v 1.3 1994/08/04 06:03:46 davidg Exp $ + * $Id: nfs.h,v 1.4 1994/08/21 06:50:08 paul Exp $ */ #ifndef _NFS_NFS_H_ @@ -291,7 +291,7 @@ struct nfsd { int nd_repstat; /* Reply status value */ struct ucred nd_cr; /* Credentials for req. */ int nd_nqlflag; /* Leasing flag */ - int nd_duration; /* Lease duration */ + u_long nd_duration; /* Lease duration */ int nd_authlen; /* Authenticator len */ u_char nd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ struct proc *nd_procp; /* Proc ptr */ @@ -302,6 +302,53 @@ struct nfsd { #define NFSD_REQINPROG 0x04 #define NFSD_NEEDAUTH 0x08 #define NFSD_AUTHFAIL 0x10 + +int nfs_reply __P((struct nfsreq *)); +int nfs_getreq __P((struct nfsd *,int)); +int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *)); +int nfs_rephead __P((int,struct nfsd *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *)); +int nfs_sndlock __P((int *,struct nfsreq *)); +int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); +int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int)); +int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *)); +int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int)); +int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *)); +int nfs_asyncio __P((struct buf *,struct ucred *)); +int nfs_doio __P((struct buf *,struct ucred *,struct proc *)); +int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *)); +int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *)); +int nfs_readdirlookrpc __P((struct vnode *,register struct uio *,struct ucred *)); +int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); +int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,struct ucred *,struct nfssvc_sock *,struct mbuf *,int *)); +int nfsrv_access __P((struct vnode *,int,struct ucred *,int,struct proc *)); +int netaddr_match __P((int,union nethostaddr *,struct mbuf *)); +int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *)); +int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *)); +int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct proc *)); +void nfsm_adj __P((struct mbuf *,int,int)); +int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *)); +void nfsrv_initcache __P((void)); +int nfs_rcvlock __P((struct nfsreq *)); +int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,int *,char **,int *)); +int nfs_msg __P((struct proc *,char *,char *)); +int nfs_adv __P((struct mbuf **,caddr_t *,int,int)); +int nfsrv_getstream __P((struct nfssvc_sock *,int)); +void nfs_nhinit __P((void)); +void nfs_timer __P((void*)); +struct nfsnode ** nfs_hash __P((nfsv2fh_t *)); +int nfssvc_iod __P((struct proc *)); +int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *)); +int nfssvc_addsock __P((struct file *,struct mbuf *)); +int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *)); +int nfsrv_getcache __P((struct mbuf *,struct nfsd *,struct mbuf **)); +void nfsrv_updatecache __P((struct mbuf *,struct nfsd *,int,struct mbuf *)); +int mountnfs __P((struct nfs_args *,struct mount *,struct mbuf *,char *,char *,struct vnode **)); +int nfs_connect __P((struct nfsmount *,struct nfsreq *)); +int nfs_getattrcache __P((struct vnode *,struct vattr *)); +int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long)); +int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *)); +int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *)); +void nfsrv_init __P((int)); #endif /* KERNEL */ #endif diff --git a/sys/nfsclient/nfsm_subs.h b/sys/nfsclient/nfsm_subs.h index 603f362..954a92f 100644 --- a/sys/nfsclient/nfsm_subs.h +++ b/sys/nfsclient/nfsm_subs.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfsm_subs.h 8.1 (Berkeley) 6/16/93 - * $Id: nfsm_subs.h,v 1.2 1994/08/02 07:52:20 davidg Exp $ + * $Id: nfsm_subs.h,v 1.3 1994/08/21 06:50:10 paul Exp $ */ #ifndef _NFS_NFSM_SUBS_H_ @@ -95,11 +95,14 @@ extern struct mbuf *nfsm_reqh(); if (t1 >= (s)) { \ (a) = (c)(dpos); \ dpos += (s); \ - } else if (error = nfsm_disct(&md, &dpos, (s), t1, &cp2)) { \ - m_freem(mrep); \ - goto nfsmout; \ } else { \ - (a) = (c)cp2; \ + error = nfsm_disct(&md, &dpos, (s), t1, &cp2); \ + if (error) { \ + m_freem(mrep); \ + goto nfsmout; \ + } else { \ + (a) = (c)cp2; \ + } \ } } #define nfsm_fhtom(v) \ @@ -113,7 +116,8 @@ extern struct mbuf *nfsm_reqh(); #define nfsm_mtofh(d,v) \ { struct nfsnode *np; nfsv2fh_t *fhp; \ nfsm_dissect(fhp,nfsv2fh_t *,NFSX_FH); \ - if (error = nfs_nget((d)->v_mount, fhp, &np)) { \ + error = nfs_nget((d)->v_mount, fhp, &np); \ + if (error) { \ m_freem(mrep); \ goto nfsmout; \ } \ @@ -123,7 +127,8 @@ extern struct mbuf *nfsm_reqh(); #define nfsm_loadattr(v,a) \ { struct vnode *tvp = (v); \ - if (error = nfs_loadattrcache(&tvp, &md, &dpos, (a))) { \ + error = nfs_loadattrcache(&tvp, &md, &dpos, (a)); \ + if (error) { \ m_freem(mrep); \ goto nfsmout; \ } \ @@ -152,7 +157,8 @@ extern struct mbuf *nfsm_reqh(); } #define nfsm_uiotom(p,s) \ - if (error = nfsm_uiotombuf((p),&mb,(s),&bpos)) { \ + error = nfsm_uiotombuf((p),&mb,(s),&bpos); \ + if (error) { \ m_freem(mreq); \ goto nfsmout; \ } @@ -166,8 +172,9 @@ extern struct mbuf *nfsm_reqh(); #define nfsm_rndup(a) (((a)+3)&(~0x3)) #define nfsm_request(v, t, p, c) \ - if (error = nfs_request((v), mreq, (t), (p), \ - (c), &mrep, &md, &dpos)) \ + error = nfs_request((v), mreq, (t), (p), \ + (c), &mrep, &md, &dpos); \ + if (error) \ goto nfsmout #define nfsm_strtom(a,s,m) \ @@ -182,9 +189,12 @@ extern struct mbuf *nfsm_reqh(); *tl++ = txdr_unsigned(s); \ *(tl+((t2>>2)-2)) = 0; \ bcopy((caddr_t)(a), (caddr_t)tl, (s)); \ - } else if (error = nfsm_strtmbuf(&mb, &bpos, (a), (s))) { \ - m_freem(mreq); \ - goto nfsmout; \ + } else { \ + error = nfsm_strtmbuf(&mb, &bpos, (a), (s)); \ + if (error) { \ + m_freem(mreq); \ + goto nfsmout; \ + } \ } #define nfsm_srvdone \ @@ -210,9 +220,12 @@ extern struct mbuf *nfsm_reqh(); t1 = mtod(md, caddr_t)+md->m_len-dpos; \ if (t1 >= (s)) { \ dpos += (s); \ - } else if (error = nfs_adv(&md, &dpos, (s), t1)) { \ - m_freem(mrep); \ - goto nfsmout; \ + } else { \ + error = nfs_adv(&md, &dpos, (s), t1); \ + if (error) { \ + m_freem(mrep); \ + goto nfsmout; \ + } \ } #define nfsm_srvmtofh(f) \ diff --git a/sys/nfsclient/nfsnode.h b/sys/nfsclient/nfsnode.h index f0b586a..5bb170b 100644 --- a/sys/nfsclient/nfsnode.h +++ b/sys/nfsclient/nfsnode.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfsnode.h 8.4 (Berkeley) 2/13/94 - * $Id: nfsnode.h,v 1.5 1994/08/21 06:50:11 paul Exp $ + * $Id: nfsnode.h,v 1.6 1994/09/22 19:38:29 wollman Exp $ */ #ifndef _NFS_NFSNODE_H_ @@ -163,6 +163,13 @@ int nfs_vfree __P((struct vop_vfree_args *)); int nfs_truncate __P((struct vop_truncate_args *)); int nfs_update __P((struct vop_update_args *)); int nfs_bwrite __P((struct vop_bwrite_args *)); + +/* other stuff */ +int nfs_removeit __P((struct sillyrename *)); +int nfs_nget __P((struct mount *,nfsv2fh_t *,struct nfsnode **)); +int nfs_lookitup __P((struct sillyrename *,nfsv2fh_t *,struct proc *)); +int nfs_sillyrename __P((struct vnode *,struct vnode *,struct componentname *)); + #endif /* KERNEL */ #endif diff --git a/sys/nfsclient/nfsstats.h b/sys/nfsclient/nfsstats.h index acabf8f..844acdc 100644 --- a/sys/nfsclient/nfsstats.h +++ b/sys/nfsclient/nfsstats.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs.h 8.1 (Berkeley) 6/10/93 - * $Id: nfs.h,v 1.3 1994/08/04 06:03:46 davidg Exp $ + * $Id: nfs.h,v 1.4 1994/08/21 06:50:08 paul Exp $ */ #ifndef _NFS_NFS_H_ @@ -291,7 +291,7 @@ struct nfsd { int nd_repstat; /* Reply status value */ struct ucred nd_cr; /* Credentials for req. */ int nd_nqlflag; /* Leasing flag */ - int nd_duration; /* Lease duration */ + u_long nd_duration; /* Lease duration */ int nd_authlen; /* Authenticator len */ u_char nd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ struct proc *nd_procp; /* Proc ptr */ @@ -302,6 +302,53 @@ struct nfsd { #define NFSD_REQINPROG 0x04 #define NFSD_NEEDAUTH 0x08 #define NFSD_AUTHFAIL 0x10 + +int nfs_reply __P((struct nfsreq *)); +int nfs_getreq __P((struct nfsd *,int)); +int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *)); +int nfs_rephead __P((int,struct nfsd *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *)); +int nfs_sndlock __P((int *,struct nfsreq *)); +int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); +int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int)); +int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *)); +int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int)); +int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *)); +int nfs_asyncio __P((struct buf *,struct ucred *)); +int nfs_doio __P((struct buf *,struct ucred *,struct proc *)); +int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *)); +int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *)); +int nfs_readdirlookrpc __P((struct vnode *,register struct uio *,struct ucred *)); +int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); +int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,struct ucred *,struct nfssvc_sock *,struct mbuf *,int *)); +int nfsrv_access __P((struct vnode *,int,struct ucred *,int,struct proc *)); +int netaddr_match __P((int,union nethostaddr *,struct mbuf *)); +int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *)); +int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *)); +int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct proc *)); +void nfsm_adj __P((struct mbuf *,int,int)); +int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *)); +void nfsrv_initcache __P((void)); +int nfs_rcvlock __P((struct nfsreq *)); +int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,int *,char **,int *)); +int nfs_msg __P((struct proc *,char *,char *)); +int nfs_adv __P((struct mbuf **,caddr_t *,int,int)); +int nfsrv_getstream __P((struct nfssvc_sock *,int)); +void nfs_nhinit __P((void)); +void nfs_timer __P((void*)); +struct nfsnode ** nfs_hash __P((nfsv2fh_t *)); +int nfssvc_iod __P((struct proc *)); +int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *)); +int nfssvc_addsock __P((struct file *,struct mbuf *)); +int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *)); +int nfsrv_getcache __P((struct mbuf *,struct nfsd *,struct mbuf **)); +void nfsrv_updatecache __P((struct mbuf *,struct nfsd *,int,struct mbuf *)); +int mountnfs __P((struct nfs_args *,struct mount *,struct mbuf *,char *,char *,struct vnode **)); +int nfs_connect __P((struct nfsmount *,struct nfsreq *)); +int nfs_getattrcache __P((struct vnode *,struct vattr *)); +int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long)); +int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *)); +int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *)); +void nfsrv_init __P((int)); #endif /* KERNEL */ #endif |