nfs prototype changes
This commit is contained in:
parent
245d8c1eb2
commit
e4c93ec893
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_bio.c,v 1.22 1996/02/01 00:39:50 jtc Exp $ */
|
||||
/* $NetBSD: nfs_bio.c,v 1.23 1996/02/09 21:48:19 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -47,6 +47,8 @@
|
||||
#include <sys/trace.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/signalvar.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
@ -56,8 +58,8 @@
|
||||
#include <nfs/nfs.h>
|
||||
#include <nfs/nfsmount.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
struct buf *incore(), *nfs_getcacheblk();
|
||||
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
|
||||
extern int nfs_numasync;
|
||||
|
||||
@ -65,6 +67,7 @@ extern int nfs_numasync;
|
||||
* Vnode op for read using bio
|
||||
* Any similarity to readip() is purely coincidental
|
||||
*/
|
||||
int
|
||||
nfs_bioread(vp, uio, ioflag, cred)
|
||||
register struct vnode *vp;
|
||||
register struct uio *uio;
|
||||
@ -73,13 +76,13 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
{
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
register int biosize, diff;
|
||||
struct buf *bp, *rabp;
|
||||
struct buf *bp = NULL, *rabp;
|
||||
struct vattr vattr;
|
||||
struct proc *p;
|
||||
struct nfsmount *nmp;
|
||||
daddr_t lbn, bn, rabn;
|
||||
caddr_t baddr;
|
||||
int got_buf, nra, error = 0, n, on, not_readin;
|
||||
int got_buf = 0, nra, error = 0, n = 0, on = 0, not_readin;
|
||||
|
||||
#ifdef lint
|
||||
ioflag = ioflag;
|
||||
@ -118,20 +121,23 @@ 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.tv_sec;
|
||||
} else {
|
||||
if (error = VOP_GETATTR(vp, &vattr, cred, p))
|
||||
if ((error = VOP_GETATTR(vp, &vattr, cred, p)) != 0)
|
||||
return (error);
|
||||
if (np->n_mtime != vattr.va_mtime.tv_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.tv_sec;
|
||||
}
|
||||
@ -156,14 +162,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 +186,13 @@ nfs_bioread(vp, uio, ioflag, cred)
|
||||
case VDIR:
|
||||
error = nfs_readdirrpc(vp, uio, cred);
|
||||
break;
|
||||
case VCHR:
|
||||
case VSOCK:
|
||||
case VFIFO:
|
||||
case VBAD:
|
||||
case VNON:
|
||||
case VBLK:
|
||||
break;
|
||||
};
|
||||
return (error);
|
||||
}
|
||||
@ -233,7 +248,8 @@ again:
|
||||
if ((bp->b_flags & (B_DONE | B_DELWRI)) == 0) {
|
||||
bp->b_flags |= B_READ;
|
||||
not_readin = 0;
|
||||
if (error = nfs_doio(bp, cred, p)) {
|
||||
error = nfs_doio(bp, cred, p);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
@ -274,7 +290,7 @@ again:
|
||||
return (EINTR);
|
||||
if ((bp->b_flags & B_DONE) == 0) {
|
||||
bp->b_flags |= B_READ;
|
||||
if (error = nfs_doio(bp, cred, p)) {
|
||||
if ((error = nfs_doio(bp, cred, p)) != 0) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
@ -293,7 +309,7 @@ again:
|
||||
return (EINTR);
|
||||
if ((bp->b_flags & B_DONE) == 0) {
|
||||
bp->b_flags |= B_READ;
|
||||
if (error = nfs_doio(bp, cred, p)) {
|
||||
if ((error = nfs_doio(bp, cred, p)) != 0) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
}
|
||||
@ -324,6 +340,13 @@ again:
|
||||
n = min(uio->uio_resid, NFS_DIRBLKSIZ - bp->b_resid);
|
||||
got_buf = 1;
|
||||
break;
|
||||
case VBAD:
|
||||
case VSOCK:
|
||||
case VCHR:
|
||||
case VBLK:
|
||||
case VNON:
|
||||
case VFIFO:
|
||||
break;
|
||||
};
|
||||
|
||||
if (n > 0) {
|
||||
@ -338,6 +361,14 @@ again:
|
||||
case VDIR:
|
||||
uio->uio_offset = bp->b_blkno;
|
||||
break;
|
||||
case VREG:
|
||||
case VBAD:
|
||||
case VFIFO:
|
||||
case VSOCK:
|
||||
case VCHR:
|
||||
case VBLK:
|
||||
case VNON:
|
||||
break;
|
||||
};
|
||||
if (got_buf)
|
||||
brelse(bp);
|
||||
@ -348,14 +379,16 @@ again:
|
||||
/*
|
||||
* Vnode op for write using bio
|
||||
*/
|
||||
nfs_write(ap)
|
||||
int
|
||||
nfs_write(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_write_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct vnode a_vp;
|
||||
struct uio *a_uio;
|
||||
int a_ioflag;
|
||||
struct ucred *a_cred;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register int biosize;
|
||||
register struct uio *uio = ap->a_uio;
|
||||
struct proc *p = uio->uio_procp;
|
||||
@ -384,12 +417,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;
|
||||
}
|
||||
@ -434,7 +469,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;
|
||||
}
|
||||
@ -489,13 +525,15 @@ again:
|
||||
if (np->n_lrev != np->n_brev ||
|
||||
(np->n_flag & NQNFSNONCACHE)) {
|
||||
brelse(bp);
|
||||
if (error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1))
|
||||
error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
|
||||
if (error)
|
||||
return (error);
|
||||
np->n_brev = np->n_lrev;
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
if (error = uiomove((char *)bp->b_data + on, n, uio)) {
|
||||
error = uiomove((char *)bp->b_data + on, n, uio);
|
||||
if (error) {
|
||||
bp->b_flags |= B_ERROR;
|
||||
brelse(bp);
|
||||
return (error);
|
||||
@ -528,7 +566,7 @@ again:
|
||||
*/
|
||||
if ((np->n_flag & NQNFSNONCACHE) || (ioflag & IO_SYNC)) {
|
||||
bp->b_proc = p;
|
||||
if (error = VOP_BWRITE(bp))
|
||||
if ((error = VOP_BWRITE(bp)) != 0)
|
||||
return (error);
|
||||
} else if ((n + on) == biosize &&
|
||||
(nmp->nm_flag & NFSMNT_NQNFS) == 0) {
|
||||
@ -573,6 +611,7 @@ nfs_getcacheblk(vp, bn, size, p)
|
||||
* Flush and invalidate all dirty buffers. If another process is already
|
||||
* doing the flush, just wait for completion.
|
||||
*/
|
||||
int
|
||||
nfs_vinvalbuf(vp, flags, cred, p, intrflg)
|
||||
struct vnode *vp;
|
||||
int flags;
|
||||
@ -633,6 +672,7 @@ nfs_vinvalbuf(vp, flags, cred, p, intrflg)
|
||||
* This is mainly to avoid queueing async I/O requests when the nfsiods
|
||||
* are all hung on a dead server.
|
||||
*/
|
||||
int
|
||||
nfs_asyncio(bp, cred)
|
||||
register struct buf *bp;
|
||||
struct ucred *cred;
|
||||
@ -670,14 +710,14 @@ 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;
|
||||
register struct vnode *vp;
|
||||
struct nfsnode *np;
|
||||
struct nfsmount *nmp;
|
||||
int error, diff, len;
|
||||
int error = 0, diff, len;
|
||||
struct uio uio;
|
||||
struct iovec io;
|
||||
|
||||
@ -772,6 +812,12 @@ nfs_doio(bp, cr, p)
|
||||
*/
|
||||
bp->b_blkno = uiop->uio_offset;
|
||||
break;
|
||||
case VNON:
|
||||
case VBLK:
|
||||
case VCHR:
|
||||
case VFIFO:
|
||||
case VBAD:
|
||||
case VSOCK:
|
||||
};
|
||||
if (error) {
|
||||
bp->b_flags |= B_ERROR;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_boot.c,v 1.20 1995/12/19 23:07:24 cgd Exp $ */
|
||||
/* $NetBSD: nfs_boot.c,v 1.21 1996/02/09 21:48:22 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Adam Glass, Gordon Ross
|
||||
@ -51,6 +51,7 @@
|
||||
#include <nfs/nfsdiskless.h>
|
||||
#include <nfs/krpc.h>
|
||||
#include <nfs/xdr_subs.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
#include "ether.h"
|
||||
#if NETHER == 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_node.c,v 1.14 1995/12/19 23:07:27 cgd Exp $ */
|
||||
/* $NetBSD: nfs_node.c,v 1.15 1996/02/09 21:48:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -53,6 +53,7 @@
|
||||
#include <nfs/nfsnode.h>
|
||||
#include <nfs/nfsmount.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
#define NFSNOHASH(fhsum) \
|
||||
(&nfsnodehashtbl[(fhsum) & nfsnodehash])
|
||||
@ -66,6 +67,7 @@ u_long nfsnodehash;
|
||||
* Initialize hash links for nfsnodes
|
||||
* and build nfsnode free list.
|
||||
*/
|
||||
void
|
||||
nfs_nhinit()
|
||||
{
|
||||
|
||||
@ -96,6 +98,7 @@ nfs_hash(fhp)
|
||||
* In all cases, a pointer to a
|
||||
* nfsnode structure is returned.
|
||||
*/
|
||||
int
|
||||
nfs_nget(mntp, fhp, npp)
|
||||
struct mount *mntp;
|
||||
register nfsv2fh_t *fhp;
|
||||
@ -104,7 +107,6 @@ nfs_nget(mntp, fhp, npp)
|
||||
register struct nfsnode *np;
|
||||
struct nfsnodehashhead *nhpp;
|
||||
register struct vnode *vp;
|
||||
extern int (**nfsv2_vnodeop_p)();
|
||||
struct vnode *nvp;
|
||||
int error;
|
||||
|
||||
@ -120,7 +122,8 @@ loop:
|
||||
*npp = np;
|
||||
return(0);
|
||||
}
|
||||
if (error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &nvp)) {
|
||||
error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &nvp);
|
||||
if (error) {
|
||||
*npp = 0;
|
||||
return (error);
|
||||
}
|
||||
@ -150,11 +153,13 @@ loop:
|
||||
return (0);
|
||||
}
|
||||
|
||||
nfs_inactive(ap)
|
||||
int
|
||||
nfs_inactive(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_inactive_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct nfsnode *np;
|
||||
register struct sillyrename *sp;
|
||||
struct proc *p = curproc; /* XXX */
|
||||
@ -185,11 +190,13 @@ nfs_inactive(ap)
|
||||
/*
|
||||
* Reclaim an nfsnode so that it can be used for other purposes.
|
||||
*/
|
||||
nfs_reclaim(ap)
|
||||
int
|
||||
nfs_reclaim(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_reclaim_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
register struct nfsmount *nmp = VFSTONFS(vp->v_mount);
|
||||
@ -214,11 +221,13 @@ nfs_reclaim(ap)
|
||||
/*
|
||||
* Lock an nfsnode
|
||||
*/
|
||||
nfs_lock(ap)
|
||||
int
|
||||
nfs_lock(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_lock_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
|
||||
/*
|
||||
@ -238,23 +247,30 @@ nfs_lock(ap)
|
||||
/*
|
||||
* Unlock an nfsnode
|
||||
*/
|
||||
nfs_unlock(ap)
|
||||
int
|
||||
nfs_unlock(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_unlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap;
|
||||
{
|
||||
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for a locked nfsnode
|
||||
*/
|
||||
nfs_islocked(ap)
|
||||
int
|
||||
nfs_islocked(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_islocked_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -265,12 +281,13 @@ nfs_islocked(ap)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfs_abortop(ap)
|
||||
nfs_abortop(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_abortop_args /* {
|
||||
struct vnode *a_dvp;
|
||||
struct componentname *a_cnp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_nqlease.c,v 1.11 1995/12/19 23:07:29 cgd Exp $ */
|
||||
/* $NetBSD: nfs_nqlease.c,v 1.12 1996/02/09 21:48:26 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -74,6 +74,7 @@
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfsnode.h>
|
||||
#include <nfs/nfsmount.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
time_t nqnfsstarttime = (time_t)0;
|
||||
u_int32_t nqnfs_prog, nqnfs_vers;
|
||||
@ -81,11 +82,6 @@ int nqsrv_clockskew = NQ_CLOCKSKEW;
|
||||
int nqsrv_writeslack = NQ_WRITESLACK;
|
||||
int nqsrv_maxlease = NQ_MAXLEASE;
|
||||
int nqsrv_maxnumlease = NQ_MAXNUMLEASE;
|
||||
void nqsrv_instimeq(), nqsrv_send_eviction(), nfs_sndunlock();
|
||||
void nqsrv_unlocklease(), nqsrv_waitfor_expiry(), nfsrv_slpderef();
|
||||
void nqsrv_addhost(), nqsrv_locklease(), nqnfs_serverd();
|
||||
void nqnfs_clientlease();
|
||||
struct mbuf *nfsm_rpchead();
|
||||
|
||||
/*
|
||||
* Signifies which rpcs can have piggybacked lease requests
|
||||
@ -146,6 +142,7 @@ extern int nfsd_waiting;
|
||||
* is when a new lease is being allocated, since it is not in the timer
|
||||
* queue yet. (Ditto for the splsoftclock() and splx(s) calls)
|
||||
*/
|
||||
int
|
||||
nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
struct vnode *vp;
|
||||
u_int *duration;
|
||||
@ -157,8 +154,8 @@ nqsrv_getlease(vp, duration, flags, nd, nam, cachablep, frev, cred)
|
||||
struct ucred *cred;
|
||||
{
|
||||
register struct nqlease *lp;
|
||||
register struct nqfhhashhead *lpp;
|
||||
register struct nqhost *lph;
|
||||
register struct nqfhhashhead *lpp = NULL;
|
||||
register struct nqhost *lph = NULL;
|
||||
struct nqlease *tlp;
|
||||
struct nqm **lphp;
|
||||
struct vattr vattr;
|
||||
@ -169,7 +166,7 @@ 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))
|
||||
if ((error = VOP_GETATTR(vp, &vattr, cred, nd->nd_procp)) != 0)
|
||||
return (error);
|
||||
*frev = vattr.va_filerev;
|
||||
s = splsoftclock();
|
||||
@ -181,7 +178,7 @@ 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)) {
|
||||
if ((error = VFS_VPTOFH(vp, &fh.fh_fid)) != 0) {
|
||||
splx(s);
|
||||
return (error);
|
||||
}
|
||||
@ -304,14 +301,16 @@ doreply:
|
||||
* Local lease check for server syscalls.
|
||||
* Just set up args and let nqsrv_getlease() do the rest.
|
||||
*/
|
||||
lease_check(ap)
|
||||
int
|
||||
lease_check(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_lease_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct proc *a_p;
|
||||
struct ucred *a_cred;
|
||||
int a_flag;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
int duration = 0, cache;
|
||||
struct nfsd nfsd;
|
||||
u_quad_t frev;
|
||||
@ -320,6 +319,7 @@ lease_check(ap)
|
||||
nfsd.nd_procp = ap->a_p;
|
||||
(void) nqsrv_getlease(ap->a_vp, &duration, NQL_CHECK | ap->a_flag,
|
||||
&nfsd, (struct mbuf *)0, &cache, &frev, ap->a_cred);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -389,6 +389,7 @@ nqsrv_instimeq(lp, duration)
|
||||
* This is somewhat messy due to the union in the nqhost structure.
|
||||
* The local host is indicated by the special value of NQLOCALSLP for slp.
|
||||
*/
|
||||
int
|
||||
nqsrv_cmpnam(slp, nam, lph)
|
||||
register struct nfssvc_sock *slp;
|
||||
struct mbuf *nam;
|
||||
@ -586,7 +587,7 @@ tryagain:
|
||||
void
|
||||
nqnfs_serverd()
|
||||
{
|
||||
register struct nqlease *lp, *lq;
|
||||
register struct nqlease *lp;
|
||||
register struct nqhost *lph;
|
||||
struct nqlease *nextlp;
|
||||
struct nqm *lphnext, *olphnext;
|
||||
@ -668,6 +669,7 @@ nqnfs_serverd()
|
||||
* Do the from/to xdr translation and call nqsrv_getlease() to
|
||||
* do the real work.
|
||||
*/
|
||||
int
|
||||
nqnfsrv_getlease(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -694,8 +696,9 @@ nqnfsrv_getlease(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_dissect(tl, u_int32_t *, 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;
|
||||
@ -719,6 +722,7 @@ nqnfsrv_getlease(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
* Called from nfssvc_nfsd() when a "vacated" message is received from a
|
||||
* client. Find the entry and expire it.
|
||||
*/
|
||||
int
|
||||
nqnfsrv_vacated(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -792,6 +796,7 @@ nfsmout:
|
||||
/*
|
||||
* Client get lease rpc function.
|
||||
*/
|
||||
int
|
||||
nqnfs_getlease(vp, rwflag, cred, p)
|
||||
register struct vnode *vp;
|
||||
int rwflag;
|
||||
@ -836,6 +841,7 @@ nqnfs_getlease(vp, rwflag, cred, p)
|
||||
/*
|
||||
* Client vacated message function.
|
||||
*/
|
||||
int
|
||||
nqnfs_vacated(vp, cred)
|
||||
register struct vnode *vp;
|
||||
struct ucred *cred;
|
||||
@ -881,6 +887,7 @@ nqnfs_vacated(vp, cred)
|
||||
/*
|
||||
* Called for client side callbacks
|
||||
*/
|
||||
int
|
||||
nqnfs_callback(nmp, mrep, md, dpos)
|
||||
struct nfsmount *nmp;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -899,7 +906,7 @@ nqnfs_callback(nmp, mrep, md, dpos)
|
||||
nd.nd_mrep = mrep;
|
||||
nd.nd_md = md;
|
||||
nd.nd_dpos = dpos;
|
||||
if (error = nfs_getreq(&nd, FALSE))
|
||||
if ((error = nfs_getreq(&nd, FALSE)) != 0)
|
||||
return (error);
|
||||
md = nd.nd_md;
|
||||
dpos = nd.nd_dpos;
|
||||
@ -910,7 +917,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, (nfsv2fh_t *) fhp, &np);
|
||||
if (error)
|
||||
return (error);
|
||||
vp = NFSTOV(np);
|
||||
if (np->n_timer.cqe_next != 0) {
|
||||
@ -932,6 +940,7 @@ nqnfs_callback(nmp, mrep, md, dpos)
|
||||
* "sleep" since nfs_reclaim() called from vclean() can pull a node off
|
||||
* the list asynchronously.
|
||||
*/
|
||||
int
|
||||
nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
|
||||
register struct nfsmount *nmp;
|
||||
struct ucred *cred;
|
||||
@ -943,7 +952,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
|
||||
register struct nfsnode *np;
|
||||
struct vnode *vp;
|
||||
struct nfsreq myrep;
|
||||
int error, vpid;
|
||||
int error = 0, vpid;
|
||||
|
||||
/*
|
||||
* First initialize some variables
|
||||
@ -999,13 +1008,15 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
|
||||
while (np != (void *)&nmp->nm_timerhead &&
|
||||
(nmp->nm_flag & NFSMNT_DISMINPROG) == 0) {
|
||||
vp = NFSTOV(np);
|
||||
if (strncmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS, MFSNAMELEN)) panic("trash2");
|
||||
if (strncmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS, MFSNAMELEN))
|
||||
panic("trash2");
|
||||
vpid = vp->v_id;
|
||||
if (np->n_expiry < time.tv_sec) {
|
||||
if (vget(vp, 1) == 0) {
|
||||
nmp->nm_inprog = vp;
|
||||
if (vpid == vp->v_id) {
|
||||
if (strncmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS, MFSNAMELEN)) panic("trash3");
|
||||
if (strncmp(&vp->v_mount->mnt_stat.f_fstypename[0], MOUNT_NFS, MFSNAMELEN))
|
||||
panic("trash3");
|
||||
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
|
||||
np->n_timer.cqe_next = 0;
|
||||
if ((np->n_flag & (NMODIFIED | NQNFSEVICTED))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_serv.c,v 1.21 1996/02/09 15:47:11 mycroft Exp $ */
|
||||
/* $NetBSD: nfs_serv.c,v 1.22 1996/02/09 21:48:27 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -75,6 +75,7 @@
|
||||
#include <nfs/xdr_subs.h>
|
||||
#include <nfs/nfsm_subs.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
/* Defs */
|
||||
#define TRUE 1
|
||||
@ -90,6 +91,7 @@ nfstype nfs_type[9] = { NFNON, NFREG, NFDIR, NFBLK, NFCHR, NFLNK, NFNON,
|
||||
/*
|
||||
* nqnfs access service
|
||||
*/
|
||||
int
|
||||
nqnfsrv_access(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -103,7 +105,7 @@ nqnfsrv_access(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
register u_int32_t *tl;
|
||||
register int32_t t1;
|
||||
caddr_t bpos;
|
||||
int error = 0, rdonly, cache, mode = 0;
|
||||
int error = 0, rdonly, cache = 0, mode = 0;
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mreq;
|
||||
u_quad_t frev;
|
||||
@ -111,7 +113,8 @@ nqnfsrv_access(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
fhp = &nfh.fh_generic;
|
||||
nfsm_srvmtofh(fhp);
|
||||
nfsm_dissect(tl, u_int32_t *, 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;
|
||||
@ -128,6 +131,7 @@ nqnfsrv_access(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
/*
|
||||
* nfs getattr service
|
||||
*/
|
||||
int
|
||||
nfsrv_getattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -150,7 +154,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, &va, cred, nfsd->nd_procp);
|
||||
@ -164,6 +169,7 @@ nfsrv_getattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
/*
|
||||
* nfs setattr service
|
||||
*/
|
||||
int
|
||||
nfsrv_setattr(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -187,8 +193,10 @@ 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))
|
||||
nfsm_dissect(sp, struct nfsv2_sattr *,
|
||||
NFSX_SATTR(nfsd->nd_nqlflag != NQL_NOVAL));
|
||||
error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, nfsd->nd_slp, nam, &rdonly);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(vp, NQL_WRITE);
|
||||
VATTR_NULL(&va);
|
||||
@ -239,11 +247,11 @@ 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))
|
||||
} else if ((error = nfsrv_access(vp, VWRITE, cred, rdonly,
|
||||
nfsd->nd_procp)) != 0)
|
||||
goto out;
|
||||
}
|
||||
if (error = VOP_SETATTR(vp, &va, cred, nfsd->nd_procp)) {
|
||||
if ((error = VOP_SETATTR(vp, &va, cred, nfsd->nd_procp)) != 0) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -263,6 +271,7 @@ out:
|
||||
/*
|
||||
* nfs lookup rpc
|
||||
*/
|
||||
int
|
||||
nfsrv_lookup(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -296,8 +305,8 @@ 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))
|
||||
if ((error = nfs_namei(&nd, fhp, len, nfsd->nd_slp, nam, &md, &dpos,
|
||||
nfsd->nd_procp)) != 0)
|
||||
nfsm_reply(0);
|
||||
nqsrv_getl(nd.ni_startdir, NQL_READ);
|
||||
vrele(nd.ni_startdir);
|
||||
@ -305,7 +314,7 @@ 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)) {
|
||||
if ((error = VFS_VPTOFH(vp, &fhp->fh_fid)) != 0) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -336,6 +345,7 @@ nfsrv_lookup(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
/*
|
||||
* nfs readlink service
|
||||
*/
|
||||
int
|
||||
nfsrv_readlink(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -351,7 +361,7 @@ nfsrv_readlink(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
caddr_t bpos;
|
||||
int error = 0, rdonly, cache, i, tlen, len;
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mp2, *mp3, *mreq;
|
||||
struct mbuf *mb, *mb2, *mp2 = NULL, *mp3 = NULL, *mreq;
|
||||
struct vnode *vp;
|
||||
nfsv2fh_t nfh;
|
||||
fhandle_t *fhp;
|
||||
@ -389,7 +399,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);
|
||||
}
|
||||
@ -418,6 +429,7 @@ out:
|
||||
/*
|
||||
* nfs read service
|
||||
*/
|
||||
int
|
||||
nfsrv_read(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -454,7 +466,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;
|
||||
@ -462,12 +475,16 @@ nfsrv_read(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nqsrv_getl(vp, NQL_READ);
|
||||
if ((error = nfsrv_access(vp, VREAD, cred, rdonly, nfsd->nd_procp)) &&
|
||||
(error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp))) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
if (error = VOP_GETATTR(vp, &va, cred, nfsd->nd_procp)) {
|
||||
error = nfsrv_access(vp, VREAD, cred, rdonly, nfsd->nd_procp);
|
||||
if (error)
|
||||
goto out;
|
||||
error = nfsrv_access(vp, VEXEC, cred, rdonly, nfsd->nd_procp);
|
||||
if (error)
|
||||
goto out;
|
||||
error = VOP_GETATTR(vp, &va, cred, nfsd->nd_procp);
|
||||
|
||||
if (error) {
|
||||
out:
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -537,6 +554,7 @@ nfsrv_read(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
/*
|
||||
* nfs write service
|
||||
*/
|
||||
int
|
||||
nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -592,7 +610,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;
|
||||
@ -600,7 +619,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);
|
||||
}
|
||||
@ -643,7 +663,7 @@ nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
nfsm_reply(0);
|
||||
}
|
||||
uiop->uio_resid = siz;
|
||||
if (error = VOP_WRITE(vp, uiop, ioflags, cred)) {
|
||||
if ((error = VOP_WRITE(vp, uiop, ioflags, cred)) != 0) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -665,6 +685,7 @@ nfsrv_write(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
* nfs create service
|
||||
* now does a truncate to 0 length via. setattr if it already exists
|
||||
*/
|
||||
int
|
||||
nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -683,7 +704,7 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
int error = 0, rdev, cache, len, tsize;
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mreq;
|
||||
struct vnode *vp;
|
||||
struct vnode *vp = NULL;
|
||||
nfsv2fh_t nfh;
|
||||
fhandle_t *fhp;
|
||||
u_quad_t frev;
|
||||
@ -695,8 +716,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(&va);
|
||||
nfsm_dissect(sp, struct nfsv2_sattr *, NFSX_SATTR(nfsd->nd_nqlflag != NQL_NOVAL));
|
||||
@ -717,7 +739,9 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
if (va.va_type == VREG || va.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, &va))
|
||||
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd,
|
||||
&va);
|
||||
if (error)
|
||||
nfsm_reply(0);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
} else if (va.va_type == VCHR || va.va_type == VBLK ||
|
||||
@ -731,14 +755,16 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
error = ENXIO;
|
||||
goto out;
|
||||
#endif /* FIFO */
|
||||
} else if (error = suser(cred, (u_short *)0)) {
|
||||
} else if ((error = suser(cred, (u_short *)0)) != 0) {
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
goto out;
|
||||
} else
|
||||
va.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, &va)) {
|
||||
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd,
|
||||
&va);
|
||||
if (error) {
|
||||
vrele(nd.ni_startdir);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -746,7 +772,7 @@ 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)) {
|
||||
if ((error = lookup(&nd)) != 0) {
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -783,13 +809,16 @@ nfsrv_create(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
} else
|
||||
fxdr_hyper(&sp->sa_nqsize, &va.va_size);
|
||||
if (va.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, &va, cred, nfsd->nd_procp)) {
|
||||
error = VOP_SETATTR(vp, &va, cred, nfsd->nd_procp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -797,7 +826,7 @@ 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)) {
|
||||
if ((error = VFS_VPTOFH(vp, &fhp->fh_fid)) != 0) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -824,11 +853,13 @@ out:
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
nfsm_reply(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* nfs remove service
|
||||
*/
|
||||
int
|
||||
nfsrv_remove(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -854,8 +885,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;
|
||||
/*
|
||||
@ -884,6 +916,7 @@ out:
|
||||
/*
|
||||
* nfs rename service
|
||||
*/
|
||||
int
|
||||
nfsrv_rename(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -898,7 +931,7 @@ nfsrv_rename(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mreq;
|
||||
struct nameidata fromnd, tond;
|
||||
struct vnode *fvp, *tvp, *tdvp;
|
||||
struct vnode *fvp = NULL, *tvp, *tdvp;
|
||||
nfsv2fh_t fnfh, tnfh;
|
||||
fhandle_t *ffhp, *tfhp;
|
||||
u_quad_t frev;
|
||||
@ -918,8 +951,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);
|
||||
@ -928,8 +962,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);
|
||||
@ -1016,6 +1051,7 @@ nfsmout:
|
||||
/*
|
||||
* nfs link service
|
||||
*/
|
||||
int
|
||||
nfsrv_link(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1040,13 +1076,15 @@ 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);
|
||||
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 out;
|
||||
if (nd.ni_vp) {
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
@ -1070,6 +1108,7 @@ out:
|
||||
/*
|
||||
* nfs symbolic link service
|
||||
*/
|
||||
int
|
||||
nfsrv_symlink(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1099,8 +1138,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);
|
||||
@ -1151,6 +1191,7 @@ nfsmout:
|
||||
/*
|
||||
* nfs mkdir service
|
||||
*/
|
||||
int
|
||||
nfsrv_mkdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1179,8 +1220,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_int32_t *, NFSX_UNSIGNED);
|
||||
VATTR_NULL(&va);
|
||||
@ -1198,12 +1240,12 @@ 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, &va))
|
||||
if ((error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &va)) != 0)
|
||||
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)) {
|
||||
if ((error = VFS_VPTOFH(vp, &fhp->fh_fid)) != 0) {
|
||||
vput(vp);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
@ -1228,6 +1270,7 @@ nfsmout:
|
||||
/*
|
||||
* nfs rmdir service
|
||||
*/
|
||||
int
|
||||
nfsrv_rmdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1253,8 +1296,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) {
|
||||
@ -1327,6 +1371,7 @@ struct flrep {
|
||||
u_int32_t fl_fattr[NFSX_NQFATTR / sizeof (u_int32_t)];
|
||||
};
|
||||
|
||||
int
|
||||
nfsrv_readdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1336,7 +1381,7 @@ nfsrv_readdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
{
|
||||
register char *bp, *be;
|
||||
register struct mbuf *mp;
|
||||
register struct dirent *dp;
|
||||
register struct dirent *dp = NULL;
|
||||
register caddr_t cp;
|
||||
register u_int32_t *tl;
|
||||
register int32_t t1;
|
||||
@ -1364,10 +1409,12 @@ nfsrv_readdir(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
siz = NFS_MAXREADDIR;
|
||||
fullsiz = siz;
|
||||
ncookies = siz / 16; /* Guess at the number of cookies needed. */
|
||||
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);
|
||||
}
|
||||
@ -1510,6 +1557,7 @@ again:
|
||||
nfsm_srvdone;
|
||||
}
|
||||
|
||||
int
|
||||
nqnfsrv_readdirlook(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1519,7 +1567,7 @@ nqnfsrv_readdirlook(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
{
|
||||
register char *bp, *be;
|
||||
register struct mbuf *mp;
|
||||
register struct dirent *dp;
|
||||
register struct dirent *dp = NULL;
|
||||
register caddr_t cp;
|
||||
register u_int32_t *tl;
|
||||
register int32_t t1;
|
||||
@ -1551,10 +1599,12 @@ nqnfsrv_readdirlook(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
siz = NFS_MAXREADDIR;
|
||||
fullsiz = siz;
|
||||
ncookies = siz / 16; /* Guess at the number of cookies needed. */
|
||||
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);
|
||||
}
|
||||
@ -1749,6 +1799,7 @@ invalid:
|
||||
/*
|
||||
* nfs statfs service
|
||||
*/
|
||||
int
|
||||
nfsrv_statfs(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1761,7 +1812,7 @@ nfsrv_statfs(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
register u_int32_t *tl;
|
||||
register int32_t t1;
|
||||
caddr_t bpos;
|
||||
int error = 0, rdonly, cache, isnq;
|
||||
int error = 0, rdonly, cache = 0, isnq;
|
||||
char *cp2;
|
||||
struct mbuf *mb, *mb2, *mreq;
|
||||
struct vnode *vp;
|
||||
@ -1773,7 +1824,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);
|
||||
@ -1796,6 +1848,7 @@ nfsrv_statfs(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
* Null operation, used by clients to ping server
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfsrv_null(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1804,7 +1857,7 @@ nfsrv_null(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct mbuf *nam, **mrq;
|
||||
{
|
||||
caddr_t bpos;
|
||||
int error = VNOVAL, cache;
|
||||
int error = VNOVAL, cache = 0;
|
||||
struct mbuf *mb, *mreq;
|
||||
u_quad_t frev;
|
||||
|
||||
@ -1816,6 +1869,7 @@ nfsrv_null(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
* No operation, used for obsolete procedures
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfsrv_noop(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct nfsd *nfsd;
|
||||
struct mbuf *mrep, *md;
|
||||
@ -1824,7 +1878,7 @@ nfsrv_noop(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
struct mbuf *nam, **mrq;
|
||||
{
|
||||
caddr_t bpos;
|
||||
int error, cache;
|
||||
int error, cache = 0;
|
||||
struct mbuf *mb, *mreq;
|
||||
u_quad_t frev;
|
||||
|
||||
@ -1846,6 +1900,7 @@ nfsrv_noop(nfsd, mrep, md, dpos, cred, nam, mrq)
|
||||
* this because it opens a security hole, but since the nfs server opens
|
||||
* a security hole the size of a barn door anyhow, what the heck.
|
||||
*/
|
||||
int
|
||||
nfsrv_access(vp, flags, cred, rdonly, p)
|
||||
register struct vnode *vp;
|
||||
int flags;
|
||||
@ -1866,6 +1921,13 @@ nfsrv_access(vp, flags, cred, rdonly, p)
|
||||
switch (vp->v_type) {
|
||||
case VREG: case VDIR: case VLNK:
|
||||
return (EROFS);
|
||||
case VNON:
|
||||
case VBLK:
|
||||
case VCHR:
|
||||
case VSOCK:
|
||||
case VFIFO:
|
||||
case VBAD:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -1876,7 +1938,7 @@ 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))
|
||||
if ((error = VOP_GETATTR(vp, &vattr, cred, p)) != 0)
|
||||
return (error);
|
||||
if ((error = VOP_ACCESS(vp, flags, cred, p)) &&
|
||||
cred->cr_uid != vattr.va_uid)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_socket.c,v 1.22 1995/12/19 23:07:38 cgd Exp $ */
|
||||
/* $NetBSD: nfs_socket.c,v 1.23 1996/02/09 21:48:29 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993
|
||||
@ -55,6 +55,7 @@
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/tprintf.h>
|
||||
#include <sys/namei.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
@ -67,6 +68,7 @@
|
||||
#include <nfs/nfsnode.h>
|
||||
#include <nfs/nfsrtt.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
@ -153,10 +155,6 @@ static int proct[NFS_NPROCS] = {
|
||||
#define NFS_CWNDSCALE 256
|
||||
#define NFS_MAXCWND (NFS_CWNDSCALE * 32)
|
||||
static int nfs_backoff[8] = { 2, 4, 8, 16, 32, 64, 128, 256, };
|
||||
int nfs_sbwait();
|
||||
void nfs_disconnect(), nfs_realign(), nfsrv_wakenfsd(), nfs_sndunlock();
|
||||
void nfs_rcvunlock(), nqnfs_serverd(), nqnfs_clientlease();
|
||||
struct mbuf *nfsm_rpchead();
|
||||
int nfsrtton = 0;
|
||||
struct nfsrtt nfsrtt;
|
||||
|
||||
@ -164,6 +162,7 @@ struct nfsrtt nfsrtt;
|
||||
* Initialize sockets and congestion for a new NFS connection.
|
||||
* We do not free the sockaddr if error.
|
||||
*/
|
||||
int
|
||||
nfs_connect(nmp, rep)
|
||||
register struct nfsmount *nmp;
|
||||
struct nfsreq *rep;
|
||||
@ -177,8 +176,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;
|
||||
@ -212,7 +212,7 @@ nfs_connect(nmp, rep)
|
||||
goto bad;
|
||||
}
|
||||
} else {
|
||||
if (error = soconnect(so, nmp->nm_nam))
|
||||
if ((error = soconnect(so, nmp->nm_nam)) != 0)
|
||||
goto bad;
|
||||
|
||||
/*
|
||||
@ -273,7 +273,7 @@ nfs_connect(nmp, rep)
|
||||
rcvreserve = (nmp->nm_rsize + NFS_MAXPKTHDR +
|
||||
sizeof (u_int32_t)) * 2;
|
||||
}
|
||||
if (error = soreserve(so, sndreserve, rcvreserve))
|
||||
if ((error = soreserve(so, sndreserve, rcvreserve)) != 0)
|
||||
goto bad;
|
||||
so->so_rcv.sb_flags |= SB_NOINTR;
|
||||
so->so_snd.sb_flags |= SB_NOINTR;
|
||||
@ -302,6 +302,7 @@ bad:
|
||||
* If this fails the mount point is DEAD!
|
||||
* nb: Must be called with the nfs_sndlock() set on the mount point.
|
||||
*/
|
||||
int
|
||||
nfs_reconnect(rep)
|
||||
register struct nfsreq *rep;
|
||||
{
|
||||
@ -310,7 +311,7 @@ nfs_reconnect(rep)
|
||||
int error;
|
||||
|
||||
nfs_disconnect(nmp);
|
||||
while (error = nfs_connect(nmp, rep)) {
|
||||
while ((error = nfs_connect(nmp, rep)) != 0) {
|
||||
if (error == EINTR || error == ERESTART)
|
||||
return (EINTR);
|
||||
(void) tsleep((caddr_t)&lbolt, PSOCK, "nfscon", 0);
|
||||
@ -357,6 +358,7 @@ nfs_disconnect(nmp)
|
||||
* - return EPIPE if a connection is lost for connection based sockets (TCP...)
|
||||
* - do any cleanup required by recoverable socket errors (???)
|
||||
*/
|
||||
int
|
||||
nfs_send(so, nam, top, rep)
|
||||
register struct socket *so;
|
||||
struct mbuf *nam;
|
||||
@ -425,6 +427,7 @@ nfs_send(so, nam, top, rep)
|
||||
* For SOCK_STREAM we must be very careful to read an entire record once
|
||||
* we have read any of it, even if the system call has been interrupted.
|
||||
*/
|
||||
int
|
||||
nfs_receive(rep, aname, mp)
|
||||
register struct nfsreq *rep;
|
||||
struct mbuf **aname;
|
||||
@ -456,7 +459,7 @@ 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))
|
||||
if ((error = nfs_sndlock(&rep->r_nmp->nm_flag, rep)) != 0)
|
||||
return (error);
|
||||
tryagain:
|
||||
/*
|
||||
@ -473,7 +476,7 @@ tryagain:
|
||||
return (EINTR);
|
||||
}
|
||||
if ((so = rep->r_nmp->nm_so) == NULL) {
|
||||
if (error = nfs_reconnect(rep)) {
|
||||
if ((error = nfs_reconnect(rep)) != 0) {
|
||||
nfs_sndunlock(&rep->r_nmp->nm_flag);
|
||||
return (error);
|
||||
}
|
||||
@ -482,7 +485,8 @@ tryagain:
|
||||
while (rep->r_flags & R_MUSTRESEND) {
|
||||
m = m_copym(rep->r_mreq, 0, M_COPYALL, M_WAIT);
|
||||
nfsstats.rpcretries++;
|
||||
if (error = nfs_send(so, rep->r_nmp->nm_nam, m, rep)) {
|
||||
error = nfs_send(so, rep->r_nmp->nm_nam, m, rep);
|
||||
if (error) {
|
||||
if (error == EINTR || error == ERESTART ||
|
||||
(error = nfs_reconnect(rep))) {
|
||||
nfs_sndunlock(&rep->r_nmp->nm_flag);
|
||||
@ -631,6 +635,7 @@ errout:
|
||||
* with outstanding requests using the xid, until ours is found.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfs_reply(myrep)
|
||||
struct nfsreq *myrep;
|
||||
{
|
||||
@ -652,7 +657,7 @@ nfs_reply(myrep)
|
||||
* Also necessary for connection based protocols to avoid
|
||||
* race conditions during a reconnect.
|
||||
*/
|
||||
if (error = nfs_rcvlock(myrep))
|
||||
if ((error = nfs_rcvlock(myrep)) != 0)
|
||||
return (error);
|
||||
/* Already received, bye bye */
|
||||
if (myrep->r_mrep != NULL) {
|
||||
@ -796,6 +801,7 @@ nfsmout:
|
||||
* by mrep or error
|
||||
* nb: always frees up mreq mbuf list
|
||||
*/
|
||||
int
|
||||
nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
|
||||
struct vnode *vp;
|
||||
struct mbuf *mrest;
|
||||
@ -812,7 +818,6 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
|
||||
register int i;
|
||||
struct nfsmount *nmp;
|
||||
struct mbuf *md, *mheadend;
|
||||
struct nfsreq *reph;
|
||||
struct nfsnode *np;
|
||||
time_t reqtime, waituntil;
|
||||
caddr_t dpos, cp2;
|
||||
@ -1065,6 +1070,7 @@ nfsmout:
|
||||
* Generate the rpc reply header
|
||||
* siz arg. is used to decide if adding a cluster is worthwhile
|
||||
*/
|
||||
int
|
||||
nfs_rephead(siz, nd, err, cache, frev, mrq, mbp, bposp)
|
||||
int siz;
|
||||
struct nfsd *nd;
|
||||
@ -1178,7 +1184,9 @@ nfs_timer(arg)
|
||||
register struct socket *so;
|
||||
register struct nfsmount *nmp;
|
||||
register int timeo;
|
||||
#ifdef NFSSERVER
|
||||
static long lasttime = 0;
|
||||
#endif
|
||||
int s, error;
|
||||
|
||||
s = splsoftnet();
|
||||
@ -1286,6 +1294,7 @@ nfs_timer(arg)
|
||||
* Test for a termination condition pending on the process.
|
||||
* This is used for NFSMNT_INT mounts.
|
||||
*/
|
||||
int
|
||||
nfs_sigintr(nmp, rep, p)
|
||||
struct nfsmount *nmp;
|
||||
struct nfsreq *rep;
|
||||
@ -1309,6 +1318,7 @@ nfs_sigintr(nmp, rep, p)
|
||||
* and also to avoid race conditions between the processes with nfs requests
|
||||
* in progress when a reconnect is necessary.
|
||||
*/
|
||||
int
|
||||
nfs_sndlock(flagp, rep)
|
||||
register int *flagp;
|
||||
struct nfsreq *rep;
|
||||
@ -1354,6 +1364,7 @@ nfs_sndunlock(flagp)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
nfs_rcvlock(rep)
|
||||
register struct nfsreq *rep;
|
||||
{
|
||||
@ -1491,6 +1502,7 @@ nfs_realign(m, hsiz)
|
||||
* - verify it
|
||||
* - fill in the cred struct.
|
||||
*/
|
||||
int
|
||||
nfs_getreq(nd, has_header)
|
||||
register struct nfsd *nd;
|
||||
int has_header;
|
||||
@ -1639,6 +1651,7 @@ nfsmout:
|
||||
return (error);
|
||||
}
|
||||
|
||||
void
|
||||
nfs_msg(p, server, msg)
|
||||
struct proc *p;
|
||||
char *server, *msg;
|
||||
@ -1654,29 +1667,9 @@ nfs_msg(p, server, msg)
|
||||
}
|
||||
|
||||
#ifdef NFSSERVER
|
||||
int nfsrv_null(),
|
||||
nfsrv_getattr(),
|
||||
nfsrv_setattr(),
|
||||
nfsrv_lookup(),
|
||||
nfsrv_readlink(),
|
||||
nfsrv_read(),
|
||||
nfsrv_write(),
|
||||
nfsrv_create(),
|
||||
nfsrv_remove(),
|
||||
nfsrv_rename(),
|
||||
nfsrv_link(),
|
||||
nfsrv_symlink(),
|
||||
nfsrv_mkdir(),
|
||||
nfsrv_rmdir(),
|
||||
nfsrv_readdir(),
|
||||
nfsrv_statfs(),
|
||||
nfsrv_noop(),
|
||||
nqnfsrv_readdirlook(),
|
||||
nqnfsrv_getlease(),
|
||||
nqnfsrv_vacated(),
|
||||
nqnfsrv_access();
|
||||
|
||||
int (*nfsrv_procs[NFS_NPROCS])() = {
|
||||
int (*nfsrv_procs[NFS_NPROCS]) __P((struct nfsd *, struct mbuf *, struct mbuf *,
|
||||
caddr_t, struct ucred *, struct mbuf *,
|
||||
struct mbuf **)) = {
|
||||
nfsrv_null,
|
||||
nfsrv_getattr,
|
||||
nfsrv_setattr,
|
||||
@ -1770,7 +1763,7 @@ nfsrv_rcv(so, arg, waitflag)
|
||||
/*
|
||||
* Now try and parse record(s) out of the raw stream data.
|
||||
*/
|
||||
if (error = nfsrv_getstream(slp, waitflag)) {
|
||||
if ((error = nfsrv_getstream(slp, waitflag)) != 0) {
|
||||
if (error == EPERM)
|
||||
slp->ns_flag |= SLP_DISCONN;
|
||||
else
|
||||
@ -1820,6 +1813,7 @@ dorecs:
|
||||
* stream socket. The "waitflag" argument indicates whether or not it
|
||||
* can sleep.
|
||||
*/
|
||||
int
|
||||
nfsrv_getstream(slp, waitflag)
|
||||
register struct nfssvc_sock *slp;
|
||||
int waitflag;
|
||||
@ -1827,7 +1821,7 @@ nfsrv_getstream(slp, waitflag)
|
||||
register struct mbuf *m;
|
||||
register char *cp1, *cp2;
|
||||
register int len;
|
||||
struct mbuf *om, *m2, *recm;
|
||||
struct mbuf *om, *m2, *recm = NULL;
|
||||
u_long recmark;
|
||||
|
||||
if (slp->ns_flag & SLP_GETSTREAM)
|
||||
@ -1924,6 +1918,7 @@ nfsrv_getstream(slp, waitflag)
|
||||
/*
|
||||
* Parse an RPC header.
|
||||
*/
|
||||
int
|
||||
nfsrv_dorec(slp, nd)
|
||||
register struct nfssvc_sock *slp;
|
||||
register struct nfsd *nd;
|
||||
@ -1934,7 +1929,7 @@ 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)
|
||||
if ((slp->ns_rec = m->m_nextpkt) != NULL)
|
||||
m->m_nextpkt = (struct mbuf *)0;
|
||||
else
|
||||
slp->ns_recend = (struct mbuf *)0;
|
||||
@ -1947,7 +1942,7 @@ 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)) {
|
||||
if ((error = nfs_getreq(nd, TRUE)) != 0) {
|
||||
m_freem(nd->nd_nam);
|
||||
return (error);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_srvcache.c,v 1.10 1994/12/13 17:17:03 mycroft Exp $ */
|
||||
/* $NetBSD: nfs_srvcache.c,v 1.11 1996/02/09 21:48:32 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -64,6 +64,7 @@
|
||||
#include <nfs/nfs.h>
|
||||
#include <nfs/nfsrvcache.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
long numnfsrvcache, desirednfsrvcache = NFSRVCACHESIZ;
|
||||
|
||||
@ -138,6 +139,7 @@ static int repliesstatus[NFS_NPROCS] = {
|
||||
/*
|
||||
* Initialize the server request cache list
|
||||
*/
|
||||
void
|
||||
nfsrv_initcache()
|
||||
{
|
||||
|
||||
@ -159,6 +161,7 @@ nfsrv_initcache()
|
||||
* return DOIT
|
||||
* Update/add new request at end of lru list
|
||||
*/
|
||||
int
|
||||
nfsrv_getcache(nam, nd, repp)
|
||||
struct mbuf *nam;
|
||||
register struct nfsd *nd;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_subs.c,v 1.23 1996/02/01 00:40:44 jtc Exp $ */
|
||||
/* $NetBSD: nfs_subs.c,v 1.24 1996/02/09 21:48:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -63,9 +63,12 @@
|
||||
#include <nfs/nfsmount.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfsrtt.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#ifdef ISO
|
||||
#include <netiso/iso.h>
|
||||
@ -266,6 +269,7 @@ nfsm_rpchead(cr, nqnfs, procid, auth_type, auth_len, auth_str, mrest,
|
||||
/*
|
||||
* copies mbuf chain to the uio scatter/gather list
|
||||
*/
|
||||
int
|
||||
nfsm_mbuftouio(mrep, uiop, siz, dpos)
|
||||
struct mbuf **mrep;
|
||||
register struct uio *uiop;
|
||||
@ -340,6 +344,7 @@ nfsm_mbuftouio(mrep, uiop, siz, dpos)
|
||||
/*
|
||||
* copies a uio scatter/gather list to an mbuf chain...
|
||||
*/
|
||||
int
|
||||
nfsm_uiotombuf(uiop, mq, siz, bpos)
|
||||
register struct uio *uiop;
|
||||
struct mbuf **mq;
|
||||
@ -427,6 +432,7 @@ nfsm_uiotombuf(uiop, mq, siz, bpos)
|
||||
* This is used by the macros nfsm_dissect and nfsm_dissecton for tough
|
||||
* cases. (The macros use the vars. dpos and dpos2)
|
||||
*/
|
||||
int
|
||||
nfsm_disct(mdp, dposp, siz, left, cp2)
|
||||
struct mbuf **mdp;
|
||||
caddr_t *dposp;
|
||||
@ -489,6 +495,7 @@ nfsm_disct(mdp, dposp, siz, left, cp2)
|
||||
/*
|
||||
* Advance the position in the mbuf chain.
|
||||
*/
|
||||
int
|
||||
nfs_adv(mdp, dposp, offs, left)
|
||||
struct mbuf **mdp;
|
||||
caddr_t *dposp;
|
||||
@ -515,13 +522,14 @@ nfs_adv(mdp, dposp, offs, left)
|
||||
/*
|
||||
* Copy a string into mbufs for the hard cases...
|
||||
*/
|
||||
int
|
||||
nfsm_strtmbuf(mb, bpos, cp, siz)
|
||||
struct mbuf **mb;
|
||||
char **bpos;
|
||||
char *cp;
|
||||
long siz;
|
||||
{
|
||||
register struct mbuf *m1, *m2;
|
||||
register struct mbuf *m1 = NULL, *m2;
|
||||
long left, xfer, len, tlen;
|
||||
u_int32_t *tl;
|
||||
int putsize;
|
||||
@ -580,6 +588,7 @@ nfsm_strtmbuf(mb, bpos, cp, siz)
|
||||
/*
|
||||
* Called once to initialize data structures...
|
||||
*/
|
||||
void
|
||||
nfs_init()
|
||||
{
|
||||
register int i;
|
||||
@ -632,7 +641,7 @@ nfs_init()
|
||||
* Initialize reply list and start timer
|
||||
*/
|
||||
TAILQ_INIT(&nfs_reqq);
|
||||
nfs_timer();
|
||||
nfs_timer(NULL);
|
||||
}
|
||||
|
||||
#ifdef NFSCLIENT
|
||||
@ -650,6 +659,7 @@ nfs_init()
|
||||
* Iff vap not NULL
|
||||
* copy the attributes to *vaper
|
||||
*/
|
||||
int
|
||||
nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
struct vnode **vpp;
|
||||
struct mbuf **mdp;
|
||||
@ -659,7 +669,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
register struct vnode *vp = *vpp;
|
||||
register struct vattr *vap;
|
||||
register struct nfsv2_fattr *fp;
|
||||
extern int (**spec_nfsv2nodeop_p)();
|
||||
extern int (**spec_nfsv2nodeop_p) __P((void *));
|
||||
register struct nfsnode *np;
|
||||
register struct nfsnodehashhead *nhpp;
|
||||
register int32_t t1;
|
||||
@ -676,7 +686,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);
|
||||
@ -705,7 +716,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
vp->v_type = vtyp;
|
||||
if (vp->v_type == VFIFO) {
|
||||
#ifdef FIFO
|
||||
extern int (**fifo_nfsv2nodeop_p)();
|
||||
extern int (**fifo_nfsv2nodeop_p) __P((void *));
|
||||
vp->v_op = fifo_nfsv2nodeop_p;
|
||||
#else
|
||||
return (EOPNOTSUPP);
|
||||
@ -713,7 +724,8 @@ 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.
|
||||
*/
|
||||
@ -808,6 +820,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
|
||||
* If the cache is valid, copy contents to *vap and return 0
|
||||
* otherwise return an error
|
||||
*/
|
||||
int
|
||||
nfs_getattrcache(vp, vaper)
|
||||
register struct vnode *vp;
|
||||
struct vattr *vaper;
|
||||
@ -865,6 +878,7 @@ nfs_getattrcache(vp, vaper)
|
||||
/*
|
||||
* Set up nameidata for a lookup() call and do it
|
||||
*/
|
||||
int
|
||||
nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, p)
|
||||
register struct nameidata *ndp;
|
||||
fhandle_t *fhp;
|
||||
@ -915,7 +929,7 @@ 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))
|
||||
else if ((error = nfs_adv(mdp, dposp, len, rem)) != 0)
|
||||
goto out;
|
||||
}
|
||||
ndp->ni_pathlen = tocp - cnp->cn_pnbuf;
|
||||
@ -923,8 +937,9 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, p)
|
||||
/*
|
||||
* 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);
|
||||
@ -940,7 +955,7 @@ 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))
|
||||
if ((error = lookup(ndp)) != 0)
|
||||
goto out;
|
||||
/*
|
||||
* Check for encountering a symbolic link
|
||||
@ -1025,7 +1040,7 @@ nfsm_adj(mp, len, nul)
|
||||
}
|
||||
count -= m->m_len;
|
||||
}
|
||||
while (m = m->m_next)
|
||||
while ((m = m->m_next) != NULL)
|
||||
m->m_len = 0;
|
||||
}
|
||||
|
||||
@ -1036,6 +1051,7 @@ nfsm_adj(mp, len, nul)
|
||||
* - if cred->cr_uid == 0 or MNT_EXPORTANON set it to credanon
|
||||
* - if not lockflag unlock it with VOP_UNLOCK()
|
||||
*/
|
||||
int
|
||||
nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp)
|
||||
fhandle_t *fhp;
|
||||
int lockflag;
|
||||
@ -1054,7 +1070,8 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp)
|
||||
*vpp = (struct vnode *)0;
|
||||
if ((mp = getvfs(&fhp->fh_fsid)) == NULL)
|
||||
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.
|
||||
@ -1097,6 +1114,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp)
|
||||
* The AF_INET family is handled as a special case so that address mbufs
|
||||
* don't need to be saved to store "struct in_addr", which is only 4 bytes.
|
||||
*/
|
||||
int
|
||||
netaddr_match(family, haddr, nam)
|
||||
int family;
|
||||
union nethostaddr *haddr;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_syscalls.c,v 1.17 1995/12/19 23:07:46 cgd Exp $ */
|
||||
/* $NetBSD: nfs_syscalls.c,v 1.18 1996/02/09 21:48:36 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -56,6 +56,7 @@
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/filedesc.h>
|
||||
|
||||
#include <sys/syscallargs.h>
|
||||
|
||||
@ -72,10 +73,14 @@
|
||||
#include <nfs/nfsnode.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfsrtt.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
/* Global defs. */
|
||||
extern u_int32_t nfs_prog, nfs_vers;
|
||||
extern int32_t (*nfsrv_procs[NFS_NPROCS])();
|
||||
extern int32_t (*nfsrv_procs[NFS_NPROCS]) __P((struct nfsd *, struct mbuf *,
|
||||
struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *,
|
||||
struct mbuf **));
|
||||
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
|
||||
extern int nfs_numasync;
|
||||
extern time_t nqnfsstarttime;
|
||||
@ -83,19 +88,22 @@ extern int nqsrv_writeslack;
|
||||
extern int nfsrtton;
|
||||
struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
|
||||
int nuidhash_max = NFS_MAXUIDHASH;
|
||||
static int nfs_numnfsd = 0;
|
||||
int nfsd_waiting = 0;
|
||||
#ifdef NFSSERVER
|
||||
static int nfs_numnfsd = 0;
|
||||
static int notstarted = 1;
|
||||
static int modify_flag = 0;
|
||||
static struct nfsdrt nfsdrt;
|
||||
void nfsrv_cleancache(), nfsrv_rcv(), nfsrv_wakenfsd(), nfs_sndunlock();
|
||||
static void nfsd_rt();
|
||||
void nfsrv_slpderef(), nfsrv_init();
|
||||
#endif
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
|
||||
#ifdef NFSSERVER
|
||||
static void nfsd_rt __P((struct timeval *, int, struct nfsd *, struct mbuf *,
|
||||
int));
|
||||
#endif
|
||||
/*
|
||||
* NFS server system calls
|
||||
* getfh() lives here too, but maybe should move to kern/vfs_syscalls.c
|
||||
@ -104,9 +112,10 @@ static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
|
||||
/*
|
||||
* Get file handle system call
|
||||
*/
|
||||
int
|
||||
sys_getfh(p, v, retval)
|
||||
struct proc *p;
|
||||
void *v;
|
||||
register void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
register struct sys_getfh_args /* {
|
||||
@ -121,11 +130,11 @@ sys_getfh(p, v, retval)
|
||||
/*
|
||||
* Must be super user
|
||||
*/
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
|
||||
return (error);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
|
||||
SCARG(uap, fname), p);
|
||||
if (error = namei(&nd))
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return (error);
|
||||
vp = nd.ni_vp;
|
||||
bzero((caddr_t)&fh, sizeof(fh));
|
||||
@ -145,6 +154,7 @@ sys_getfh(p, v, retval)
|
||||
* - remains in the kernel as an nfsd
|
||||
* - remains in the kernel as an nfsiod
|
||||
*/
|
||||
int
|
||||
sys_nfssvc(p, v, retval)
|
||||
struct proc *p;
|
||||
void *v;
|
||||
@ -155,21 +165,23 @@ sys_nfssvc(p, v, retval)
|
||||
syscallarg(caddr_t) argp;
|
||||
} */ *uap = v;
|
||||
struct nameidata nd;
|
||||
struct nfsmount *nmp;
|
||||
int error;
|
||||
#ifdef NFSSERVER
|
||||
struct file *fp;
|
||||
struct mbuf *nam;
|
||||
struct nfsd_args nfsdarg;
|
||||
struct nfsd_srvargs nfsd_srvargs, *nsd = &nfsd_srvargs;
|
||||
struct nfsd_cargs ncd;
|
||||
struct nfsd *nfsd;
|
||||
struct nfssvc_sock *slp;
|
||||
struct nfsuid *nuidp, **nuh;
|
||||
struct nfsmount *nmp;
|
||||
int error;
|
||||
struct nfsuid *nuidp;
|
||||
#endif
|
||||
struct nfsd_cargs ncd;
|
||||
|
||||
/*
|
||||
* Must be super user
|
||||
*/
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
|
||||
return (error);
|
||||
while (nfssvc_sockhead_flag & SLP_INIT) {
|
||||
nfssvc_sockhead_flag |= SLP_WANTINIT;
|
||||
@ -185,12 +197,12 @@ sys_nfssvc(p, v, retval)
|
||||
#ifndef NFSCLIENT
|
||||
error = ENOSYS;
|
||||
#else /* !NFSCLIENT */
|
||||
if (error =
|
||||
copyin(SCARG(uap, argp), (caddr_t)&ncd, sizeof (ncd)))
|
||||
error = copyin(SCARG(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))
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return (error);
|
||||
if ((nd.ni_vp->v_flag & VROOT) == 0)
|
||||
error = EINVAL;
|
||||
@ -209,27 +221,31 @@ sys_nfssvc(p, v, retval)
|
||||
#ifndef NFSSERVER
|
||||
error = ENOSYS;
|
||||
#else /* !NFSSERVER */
|
||||
if (error = copyin(SCARG(uap, argp), (caddr_t)&nfsdarg,
|
||||
sizeof(nfsdarg)))
|
||||
error = copyin(SCARG(uap, argp), (caddr_t)&nfsdarg,
|
||||
sizeof(nfsdarg));
|
||||
if (error)
|
||||
return (error);
|
||||
if (error = getsock(p->p_fd, nfsdarg.sock, &fp))
|
||||
if ((error = getsock(p->p_fd, nfsdarg.sock, &fp)) != 0)
|
||||
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);
|
||||
#endif /* !NFSSERVER */
|
||||
} else {
|
||||
#ifndef NFSSERVER
|
||||
error = ENOSYS;
|
||||
#else /* !NFSSERVER */
|
||||
if (error = copyin(SCARG(uap, argp), (caddr_t)nsd,
|
||||
sizeof (*nsd)))
|
||||
error = copyin(SCARG(uap, argp), (caddr_t)nsd, sizeof (*nsd));
|
||||
if (error)
|
||||
return (error);
|
||||
if ((SCARG(uap, flag) & NFSSVC_AUTHIN) &&
|
||||
(nfsd = nsd->nsd_nfsd) &&
|
||||
@ -293,6 +309,7 @@ sys_nfssvc(p, v, retval)
|
||||
/*
|
||||
* Adds a socket to the list for servicing by nfsds.
|
||||
*/
|
||||
int
|
||||
nfssvc_addsock(fp, mynam)
|
||||
struct file *fp;
|
||||
struct mbuf *mynam;
|
||||
@ -328,7 +345,7 @@ nfssvc_addsock(fp, mynam)
|
||||
siz = NFS_MAXPACKET + sizeof (u_int32_t);
|
||||
else
|
||||
siz = NFS_MAXPACKET;
|
||||
if (error = soreserve(so, siz, siz)) {
|
||||
if ((error = soreserve(so, siz, siz)) != 0) {
|
||||
m_freem(mynam);
|
||||
return (error);
|
||||
}
|
||||
@ -383,6 +400,7 @@ nfssvc_addsock(fp, mynam)
|
||||
* Called by nfssvc() for nfsds. Just loops around servicing rpc requests
|
||||
* until it is killed by a signal.
|
||||
*/
|
||||
int
|
||||
nfssvc_nfsd(nsd, argp, p)
|
||||
struct nfsd_srvargs *nsd;
|
||||
caddr_t argp;
|
||||
@ -397,7 +415,7 @@ nfssvc_nfsd(nsd, argp, p)
|
||||
struct mbuf *mreq, *nam;
|
||||
struct timeval starttime;
|
||||
struct nfsuid *uidp;
|
||||
int error, cacherep, s;
|
||||
int error = 0, cacherep, s;
|
||||
int sotype;
|
||||
|
||||
s = splsoftnet();
|
||||
@ -479,7 +497,7 @@ nfssvc_nfsd(nsd, argp, p)
|
||||
* nam2 == NULL for connection based protocols to disable
|
||||
* recent request caching.
|
||||
*/
|
||||
if (nam2 = nd->nd_nam) {
|
||||
if ((nam2 = nd->nd_nam) != NULL) {
|
||||
nam = nam2;
|
||||
cacherep = RC_CHECKIT;
|
||||
} else {
|
||||
@ -645,17 +663,17 @@ done:
|
||||
* will stop using it and clear ns_flag at the end so that it will not be
|
||||
* reassigned during cleanup.
|
||||
*/
|
||||
void
|
||||
nfsrv_zapsock(slp)
|
||||
register struct nfssvc_sock *slp;
|
||||
{
|
||||
register struct nfsuid *nuidp, *nnuidp;
|
||||
register int i;
|
||||
struct socket *so;
|
||||
struct file *fp;
|
||||
struct mbuf *m;
|
||||
|
||||
slp->ns_flag &= ~SLP_ALLFLAGS;
|
||||
if (fp = slp->ns_fp) {
|
||||
if ((fp = slp->ns_fp) != NULL) {
|
||||
slp->ns_fp = (struct file *)0;
|
||||
so = slp->ns_so;
|
||||
so->so_upcall = NULL;
|
||||
@ -783,6 +801,7 @@ nfsd_rt(startp, sotype, nd, nam, cacherep)
|
||||
* They do read-ahead and write-behind operations on the block I/O cache.
|
||||
* Never returns unless it fails or gets killed.
|
||||
*/
|
||||
int
|
||||
nfssvc_iod(p)
|
||||
struct proc *p;
|
||||
{
|
||||
@ -832,6 +851,7 @@ nfssvc_iod(p)
|
||||
* Get an authorization string for the uid by having the mount_nfs sitting
|
||||
* on this mount point porpous out of the kernel and do it.
|
||||
*/
|
||||
int
|
||||
nfs_getauth(nmp, rep, cred, auth_type, auth_str, auth_len)
|
||||
register struct nfsmount *nmp;
|
||||
struct nfsreq *rep;
|
||||
@ -846,7 +866,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);
|
||||
}
|
||||
|
220
sys/nfs/nfs_var.h
Normal file
220
sys/nfs/nfs_var.h
Normal file
@ -0,0 +1,220 @@
|
||||
/* $NetBSD: nfs_var.h,v 1.1 1996/02/09 21:48:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Christos Zoulas.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
struct vnode;
|
||||
struct uio;
|
||||
struct ucred;
|
||||
struct proc;
|
||||
struct buf;
|
||||
struct nfs_diskless;
|
||||
struct sockaddr_in;
|
||||
struct nfs_dlmount;
|
||||
struct vnode;
|
||||
struct nfsd;
|
||||
struct mbuf;
|
||||
struct file;
|
||||
struct nqlease;
|
||||
struct nqhost;
|
||||
struct nfssvc_sock;
|
||||
struct nfsmount;
|
||||
struct socket;
|
||||
struct nfsreq;
|
||||
struct vattr;
|
||||
struct nameidata;
|
||||
struct nfsnode;
|
||||
struct sillyrename;
|
||||
struct componentname;
|
||||
|
||||
|
||||
/* nfs_bio.c */
|
||||
int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *));
|
||||
struct buf *nfs_getcacheblk __P((struct vnode *, daddr_t, int, struct proc *));
|
||||
int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
|
||||
int));
|
||||
int nfs_asyncio __P((struct buf *, struct ucred *));
|
||||
int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
|
||||
|
||||
/* nfs_boot.c */
|
||||
int nfs_boot_init __P((struct nfs_diskless *, struct proc *));
|
||||
int nfs_boot_init __P((struct nfs_diskless *, struct proc *));
|
||||
|
||||
/* nfs_node.c */
|
||||
void nfs_nhinit __P((void));
|
||||
struct nfsnodehashhead *nfs_hash __P((nfsv2fh_t *));
|
||||
int nfs_nget __P((struct mount *, nfsv2fh_t *, struct nfsnode **));
|
||||
|
||||
/* nfs_vnops.c */
|
||||
int nfs_null __P((struct vnode *, struct ucred *, struct proc *));
|
||||
int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
|
||||
int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
|
||||
int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int));
|
||||
int nfs_removeit __P((struct sillyrename *));
|
||||
int nfs_renameit __P((struct vnode *, struct componentname *,
|
||||
struct sillyrename *));
|
||||
int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
|
||||
int nfs_readdirlookrpc __P((struct vnode *, struct uio *, struct ucred *));
|
||||
int nfs_sillyrename __P((struct vnode *, struct vnode *,
|
||||
struct componentname *));
|
||||
int nfs_lookitup __P((struct sillyrename *, nfsv2fh_t *, struct proc *));
|
||||
|
||||
/* nfs_nqlease.c */
|
||||
int nqsrv_getlease __P((struct vnode *, u_int *, int, struct nfsd *,
|
||||
struct mbuf *, int *, u_quad_t *, struct ucred *));
|
||||
int lease_check __P((void *));
|
||||
void nqsrv_addhost __P((struct nqhost *, struct nfssvc_sock *, struct mbuf *));
|
||||
void nqsrv_instimeq __P((struct nqlease *, u_long));
|
||||
int nqsrv_cmpnam __P((struct nfssvc_sock *, struct mbuf *, struct nqhost *));
|
||||
void nqsrv_send_eviction __P((struct vnode *, struct nqlease *,
|
||||
struct nfssvc_sock *, struct mbuf *,
|
||||
struct ucred *));
|
||||
void nqsrv_waitfor_expiry __P((struct nqlease *));
|
||||
void nqnfs_serverd __P((void));
|
||||
int nqnfsrv_getlease __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nqnfsrv_vacated __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nqnfs_getlease __P((struct vnode *, int, struct ucred *, struct proc *));
|
||||
int nqnfs_vacated __P((struct vnode *, struct ucred *));
|
||||
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 *));
|
||||
void nqnfs_clientlease __P((struct nfsmount *, struct nfsnode *, int, int ,
|
||||
time_t, u_quad_t));
|
||||
void lease_updatetime __P((int));
|
||||
void nqsrv_locklease __P((struct nqlease *));
|
||||
void nqsrv_unlocklease __P((struct nqlease *));
|
||||
|
||||
/* nfs_serv.c */
|
||||
int nqnfsrv_access __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_getattr __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_setattr __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_lookup __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_readlink __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_read __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_write __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_create __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_remove __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_rename __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_link __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_symlink __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_mkdir __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_rmdir __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_readdir __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nqnfsrv_readdirlook __P((struct nfsd *, struct mbuf *, struct mbuf *,
|
||||
caddr_t, struct ucred *, struct mbuf *,
|
||||
struct mbuf **));
|
||||
int nfsrv_statfs __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_null __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_noop __P((struct nfsd *, struct mbuf *, struct mbuf *, caddr_t,
|
||||
struct ucred *, struct mbuf *, struct mbuf **));
|
||||
int nfsrv_access __P((struct vnode *, int, struct ucred *, int, struct proc *));
|
||||
|
||||
/* nfs_socket.c */
|
||||
int nfs_connect __P((struct nfsmount *, struct nfsreq *));
|
||||
int nfs_reconnect __P((struct nfsreq *));
|
||||
void nfs_disconnect __P((struct nfsmount *));
|
||||
int nfs_send __P((struct socket *, struct mbuf *, struct mbuf *,
|
||||
struct nfsreq *));
|
||||
int nfs_receive __P((struct nfsreq *, struct mbuf **, struct mbuf **));
|
||||
int nfs_reply __P((struct nfsreq *));
|
||||
int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
|
||||
struct ucred *, struct mbuf **, struct mbuf **,
|
||||
caddr_t *));
|
||||
int nfs_rephead __P((int, struct nfsd *, int, int, u_quad_t *, struct mbuf **,
|
||||
struct mbuf **, caddr_t *));
|
||||
void nfs_timer __P((void *));
|
||||
int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
|
||||
int nfs_sndlock __P((int *, struct nfsreq *));
|
||||
void nfs_sndunlock __P((int *));
|
||||
int nfs_rcvlock __P((struct nfsreq *));
|
||||
void nfs_rcvunlock __P((int *));
|
||||
void nfs_realign __P((struct mbuf *, int));
|
||||
int nfs_getreq __P((struct nfsd *, int));
|
||||
void nfs_msg __P((struct proc *, char *, char *));
|
||||
void nfsrv_rcv __P((struct socket *, caddr_t, int));
|
||||
int nfsrv_getstream __P((struct nfssvc_sock *, int));
|
||||
int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *));
|
||||
void nfsrv_wakenfsd __P((struct nfssvc_sock *));
|
||||
|
||||
/* nfs_srvcache.c */
|
||||
void nfsrv_initcache __P((void));
|
||||
int nfsrv_getcache __P((struct mbuf *, struct nfsd *, struct mbuf **));
|
||||
void nfsrv_updatecache __P((struct mbuf *, struct nfsd *, int, struct mbuf *));
|
||||
void nfsrv_cleancache __P((void));
|
||||
|
||||
/* nfs_subs.c */
|
||||
struct mbuf *nfsm_reqh __P((struct vnode *, u_long, int, caddr_t *));
|
||||
struct mbuf *nfsm_rpchead __P((struct ucred *, int, int, int, int, char *,
|
||||
struct mbuf *, int, struct mbuf **,
|
||||
u_int32_t *));
|
||||
int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
|
||||
int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
|
||||
int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
|
||||
int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
|
||||
int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
|
||||
int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
|
||||
struct vattr *));
|
||||
int nfs_getattrcache __P((struct vnode *, 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 nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
|
||||
struct nfssvc_sock *, struct mbuf *, int *));
|
||||
int netaddr_match __P((int, union nethostaddr *, struct mbuf *));
|
||||
|
||||
/* nfs_syscalls.c */
|
||||
int nfssvc_addsock __P((struct file *, struct mbuf *));
|
||||
int nfssvc_nfsd __P((struct nfsd_srvargs *, caddr_t, struct proc *));
|
||||
void nfsrv_zapsock __P((struct nfssvc_sock *));
|
||||
void nfsrv_slpderef __P((struct nfssvc_sock *));
|
||||
void nfsrv_init __P((int));
|
||||
int nfssvc_iod __P((struct proc *));
|
||||
int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
|
||||
int *, char **, int *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.40 1996/02/01 00:41:05 jtc Exp $ */
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.41 1996/02/09 21:48:38 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -50,6 +50,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>
|
||||
@ -65,6 +66,7 @@
|
||||
#include <nfs/nfsm_subs.h>
|
||||
#include <nfs/nfsdiskless.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
/*
|
||||
* nfs vfs operations.
|
||||
@ -116,7 +118,7 @@ nfs_statfs(mp, sbp, p)
|
||||
|
||||
nmp = VFSTONFS(mp);
|
||||
isnq = (nmp->nm_flag & NFSMNT_NQNFS);
|
||||
if (error = nfs_nget(mp, &nmp->nm_fh, &np))
|
||||
if ((error = nfs_nget(mp, &nmp->nm_fh, &np)) != 0)
|
||||
return (error);
|
||||
vp = NFSTOV(np);
|
||||
nfsstats.rpccnt[NFSPROC_STATFS]++;
|
||||
@ -171,7 +173,6 @@ nfs_mountroot()
|
||||
struct mount *mp;
|
||||
struct vnode *vp;
|
||||
struct proc *procp;
|
||||
struct ucred *cred;
|
||||
long n;
|
||||
int error;
|
||||
|
||||
@ -197,7 +198,7 @@ nfs_mountroot()
|
||||
* Create the root mount point.
|
||||
*/
|
||||
mp = nfs_mount_diskless(&nd.nd_root, "/", 0, &vp);
|
||||
printf("root on %s\n", &nd.nd_root.ndm_host);
|
||||
printf("root on %s\n", nd.nd_root.ndm_host);
|
||||
|
||||
/*
|
||||
* Link it into the mount list.
|
||||
@ -248,7 +249,7 @@ nfs_mountroot()
|
||||
* swap file can be on a different server from the rootfs.
|
||||
*/
|
||||
mp = nfs_mount_diskless(&nd.nd_swap, "/swap", 0, &vp);
|
||||
printf("swap on %s\n", &nd.nd_swap.ndm_host);
|
||||
printf("swap on %s\n", nd.nd_swap.ndm_host);
|
||||
|
||||
/*
|
||||
* Since the swap file is not the root dir of a file system,
|
||||
@ -327,7 +328,8 @@ nfs_mount_diskless(ndmntp, mntname, mntflag, vpp)
|
||||
bcopy((caddr_t)args.addr, mtod(m, caddr_t),
|
||||
(m->m_len = args.addr->sa_len));
|
||||
|
||||
if (error = mountnfs(&args, mp, m, mntname, args.hostname, vpp))
|
||||
error = mountnfs(&args, mp, m, mntname, args.hostname, vpp);
|
||||
if (error)
|
||||
panic("nfs_mountroot: mount %s failed: %d", mntname);
|
||||
|
||||
return (mp);
|
||||
@ -444,7 +446,8 @@ nfs_mount(mp, path, data, ndp, p)
|
||||
size_t 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 (mp->mnt_flag & MNT_UPDATE) {
|
||||
register struct nfsmount *nmp = VFSTONFS(mp);
|
||||
@ -454,17 +457,19 @@ nfs_mount(mp, path, data, ndp, p)
|
||||
nfs_decode_args(nmp, &args);
|
||||
return (0);
|
||||
}
|
||||
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))
|
||||
if ((error = copyinstr(path, pth, MNAMELEN-1, &len)) != 0)
|
||||
return (error);
|
||||
bzero(&pth[len], MNAMELEN - len);
|
||||
if (error = copyinstr(args.hostname, hst, MNAMELEN-1, &len))
|
||||
if ((error = copyinstr(args.hostname, hst, MNAMELEN-1, &len)) != 0)
|
||||
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);
|
||||
@ -561,7 +566,7 @@ 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))
|
||||
if ((error = nfs_nget(mp, &nmp->nm_fh, &np)) != 0)
|
||||
goto bad;
|
||||
*vpp = NFSTOV(np);
|
||||
|
||||
@ -586,7 +591,6 @@ nfs_unmount(mp, mntflags, p)
|
||||
struct nfsnode *np;
|
||||
struct vnode *vp;
|
||||
int error, flags = 0;
|
||||
extern int doforce;
|
||||
|
||||
if (mntflags & MNT_FORCE)
|
||||
flags |= FORCECLOSE;
|
||||
@ -605,7 +609,7 @@ 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))
|
||||
if ((error = nfs_nget(mp, &nmp->nm_fh, &np)) != 0)
|
||||
return(error);
|
||||
vp = NFSTOV(np);
|
||||
if (vp->v_usecount > 2) {
|
||||
@ -619,7 +623,7 @@ 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)) {
|
||||
if ((error = vflush(mp, vp, flags)) != 0) {
|
||||
vput(vp);
|
||||
nmp->nm_flag &= ~NFSMNT_DISMINPROG;
|
||||
return (error);
|
||||
@ -660,7 +664,7 @@ nfs_root(mp, vpp)
|
||||
int error;
|
||||
|
||||
nmp = VFSTONFS(mp);
|
||||
if (error = nfs_nget(mp, &nmp->nm_fh, &np))
|
||||
if ((error = nfs_nget(mp, &nmp->nm_fh, &np)) != 0)
|
||||
return (error);
|
||||
vp = NFSTOV(np);
|
||||
vp->v_type = VDIR;
|
||||
@ -702,7 +706,7 @@ loop:
|
||||
continue;
|
||||
if (vget(vp, 1))
|
||||
goto loop;
|
||||
if (error = VOP_FSYNC(vp, cred, waitfor, p))
|
||||
if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0)
|
||||
allerror = error;
|
||||
vput(vp);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_vnops.c,v 1.57 1996/02/09 14:46:03 mycroft Exp $ */
|
||||
/* $NetBSD: nfs_vnops.c,v 1.58 1996/02/09 21:48:41 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -70,6 +70,7 @@
|
||||
#include <nfs/xdr_subs.h>
|
||||
#include <nfs/nfsm_subs.h>
|
||||
#include <nfs/nqnfs.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
/* Defs */
|
||||
#define TRUE 1
|
||||
@ -78,7 +79,7 @@
|
||||
/*
|
||||
* Global vfs data structures for nfs
|
||||
*/
|
||||
int (**nfsv2_vnodeop_p)();
|
||||
int (**nfsv2_vnodeop_p) __P((void *));
|
||||
struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = {
|
||||
{ &vop_default_desc, vn_default_error },
|
||||
{ &vop_lookup_desc, nfs_lookup }, /* lookup */
|
||||
@ -123,7 +124,7 @@ struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = {
|
||||
{ &vop_truncate_desc, nfs_truncate }, /* truncate */
|
||||
{ &vop_update_desc, nfs_update }, /* update */
|
||||
{ &vop_bwrite_desc, vn_bwrite },
|
||||
{ (struct vnodeop_desc*)NULL, (int(*)())NULL }
|
||||
{ (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
|
||||
};
|
||||
struct vnodeopv_desc nfsv2_vnodeop_opv_desc =
|
||||
{ &nfsv2_vnodeop_p, nfsv2_vnodeop_entries };
|
||||
@ -131,7 +132,7 @@ struct vnodeopv_desc nfsv2_vnodeop_opv_desc =
|
||||
/*
|
||||
* Special device vnode ops
|
||||
*/
|
||||
int (**spec_nfsv2nodeop_p)();
|
||||
int (**spec_nfsv2nodeop_p) __P((void *));
|
||||
struct vnodeopv_entry_desc spec_nfsv2nodeop_entries[] = {
|
||||
{ &vop_default_desc, vn_default_error },
|
||||
{ &vop_lookup_desc, spec_lookup }, /* lookup */
|
||||
@ -176,13 +177,13 @@ struct vnodeopv_entry_desc spec_nfsv2nodeop_entries[] = {
|
||||
{ &vop_truncate_desc, spec_truncate }, /* truncate */
|
||||
{ &vop_update_desc, nfs_update }, /* update */
|
||||
{ &vop_bwrite_desc, vn_bwrite },
|
||||
{ (struct vnodeop_desc*)NULL, (int(*)())NULL }
|
||||
{ (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
|
||||
};
|
||||
struct vnodeopv_desc spec_nfsv2nodeop_opv_desc =
|
||||
{ &spec_nfsv2nodeop_p, spec_nfsv2nodeop_entries };
|
||||
|
||||
#ifdef FIFO
|
||||
int (**fifo_nfsv2nodeop_p)();
|
||||
int (**fifo_nfsv2nodeop_p) __P((void *));
|
||||
struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = {
|
||||
{ &vop_default_desc, vn_default_error },
|
||||
{ &vop_lookup_desc, fifo_lookup }, /* lookup */
|
||||
@ -227,14 +228,12 @@ struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = {
|
||||
{ &vop_truncate_desc, fifo_truncate }, /* truncate */
|
||||
{ &vop_update_desc, nfs_update }, /* update */
|
||||
{ &vop_bwrite_desc, vn_bwrite },
|
||||
{ (struct vnodeop_desc*)NULL, (int(*)())NULL }
|
||||
{ (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
|
||||
};
|
||||
struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc =
|
||||
{ &fifo_nfsv2nodeop_p, fifo_nfsv2nodeop_entries };
|
||||
#endif /* FIFO */
|
||||
|
||||
void nqnfs_clientlease();
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
@ -271,14 +270,15 @@ nfs_null(vp, cred, procp)
|
||||
* changed on the server, accesses might still fail later.
|
||||
*/
|
||||
int
|
||||
nfs_access(ap)
|
||||
nfs_access(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_access_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_mode;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register u_int32_t *tl;
|
||||
register caddr_t cp;
|
||||
@ -327,14 +327,15 @@ nfs_access(ap)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfs_open(ap)
|
||||
nfs_open(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_open_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_mode;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
|
||||
@ -371,11 +372,13 @@ nfs_open(ap)
|
||||
(void) vnode_pager_uncache(vp);
|
||||
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.tv_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.tv_sec) {
|
||||
np->n_direofoffset = 0;
|
||||
@ -398,15 +401,16 @@ nfs_open(ap)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfs_close(ap)
|
||||
nfs_close(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_close_args /* {
|
||||
struct vnodeop_desc *a_desc;
|
||||
struct vnode *a_vp;
|
||||
int a_fflag;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
int error = 0;
|
||||
@ -429,14 +433,15 @@ nfs_close(ap)
|
||||
* nfs getattr call from vfs.
|
||||
*/
|
||||
int
|
||||
nfs_getattr(ap)
|
||||
nfs_getattr(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_getattr_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
register caddr_t cp;
|
||||
@ -467,15 +472,16 @@ nfs_getattr(ap)
|
||||
* nfs setattr call.
|
||||
*/
|
||||
int
|
||||
nfs_setattr(ap)
|
||||
nfs_setattr(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_setattr_args /* {
|
||||
struct vnodeop_desc *a_desc;
|
||||
struct vnode *a_vp;
|
||||
struct vattr *a_vap;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct nfsv2_sattr *sp;
|
||||
register caddr_t cp;
|
||||
register int32_t t1;
|
||||
@ -486,7 +492,7 @@ nfs_setattr(ap)
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
register struct vattr *vap = ap->a_vap;
|
||||
u_quad_t frev, tsize;
|
||||
u_quad_t frev, tsize = 0;
|
||||
|
||||
if (vap->va_size != VNOVAL) {
|
||||
switch (vp->v_type) {
|
||||
@ -574,14 +580,15 @@ nfs_setattr(ap)
|
||||
* If not found, unlock the directory nfsnode and do the rpc
|
||||
*/
|
||||
int
|
||||
nfs_lookup(ap)
|
||||
nfs_lookup(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_lookup_args /* {
|
||||
struct vnodeop_desc *a_desc;
|
||||
struct vnode *a_dvp;
|
||||
struct vnode **a_vpp;
|
||||
struct componentname *a_cnp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
register struct vnode **vpp = ap->a_vpp;
|
||||
@ -592,14 +599,14 @@ nfs_lookup(ap)
|
||||
register int32_t t1, t2;
|
||||
struct nfsmount *nmp;
|
||||
caddr_t bpos, dpos, cp2;
|
||||
time_t reqtime;
|
||||
time_t reqtime = 0;
|
||||
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
|
||||
struct vnode *newvp;
|
||||
long len;
|
||||
nfsv2fh_t *fhp;
|
||||
struct nfsnode *np;
|
||||
int lockparent, wantparent, error = 0;
|
||||
int nqlflag, cachable;
|
||||
int nqlflag = 0, cachable = 0;
|
||||
u_quad_t frev;
|
||||
|
||||
*vpp = NULL;
|
||||
@ -710,13 +717,13 @@ nfsmout:
|
||||
m_freem(mrep);
|
||||
return (EISDIR);
|
||||
}
|
||||
if (error = nfs_nget(dvp->v_mount, fhp, &np)) {
|
||||
if ((error = nfs_nget(dvp->v_mount, fhp, &np)) != 0) {
|
||||
m_freem(mrep);
|
||||
return (error);
|
||||
}
|
||||
newvp = NFSTOV(np);
|
||||
if (error =
|
||||
nfs_loadattrcache(&newvp, &md, &dpos, (struct vattr *)0)) {
|
||||
error = nfs_loadattrcache(&newvp, &md, &dpos, NULL);
|
||||
if (error) {
|
||||
vrele(newvp);
|
||||
m_freem(mrep);
|
||||
return (error);
|
||||
@ -731,13 +738,14 @@ nfsmout:
|
||||
VREF(dvp);
|
||||
newvp = dvp;
|
||||
} else {
|
||||
if (error = nfs_nget(dvp->v_mount, fhp, &np)) {
|
||||
if ((error = nfs_nget(dvp->v_mount, fhp, &np)) != 0) {
|
||||
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);
|
||||
@ -763,14 +771,15 @@ nfsmout:
|
||||
* Just call nfs_bioread() to do the work.
|
||||
*/
|
||||
int
|
||||
nfs_read(ap)
|
||||
nfs_read(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_read_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct uio *a_uio;
|
||||
int a_ioflag;
|
||||
struct ucred *a_cred;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
|
||||
if (vp->v_type != VREG)
|
||||
@ -782,13 +791,14 @@ nfs_read(ap)
|
||||
* nfs readlink call
|
||||
*/
|
||||
int
|
||||
nfs_readlink(ap)
|
||||
nfs_readlink(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_readlink_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct uio *a_uio;
|
||||
struct ucred *a_cred;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
|
||||
if (vp->v_type != VLNK)
|
||||
@ -952,14 +962,15 @@ nfsmout:
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfs_mknod(ap)
|
||||
nfs_mknod(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_mknod_args /* {
|
||||
struct vnode *a_dvp;
|
||||
struct vnode **a_vpp;
|
||||
struct componentname *a_cnp;
|
||||
struct vattr *a_vap;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
register struct vattr *vap = ap->a_vap;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
@ -1024,14 +1035,15 @@ nfs_mknod(ap)
|
||||
* nfs file create call
|
||||
*/
|
||||
int
|
||||
nfs_create(ap)
|
||||
nfs_create(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_create_args /* {
|
||||
struct vnode *a_dvp;
|
||||
struct vnode **a_vpp;
|
||||
struct componentname *a_cnp;
|
||||
struct vattr *a_vap;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
register struct vattr *vap = ap->a_vap;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
@ -1090,14 +1102,15 @@ nfs_create(ap)
|
||||
* do the remove rpc
|
||||
*/
|
||||
int
|
||||
nfs_remove(ap)
|
||||
nfs_remove(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_remove_args /* {
|
||||
struct vnodeop_desc *a_desc;
|
||||
struct vnode * a_dvp;
|
||||
struct vnode * a_vp;
|
||||
struct componentname * a_cnp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
@ -1196,7 +1209,9 @@ nfs_removeit(sp)
|
||||
* nfs file rename call
|
||||
*/
|
||||
int
|
||||
nfs_rename(ap)
|
||||
nfs_rename(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_rename_args /* {
|
||||
struct vnode *a_fdvp;
|
||||
struct vnode *a_fvp;
|
||||
@ -1204,8 +1219,7 @@ nfs_rename(ap)
|
||||
struct vnode *a_tdvp;
|
||||
struct vnode *a_tvp;
|
||||
struct componentname *a_tcnp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *fvp = ap->a_fvp;
|
||||
register struct vnode *tvp = ap->a_tvp;
|
||||
register struct vnode *fdvp = ap->a_fdvp;
|
||||
@ -1299,13 +1313,14 @@ nfs_renameit(sdvp, scnp, sp)
|
||||
* nfs hard link create call
|
||||
*/
|
||||
int
|
||||
nfs_link(ap)
|
||||
nfs_link(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_link_args /* {
|
||||
struct vnode *a_dvp;
|
||||
struct vnode *a_vp;
|
||||
struct componentname *a_cnp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
@ -1358,15 +1373,16 @@ nfs_link(ap)
|
||||
*/
|
||||
/* start here */
|
||||
int
|
||||
nfs_symlink(ap)
|
||||
nfs_symlink(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_symlink_args /* {
|
||||
struct vnode *a_dvp;
|
||||
struct vnode **a_vpp;
|
||||
struct componentname *a_cnp;
|
||||
struct vattr *a_vap;
|
||||
char *a_target;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
register struct vattr *vap = ap->a_vap;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
@ -1420,14 +1436,15 @@ nfs_symlink(ap)
|
||||
* nfs make dir call
|
||||
*/
|
||||
int
|
||||
nfs_mkdir(ap)
|
||||
nfs_mkdir(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_mkdir_args /* {
|
||||
struct vnode *a_dvp;
|
||||
struct vnode **a_vpp;
|
||||
struct componentname *a_cnp;
|
||||
struct vattr *a_vap;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
register struct vattr *vap = ap->a_vap;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
@ -1501,13 +1518,14 @@ nfs_mkdir(ap)
|
||||
* nfs remove directory call
|
||||
*/
|
||||
int
|
||||
nfs_rmdir(ap)
|
||||
nfs_rmdir(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_rmdir_args /* {
|
||||
struct vnode *a_dvp;
|
||||
struct vnode *a_vp;
|
||||
struct componentname *a_cnp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct vnode *dvp = ap->a_dvp;
|
||||
register struct componentname *cnp = ap->a_cnp;
|
||||
@ -1553,7 +1571,9 @@ nfs_rmdir(ap)
|
||||
* Ultrix implementation of NFS.
|
||||
*/
|
||||
int
|
||||
nfs_readdir(ap)
|
||||
nfs_readdir(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_readdir_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct uio *a_uio;
|
||||
@ -1561,8 +1581,7 @@ nfs_readdir(ap)
|
||||
int *a_eofflag;
|
||||
u_long *a_cookies;
|
||||
int a_ncookies;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
register struct uio *uio = ap->a_uio;
|
||||
@ -1638,11 +1657,11 @@ nfs_readdirrpc(vp, uiop, cred)
|
||||
struct ucred *cred;
|
||||
{
|
||||
register long len;
|
||||
register struct dirent *dp;
|
||||
register struct dirent *dp = NULL;
|
||||
register u_int32_t *tl;
|
||||
register caddr_t cp;
|
||||
register int32_t t1;
|
||||
long tlen, lastlen;
|
||||
long tlen, lastlen = 0;
|
||||
caddr_t bpos, dpos, cp2;
|
||||
int error = 0;
|
||||
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
|
||||
@ -1650,8 +1669,8 @@ nfs_readdirrpc(vp, uiop, cred)
|
||||
caddr_t dpos2;
|
||||
int siz;
|
||||
int more_dirs = 1;
|
||||
u_long off, savoff;
|
||||
struct dirent *savdp;
|
||||
u_long off = 0, savoff = 0;
|
||||
struct dirent *savdp = NULL;
|
||||
struct nfsmount *nmp;
|
||||
struct nfsnode *np = VTONFS(vp);
|
||||
long tresid, extra;
|
||||
@ -1787,7 +1806,7 @@ nfs_readdirlookrpc(vp, uiop, cred)
|
||||
struct ucred *cred;
|
||||
{
|
||||
register int len;
|
||||
register struct dirent *dp;
|
||||
register struct dirent *dp = NULL;
|
||||
register u_int32_t *tl;
|
||||
register caddr_t cp;
|
||||
register int32_t t1;
|
||||
@ -1795,15 +1814,15 @@ nfs_readdirlookrpc(vp, uiop, cred)
|
||||
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
|
||||
struct nameidata nami, *ndp = &nami;
|
||||
struct componentname *cnp = &ndp->ni_cnd;
|
||||
u_long off, endoff, fileno;
|
||||
time_t reqtime, ltime;
|
||||
u_long off = 0, endoff = 0, fileno;
|
||||
time_t reqtime, ltime = 0;
|
||||
struct nfsmount *nmp;
|
||||
struct nfsnode *np;
|
||||
struct vnode *newvp;
|
||||
nfsv2fh_t *fhp;
|
||||
u_quad_t frev;
|
||||
int error = 0, tlen, more_dirs = 1, tresid, doit, bigenough, i;
|
||||
int cachable;
|
||||
int cachable = 0;
|
||||
|
||||
if (uiop->uio_iovcnt != 1)
|
||||
panic("nfs rdirlook");
|
||||
@ -1851,12 +1870,13 @@ 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, NULL);
|
||||
if (error)
|
||||
doit = 0;
|
||||
nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
fileno = fxdr_unsigned(u_int32_t, *tl++);
|
||||
@ -2002,7 +2022,7 @@ nfs_sillyrename(dvp, vp, cnp)
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
if (error = nfs_renameit(dvp, cnp, sp))
|
||||
if ((error = nfs_renameit(dvp, cnp, sp)) != 0)
|
||||
goto bad;
|
||||
nfs_lookitup(sp, &np->n_fh, cnp->cn_proc);
|
||||
np->n_sillyrename = sp;
|
||||
@ -2070,15 +2090,16 @@ nfs_lookitup(sp, fhp, procp)
|
||||
* context of the swapper process (2).
|
||||
*/
|
||||
int
|
||||
nfs_bmap(ap)
|
||||
nfs_bmap(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
|
||||
if (ap->a_vpp != NULL)
|
||||
@ -2095,9 +2116,10 @@ nfs_bmap(ap)
|
||||
* request.
|
||||
*/
|
||||
int
|
||||
nfs_strategy(ap)
|
||||
struct vop_strategy_args *ap;
|
||||
nfs_strategy(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_strategy_args *ap = v;
|
||||
register struct buf *bp = ap->a_bp;
|
||||
struct ucred *cr;
|
||||
struct proc *p;
|
||||
@ -2131,14 +2153,17 @@ nfs_strategy(ap)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfs_mmap(ap)
|
||||
nfs_mmap(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_mmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_fflags;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -2150,15 +2175,16 @@ nfs_mmap(ap)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
nfs_fsync(ap)
|
||||
nfs_fsync(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_fsync_args /* {
|
||||
struct vnodeop_desc *a_desc;
|
||||
struct vnode * a_vp;
|
||||
struct ucred * a_cred;
|
||||
int a_waitfor;
|
||||
struct proc * a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
register struct buf *bp;
|
||||
@ -2235,13 +2261,17 @@ loop:
|
||||
* information from the remote server.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
nfs_pathconf(ap)
|
||||
int
|
||||
nfs_pathconf(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_name;
|
||||
register_t *a_retval;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -2250,15 +2280,16 @@ nfs_pathconf(ap)
|
||||
* NFS advisory byte-level locks.
|
||||
*/
|
||||
int
|
||||
nfs_advlock(ap)
|
||||
nfs_advlock(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_advlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
caddr_t a_id;
|
||||
int a_op;
|
||||
struct flock *a_fl;
|
||||
int a_flags;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct nfsnode *np = VTONFS(ap->a_vp);
|
||||
|
||||
return (lf_advlock(&np->n_lockf, np->n_size, ap->a_id, ap->a_op,
|
||||
@ -2269,11 +2300,12 @@ nfs_advlock(ap)
|
||||
* Print out the contents of an nfsnode.
|
||||
*/
|
||||
int
|
||||
nfs_print(ap)
|
||||
nfs_print(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_print_args /* {
|
||||
struct vnode *a_vp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
|
||||
@ -2284,6 +2316,7 @@ nfs_print(ap)
|
||||
fifo_printinfo(vp);
|
||||
#endif /* FIFO */
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2291,14 +2324,17 @@ nfs_print(ap)
|
||||
* Currently unsupported.
|
||||
*/
|
||||
int
|
||||
nfs_blkatoff(ap)
|
||||
nfs_blkatoff(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_blkatoff_args /* {
|
||||
struct vnode *a_vp;
|
||||
off_t a_offset;
|
||||
char **a_res;
|
||||
struct buf **a_bpp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
@ -2308,14 +2344,17 @@ nfs_blkatoff(ap)
|
||||
* Currently unsupported.
|
||||
*/
|
||||
int
|
||||
nfs_valloc(ap)
|
||||
nfs_valloc(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_valloc_args /* {
|
||||
struct vnode *a_pvp;
|
||||
int a_mode;
|
||||
struct ucred *a_cred;
|
||||
struct vnode **a_vpp;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
@ -2325,13 +2364,16 @@ nfs_valloc(ap)
|
||||
* Currently unsupported.
|
||||
*/
|
||||
int
|
||||
nfs_vfree(ap)
|
||||
nfs_vfree(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_vfree_args /* {
|
||||
struct vnode *a_pvp;
|
||||
ino_t a_ino;
|
||||
int a_mode;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
@ -2340,15 +2382,18 @@ nfs_vfree(ap)
|
||||
* NFS file truncation.
|
||||
*/
|
||||
int
|
||||
nfs_truncate(ap)
|
||||
nfs_truncate(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_truncate_args /* {
|
||||
struct vnode *a_vp;
|
||||
off_t a_length;
|
||||
int a_flags;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
|
||||
/* Use nfs_setattr */
|
||||
printf("nfs_truncate: need to implement!!");
|
||||
@ -2359,14 +2404,17 @@ nfs_truncate(ap)
|
||||
* NFS update.
|
||||
*/
|
||||
int
|
||||
nfs_update(ap)
|
||||
nfs_update(v)
|
||||
void *v;
|
||||
{
|
||||
#if 0
|
||||
struct vop_update_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct timeval *a_ta;
|
||||
struct timeval *a_tm;
|
||||
int a_waitfor;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
#endif
|
||||
|
||||
/* Use nfs_setattr */
|
||||
printf("nfs_update: need to implement!!");
|
||||
@ -2379,18 +2427,19 @@ nfs_update(ap)
|
||||
* local to the client.
|
||||
*/
|
||||
int
|
||||
nfsspec_access(ap)
|
||||
nfsspec_access(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_access_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_mode;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
struct vattr va;
|
||||
int error;
|
||||
|
||||
if (error = VOP_GETATTR(ap->a_vp, &va, ap->a_cred, ap->a_p))
|
||||
if ((error = VOP_GETATTR(ap->a_vp, &va, ap->a_cred, ap->a_p)) != 0)
|
||||
return (error);
|
||||
|
||||
return (vaccess(va.va_mode, va.va_uid, va.va_gid, ap->a_mode,
|
||||
@ -2401,14 +2450,15 @@ nfsspec_access(ap)
|
||||
* Read wrapper for special devices.
|
||||
*/
|
||||
int
|
||||
nfsspec_read(ap)
|
||||
nfsspec_read(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_read_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct uio *a_uio;
|
||||
int a_ioflag;
|
||||
struct ucred *a_cred;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct nfsnode *np = VTONFS(ap->a_vp);
|
||||
|
||||
/*
|
||||
@ -2423,14 +2473,15 @@ nfsspec_read(ap)
|
||||
* Write wrapper for special devices.
|
||||
*/
|
||||
int
|
||||
nfsspec_write(ap)
|
||||
nfsspec_write(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_write_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct uio *a_uio;
|
||||
int a_ioflag;
|
||||
struct ucred *a_cred;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct nfsnode *np = VTONFS(ap->a_vp);
|
||||
|
||||
/*
|
||||
@ -2447,14 +2498,15 @@ nfsspec_write(ap)
|
||||
* Update the times on the nfsnode then do device close.
|
||||
*/
|
||||
int
|
||||
nfsspec_close(ap)
|
||||
nfsspec_close(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_close_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_fflag;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
struct vattr vattr;
|
||||
@ -2485,15 +2537,16 @@ nfsspec_close(ap)
|
||||
* Read wrapper for fifos.
|
||||
*/
|
||||
int
|
||||
nfsfifo_read(ap)
|
||||
nfsfifo_read(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_read_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct uio *a_uio;
|
||||
int a_ioflag;
|
||||
struct ucred *a_cred;
|
||||
} */ *ap;
|
||||
{
|
||||
extern int (**fifo_vnodeop_p)();
|
||||
} */ *ap = v;
|
||||
extern int (**fifo_vnodeop_p) __P((void *));
|
||||
register struct nfsnode *np = VTONFS(ap->a_vp);
|
||||
|
||||
/*
|
||||
@ -2508,15 +2561,16 @@ nfsfifo_read(ap)
|
||||
* Write wrapper for fifos.
|
||||
*/
|
||||
int
|
||||
nfsfifo_write(ap)
|
||||
nfsfifo_write(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_write_args /* {
|
||||
struct vnode *a_vp;
|
||||
struct uio *a_uio;
|
||||
int a_ioflag;
|
||||
struct ucred *a_cred;
|
||||
} */ *ap;
|
||||
{
|
||||
extern int (**fifo_vnodeop_p)();
|
||||
} */ *ap = v;
|
||||
extern int (**fifo_vnodeop_p) __P((void *));
|
||||
register struct nfsnode *np = VTONFS(ap->a_vp);
|
||||
|
||||
/*
|
||||
@ -2533,18 +2587,19 @@ nfsfifo_write(ap)
|
||||
* Update the times on the nfsnode then do fifo close.
|
||||
*/
|
||||
int
|
||||
nfsfifo_close(ap)
|
||||
nfsfifo_close(v)
|
||||
void *v;
|
||||
{
|
||||
struct vop_close_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_fflag;
|
||||
struct ucred *a_cred;
|
||||
struct proc *a_p;
|
||||
} */ *ap;
|
||||
{
|
||||
} */ *ap = v;
|
||||
register struct vnode *vp = ap->a_vp;
|
||||
register struct nfsnode *np = VTONFS(vp);
|
||||
struct vattr vattr;
|
||||
extern int (**fifo_vnodeop_p)();
|
||||
extern int (**fifo_vnodeop_p) __P((void *));
|
||||
|
||||
if (np->n_flag & (NACC | NUPD)) {
|
||||
if (np->n_flag & NACC)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfsm_subs.h,v 1.7 1995/12/19 23:08:00 cgd Exp $ */
|
||||
/* $NetBSD: nfsm_subs.h,v 1.8 1996/02/09 21:48:43 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -47,8 +47,6 @@
|
||||
/*
|
||||
* First define what the actual subs. return
|
||||
*/
|
||||
extern struct mbuf *nfsm_reqh();
|
||||
|
||||
#define M_HASCL(m) ((m)->m_flags & M_EXT)
|
||||
#define NFSMINOFF(m) \
|
||||
if (M_HASCL(m)) \
|
||||
@ -93,7 +91,8 @@ extern struct mbuf *nfsm_reqh();
|
||||
if (t1 >= (s)) { \
|
||||
(a) = (c)(dpos); \
|
||||
dpos += (s); \
|
||||
} else if (error = nfsm_disct(&md, &dpos, (s), t1, &cp2)) { \
|
||||
} else if ((error = nfsm_disct(&md, &dpos, \
|
||||
(s), t1, &cp2)) != 0) { \
|
||||
m_freem(mrep); \
|
||||
goto nfsmout; \
|
||||
} else { \
|
||||
@ -111,7 +110,7 @@ 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)) { \
|
||||
if ((error = nfs_nget((d)->v_mount, fhp, &np)) != 0) { \
|
||||
m_freem(mrep); \
|
||||
goto nfsmout; \
|
||||
} \
|
||||
@ -121,7 +120,7 @@ extern struct mbuf *nfsm_reqh();
|
||||
|
||||
#define nfsm_loadattr(v,a) \
|
||||
{ struct vnode *tvp = (v); \
|
||||
if (error = nfs_loadattrcache(&tvp, &md, &dpos, (a))) { \
|
||||
if ((error = nfs_loadattrcache(&tvp, &md, &dpos, (a))) != 0) { \
|
||||
m_freem(mrep); \
|
||||
goto nfsmout; \
|
||||
} \
|
||||
@ -144,13 +143,13 @@ extern struct mbuf *nfsm_reqh();
|
||||
|
||||
#define nfsm_mtouio(p,s) \
|
||||
if ((s) > 0 && \
|
||||
(error = nfsm_mbuftouio(&md,(p),(s),&dpos))) { \
|
||||
(error = nfsm_mbuftouio(&md,(p),(s),&dpos)) != 0) { \
|
||||
m_freem(mrep); \
|
||||
goto nfsmout; \
|
||||
}
|
||||
|
||||
#define nfsm_uiotom(p,s) \
|
||||
if (error = nfsm_uiotombuf((p),&mb,(s),&bpos)) { \
|
||||
if ((error = nfsm_uiotombuf((p),&mb,(s),&bpos)) != 0) { \
|
||||
m_freem(mreq); \
|
||||
goto nfsmout; \
|
||||
}
|
||||
@ -164,8 +163,8 @@ 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)) \
|
||||
if ((error = nfs_request((v), mreq, (t), (p), \
|
||||
(c), &mrep, &md, &dpos)) != 0) \
|
||||
goto nfsmout
|
||||
|
||||
#define nfsm_strtom(a,s,m) \
|
||||
@ -180,7 +179,8 @@ 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))) { \
|
||||
} else if ((error = nfsm_strtmbuf(&mb, &bpos, \
|
||||
(a), (s))) != 0) { \
|
||||
m_freem(mreq); \
|
||||
goto nfsmout; \
|
||||
}
|
||||
@ -208,7 +208,7 @@ 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)) { \
|
||||
} else if ((error = nfs_adv(&md, &dpos, (s), t1)) != 0) { \
|
||||
m_freem(mrep); \
|
||||
goto nfsmout; \
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfsmount.h,v 1.8 1995/03/26 20:37:31 jtc Exp $ */
|
||||
/* $NetBSD: nfsmount.h,v 1.9 1996/02/09 21:48:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -78,51 +78,26 @@ struct nfsmount {
|
||||
* Convert mount ptr to nfsmount ptr.
|
||||
*/
|
||||
#define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data))
|
||||
#endif /* _KERNEL */
|
||||
|
||||
/*
|
||||
* Prototypes for NFS mount operations
|
||||
*/
|
||||
int nfs_mount __P((
|
||||
struct mount *mp,
|
||||
char *path,
|
||||
caddr_t data,
|
||||
struct nameidata *ndp,
|
||||
struct proc *p));
|
||||
int nfs_start __P((
|
||||
struct mount *mp,
|
||||
int flags,
|
||||
struct proc *p));
|
||||
int nfs_unmount __P((
|
||||
struct mount *mp,
|
||||
int mntflags,
|
||||
struct proc *p));
|
||||
int nfs_root __P((
|
||||
struct mount *mp,
|
||||
struct vnode **vpp));
|
||||
int nfs_quotactl __P((
|
||||
struct mount *mp,
|
||||
int cmds,
|
||||
uid_t uid,
|
||||
caddr_t arg,
|
||||
struct proc *p));
|
||||
int nfs_statfs __P((
|
||||
struct mount *mp,
|
||||
struct statfs *sbp,
|
||||
struct proc *p));
|
||||
int nfs_sync __P((
|
||||
struct mount *mp,
|
||||
int waitfor,
|
||||
struct ucred *cred,
|
||||
struct proc *p));
|
||||
int nfs_fhtovp __P((
|
||||
struct mount *mp,
|
||||
struct fid *fhp,
|
||||
struct mbuf *nam,
|
||||
struct vnode **vpp,
|
||||
int *exflagsp,
|
||||
struct ucred **credanonp));
|
||||
int nfs_vptofh __P((
|
||||
struct vnode *vp,
|
||||
struct fid *fhp));
|
||||
int nfs_init __P(());
|
||||
int nfs_statfs __P((struct mount *, struct statfs *, struct proc *));
|
||||
int nfs_mountroot __P((void));
|
||||
void nfs_decode_args __P((struct nfsmount *, struct nfs_args *));
|
||||
int nfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *,
|
||||
struct proc *));
|
||||
int mountnfs __P((struct nfs_args *, struct mount *, struct mbuf *, char *,
|
||||
char *, struct vnode **));
|
||||
int nfs_unmount __P((struct mount *, int, struct proc *));
|
||||
int nfs_root __P((struct mount *, struct vnode **));
|
||||
int nfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
|
||||
int nfs_vget __P((struct mount *, ino_t, struct vnode **));
|
||||
int nfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
|
||||
struct vnode **, int *, struct ucred **));
|
||||
int nfs_vptofh __P((struct vnode *, struct fid *));
|
||||
int nfs_start __P((struct mount *, int, struct proc *));
|
||||
int nfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
|
||||
void nfs_init __P((void));
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfsnode.h,v 1.14 1995/03/26 20:37:32 jtc Exp $ */
|
||||
/* $NetBSD: nfsnode.h,v 1.15 1996/02/09 21:48:47 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -109,59 +109,60 @@ TAILQ_HEAD(, buf) nfs_bufq;
|
||||
/*
|
||||
* Prototypes for NFS vnode operations
|
||||
*/
|
||||
int nfs_lookup __P((struct vop_lookup_args *));
|
||||
int nfs_create __P((struct vop_create_args *));
|
||||
int nfs_mknod __P((struct vop_mknod_args *));
|
||||
int nfs_open __P((struct vop_open_args *));
|
||||
int nfs_close __P((struct vop_close_args *));
|
||||
int nfsspec_close __P((struct vop_close_args *));
|
||||
int nfs_lookup __P((void *));
|
||||
int nfs_create __P((void *));
|
||||
int nfs_mknod __P((void *));
|
||||
int nfs_open __P((void *));
|
||||
int nfs_close __P((void *));
|
||||
int nfsspec_close __P((void *));
|
||||
#ifdef FIFO
|
||||
int nfsfifo_close __P((struct vop_close_args *));
|
||||
int nfsfifo_close __P((void *));
|
||||
#endif
|
||||
int nfs_access __P((struct vop_access_args *));
|
||||
int nfsspec_access __P((struct vop_access_args *));
|
||||
int nfs_getattr __P((struct vop_getattr_args *));
|
||||
int nfs_setattr __P((struct vop_setattr_args *));
|
||||
int nfs_read __P((struct vop_read_args *));
|
||||
int nfs_write __P((struct vop_write_args *));
|
||||
#define nfs_lease_check ((int (*) __P((struct vop_lease_args *)))nullop)
|
||||
int nfsspec_read __P((struct vop_read_args *));
|
||||
int nfsspec_write __P((struct vop_write_args *));
|
||||
int nfs_access __P((void *));
|
||||
int nfsspec_access __P((void *));
|
||||
int nfs_getattr __P((void *));
|
||||
int nfs_setattr __P((void *));
|
||||
int nfs_read __P((void *));
|
||||
int nfs_write __P((void *));
|
||||
#define nfs_lease_check (int (*) __P((void *))) nullop
|
||||
int nfsspec_read __P((void *));
|
||||
int nfsspec_write __P((void *));
|
||||
#ifdef FIFO
|
||||
int nfsfifo_read __P((struct vop_read_args *));
|
||||
int nfsfifo_write __P((struct vop_write_args *));
|
||||
int nfsfifo_read __P((void *));
|
||||
int nfsfifo_write __P((void *));
|
||||
#endif
|
||||
#define nfs_ioctl ((int (*) __P((struct vop_ioctl_args *)))enoioctl)
|
||||
#define nfs_select ((int (*) __P((struct vop_select_args *)))seltrue)
|
||||
int nfs_mmap __P((struct vop_mmap_args *));
|
||||
int nfs_fsync __P((struct vop_fsync_args *));
|
||||
#define nfs_seek ((int (*) __P((struct vop_seek_args *)))nullop)
|
||||
int nfs_remove __P((struct vop_remove_args *));
|
||||
int nfs_link __P((struct vop_link_args *));
|
||||
int nfs_rename __P((struct vop_rename_args *));
|
||||
int nfs_mkdir __P((struct vop_mkdir_args *));
|
||||
int nfs_rmdir __P((struct vop_rmdir_args *));
|
||||
int nfs_symlink __P((struct vop_symlink_args *));
|
||||
int nfs_readdir __P((struct vop_readdir_args *));
|
||||
int nfs_readlink __P((struct vop_readlink_args *));
|
||||
int nfs_abortop __P((struct vop_abortop_args *));
|
||||
int nfs_inactive __P((struct vop_inactive_args *));
|
||||
int nfs_reclaim __P((struct vop_reclaim_args *));
|
||||
int nfs_lock __P((struct vop_lock_args *));
|
||||
int nfs_unlock __P((struct vop_unlock_args *));
|
||||
int nfs_bmap __P((struct vop_bmap_args *));
|
||||
int nfs_strategy __P((struct vop_strategy_args *));
|
||||
int nfs_print __P((struct vop_print_args *));
|
||||
int nfs_islocked __P((struct vop_islocked_args *));
|
||||
int nfs_pathconf __P((struct vop_pathconf_args *));
|
||||
int nfs_advlock __P((struct vop_advlock_args *));
|
||||
int nfs_blkatoff __P((struct vop_blkatoff_args *));
|
||||
int nfs_vget __P((struct mount *, ino_t, struct vnode **));
|
||||
int nfs_valloc __P((struct vop_valloc_args *));
|
||||
#define nfs_reallocblks \
|
||||
((int (*) __P((struct vop_reallocblks_args *)))eopnotsupp)
|
||||
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 *));
|
||||
#define nfs_ioctl (int (*) __P((void *))) enoioctl
|
||||
#define nfs_select (int (*) __P((void *))) seltrue
|
||||
int nfs_mmap __P((void *));
|
||||
int nfs_fsync __P((void *));
|
||||
#define nfs_seek (int (*) __P((void *))) nullop
|
||||
int nfs_remove __P((void *));
|
||||
int nfs_link __P((void *));
|
||||
int nfs_rename __P((void *));
|
||||
int nfs_mkdir __P((void *));
|
||||
int nfs_rmdir __P((void *));
|
||||
int nfs_symlink __P((void *));
|
||||
int nfs_readdir __P((void *));
|
||||
int nfs_readlink __P((void *));
|
||||
int nfs_abortop __P((void *));
|
||||
int nfs_inactive __P((void *));
|
||||
int nfs_reclaim __P((void *));
|
||||
int nfs_lock __P((void *));
|
||||
int nfs_unlock __P((void *));
|
||||
int nfs_bmap __P((void *));
|
||||
int nfs_strategy __P((void *));
|
||||
int nfs_print __P((void *));
|
||||
int nfs_islocked __P((void *));
|
||||
int nfs_pathconf __P((void *));
|
||||
int nfs_advlock __P((void *));
|
||||
int nfs_blkatoff __P((void *));
|
||||
int nfs_valloc __P((void *));
|
||||
#define nfs_reallocblks (int (*) __P((void *))) eopnotsupp
|
||||
int nfs_vfree __P((void *));
|
||||
int nfs_truncate __P((void *));
|
||||
int nfs_update __P((void *));
|
||||
int nfs_bwrite __P((void *));
|
||||
|
||||
extern int (**nfsv2_vnodeop_p) __P((void *));
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
Loading…
Reference in New Issue
Block a user