diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-04-21 22:33:19 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-04-21 22:33:19 +0000 |
commit | 67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (patch) | |
tree | 967b89f6e07398a22bd8c76d30179b648776542d /sys/nfs/nfs_vnops.c | |
parent | ba95d3c1d69cdb251d15a12ebf70f50b0ea2019b (diff) |
partial sync with netbsd 960418, more to come
Diffstat (limited to 'sys/nfs/nfs_vnops.c')
-rw-r--r-- | sys/nfs/nfs_vnops.c | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 08903b91418..c6e640bed5c 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,5 +1,5 @@ -/* $OpenBSD: nfs_vnops.c,v 1.6 1996/04/17 04:50:35 mickey Exp $ */ -/* $NetBSD: nfs_vnops.c,v 1.60 1996/03/05 05:30:09 jtk Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.7 1996/04/21 22:30:36 deraadt Exp $ */ +/* $NetBSD: nfs_vnops.c,v 1.61 1996/04/03 23:25:42 thorpej Exp $ */ /* * Copyright (c) 1989, 1993 @@ -196,6 +196,7 @@ struct vnodeopv_entry_desc spec_nfsv2nodeop_entries[] = { struct vnodeopv_desc spec_nfsv2nodeop_opv_desc = { &spec_nfsv2nodeop_p, spec_nfsv2nodeop_entries }; +#ifdef FIFO int (**fifo_nfsv2nodeop_p) __P((void *)); struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = { { &vop_default_desc, vn_default_error }, @@ -248,6 +249,7 @@ struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = { }; struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc = { &fifo_nfsv2nodeop_p, fifo_nfsv2nodeop_entries }; +#endif /* FIFO */ /* * Global variables @@ -587,7 +589,6 @@ nfs_setattr(v) vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) && (vp->v_mount->mnt_flag & MNT_RDONLY)) return (EROFS); - if (vap->va_size != VNOVAL) { switch (vp->v_type) { case VDIR: @@ -611,8 +612,11 @@ nfs_setattr(v) */ if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); - error = nfs_vinvalbuf(vp, - ((vap->va_size == 0)? 0 : V_SAVE), + if (vap->va_size == 0) + error = nfs_vinvalbuf(vp, 0, + ap->a_cred, ap->a_p, 1); + else + error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1); if (error) return (error); @@ -626,7 +630,6 @@ nfs_setattr(v) (error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) return (error); - error = nfs_setattrrpc(vp, vap, ap->a_cred, ap->a_p); if (error && vap->va_size != VNOVAL) { np->n_size = np->n_vattr.va_size = tsize; @@ -740,7 +743,7 @@ nfs_setattrrpc(vp, vap, cred, procp) if (v3) { nfsm_wcc_data(vp, wccflag); } else - nfsm_loadattr(vp, (struct vattr *)NULL); + nfsm_loadattr(vp, (struct vattr *)0); nfsm_reqdone; return (error); } @@ -857,7 +860,7 @@ nfs_lookup(v) nfsm_postop_attr(newvp, attrflag); nfsm_postop_attr(dvp, attrflag); } else - nfsm_loadattr(newvp, (struct vattr *)NULL); + nfsm_loadattr(newvp, (struct vattr *)0); *vpp = newvp; m_freem(mrep); cnp->cn_flags |= SAVENAME; @@ -879,7 +882,7 @@ nfs_lookup(v) nfsm_postop_attr(newvp, attrflag); nfsm_postop_attr(dvp, attrflag); } else - nfsm_loadattr(newvp, (struct vattr *)NULL); + nfsm_loadattr(newvp, (struct vattr *)0); if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && @@ -1027,7 +1030,7 @@ nfs_readrpc(vp, uiop, cred) nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED); eof = fxdr_unsigned(int, *(tl + 1)); } else - nfsm_loadattr(vp, (struct vattr *)NULL); + nfsm_loadattr(vp, (struct vattr *)0); nfsm_strsiz(retlen, nmp->nm_rsize); nfsm_mtouio(uiop, retlen); m_freem(mrep); @@ -1138,7 +1141,7 @@ nfs_writerpc(vp, uiop, cred, iomode, must_commit) } } } else - nfsm_loadattr(vp, (struct vattr *)NULL); + nfsm_loadattr(vp, (struct vattr *)0); if (wccflag) VTONFS(vp)->n_mtime = VTONFS(vp)->n_vattr.va_mtime.tv_sec; m_freem(mrep); @@ -1168,7 +1171,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap) register u_int32_t *tl; register caddr_t cp; register int32_t t1, t2; - struct vnode *newvp = NULL; + struct vnode *newvp = (struct vnode *)0; struct nfsnode *np; char *cp2; caddr_t bpos, dpos; @@ -1216,7 +1219,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap) if (!gotvp) { if (newvp) { vrele(newvp); - newvp = (struct vnode *)NULL; + newvp = (struct vnode *)0; } error = nfs_lookitup(dvp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_cred, cnp->cn_proc, &np); @@ -1289,8 +1292,8 @@ nfs_create(v) register u_int32_t *tl; register caddr_t cp; register int32_t t1, t2; - struct nfsnode *np = NULL; - struct vnode *newvp = NULL; + struct nfsnode *np = (struct nfsnode *)0; + struct vnode *newvp = (struct vnode *)0; caddr_t bpos, dpos, cp2; int error = 0, wccflag = NFSV3_WCCRATTR, gotvp = 0, fmode = 0; struct mbuf *mreq, *mrep, *md, *mb, *mb2; @@ -1343,7 +1346,7 @@ again: if (!gotvp) { if (newvp) { vrele(newvp); - newvp = (struct vnode *)NULL; + newvp = (struct vnode *)0; } error = nfs_lookitup(dvp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_cred, cnp->cn_proc, &np); @@ -1456,7 +1459,7 @@ nfs_removeit(sp) { return (nfs_removerpc(sp->s_dvp, sp->s_name, sp->s_namlen, sp->s_cred, - (struct proc *)NULL)); + (struct proc *)0)); } /* @@ -1714,7 +1717,7 @@ nfs_symlink(v) caddr_t bpos, dpos, cp2; int slen, error = 0, wccflag = NFSV3_WCCRATTR, gotvp; struct mbuf *mreq, *mrep, *md, *mb, *mb2; - struct vnode *newvp = NULL; + struct vnode *newvp = (struct vnode *)0; int v3 = NFS_ISV3(dvp); nfsstats.rpccnt[NFSPROC_SYMLINK]++; @@ -1781,8 +1784,8 @@ nfs_mkdir(v) register caddr_t cp; register int32_t t1, t2; register int len; - struct nfsnode *np = NULL; - struct vnode *newvp = NULL; + struct nfsnode *np = (struct nfsnode *)0; + struct vnode *newvp = (struct vnode *)0; caddr_t bpos, dpos, cp2; int error = 0, wccflag = NFSV3_WCCRATTR; int gotvp = 0; @@ -1823,7 +1826,7 @@ nfs_mkdir(v) if (error == EEXIST || (!error && !gotvp)) { if (newvp) { vrele(newvp); - newvp = (struct vnode *)NULL; + newvp = (struct vnode *)0; } error = nfs_lookitup(dvp, cnp->cn_nameptr, len, cnp->cn_cred, cnp->cn_proc, &np); @@ -2329,7 +2332,7 @@ nfs_readdirplusrpc(vp, uiop, cred) dpos = dpossav1; mdsav2 = md; md = mdsav1; - nfsm_loadattr(newvp, (struct vattr *)NULL); + nfsm_loadattr(newvp, (struct vattr *)0); dpos = dpossav2; md = mdsav2; dp->d_type = @@ -2437,7 +2440,7 @@ nfs_sillyrename(dvp, vp, cnp) /* Try lookitups until we get one that isn't there */ while (nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred, - cnp->cn_proc, (struct nfsnode **)NULL) == 0) { + cnp->cn_proc, (struct nfsnode **)0) == 0) { sp->s_name[4]++; if (sp->s_name[4] > 'z') { error = EINVAL; @@ -2478,7 +2481,7 @@ nfs_lookitup(dvp, name, len, cred, procp, npp) register u_int32_t *tl; register caddr_t cp; register int32_t t1, t2; - struct vnode *newvp = NULL; + struct vnode *newvp = (struct vnode *)0; struct nfsnode *np, *dnp = VTONFS(dvp); caddr_t bpos, dpos, cp2; int error = 0, fhlen, attrflag; @@ -2523,7 +2526,7 @@ nfs_lookitup(dvp, name, len, cred, procp, npp) return (ENOENT); } } else - nfsm_loadattr(newvp, (struct vattr *)NULL); + nfsm_loadattr(newvp, (struct vattr *)0); } nfsm_reqdone; if (npp && *npp == NULL) { @@ -2627,7 +2630,7 @@ nfs_strategy(v) if ((bp->b_flags & (B_PHYS|B_ASYNC)) == (B_PHYS|B_ASYNC)) panic("nfs physio/async"); if (bp->b_flags & B_ASYNC) - p = (struct proc *)NULL; + p = (struct proc *)0; else p = curproc; /* XXX */ if (bp->b_flags & B_READ) @@ -2826,7 +2829,7 @@ loop: "nfsfsync", slptimeo); splx(s); if (error) { - if (nfs_sigintr(nmp, (struct nfsreq *)NULL, p)) + if (nfs_sigintr(nmp, (struct nfsreq *)0, p)) return (EINTR); if (slpflag == PCATCH) { slpflag = 0; @@ -2859,7 +2862,7 @@ loop: error = tsleep((caddr_t)&vp->v_numoutput, slpflag | (PRIBIO + 1), "nfsfsync", slptimeo); if (error) { - if (nfs_sigintr(nmp, (struct nfsreq *)NULL, p)) + if (nfs_sigintr(nmp, (struct nfsreq *)0, p)) return (EINTR); if (slpflag == PCATCH) { slpflag = 0; @@ -2938,8 +2941,10 @@ nfs_print(v) printf("tag VT_NFS, fileid %ld fsid 0x%lx", np->n_vattr.va_fileid, np->n_vattr.va_fsid); +#ifdef FIFO if (vp->v_type == VFIFO) fifo_printinfo(vp); +#endif printf("\n"); return (0); } @@ -3253,6 +3258,7 @@ nfsspec_close(v) return (VOCALL(spec_vnodeop_p, VOFFSET(vop_close), ap)); } +#ifdef FIFO /* * Read wrapper for fifos. */ @@ -3345,3 +3351,4 @@ nfsfifo_close(v) } return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); } +#endif /* ! FIFO */ |