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.
This commit is contained in:
parent
f86eaaca2c
commit
48fbb6cc7e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3305
@ -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
|
||||
|
@ -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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_write(ap)
|
||||
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 @@ nfs_write(ap)
|
||||
*/
|
||||
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;
|
||||
|
@ -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.
|
||||
|
@ -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) \
|
||||
|
@ -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 @@ nfs_nget(mntp, fhp, npp)
|
||||
*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 @@ nfs_nget(mntp, fhp, npp)
|
||||
* 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;
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_nqlease.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: nfs_nqlease.c,v 1.4 1994/08/13 14:21:55 davidg Exp $
|
||||
* $Id: nfs_nqlease.c,v 1.5 1994/09/23 17:49:44 wollman Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -181,7 +181,8 @@ nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
return (0);
|
||||
if (*duration > nqsrv_maxlease)
|
||||
*duration = nqsrv_maxlease;
|
||||
if (error = VOP_GETATTR(vp, &vattr, cred, nd->nd_procp))
|
||||
error = VOP_GETATTR(vp, &vattr, cred, nd->nd_procp);
|
||||
if (error)
|
||||
return (error);
|
||||
*frev = vattr.va_filerev;
|
||||
s = splsoftclock();
|
||||
@ -194,7 +195,8 @@ nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
* Find the lease by searching the hash list.
|
||||
*/
|
||||
fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
if (error = VFS_VPTOFH(vp, &fh.fh_fid)) {
|
||||
error = VFS_VPTOFH(vp, &fh.fh_fid);
|
||||
if (error) {
|
||||
splx(s);
|
||||
return (error);
|
||||
}
|
||||
@ -301,7 +303,8 @@ nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
lp->lc_vp = vp;
|
||||
lp->lc_fsid = fh.fh_fsid;
|
||||
bcopy(fh.fh_fid.fid_data, lp->lc_fiddata, fh.fh_fid.fid_len - sizeof (long));
|
||||
if (lq = *lpp)
|
||||
lq = *lpp;
|
||||
if (lq)
|
||||
lq->lc_fhprev = &lp->lc_fhnext;
|
||||
lp->lc_fhnext = lq;
|
||||
lp->lc_fhprev = lpp;
|
||||
@ -327,7 +330,8 @@ nfs_lease_check(vp, p, cred, flag)
|
||||
struct ucred *cred;
|
||||
int flag;
|
||||
{
|
||||
int duration = 0, cache;
|
||||
u_long duration = 0;
|
||||
int cache;
|
||||
struct nfsd nfsd;
|
||||
u_quad_t frev;
|
||||
|
||||
@ -631,7 +635,8 @@ nqnfs_serverd()
|
||||
nqsrv_instimeq(lp, nqsrv_writeslack);
|
||||
} else {
|
||||
remque(lp);
|
||||
if (lq = lp->lc_fhnext)
|
||||
lq = lp->lc_fhnext;
|
||||
if (lq)
|
||||
lq->lc_fhprev = lp->lc_fhprev;
|
||||
*lp->lc_fhprev = lq;
|
||||
/*
|
||||
@ -711,8 +716,9 @@ nqnfsrv_getlease(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_dissect(tl, u_long *, 2*NFSX_UNSIGNED);
|
||||
flags = fxdr_unsigned(int, *tl++);
|
||||
nfsd->nd_duration = fxdr_unsigned(int, *tl);
|
||||
if (error = nfsrv_fhtovp(fhp,
|
||||
TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp,
|
||||
TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (rdonly && flags == NQL_WRITE) {
|
||||
error = EROFS;
|
||||
@ -918,7 +924,8 @@ nqnfs_callback(nmp, mrep, md, dpos)
|
||||
nd.nd_mrep = mrep;
|
||||
nd.nd_md = md;
|
||||
nd.nd_dpos = dpos;
|
||||
if (error = nfs_getreq(&nd, FALSE))
|
||||
error = nfs_getreq(&nd, FALSE);
|
||||
if (error)
|
||||
return (error);
|
||||
md = nd.nd_md;
|
||||
dpos = nd.nd_dpos;
|
||||
@ -929,7 +936,8 @@ nqnfs_callback(nmp, mrep, md, dpos)
|
||||
fhp = &nfh.fh_generic;
|
||||
nfsm_srvmtofh(fhp);
|
||||
m_freem(mrep);
|
||||
if (error = nfs_nget(nmp->nm_mountp, fhp, &np))
|
||||
error = nfs_nget(nmp->nm_mountp, fhp, &np);
|
||||
if (error)
|
||||
return (error);
|
||||
vp = NFSTOV(np);
|
||||
if (np->n_tnext) {
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
|
||||
* $Id: nfs_serv.c,v 1.5 1994/09/22 19:38:25 wollman Exp $
|
||||
* $Id: nfs_serv.c,v 1.6 1994/09/28 16:45:18 dfr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -111,7 +111,8 @@ nqnfsrv_access(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fhp = &nfh.fh_generic;
|
||||
nfsm_srvmtofh(fhp);
|
||||
nfsm_dissect(tl, u_long *, 3 * NFSX_UNSIGNED);
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (*tl++ == nfs_true)
|
||||
mode |= VREAD;
|
||||
@ -152,7 +153,8 @@ nfsrv_getattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
|
||||
fhp = &nfh.fh_generic;
|
||||
nfsm_srvmtofh(fhp);
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_READ);
|
||||
error = VOP_GETATTR(vp, vap, cred, nfsd->nd_procp);
|
||||
@ -192,7 +194,8 @@ nfsrv_setattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fhp = &nfh.fh_generic;
|
||||
nfsm_srvmtofh(fhp);
|
||||
nfsm_dissect(sp, struct nfsv2_sattr *, NFSX_SATTR(nfsd->nd_nqlflag != NQL_NOVAL));
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_WRITE);
|
||||
VATTR_NULL(vap);
|
||||
@ -243,11 +246,15 @@ nfsrv_setattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (vp->v_type == VDIR) {
|
||||
error = EISDIR;
|
||||
goto out;
|
||||
} else if (error = nfsrv_access(vp, VWRITE, cred, rdonly,
|
||||
nfsd->nd_procp))
|
||||
goto out;
|
||||
} else {
|
||||
error = nfsrv_access(vp, VWRITE, cred, rdonly,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
if (error = VOP_SETATTR(vp, vap, cred, nfsd->nd_procp)) {
|
||||
error = VOP_SETATTR(vp, vap, cred, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -284,7 +291,8 @@ nfsrv_lookup(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
register u_long *tl;
|
||||
register long t1;
|
||||
caddr_t bpos;
|
||||
int error = 0, cache, duration2, cache2, len;
|
||||
int error = 0, cache, cache2, len;
|
||||
u_long duration2;
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mreq;
|
||||
struct vattr va, *vap = &va;
|
||||
@ -301,8 +309,9 @@ nfsrv_lookup(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = LOOKUP;
|
||||
nd.ni_cnd.cn_flags = LOCKLEAF | SAVESTART;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(nd.ni_startdir, NQL_READ);
|
||||
vrele(nd.ni_startdir);
|
||||
@ -310,7 +319,8 @@ nfsrv_lookup(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
vp = nd.ni_vp;
|
||||
bzero((caddr_t)fhp, sizeof(nfh));
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) {
|
||||
error = VFS_VPTOFH(vp, &fhp->fh_fid);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -395,7 +405,8 @@ nfsrv_readlink(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
uiop->uio_rw = UIO_READ;
|
||||
uiop->uio_segflg = UIO_SYSSPACE;
|
||||
uiop->uio_procp = (struct proc *)0;
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly)) {
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error) {
|
||||
m_freem(mp3);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -461,7 +472,8 @@ nfsrv_read(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fxdr_hyper(tl, &off);
|
||||
}
|
||||
nfsm_srvstrsiz(cnt, NFS_MAXDATA);
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (vp->v_type != VREG) {
|
||||
error = (vp->v_type == VDIR) ? EISDIR : EACCES;
|
||||
@ -474,7 +486,8 @@ nfsrv_read(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
if (error = VOP_GETATTR(vp, vap, cred, nfsd->nd_procp)) {
|
||||
error = VOP_GETATTR(vp, vap, cred, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -601,7 +614,8 @@ nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
mp->m_len -= siz;
|
||||
NFSMADV(mp, siz);
|
||||
}
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (vp->v_type != VREG) {
|
||||
error = (vp->v_type == VDIR) ? EISDIR : EACCES;
|
||||
@ -609,7 +623,8 @@ nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nqsrv_getl(vp, NQL_WRITE);
|
||||
if (error = nfsrv_access(vp, VWRITE, cred, rdonly, nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VWRITE, cred, rdonly, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -652,7 +667,8 @@ nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_reply(0);
|
||||
}
|
||||
uiop->uio_resid = siz;
|
||||
if (error = VOP_WRITE(vp, uiop, ioflags, cred)) {
|
||||
error = VOP_WRITE(vp, uiop, ioflags, cred);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -706,8 +722,9 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = CREATE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
VATTR_NULL(vap);
|
||||
nfsm_dissect(sp, struct nfsv2_sattr *, NFSX_SATTR(nfsd->nd_nqlflag != NQL_NOVAL));
|
||||
@ -728,7 +745,8 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (vap->va_type == VREG || vap->va_type == VSOCK) {
|
||||
vrele(nd.ni_startdir);
|
||||
nqsrv_getl(nd.ni_dvp, NQL_WRITE);
|
||||
if (error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap))
|
||||
error=VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
} else if (vap->va_type == VCHR || vap->va_type == VBLK ||
|
||||
@ -736,14 +754,18 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (vap->va_type == VCHR && rdev == 0xffffffff)
|
||||
vap->va_type = VFIFO;
|
||||
if (vap->va_type == VFIFO) {
|
||||
} else if (error = suser(cred, (u_short *)0)) {
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
goto out;
|
||||
} else
|
||||
vap->va_rdev = (dev_t)rdev;
|
||||
} else {
|
||||
error = suser(cred, (u_short *)0);
|
||||
if (error) {
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
goto out;
|
||||
} else
|
||||
vap->va_rdev = (dev_t)rdev;
|
||||
}
|
||||
nqsrv_getl(nd.ni_dvp, NQL_WRITE);
|
||||
if (error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap)) {
|
||||
error=VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (error) {
|
||||
vrele(nd.ni_startdir);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -751,7 +773,8 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_flags &= ~(LOCKPARENT | SAVESTART);
|
||||
nd.ni_cnd.cn_proc = nfsd->nd_procp;
|
||||
nd.ni_cnd.cn_cred = nfsd->nd_procp->p_ucred;
|
||||
if (error = lookup(&nd)) {
|
||||
error = lookup(&nd);
|
||||
if (error) {
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -788,13 +811,15 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
} else
|
||||
fxdr_hyper(&sp->sa_nqsize, &vap->va_size);
|
||||
if (vap->va_size != -1) {
|
||||
if (error = nfsrv_access(vp, VWRITE, cred,
|
||||
(nd.ni_cnd.cn_flags & RDONLY), nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VWRITE, cred,
|
||||
(nd.ni_cnd.cn_flags & RDONLY), nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nqsrv_getl(vp, NQL_WRITE);
|
||||
if (error = VOP_SETATTR(vp, vap, cred, nfsd->nd_procp)) {
|
||||
error = VOP_SETATTR(vp, vap, cred, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -802,7 +827,8 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
}
|
||||
bzero((caddr_t)fhp, sizeof(nfh));
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) {
|
||||
error = VFS_VPTOFH(vp, &fhp->fh_fid);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -861,8 +887,9 @@ nfsrv_remove(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = DELETE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
vp = nd.ni_vp;
|
||||
if (vp->v_type == VDIR &&
|
||||
@ -931,8 +958,9 @@ nfsrv_rename(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fromnd.ni_cnd.cn_cred = cred;
|
||||
fromnd.ni_cnd.cn_nameiop = DELETE;
|
||||
fromnd.ni_cnd.cn_flags = WANTPARENT | SAVESTART;
|
||||
if (error = nfs_namei(&fromnd, ffhp, len, nfsd->nd_slp, nam, &md,
|
||||
&dpos, nfsd->nd_procp))
|
||||
error = nfs_namei(&fromnd, ffhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if(error)
|
||||
nfsm_reply(0);
|
||||
fvp = fromnd.ni_vp;
|
||||
nfsm_srvmtofh(tfhp);
|
||||
@ -941,8 +969,9 @@ nfsrv_rename(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
tond.ni_cnd.cn_cred = cred;
|
||||
tond.ni_cnd.cn_nameiop = RENAME;
|
||||
tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART;
|
||||
if (error = nfs_namei(&tond, tfhp, len2, nfsd->nd_slp, nam, &md,
|
||||
&dpos, nfsd->nd_procp)) {
|
||||
error = nfs_namei(&tond, tfhp, len2, nfsd->nd_slp, nam, &md,
|
||||
&dpos, nfsd->nd_procp);
|
||||
if (error) {
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
@ -1054,15 +1083,17 @@ nfsrv_link(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_srvmtofh(fhp);
|
||||
nfsm_srvmtofh(dfhp);
|
||||
nfsm_srvstrsiz(len, NFS_MAXNAMLEN);
|
||||
if (error = nfsrv_fhtovp(fhp, FALSE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, FALSE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (vp->v_type == VDIR && (error = suser(cred, (u_short *)0)))
|
||||
goto out1;
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = CREATE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT;
|
||||
if (error = nfs_namei(&nd, dfhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, dfhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
goto out1;
|
||||
xp = nd.ni_vp;
|
||||
if (xp != NULL) {
|
||||
@ -1126,8 +1157,9 @@ nfsrv_symlink(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = CREATE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
goto out;
|
||||
nfsm_strsiz(len2, NFS_MAXPATHLEN);
|
||||
MALLOC(pathcp, caddr_t, len2 + 1, M_TEMP, M_WAITOK);
|
||||
@ -1208,8 +1240,9 @@ nfsrv_mkdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = CREATE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nfsm_dissect(tl, u_long *, NFSX_UNSIGNED);
|
||||
VATTR_NULL(vap);
|
||||
@ -1227,12 +1260,14 @@ nfsrv_mkdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nqsrv_getl(nd.ni_dvp, NQL_WRITE);
|
||||
if (error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap))
|
||||
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
vp = nd.ni_vp;
|
||||
bzero((caddr_t)fhp, sizeof(nfh));
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) {
|
||||
error = VFS_VPTOFH(vp, &fhp->fh_fid);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -1283,8 +1318,9 @@ nfsrv_rmdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = DELETE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
vp = nd.ni_vp;
|
||||
if (vp->v_type != VDIR) {
|
||||
@ -1396,10 +1432,12 @@ nfsrv_readdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (cnt > NFS_MAXREADDIR)
|
||||
siz = NFS_MAXREADDIR;
|
||||
fullsiz = siz;
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_READ);
|
||||
if (error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -1580,8 +1618,9 @@ nqnfsrv_readdirlook(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct iovec iv;
|
||||
struct vattr va, *vap = &va;
|
||||
struct nfsv2_fattr *fp;
|
||||
int len, nlen, rem, xfer, tsiz, i, error = 0, duration2, cache2;
|
||||
int len, nlen, rem, xfer, tsiz, i, error = 0, cache2;
|
||||
int siz, cnt, fullsiz, eofflag, rdonly, cache;
|
||||
u_long duration2;
|
||||
u_quad_t frev, frev2;
|
||||
u_long off, toff;
|
||||
int ncookies;
|
||||
@ -1598,10 +1637,12 @@ nqnfsrv_readdirlook(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (cnt > NFS_MAXREADDIR)
|
||||
siz = NFS_MAXREADDIR;
|
||||
fullsiz = siz;
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_READ);
|
||||
if (error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -1834,7 +1875,8 @@ nfsrv_statfs(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fhp = &nfh.fh_generic;
|
||||
isnq = (nfsd->nd_nqlflag != NQL_NOVAL);
|
||||
nfsm_srvmtofh(fhp);
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
sf = &statfs;
|
||||
error = VFS_STATFS(vp->v_mount, sf, nfsd->nd_procp);
|
||||
@ -1930,6 +1972,8 @@ nfsrv_access(vp, flags, cred, rdonly, p)
|
||||
switch (vp->v_type) {
|
||||
case VREG: case VDIR: case VLNK:
|
||||
return (EROFS);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -1940,7 +1984,8 @@ nfsrv_access(vp, flags, cred, rdonly, p)
|
||||
if ((vp->v_flag & VTEXT) && !vnode_pager_uncache(vp))
|
||||
return (ETXTBSY);
|
||||
}
|
||||
if (error = VOP_GETATTR(vp, &vattr, cred, p))
|
||||
error = VOP_GETATTR(vp, &vattr, cred, p);
|
||||
if (error)
|
||||
return (error);
|
||||
if ((error = VOP_ACCESS(vp, flags, cred, p)) &&
|
||||
cred->cr_uid != vattr.va_uid)
|
||||
|
@ -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 @@ nfs_receive(rep, aname, mp)
|
||||
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 @@ nfs_receive(rep, aname, mp)
|
||||
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);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_srvcache.c 8.1 (Berkeley) 6/10/93
|
||||
* $Id$
|
||||
* $Id: nfs_srvcache.c,v 1.3 1994/08/02 07:52:12 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -237,7 +237,8 @@ nfsrv_getcache(nam, nd, repp)
|
||||
}
|
||||
rp->rc_flag |= RC_LOCKED;
|
||||
/* remove from hash chain */
|
||||
if (rq = rp->rc_forw)
|
||||
rq = rp->rc_forw;
|
||||
if (rq)
|
||||
rq->rc_back = rp->rc_back;
|
||||
*rp->rc_back = rq;
|
||||
/* remove from LRU chain */
|
||||
@ -270,7 +271,8 @@ nfsrv_getcache(nam, nd, repp)
|
||||
};
|
||||
rp->rc_proc = nd->nd_procnum;
|
||||
/* insert into hash chain */
|
||||
if (rq = *rpp)
|
||||
rq = *rpp;
|
||||
if (rq)
|
||||
rq->rc_back = &rp->rc_forw;
|
||||
rp->rc_forw = rq;
|
||||
rp->rc_back = rpp;
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 @@ nfs_sync(mp, waitfor, cred, p)
|
||||
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);
|
||||
}
|
||||
|
@ -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 @@ nfs_lookup(ap)
|
||||
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 @@ nfs_lookup(ap)
|
||||
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.
|
||||
|
@ -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) \
|
||||
|
@ -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
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nqnfs.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: nqnfs.h,v 1.3 1994/08/21 06:50:14 paul Exp $
|
||||
* $Id: nqnfs.h,v 1.4 1994/09/22 22:10:45 wollman Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NFS_NQNFS_H_
|
||||
@ -202,8 +202,13 @@ extern u_long nqfheadhash;
|
||||
#define NQNFS_AUTHERR 502
|
||||
|
||||
#ifdef KERNEL
|
||||
void nfs_lease_check __P((struct vnode *, struct proc *, struct ucred *, int));
|
||||
void nfs_lease_updatetime __P((int));
|
||||
void nfs_lease_check __P((struct vnode *, struct proc *, struct ucred *, int));
|
||||
void nfs_lease_updatetime __P((int));
|
||||
int nqsrv_cmpnam __P((struct nfssvc_sock *,struct mbuf *,struct nqhost *));
|
||||
int nqsrv_getlease __P((struct vnode *,u_long *,int,struct nfsd *,struct mbuf *,int *,u_quad_t *,struct ucred *));
|
||||
int nqnfs_getlease __P((struct vnode *,int,struct ucred *,struct proc *));
|
||||
int nqnfs_callback __P((struct nfsmount *,struct mbuf *,struct mbuf *,caddr_t));
|
||||
int nqnfs_clientd __P((struct nfsmount *,struct ucred *,struct nfsd_cargs *,int,caddr_t,struct proc *));
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -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
|
||||
|
@ -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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
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 @@ nfs_write(ap)
|
||||
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 @@ nfs_write(ap)
|
||||
*/
|
||||
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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 @@ nfs_nget(mntp, fhp, npp)
|
||||
*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 @@ nfs_nget(mntp, fhp, npp)
|
||||
* 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;
|
||||
|
||||
|
@ -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 @@ nfs_receive(rep, aname, mp)
|
||||
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 @@ nfs_receive(rep, aname, mp)
|
||||
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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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 @@ nfs_sync(mp, waitfor, cred, p)
|
||||
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);
|
||||
}
|
||||
|
@ -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 @@ nfs_lookup(ap)
|
||||
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 @@ nfs_lookup(ap)
|
||||
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.
|
||||
|
@ -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
|
||||
|
@ -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) \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
|
||||
* $Id: nfs_serv.c,v 1.5 1994/09/22 19:38:25 wollman Exp $
|
||||
* $Id: nfs_serv.c,v 1.6 1994/09/28 16:45:18 dfr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -111,7 +111,8 @@ nqnfsrv_access(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fhp = &nfh.fh_generic;
|
||||
nfsm_srvmtofh(fhp);
|
||||
nfsm_dissect(tl, u_long *, 3 * NFSX_UNSIGNED);
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (*tl++ == nfs_true)
|
||||
mode |= VREAD;
|
||||
@ -152,7 +153,8 @@ nfsrv_getattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
|
||||
fhp = &nfh.fh_generic;
|
||||
nfsm_srvmtofh(fhp);
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_READ);
|
||||
error = VOP_GETATTR(vp, vap, cred, nfsd->nd_procp);
|
||||
@ -192,7 +194,8 @@ nfsrv_setattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fhp = &nfh.fh_generic;
|
||||
nfsm_srvmtofh(fhp);
|
||||
nfsm_dissect(sp, struct nfsv2_sattr *, NFSX_SATTR(nfsd->nd_nqlflag != NQL_NOVAL));
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_WRITE);
|
||||
VATTR_NULL(vap);
|
||||
@ -243,11 +246,15 @@ nfsrv_setattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (vp->v_type == VDIR) {
|
||||
error = EISDIR;
|
||||
goto out;
|
||||
} else if (error = nfsrv_access(vp, VWRITE, cred, rdonly,
|
||||
nfsd->nd_procp))
|
||||
goto out;
|
||||
} else {
|
||||
error = nfsrv_access(vp, VWRITE, cred, rdonly,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
if (error = VOP_SETATTR(vp, vap, cred, nfsd->nd_procp)) {
|
||||
error = VOP_SETATTR(vp, vap, cred, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -284,7 +291,8 @@ nfsrv_lookup(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
register u_long *tl;
|
||||
register long t1;
|
||||
caddr_t bpos;
|
||||
int error = 0, cache, duration2, cache2, len;
|
||||
int error = 0, cache, cache2, len;
|
||||
u_long duration2;
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mreq;
|
||||
struct vattr va, *vap = &va;
|
||||
@ -301,8 +309,9 @@ nfsrv_lookup(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = LOOKUP;
|
||||
nd.ni_cnd.cn_flags = LOCKLEAF | SAVESTART;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(nd.ni_startdir, NQL_READ);
|
||||
vrele(nd.ni_startdir);
|
||||
@ -310,7 +319,8 @@ nfsrv_lookup(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
vp = nd.ni_vp;
|
||||
bzero((caddr_t)fhp, sizeof(nfh));
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) {
|
||||
error = VFS_VPTOFH(vp, &fhp->fh_fid);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -395,7 +405,8 @@ nfsrv_readlink(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
uiop->uio_rw = UIO_READ;
|
||||
uiop->uio_segflg = UIO_SYSSPACE;
|
||||
uiop->uio_procp = (struct proc *)0;
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly)) {
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error) {
|
||||
m_freem(mp3);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -461,7 +472,8 @@ nfsrv_read(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fxdr_hyper(tl, &off);
|
||||
}
|
||||
nfsm_srvstrsiz(cnt, NFS_MAXDATA);
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (vp->v_type != VREG) {
|
||||
error = (vp->v_type == VDIR) ? EISDIR : EACCES;
|
||||
@ -474,7 +486,8 @@ nfsrv_read(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
if (error = VOP_GETATTR(vp, vap, cred, nfsd->nd_procp)) {
|
||||
error = VOP_GETATTR(vp, vap, cred, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -601,7 +614,8 @@ nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
mp->m_len -= siz;
|
||||
NFSMADV(mp, siz);
|
||||
}
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (vp->v_type != VREG) {
|
||||
error = (vp->v_type == VDIR) ? EISDIR : EACCES;
|
||||
@ -609,7 +623,8 @@ nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nqsrv_getl(vp, NQL_WRITE);
|
||||
if (error = nfsrv_access(vp, VWRITE, cred, rdonly, nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VWRITE, cred, rdonly, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -652,7 +667,8 @@ nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_reply(0);
|
||||
}
|
||||
uiop->uio_resid = siz;
|
||||
if (error = VOP_WRITE(vp, uiop, ioflags, cred)) {
|
||||
error = VOP_WRITE(vp, uiop, ioflags, cred);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -706,8 +722,9 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = CREATE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | SAVESTART;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
VATTR_NULL(vap);
|
||||
nfsm_dissect(sp, struct nfsv2_sattr *, NFSX_SATTR(nfsd->nd_nqlflag != NQL_NOVAL));
|
||||
@ -728,7 +745,8 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (vap->va_type == VREG || vap->va_type == VSOCK) {
|
||||
vrele(nd.ni_startdir);
|
||||
nqsrv_getl(nd.ni_dvp, NQL_WRITE);
|
||||
if (error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap))
|
||||
error=VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
} else if (vap->va_type == VCHR || vap->va_type == VBLK ||
|
||||
@ -736,14 +754,18 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (vap->va_type == VCHR && rdev == 0xffffffff)
|
||||
vap->va_type = VFIFO;
|
||||
if (vap->va_type == VFIFO) {
|
||||
} else if (error = suser(cred, (u_short *)0)) {
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
goto out;
|
||||
} else
|
||||
vap->va_rdev = (dev_t)rdev;
|
||||
} else {
|
||||
error = suser(cred, (u_short *)0);
|
||||
if (error) {
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
goto out;
|
||||
} else
|
||||
vap->va_rdev = (dev_t)rdev;
|
||||
}
|
||||
nqsrv_getl(nd.ni_dvp, NQL_WRITE);
|
||||
if (error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap)) {
|
||||
error=VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (error) {
|
||||
vrele(nd.ni_startdir);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -751,7 +773,8 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_flags &= ~(LOCKPARENT | SAVESTART);
|
||||
nd.ni_cnd.cn_proc = nfsd->nd_procp;
|
||||
nd.ni_cnd.cn_cred = nfsd->nd_procp->p_ucred;
|
||||
if (error = lookup(&nd)) {
|
||||
error = lookup(&nd);
|
||||
if (error) {
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -788,13 +811,15 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
} else
|
||||
fxdr_hyper(&sp->sa_nqsize, &vap->va_size);
|
||||
if (vap->va_size != -1) {
|
||||
if (error = nfsrv_access(vp, VWRITE, cred,
|
||||
(nd.ni_cnd.cn_flags & RDONLY), nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VWRITE, cred,
|
||||
(nd.ni_cnd.cn_flags & RDONLY), nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nqsrv_getl(vp, NQL_WRITE);
|
||||
if (error = VOP_SETATTR(vp, vap, cred, nfsd->nd_procp)) {
|
||||
error = VOP_SETATTR(vp, vap, cred, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -802,7 +827,8 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
}
|
||||
bzero((caddr_t)fhp, sizeof(nfh));
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) {
|
||||
error = VFS_VPTOFH(vp, &fhp->fh_fid);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -861,8 +887,9 @@ nfsrv_remove(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = DELETE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
vp = nd.ni_vp;
|
||||
if (vp->v_type == VDIR &&
|
||||
@ -931,8 +958,9 @@ nfsrv_rename(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fromnd.ni_cnd.cn_cred = cred;
|
||||
fromnd.ni_cnd.cn_nameiop = DELETE;
|
||||
fromnd.ni_cnd.cn_flags = WANTPARENT | SAVESTART;
|
||||
if (error = nfs_namei(&fromnd, ffhp, len, nfsd->nd_slp, nam, &md,
|
||||
&dpos, nfsd->nd_procp))
|
||||
error = nfs_namei(&fromnd, ffhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if(error)
|
||||
nfsm_reply(0);
|
||||
fvp = fromnd.ni_vp;
|
||||
nfsm_srvmtofh(tfhp);
|
||||
@ -941,8 +969,9 @@ nfsrv_rename(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
tond.ni_cnd.cn_cred = cred;
|
||||
tond.ni_cnd.cn_nameiop = RENAME;
|
||||
tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART;
|
||||
if (error = nfs_namei(&tond, tfhp, len2, nfsd->nd_slp, nam, &md,
|
||||
&dpos, nfsd->nd_procp)) {
|
||||
error = nfs_namei(&tond, tfhp, len2, nfsd->nd_slp, nam, &md,
|
||||
&dpos, nfsd->nd_procp);
|
||||
if (error) {
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
@ -1054,15 +1083,17 @@ nfsrv_link(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_srvmtofh(fhp);
|
||||
nfsm_srvmtofh(dfhp);
|
||||
nfsm_srvstrsiz(len, NFS_MAXNAMLEN);
|
||||
if (error = nfsrv_fhtovp(fhp, FALSE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, FALSE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
if (vp->v_type == VDIR && (error = suser(cred, (u_short *)0)))
|
||||
goto out1;
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = CREATE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT;
|
||||
if (error = nfs_namei(&nd, dfhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, dfhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
goto out1;
|
||||
xp = nd.ni_vp;
|
||||
if (xp != NULL) {
|
||||
@ -1126,8 +1157,9 @@ nfsrv_symlink(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = CREATE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
goto out;
|
||||
nfsm_strsiz(len2, NFS_MAXPATHLEN);
|
||||
MALLOC(pathcp, caddr_t, len2 + 1, M_TEMP, M_WAITOK);
|
||||
@ -1208,8 +1240,9 @@ nfsrv_mkdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = CREATE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nfsm_dissect(tl, u_long *, NFSX_UNSIGNED);
|
||||
VATTR_NULL(vap);
|
||||
@ -1227,12 +1260,14 @@ nfsrv_mkdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nqsrv_getl(nd.ni_dvp, NQL_WRITE);
|
||||
if (error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap))
|
||||
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
vp = nd.ni_vp;
|
||||
bzero((caddr_t)fhp, sizeof(nfh));
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
if (error = VFS_VPTOFH(vp, &fhp->fh_fid)) {
|
||||
error = VFS_VPTOFH(vp, &fhp->fh_fid);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -1283,8 +1318,9 @@ nfsrv_rmdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
nd.ni_cnd.cn_nameiop = DELETE;
|
||||
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
|
||||
if (error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp))
|
||||
error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
vp = nd.ni_vp;
|
||||
if (vp->v_type != VDIR) {
|
||||
@ -1396,10 +1432,12 @@ nfsrv_readdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (cnt > NFS_MAXREADDIR)
|
||||
siz = NFS_MAXREADDIR;
|
||||
fullsiz = siz;
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_READ);
|
||||
if (error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -1580,8 +1618,9 @@ nqnfsrv_readdirlook(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct iovec iv;
|
||||
struct vattr va, *vap = &va;
|
||||
struct nfsv2_fattr *fp;
|
||||
int len, nlen, rem, xfer, tsiz, i, error = 0, duration2, cache2;
|
||||
int len, nlen, rem, xfer, tsiz, i, error = 0, cache2;
|
||||
int siz, cnt, fullsiz, eofflag, rdonly, cache;
|
||||
u_long duration2;
|
||||
u_quad_t frev, frev2;
|
||||
u_long off, toff;
|
||||
int ncookies;
|
||||
@ -1598,10 +1637,12 @@ nqnfsrv_readdirlook(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (cnt > NFS_MAXREADDIR)
|
||||
siz = NFS_MAXREADDIR;
|
||||
fullsiz = siz;
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_READ);
|
||||
if (error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -1834,7 +1875,8 @@ nfsrv_statfs(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fhp = &nfh.fh_generic;
|
||||
isnq = (nfsd->nd_nqlflag != NQL_NOVAL);
|
||||
nfsm_srvmtofh(fhp);
|
||||
if (error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly))
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
sf = &statfs;
|
||||
error = VFS_STATFS(vp->v_mount, sf, nfsd->nd_procp);
|
||||
@ -1930,6 +1972,8 @@ nfsrv_access(vp, flags, cred, rdonly, p)
|
||||
switch (vp->v_type) {
|
||||
case VREG: case VDIR: case VLNK:
|
||||
return (EROFS);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -1940,7 +1984,8 @@ nfsrv_access(vp, flags, cred, rdonly, p)
|
||||
if ((vp->v_flag & VTEXT) && !vnode_pager_uncache(vp))
|
||||
return (ETXTBSY);
|
||||
}
|
||||
if (error = VOP_GETATTR(vp, &vattr, cred, p))
|
||||
error = VOP_GETATTR(vp, &vattr, cred, p);
|
||||
if (error)
|
||||
return (error);
|
||||
if ((error = VOP_ACCESS(vp, flags, cred, p)) &&
|
||||
cred->cr_uid != vattr.va_uid)
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_srvcache.c 8.1 (Berkeley) 6/10/93
|
||||
* $Id$
|
||||
* $Id: nfs_srvcache.c,v 1.3 1994/08/02 07:52:12 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -237,7 +237,8 @@ nfsrv_getcache(nam, nd, repp)
|
||||
}
|
||||
rp->rc_flag |= RC_LOCKED;
|
||||
/* remove from hash chain */
|
||||
if (rq = rp->rc_forw)
|
||||
rq = rp->rc_forw;
|
||||
if (rq)
|
||||
rq->rc_back = rp->rc_back;
|
||||
*rp->rc_back = rq;
|
||||
/* remove from LRU chain */
|
||||
@ -270,7 +271,8 @@ nfsrv_getcache(nam, nd, repp)
|
||||
};
|
||||
rp->rc_proc = nd->nd_procnum;
|
||||
/* insert into hash chain */
|
||||
if (rq = *rpp)
|
||||
rq = *rpp;
|
||||
if (rq)
|
||||
rq->rc_back = &rp->rc_forw;
|
||||
rp->rc_forw = rq;
|
||||
rp->rc_back = rpp;
|
||||
|
@ -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 @@ nfs_receive(rep, aname, mp)
|
||||
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 @@ nfs_receive(rep, aname, mp)
|
||||
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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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) \
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user