summaryrefslogtreecommitdiff
path: root/sys/nfs
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 22:33:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 22:33:19 +0000
commit67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (patch)
tree967b89f6e07398a22bd8c76d30179b648776542d /sys/nfs
parentba95d3c1d69cdb251d15a12ebf70f50b0ea2019b (diff)
partial sync with netbsd 960418, more to come
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/krpc_subr.c4
-rw-r--r--sys/nfs/nfs_bio.c24
-rw-r--r--sys/nfs/nfs_node.c8
-rw-r--r--sys/nfs/nfs_nqlease.c48
-rw-r--r--sys/nfs/nfs_serv.c59
-rw-r--r--sys/nfs/nfs_socket.c77
-rw-r--r--sys/nfs/nfs_srvcache.c4
-rw-r--r--sys/nfs/nfs_subs.c29
-rw-r--r--sys/nfs/nfs_syscalls.c40
-rw-r--r--sys/nfs/nfs_vfsops.c6
-rw-r--r--sys/nfs/nfs_vnops.c63
-rw-r--r--sys/nfs/nfsm_subs.h5
12 files changed, 191 insertions, 176 deletions
diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c
index 87c48056056..53c17e84445 100644
--- a/sys/nfs/krpc_subr.c
+++ b/sys/nfs/krpc_subr.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: krpc_subr.c,v 1.3 1996/04/17 04:50:22 mickey Exp $ */
-/* $NetBSD: krpc_subr.c,v 1.11 1995/12/19 23:07:19 cgd Exp $ */
+/* $OpenBSD: krpc_subr.c,v 1.4 1996/04/21 22:30:16 deraadt Exp $ */
+/* $NetBSD: krpc_subr.c,v 1.12 1996/02/18 11:53:36 fvdl Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index a40c48454c5..a655aa20c18 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.5 1996/04/17 04:50:24 mickey Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.6 1996/04/21 22:30:18 deraadt Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25 1996/02/29 20:26:16 fvdl Exp $ */
/*
@@ -181,9 +181,9 @@ nfs_bioread(vp, uio, ioflag, cred)
|| ((vp->v_flag & VROOT) && vp->v_type == VLNK)) {
switch (vp->v_type) {
case VREG:
- return nfs_readrpc(vp, uio, cred);
+ return (nfs_readrpc(vp, uio, cred));
case VLNK:
- return nfs_readlinkrpc(vp, uio, cred);
+ return (nfs_readlinkrpc(vp, uio, cred));
case VDIR:
break;
default:
@@ -191,7 +191,7 @@ nfs_bioread(vp, uio, ioflag, cred)
vp->v_type);
};
}
- baddr = NULL;
+ baddr = (caddr_t)0;
switch (vp->v_type) {
case VREG:
nfsstats.biocache_reads++;
@@ -592,7 +592,7 @@ again:
}
} else if ((n + on) == biosize &&
(nmp->nm_flag & NFSMNT_NQNFS) == 0) {
- bp->b_proc = (struct proc *)NULL;
+ bp->b_proc = (struct proc *)0;
bp->b_flags |= B_ASYNC;
(void)nfs_writebp(bp, 0);
} else {
@@ -621,9 +621,9 @@ nfs_getcacheblk(vp, bn, size, p)
if (nmp->nm_flag & NFSMNT_INT) {
bp = getblk(vp, bn, size, PCATCH, 0);
- while (bp == NULL) {
- if (nfs_sigintr(nmp, (struct nfsreq *)NULL, p))
- return ((struct buf *)NULL);
+ while (bp == (struct buf *)0) {
+ if (nfs_sigintr(nmp, (struct nfsreq *)0, p))
+ return ((struct buf *)0);
bp = getblk(vp, bn, size, 0, 2 * hz);
}
} else
@@ -663,7 +663,7 @@ nfs_vinvalbuf(vp, flags, cred, p, intrflg)
np->n_flag |= NFLUSHWANT;
error = tsleep((caddr_t)&np->n_flag, PRIBIO + 2, "nfsvinval",
slptimeo);
- if (error && intrflg && nfs_sigintr(nmp, (struct nfsreq *)NULL, p))
+ if (error && intrflg && nfs_sigintr(nmp, (struct nfsreq *)0, p))
return (EINTR);
}
@@ -673,7 +673,7 @@ nfs_vinvalbuf(vp, flags, cred, p, intrflg)
np->n_flag |= NFLUSHINPROG;
error = vinvalbuf(vp, flags, cred, p, slpflag, 0);
while (error) {
- if (intrflg && nfs_sigintr(nmp, (struct nfsreq *)NULL, p)) {
+ if (intrflg && nfs_sigintr(nmp, (struct nfsreq *)0, p)) {
np->n_flag &= ~NFLUSHINPROG;
if (np->n_flag & NFLUSHWANT) {
np->n_flag &= ~NFLUSHWANT;
@@ -721,7 +721,7 @@ nfs_asyncio(bp, cred)
}
TAILQ_INSERT_TAIL(&nfs_bufq, bp, b_freelist);
- nfs_iodwant[i] = (struct proc *)NULL;
+ nfs_iodwant[i] = (struct proc *)0;
wakeup((caddr_t)&nfs_iodwant[i]);
return (0);
}
@@ -840,7 +840,7 @@ nfs_doio(bp, cr, p)
}
break;
case VLNK:
- uiop->uio_offset = (off_t)NULL;
+ uiop->uio_offset = (off_t)0;
nfsstats.readlink_bios++;
error = nfs_readlinkrpc(vp, uiop, cr);
break;
diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c
index 15af282b536..86806056906 100644
--- a/sys/nfs/nfs_node.c
+++ b/sys/nfs/nfs_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_node.c,v 1.5 1996/04/17 04:50:25 mickey Exp $ */
+/* $OpenBSD: nfs_node.c,v 1.6 1996/04/21 22:30:19 deraadt Exp $ */
/* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */
/*
@@ -177,8 +177,8 @@ nfs_inactive(v)
if (ap->a_vp->v_type != VDIR)
sp = np->n_sillyrename;
else
- sp = NULL;
- np->n_sillyrename = NULL;
+ sp = (struct sillyrename *)0;
+ np->n_sillyrename = (struct sillyrename *)0;
if (sp) {
/*
* Remove the silly file that was rename'd earlier
@@ -244,7 +244,7 @@ nfs_reclaim(v)
cache_purge(vp);
FREE(vp->v_data, M_NFSNODE);
- vp->v_data = NULL;
+ vp->v_data = (void *)0;
return (0);
}
diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c
index a3ed2b6dba4..e5c4596cac4 100644
--- a/sys/nfs/nfs_nqlease.c
+++ b/sys/nfs/nfs_nqlease.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_nqlease.c,v 1.5 1996/04/17 04:50:26 mickey Exp $ */
+/* $OpenBSD: nfs_nqlease.c,v 1.6 1996/04/21 22:30:20 deraadt Exp $ */
/* $NetBSD: nfs_nqlease.c,v 1.14 1996/02/18 14:06:50 fvdl Exp $ */
/*
@@ -181,7 +181,7 @@ nqsrv_getlease(vp, duration, flags, slp, procp, nam, cachablep, frev, cred)
tlp = vp->v_lease;
if ((flags & ND_CHECK) == 0)
nfsstats.srvnqnfs_getleases++;
- if (tlp == NULL) {
+ if (tlp == 0) {
/*
* Find the lease by searching the hash list.
*/
@@ -205,9 +205,9 @@ nqsrv_getlease(vp, duration, flags, slp, procp, nam, cachablep, frev, cred)
}
} else
lp = tlp;
- if (lp != NULL) {
+ if (lp != 0) {
if ((lp->lc_flag & LC_NONCACHABLE) ||
- (lp->lc_morehosts == NULL &&
+ (lp->lc_morehosts == (struct nqm *)0 &&
nqsrv_cmpnam(slp, nam, &lp->lc_host)))
goto doreply;
if ((flags & ND_READ) && (lp->lc_flag & LC_WRITE) == 0) {
@@ -327,7 +327,7 @@ nqnfs_vop_lease_check(v)
u_quad_t frev;
(void) nqsrv_getlease(ap->a_vp, &duration, ND_CHECK | ap->a_flag,
- NQLOCALSLP, ap->a_p, (struct mbuf *)NULL, &cache, &frev, ap->a_cred);
+ NQLOCALSLP, ap->a_p, (struct mbuf *)0, &cache, &frev, ap->a_cred);
return (0);
}
@@ -373,7 +373,7 @@ nqsrv_instimeq(lp, duration)
newexpiry = time.tv_sec + duration + nqsrv_clockskew;
if (lp->lc_expiry == newexpiry)
return;
- if (lp->lc_timer.cqe_next != NULL)
+ if (lp->lc_timer.cqe_next != 0)
CIRCLEQ_REMOVE(&nqtimerhead, lp, lc_timer);
lp->lc_expiry = newexpiry;
@@ -479,7 +479,7 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
nam2 = lph->lph_nam;
so = nfs_cltpsock->ns_so;
} else if (lph->lph_slp->ns_flag & SLP_VALID) {
- nam2 = (struct mbuf *)NULL;
+ nam2 = (struct mbuf *)0;
so = lph->lph_slp->ns_so;
} else
goto nextone;
@@ -487,8 +487,8 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
if (so->so_proto->pr_flags & PR_CONNREQUIRED)
solockp = &lph->lph_slp->ns_solock;
else
- solockp = (int *)NULL;
- nfsm_reqhead((struct vnode *)NULL, NQNFSPROC_EVICTED,
+ solockp = (int *)0;
+ nfsm_reqhead((struct vnode *)0, NQNFSPROC_EVICTED,
NFSX_V3FH);
nfsm_build(cp, caddr_t, NFSX_V3FH);
bzero(cp, NFSX_V3FH);
@@ -507,8 +507,8 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
}
m = nfsm_rpchead(cred, (NFSMNT_NFSV3 | NFSMNT_NQNFS),
NQNFSPROC_EVICTED,
- RPCAUTH_UNIX, 5 * NFSX_UNSIGNED, NULL,
- 0, NULL, mreq, siz, &mheadend, &xid);
+ RPCAUTH_UNIX, 5 * NFSX_UNSIGNED, (char *)0,
+ 0, (char *)0, mreq, siz, &mheadend, &xid);
/*
* For stream protocols, prepend a Sun RPC
* Record Mark.
@@ -526,7 +526,7 @@ nqsrv_send_eviction(vp, lp, slp, nam, cred)
if (solockp)
*solockp |= NFSMNT_SNDLOCK;
(void) nfs_send(so, nam2, m,
- (struct nfsreq *)NULL);
+ (struct nfsreq *)0);
if (solockp)
nfs_sndunlock(solockp);
}
@@ -639,10 +639,10 @@ nqnfs_serverd()
* recycled and has another valid lease reference,
* which is dereferenced prematurely.
*/
- lp->lc_vp->v_lease = (struct nqlease *)NULL;
+ lp->lc_vp->v_lease = (struct nqlease *)0;
lph = &lp->lc_host;
lphnext = lp->lc_morehosts;
- olphnext = (struct nqm *)NULL;
+ olphnext = (struct nqm *)0;
len = 1;
i = 0;
ok = 1;
@@ -654,7 +654,7 @@ nqnfs_serverd()
if (++i == len) {
if (olphnext) {
free((caddr_t)olphnext, M_NQMHOST);
- olphnext = (struct nqm *)NULL;
+ olphnext = (struct nqm *)0;
}
if (lphnext) {
olphnext = lphnext;
@@ -750,7 +750,7 @@ nqnfsrv_vacated(nfsd, slp, procp, mrq)
caddr_t dpos = nfsd->nd_dpos;
register struct nqlease *lp;
register struct nqhost *lph;
- struct nqlease *tlp = NULL;
+ struct nqlease *tlp = (struct nqlease *)0;
nfsfh_t nfh;
fhandle_t *fhp;
register u_int32_t *tl;
@@ -777,7 +777,7 @@ nqnfsrv_vacated(nfsd, slp, procp, mrq)
tlp = lp;
break;
}
- if (tlp != NULL) {
+ if (tlp != 0) {
lp = tlp;
len = 1;
i = 0;
@@ -851,7 +851,7 @@ nqnfs_getlease(vp, rwflag, cred, p)
if (reqtime > time.tv_sec) {
fxdr_hyper(tl, &frev);
nqnfs_clientlease(nmp, np, rwflag, cachable, reqtime, frev);
- nfsm_loadattr(vp, (struct vattr *)NULL);
+ nfsm_loadattr(vp, (struct vattr *)0);
} else
error = NQNFS_EXPIRED;
nfsm_reqdone;
@@ -889,8 +889,8 @@ nqnfs_vacated(vp, cred)
m = m->m_next;
}
m = nfsm_rpchead(cred, nmp->nm_flag, NQNFSPROC_VACATED,
- RPCAUTH_UNIX, 5 * NFSX_UNSIGNED, NULL,
- 0, NULL, mreq, i, &mheadend, &xid);
+ RPCAUTH_UNIX, 5 * NFSX_UNSIGNED, (char *)0,
+ 0, (char *)0, mreq, i, &mheadend, &xid);
if (nmp->nm_sotype == SOCK_STREAM) {
M_PREPEND(m, NFSX_UNSIGNED, M_WAIT);
*mtod(m, u_int32_t *) = htonl(0x80000000 | (m->m_pkthdr.len -
@@ -899,7 +899,7 @@ nqnfs_vacated(vp, cred)
myrep.r_flags = 0;
myrep.r_nmp = nmp;
if (nmp->nm_soflags & PR_CONNREQUIRED)
- (void) nfs_sndlock(&nmp->nm_flag, (struct nfsreq *)NULL);
+ (void) nfs_sndlock(&nmp->nm_flag, (struct nfsreq *)0);
(void) nfs_send(nmp->nm_so, nmp->nm_nam, m, &myrep);
if (nmp->nm_soflags & PR_CONNREQUIRED)
nfs_sndunlock(&nmp->nm_flag);
@@ -926,7 +926,7 @@ nqnfs_callback(nmp, mrep, md, dpos)
struct nfssvc_sock *slp;
struct nfsrv_descript ndesc;
register struct nfsrv_descript *nfsd = &ndesc;
- struct mbuf **mrq = NULL, *mb, *mreq;
+ struct mbuf **mrq = (struct mbuf **)0, *mb, *mreq;
int error = 0, cache = 0;
char *cp2, *bpos;
u_quad_t frev;
@@ -1032,8 +1032,8 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
nmp->nm_so->so_rcv.sb_cc > 0) {
myrep.r_flags = R_GETONEREP;
myrep.r_nmp = nmp;
- myrep.r_mrep = (struct mbuf *)NULL;
- myrep.r_procp = (struct proc *)NULL;
+ myrep.r_mrep = (struct mbuf *)0;
+ myrep.r_procp = (struct proc *)0;
(void) nfs_reply(&myrep);
}
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 0bfad995359..f4ac14a698a 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_serv.c,v 1.5 1996/04/17 04:50:27 mickey Exp $ */
+/* $OpenBSD: nfs_serv.c,v 1.6 1996/04/21 22:30:23 deraadt Exp $ */
/* $NetBSD: nfs_serv.c,v 1.25 1996/03/02 15:55:52 jtk Exp $ */
/*
@@ -127,7 +127,7 @@ nfsrv3_access(nfsd, slp, procp, mrq)
(nfsd->nd_flag & ND_KERBAUTH));
if (error) {
nfsm_reply(NFSX_UNSIGNED);
- nfsm_srvpostop_attr(1, (struct vattr *)NULL);
+ nfsm_srvpostop_attr(1, (struct vattr *)0);
return (0);
}
nfsmode = fxdr_unsigned(u_int32_t, *tl);
@@ -471,13 +471,13 @@ nfsrv_readlink(nfsd, slp, procp, mrq)
uiop->uio_resid = len;
uiop->uio_rw = UIO_READ;
uiop->uio_segflg = UIO_SYSSPACE;
- uiop->uio_procp = (struct proc *)NULL;
+ uiop->uio_procp = (struct proc *)0;
error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
&rdonly, (nfsd->nd_flag & ND_KERBAUTH));
if (error) {
m_freem(mp3);
nfsm_reply(2 * NFSX_UNSIGNED);
- nfsm_srvpostop_attr(1, (struct vattr *)NULL);
+ nfsm_srvpostop_attr(1, (struct vattr *)0);
return (0);
}
if (vp->v_type != VLNK) {
@@ -560,7 +560,7 @@ nfsrv_read(nfsd, slp, procp, mrq)
&rdonly, (nfsd->nd_flag & ND_KERBAUTH));
if (error) {
nfsm_reply(2 * NFSX_UNSIGNED);
- nfsm_srvpostop_attr(1, (struct vattr *)NULL);
+ nfsm_srvpostop_attr(1, (struct vattr *)0);
return (0);
}
if (vp->v_type != VREG) {
@@ -825,7 +825,7 @@ nfsrv_write(nfsd, slp, procp, mrq)
uiop->uio_resid = len;
uiop->uio_rw = UIO_WRITE;
uiop->uio_segflg = UIO_SYSSPACE;
- uiop->uio_procp = (struct proc *)NULL;
+ uiop->uio_procp = (struct proc *)0;
uiop->uio_offset = off;
error = VOP_WRITE(vp, uiop, ioflags, cred);
nfsstats.srvvop_writes++;
@@ -1061,7 +1061,7 @@ loop1:
ioflags = (IO_METASYNC | IO_SYNC | IO_NODELOCKED);
uiop->uio_rw = UIO_WRITE;
uiop->uio_segflg = UIO_SYSSPACE;
- uiop->uio_procp = (struct proc *)NULL;
+ uiop->uio_procp = (struct proc *)0;
uiop->uio_offset = nfsd->nd_off;
uiop->uio_resid = nfsd->nd_eoff - nfsd->nd_off;
if (uiop->uio_resid > 0) {
@@ -1260,7 +1260,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)NULL;
+ dirp = (struct vnode *)0;
}
}
if (error) {
@@ -1339,7 +1339,8 @@ nfsrv_create(nfsd, slp, procp, mrq)
va.va_type == VFIFO) {
if (va.va_type == VCHR && rdev == 0xffffffff)
va.va_type = VFIFO;
- if ((error = suser(cred, NULL)) != 0) {
+ error = suser(cred, (u_short *)0);
+ if (error) {
vrele(nd.ni_startdir);
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -1472,7 +1473,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
enum vtype vtyp;
char *cp2;
struct mbuf *mb, *mb2, *mreq;
- struct vnode *vp, *dirp = NULL;
+ struct vnode *vp, *dirp = (struct vnode *)0;
nfsfh_t nfh;
fhandle_t *fhp;
u_quad_t frev;
@@ -1533,7 +1534,8 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
if (!error)
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
} else {
- if ((error = suser(cred, NULL)) != 0) {
+ error = suser(cred, (u_short *)0);
+ if (error) {
vrele(nd.ni_startdir);
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -1619,12 +1621,15 @@ nfsrv_remove(nfsd, slp, procp, mrq)
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
- struct vnode *vp = NULL, *dirp;
+ struct vnode *vp, *dirp;
struct vattr dirfor, diraft;
nfsfh_t nfh;
fhandle_t *fhp;
u_quad_t frev;
+#ifndef nolint
+ vp = (struct vnode *)0;
+#endif
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
nfsm_srvnamesiz(len);
@@ -1643,7 +1648,7 @@ nfsrv_remove(nfsd, slp, procp, mrq)
if (!error) {
vp = nd.ni_vp;
if (vp->v_type == VDIR &&
- (error = suser(cred, NULL)) != 0)
+ (error = suser(cred, (u_short *)0)) != 0)
goto out;
/*
* The root of a mounted filesystem cannot be deleted.
@@ -1733,7 +1738,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
procp);
else {
vrele(fdirp);
- fdirp = (struct vnode *)NULL;
+ fdirp = (struct vnode *)0;
}
}
if (error) {
@@ -1759,7 +1764,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
procp);
else {
vrele(tdirp);
- tdirp = (struct vnode *)NULL;
+ tdirp = (struct vnode *)0;
}
}
if (error) {
@@ -1904,7 +1909,7 @@ nfsrv_link(nfsd, slp, procp, mrq)
int getret = 1, v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
- struct vnode *vp, *xp, *dirp = NULL;
+ struct vnode *vp, *xp, *dirp = (struct vnode *)0;
struct vattr dirfor, diraft, at;
nfsfh_t nfh, dnfh;
fhandle_t *fhp, *dfhp;
@@ -1923,7 +1928,7 @@ nfsrv_link(nfsd, slp, procp, mrq)
nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft);
return (0);
}
- if (vp->v_type == VDIR && (error = suser(cred, NULL)) != 0)
+ if (vp->v_type == VDIR && (error = suser(cred, (u_short *)0)) != 0)
goto out1;
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameiop = CREATE;
@@ -1936,7 +1941,7 @@ nfsrv_link(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)NULL;
+ dirp = (struct vnode *)0;
}
}
if (error)
@@ -2005,7 +2010,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
int error = 0, cache, len, len2, dirfor_ret = 1, diraft_ret = 1;
int v3 = (nfsd->nd_flag & ND_NFSV3);
struct mbuf *mb, *mreq, *mb2;
- struct vnode *dirp = NULL;
+ struct vnode *dirp = (struct vnode *)0;
nfsfh_t nfh;
fhandle_t *fhp;
u_quad_t frev;
@@ -2025,7 +2030,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)NULL;
+ dirp = (struct vnode *)0;
}
}
if (error)
@@ -2043,7 +2048,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
io.uio_iovcnt = 1;
io.uio_segflg = UIO_SYSSPACE;
io.uio_rw = UIO_READ;
- io.uio_procp = (struct proc *)NULL;
+ io.uio_procp = (struct proc *)0;
nfsm_mtouio(&io, len2);
if (!v3) {
nfsm_dissect(sp, struct nfsv2_sattr *, NFSX_V2SATTR);
@@ -2147,7 +2152,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mb2, *mreq;
- struct vnode *vp, *dirp = NULL;
+ struct vnode *vp, *dirp = (struct vnode *)0;
nfsfh_t nfh;
fhandle_t *fhp;
u_quad_t frev;
@@ -2166,7 +2171,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)NULL;
+ dirp = (struct vnode *)0;
}
}
if (error) {
@@ -2258,7 +2263,7 @@ nfsrv_rmdir(nfsd, slp, procp, mrq)
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
- struct vnode *vp, *dirp = (struct vnode *)NULL;
+ struct vnode *vp, *dirp = (struct vnode *)0;
struct vattr dirfor, diraft;
nfsfh_t nfh;
fhandle_t *fhp;
@@ -2279,7 +2284,7 @@ nfsrv_rmdir(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)NULL;
+ dirp = (struct vnode *)0;
}
}
if (error) {
@@ -2466,7 +2471,7 @@ again:
io.uio_resid = fullsiz;
io.uio_segflg = UIO_SYSSPACE;
io.uio_rw = UIO_READ;
- io.uio_procp = (struct proc *)NULL;
+ io.uio_procp = (struct proc *)0;
eofflag = 0;
#ifdef Lite2_integrated
VOP_LOCK(vp, 0, procp);
@@ -2735,7 +2740,7 @@ again:
io.uio_resid = fullsiz;
io.uio_segflg = UIO_SYSSPACE;
io.uio_rw = UIO_READ;
- io.uio_procp = (struct proc *)NULL;
+ io.uio_procp = (struct proc *)0;
eofflag = 0;
#ifdef Lite2_integrated
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index a21236d1a87..a71af7b5a7e 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: nfs_socket.c,v 1.5 1996/04/17 04:50:29 mickey Exp $ */
-/* $NetBSD: nfs_socket.c,v 1.26 1996/02/25 17:47:26 fvdl Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.6 1996/04/21 22:30:26 deraadt Exp $ */
+/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@@ -154,7 +154,7 @@ nfs_connect(nmp, rep)
struct mbuf *m;
u_int16_t tport;
- nmp->nm_so = (struct socket *)NULL;
+ nmp->nm_so = (struct socket *)0;
saddr = mtod(nmp->nm_nam, struct sockaddr *);
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
nmp->nm_soproto);
@@ -323,7 +323,7 @@ nfs_disconnect(nmp)
if (nmp->nm_so) {
so = nmp->nm_so;
- nmp->nm_so = (struct socket *)NULL;
+ nmp->nm_so = (struct socket *)0;
soshutdown(so, 2);
soclose(so);
}
@@ -367,7 +367,7 @@ nfs_send(so, nam, top, rep)
} else
soflags = so->so_proto->pr_flags;
if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED))
- sendnam = (struct mbuf *)NULL;
+ sendnam = (struct mbuf *)0;
else
sendnam = nam;
if (so->so_type == SOCK_SEQPACKET)
@@ -375,8 +375,8 @@ nfs_send(so, nam, top, rep)
else
flags = 0;
- error = sosend(so, sendnam, (struct uio *)NULL, top,
- (struct mbuf *)NULL, flags);
+ error = sosend(so, sendnam, (struct uio *)0, top,
+ (struct mbuf *)0, flags);
if (error) {
if (rep) {
log(LOG_INFO, "nfs send error %d for server %s\n",error,
@@ -430,8 +430,8 @@ nfs_receive(rep, aname, mp)
/*
* Set up arguments for soreceive()
*/
- *mp = (struct mbuf *)NULL;
- *aname = (struct mbuf *)NULL;
+ *mp = (struct mbuf *)0;
+ *aname = (struct mbuf *)0;
sotype = rep->r_nmp->nm_sotype;
/*
@@ -495,8 +495,8 @@ tryagain:
auio.uio_procp = p;
do {
rcvflg = MSG_WAITALL;
- error = soreceive(so, (struct mbuf **)NULL, &auio,
- (struct mbuf **)NULL, (struct mbuf **)NULL, &rcvflg);
+ error = soreceive(so, (struct mbuf **)0, &auio,
+ (struct mbuf **)0, (struct mbuf **)0, &rcvflg);
if (error == EWOULDBLOCK && rep) {
if (rep->r_flags & R_SOFTTERM)
return (EINTR);
@@ -528,8 +528,8 @@ tryagain:
auio.uio_resid = len;
do {
rcvflg = MSG_WAITALL;
- error = soreceive(so, (struct mbuf **)NULL,
- &auio, mp, (struct mbuf **)NULL, &rcvflg);
+ error = soreceive(so, (struct mbuf **)0,
+ &auio, mp, (struct mbuf **)0, &rcvflg);
} while (error == EWOULDBLOCK || error == EINTR ||
error == ERESTART);
if (!error && auio.uio_resid > 0) {
@@ -552,7 +552,7 @@ tryagain:
auio.uio_procp = p;
do {
rcvflg = 0;
- error = soreceive(so, (struct mbuf **)NULL,
+ error = soreceive(so, (struct mbuf **)0,
&auio, mp, &control, &rcvflg);
if (control)
m_freem(control);
@@ -571,7 +571,7 @@ tryagain:
errout:
if (error && error != EINTR && error != ERESTART) {
m_freem(*mp);
- *mp = (struct mbuf *)NULL;
+ *mp = (struct mbuf *)0;
if (error != EPIPE)
log(LOG_INFO,
"receive error %d from nfs server %s\n",
@@ -587,7 +587,7 @@ errout:
if ((so = rep->r_nmp->nm_so) == NULL)
return (EACCES);
if (so->so_state & SS_ISCONNECTED)
- getnam = (struct mbuf **)NULL;
+ getnam = (struct mbuf **)0;
else
getnam = aname;
auio.uio_resid = len = 1000000;
@@ -595,7 +595,7 @@ errout:
do {
rcvflg = 0;
error = soreceive(so, getnam, &auio, mp,
- (struct mbuf **)NULL, &rcvflg);
+ (struct mbuf **)0, &rcvflg);
if (error == EWOULDBLOCK &&
(rep->r_flags & R_SOFTTERM))
return (EINTR);
@@ -604,7 +604,7 @@ errout:
}
if (error) {
m_freem(*mp);
- *mp = (struct mbuf *)NULL;
+ *mp = (struct mbuf *)0;
}
/*
* Search for any mbufs that are not a multiple of 4 bytes long
@@ -836,7 +836,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
* Get the RPC header with authorization.
*/
kerbauth:
- verf_str = auth_str = (char *)NULL;
+ verf_str = auth_str = (char *)0;
if (nmp->nm_flag & NFSMNT_KERB) {
verf_str = nickv;
verf_len = sizeof (nickv);
@@ -972,7 +972,7 @@ tryagain:
else if ((nmp->nm_flag & NFSMNT_KERB) && *tl++ == rpc_autherr) {
if (!failed_auth) {
failed_auth++;
- mheadend->m_next = (struct mbuf *)NULL;
+ mheadend->m_next = (struct mbuf *)0;
m_freem(mrep);
m_freem(rep->r_mreq);
goto kerbauth;
@@ -1236,12 +1236,12 @@ nfs_timer(arg)
register struct socket *so;
register struct nfsmount *nmp;
register int timeo;
- register struct nfssvc_sock *slp;
+ int s, error;
#ifdef NFSSERVER
+ register struct nfssvc_sock *slp;
static long lasttime = 0;
-#endif
- int s, error;
u_quad_t cur_usec;
+#endif
s = splsoftnet();
for (rep = nfs_reqq.tqh_first; rep != 0; rep = rep->r_chain.tqe_next) {
@@ -1301,10 +1301,10 @@ nfs_timer(arg)
(m = m_copym(rep->r_mreq, 0, M_COPYALL, M_DONTWAIT))){
if ((nmp->nm_flag & NFSMNT_NOCONN) == 0)
error = (*so->so_proto->pr_usrreq)(so, PRU_SEND, m,
- (struct mbuf *)NULL, (struct mbuf *)NULL);
+ (struct mbuf *)0, (struct mbuf *)0);
else
error = (*so->so_proto->pr_usrreq)(so, PRU_SEND, m,
- nmp->nm_nam, (struct mbuf *)NULL);
+ nmp->nm_nam, (struct mbuf *)0);
if (error) {
if (NFSIGNORE_SOERROR(nmp->nm_soflags, error))
so->so_error = 0;
@@ -1352,7 +1352,7 @@ nfs_timer(arg)
}
#endif /* NFSSERVER */
splx(s);
- timeout(nfs_timer, NULL, nfs_ticks);
+ timeout(nfs_timer, (void *)0, nfs_ticks);
}
/*
@@ -1396,7 +1396,7 @@ nfs_sndlock(flagp, rep)
if (rep->r_nmp->nm_flag & NFSMNT_INT)
slpflag = PCATCH;
} else
- p = (struct proc *)NULL;
+ p = (struct proc *)0;
while (*flagp & NFSMNT_SNDLOCK) {
if (nfs_sigintr(rep->r_nmp, rep, p))
return (EINTR);
@@ -1899,9 +1899,8 @@ nfsrv_rcv(so, arg, waitflag)
*/
auio.uio_resid = 1000000000;
flags = MSG_DONTWAIT;
- error = soreceive(so, &nam, &auio, &mp,
- (struct mbuf **)NULL, &flags);
- if (error || mp == NULL) {
+ error = soreceive(so, &nam, &auio, &mp, (struct mbuf **)0, &flags);
+ if (error || mp == (struct mbuf *)0) {
if (error == EWOULDBLOCK)
slp->ns_flag |= SLP_NEEDQ;
else
@@ -1935,7 +1934,7 @@ nfsrv_rcv(so, arg, waitflag)
auio.uio_resid = 1000000000;
flags = MSG_DONTWAIT;
error = soreceive(so, &nam, &auio, &mp,
- (struct mbuf **)NULL, &flags);
+ (struct mbuf **)0, &flags);
if (mp) {
nfs_realign(mp, 10 * NFSX_UNSIGNED);
if (nam) {
@@ -1948,7 +1947,7 @@ nfsrv_rcv(so, arg, waitflag)
else
slp->ns_rec = m;
slp->ns_recend = m;
- m->m_nextpkt = (struct mbuf *)NULL;
+ m->m_nextpkt = (struct mbuf *)0;
}
if (error) {
if ((so->so_proto->pr_flags & PR_CONNREQUIRED)
@@ -2030,12 +2029,12 @@ nfsrv_getstream(slp, waitflag)
*/
if (slp->ns_cc == slp->ns_reclen) {
recm = slp->ns_raw;
- slp->ns_raw = slp->ns_rawend = (struct mbuf *)NULL;
+ slp->ns_raw = slp->ns_rawend = (struct mbuf *)0;
slp->ns_cc = slp->ns_reclen = 0;
} else if (slp->ns_cc > slp->ns_reclen) {
len = 0;
m = slp->ns_raw;
- om = (struct mbuf *)NULL;
+ om = (struct mbuf *)0;
while (len < slp->ns_reclen) {
if ((len + m->m_len) > slp->ns_reclen) {
m2 = m_copym(m, 0, slp->ns_reclen - len,
@@ -2058,7 +2057,7 @@ nfsrv_getstream(slp, waitflag)
len += m->m_len;
m = m->m_next;
recm = slp->ns_raw;
- om->m_next = (struct mbuf *)NULL;
+ om->m_next = (struct mbuf *)0;
} else {
om = m;
len += m->m_len;
@@ -2087,7 +2086,7 @@ nfsrv_getstream(slp, waitflag)
else
slp->ns_rec = slp->ns_frag;
slp->ns_recend = slp->ns_frag;
- slp->ns_frag = (struct mbuf *)NULL;
+ slp->ns_frag = (struct mbuf *)0;
}
}
}
@@ -2107,13 +2106,13 @@ nfsrv_dorec(slp, nfsd, ndp)
*ndp = NULL;
if ((slp->ns_flag & SLP_VALID) == 0 ||
- (m = slp->ns_rec) == NULL)
+ (m = slp->ns_rec) == (struct mbuf *)0)
return (ENOBUFS);
slp->ns_rec = m->m_nextpkt;
if (slp->ns_rec)
- m->m_nextpkt = (struct mbuf *)NULL;
+ m->m_nextpkt = (struct mbuf *)0;
else
- slp->ns_recend = (struct mbuf *)NULL;
+ slp->ns_recend = (struct mbuf *)0;
if (m->m_type == MT_SONAME) {
nam = m;
m = m->m_next;
diff --git a/sys/nfs/nfs_srvcache.c b/sys/nfs/nfs_srvcache.c
index 16e0d630fd2..fb6004cdfe2 100644
--- a/sys/nfs/nfs_srvcache.c
+++ b/sys/nfs/nfs_srvcache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_srvcache.c,v 1.4 1996/04/17 04:50:30 mickey Exp $ */
+/* $OpenBSD: nfs_srvcache.c,v 1.5 1996/04/21 22:30:28 deraadt Exp $ */
/* $NetBSD: nfs_srvcache.c,v 1.12 1996/02/18 11:53:49 fvdl Exp $ */
/*
@@ -204,7 +204,7 @@ loop:
} else if (rp->rc_flag & RC_REPSTATUS) {
nfsstats.srvcache_nonidemdonehits++;
nfs_rephead(0, nd, slp, rp->rc_status,
- 0, (u_quad_t *)NULL, repp, &mb, &bpos);
+ 0, (u_quad_t *)0, repp, &mb, &bpos);
ret = RC_REPLY;
} else if (rp->rc_flag & RC_REPMBUF) {
nfsstats.srvcache_nonidemdonehits++;
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 2ce960fbb44..a70cb10ba8c 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: nfs_subs.c,v 1.6 1996/04/17 04:50:31 mickey Exp $ */
-/* $NetBSD: nfs_subs.c,v 1.26 1996/03/13 00:44:17 fvdl Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.7 1996/04/21 22:30:30 deraadt Exp $ */
+/* $NetBSD: nfs_subs.c,v 1.27 1996/04/03 23:25:36 thorpej Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -728,7 +728,7 @@ nfsm_rpchead(cr, nmflag, procid, auth_type, auth_len, auth_str, verf_len,
}
mb->m_next = mrest;
mreq->m_pkthdr.len = authsiz + 10 * NFSX_UNSIGNED + mrest_len;
- mreq->m_pkthdr.rcvif = (struct ifnet *)NULL;
+ mreq->m_pkthdr.rcvif = (struct ifnet *)0;
*mbp = mb;
return (mreq);
}
@@ -1103,7 +1103,7 @@ nfs_init()
#ifdef NFSCLIENT
/* Ensure async daemons disabled */
for (i = 0; i < NFS_MAXASYNCDAEMON; i++)
- nfs_iodwant[i] = (struct proc *)NULL;
+ nfs_iodwant[i] = (struct proc *)0;
TAILQ_INIT(&nfs_bufq);
nfs_nhinit(); /* Init the nfsnode table */
#endif /* NFSCLIENT */
@@ -1206,8 +1206,12 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
if (vp->v_type != vtyp) {
vp->v_type = vtyp;
if (vp->v_type == VFIFO) {
+#ifndef FIFO
+ return (EOPNOTSUPP);
+#else
extern int (**fifo_nfsv2nodeop_p) __P((void *));
vp->v_op = fifo_nfsv2nodeop_p;
+#endif /* FIFO */
}
if (vp->v_type == VCHR || vp->v_type == VBLK) {
vp->v_op = spec_nfsv2nodeop_p;
@@ -1364,7 +1368,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag)
int error, rdonly;
struct componentname *cnp = &ndp->ni_cnd;
- *retdirp = (struct vnode *)NULL;
+ *retdirp = (struct vnode *)0;
MALLOC(cnp->cn_pnbuf, char *, len + 1, M_NAMEI, M_WAITOK);
/*
* Copy the name from the mbuf list to ndp->ni_pnbuf
@@ -1428,7 +1432,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag)
* And call lookup() to do the real work
*/
cnp->cn_proc = p;
- if ((error = lookup(ndp)) != 0)
+ error = lookup(ndp);
+ if (error)
goto out;
/*
* Check for encountering a symbolic link
@@ -1480,7 +1485,7 @@ nfsm_adj(mp, len, nul)
m = mp;
for (;;) {
count += m->m_len;
- if (m->m_next == (struct mbuf *)NULL)
+ if (m->m_next == (struct mbuf *)0)
break;
m = m->m_next;
}
@@ -1646,7 +1651,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
struct ucred *credanon;
int error, exflags;
- *vpp = (struct vnode *)NULL;
+ *vpp = (struct vnode *)0;
#ifdef Lite2_integrated
mp = vfs_getvfs(&fhp->fh_fsid);
#else
@@ -1762,14 +1767,14 @@ nfs_getcookie(np, off, add)
dp->ndm_eocookie = 0;
LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list);
} else
- return ((nfsuint64 *)NULL);
+ return ((nfsuint64 *)0);
}
while (pos >= NFSNUMCOOKIES) {
pos -= NFSNUMCOOKIES;
if (dp->ndm_list.le_next) {
if (!add && dp->ndm_eocookie < NFSNUMCOOKIES &&
pos >= dp->ndm_eocookie)
- return ((nfsuint64 *)NULL);
+ return ((nfsuint64 *)0);
dp = dp->ndm_list.le_next;
} else if (add) {
MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap),
@@ -1778,13 +1783,13 @@ nfs_getcookie(np, off, add)
LIST_INSERT_AFTER(dp, dp2, ndm_list);
dp = dp2;
} else
- return ((nfsuint64 *)NULL);
+ return ((nfsuint64 *)0);
}
if (pos >= dp->ndm_eocookie) {
if (add)
dp->ndm_eocookie = pos + 1;
else
- return ((nfsuint64 *)NULL);
+ return ((nfsuint64 *)0);
}
return (&dp->ndm_cookies[pos]);
}
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 410d85b385f..3cc0149c2d5 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_syscalls.c,v 1.5 1996/04/17 04:50:33 mickey Exp $ */
+/* $OpenBSD: nfs_syscalls.c,v 1.6 1996/04/21 22:30:33 deraadt Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */
/*
@@ -244,7 +244,7 @@ sys_nfssvc(p, v, retval)
* Get the client address for connected sockets.
*/
if (nfsdarg.name == NULL || nfsdarg.namelen == 0)
- nam = (struct mbuf *)NULL;
+ nam = (struct mbuf *)0;
else {
error = sockargs(&nam, nfsdarg.name, nfsdarg.namelen,
MT_SONAME);
@@ -290,12 +290,12 @@ sys_nfssvc(p, v, retval)
malloc(sizeof (struct nfsuid), M_NFSUID,
M_WAITOK);
} else
- nuidp = (struct nfsuid *)NULL;
+ nuidp = (struct nfsuid *)0;
if ((slp->ns_flag & SLP_VALID) == 0) {
if (nuidp)
free((caddr_t)nuidp, M_NFSUID);
} else {
- if (nuidp == NULL) {
+ if (nuidp == (struct nfsuid *)0) {
nuidp = slp->ns_uidlruhead.tqh_first;
LIST_REMOVE(nuidp, nu_hash);
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp,
@@ -373,7 +373,7 @@ nfssvc_addsock(fp, mynam)
int error, s;
so = (struct socket *)fp->f_data;
- tslp = (struct nfssvc_sock *)NULL;
+ tslp = (struct nfssvc_sock *)0;
/*
* Add it to the list, as required.
*/
@@ -472,7 +472,7 @@ nfssvc_nfsd(nsd, argp, p)
writes_todo = 0;
#endif
s = splsoftnet();
- if (nfsd == NULL) {
+ if (nfsd == (struct nfsd *)0) {
nsd->nsd_nfsd = nfsd = (struct nfsd *)
malloc(sizeof (struct nfsd), M_NFSD, M_WAITOK);
bzero((caddr_t)nfsd, sizeof (struct nfsd));
@@ -485,7 +485,7 @@ nfssvc_nfsd(nsd, argp, p)
*/
for (;;) {
if ((nfsd->nfsd_flag & NFSD_REQINPROG) == 0) {
- while (nfsd->nfsd_slp == NULL &&
+ while (nfsd->nfsd_slp == (struct nfssvc_sock *)0 &&
(nfsd_head_flag & NFSD_CHECKSLP) == 0) {
nfsd->nfsd_flag |= NFSD_WAITING;
nfsd_waiting++;
@@ -495,7 +495,7 @@ nfssvc_nfsd(nsd, argp, p)
if (error)
goto done;
}
- if (nfsd->nfsd_slp == NULL &&
+ if (nfsd->nfsd_slp == (struct nfssvc_sock *)0 &&
(nfsd_head_flag & NFSD_CHECKSLP) != 0) {
for (slp = nfssvc_sockhead.tqh_first; slp != 0;
slp = slp->ns_chain.tqe_next) {
@@ -510,7 +510,7 @@ nfssvc_nfsd(nsd, argp, p)
if (slp == 0)
nfsd_head_flag &= ~NFSD_CHECKSLP;
}
- if ((slp = nfsd->nfsd_slp) == NULL)
+ if ((slp = nfsd->nfsd_slp) == (struct nfssvc_sock *)0)
continue;
if (slp->ns_flag & SLP_VALID) {
if (slp->ns_flag & SLP_DISCONN)
@@ -518,7 +518,7 @@ nfssvc_nfsd(nsd, argp, p)
else if (slp->ns_flag & SLP_NEEDQ) {
slp->ns_flag &= ~SLP_NEEDQ;
(void) nfs_sndlock(&slp->ns_solock,
- NULL);
+ (struct nfsreq *)0);
nfsrv_rcv(slp->ns_so, (caddr_t)slp,
M_WAIT);
nfs_sndunlock(&slp->ns_solock);
@@ -544,7 +544,7 @@ nfssvc_nfsd(nsd, argp, p)
free((caddr_t)nd, M_NFSRVDESC);
nd = NULL;
}
- nfsd->nfsd_slp = (struct nfssvc_sock *)NULL;
+ nfsd->nfsd_slp = (struct nfssvc_sock *)0;
nfsd->nfsd_flag &= ~NFSD_REQINPROG;
nfsrv_slpderef(slp);
continue;
@@ -555,7 +555,7 @@ nfssvc_nfsd(nsd, argp, p)
if (so->so_proto->pr_flags & PR_CONNREQUIRED)
solockp = &slp->ns_solock;
else
- solockp = (int *)NULL;
+ solockp = (int *)0;
if (nd) {
nd->nd_starttime = time;
if (nd->nd_nam2)
@@ -636,7 +636,7 @@ nfssvc_nfsd(nsd, argp, p)
}
nfsstats.srvrpccnt[nd->nd_procnum]++;
nfsrv_updatecache(nd, TRUE, mreq);
- nd->nd_mrep = (struct mbuf *)NULL;
+ nd->nd_mrep = (struct mbuf *)0;
case RC_REPLY:
m = mreq;
siz = 0;
@@ -650,7 +650,7 @@ nfssvc_nfsd(nsd, argp, p)
}
m = mreq;
m->m_pkthdr.len = siz;
- m->m_pkthdr.rcvif = (struct ifnet *)NULL;
+ m->m_pkthdr.rcvif = (struct ifnet *)0;
/*
* For stream protocols, prepend a Sun RPC
* Record Mark.
@@ -660,7 +660,7 @@ nfssvc_nfsd(nsd, argp, p)
*mtod(m, u_int32_t *) = htonl(0x80000000 | siz);
}
if (solockp)
- (void) nfs_sndlock(solockp, (struct nfsreq *)NULL);
+ (void) nfs_sndlock(solockp, (struct nfsreq *)0);
if (slp->ns_flag & SLP_VALID)
error = nfs_send(so, nd->nd_nam2, m, NULL);
else {
@@ -722,7 +722,7 @@ done:
TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain);
splx(s);
free((caddr_t)nfsd, M_NFSD);
- nsd->nsd_nfsd = (struct nfsd *)NULL;
+ nsd->nsd_nfsd = (struct nfsd *)0;
if (--nfs_numnfsd == 0)
nfsrv_init(TRUE); /* Reinitialize everything */
return (error);
@@ -749,11 +749,11 @@ nfsrv_zapsock(slp)
slp->ns_flag &= ~SLP_ALLFLAGS;
fp = slp->ns_fp;
if (fp) {
- slp->ns_fp = (struct file *)NULL;
+ slp->ns_fp = (struct file *)0;
so = slp->ns_so;
so->so_upcall = NULL;
soshutdown(so, 2);
- closef(fp, (struct proc *)NULL);
+ closef(fp, (struct proc *)0);
if (slp->ns_nam)
MFREE(slp->ns_nam, m);
m_freem(slp->ns_raw);
@@ -917,7 +917,7 @@ nfssvc_iod(p)
/* Take one off the front of the list */
TAILQ_REMOVE(&nfs_bufq, bp, b_freelist);
if (bp->b_flags & B_READ)
- (void) nfs_doio(bp, bp->b_rcred, (struct proc *)NULL);
+ (void) nfs_doio(bp, bp->b_rcred, (struct proc *)0);
else do {
/*
* Look for a delayed write for the same vnode, so I can do
@@ -946,7 +946,7 @@ nfssvc_iod(p)
reassignbuf(nbp, nbp->b_vp);
nbp->b_vp->v_numoutput++;
}
- (void) nfs_doio(bp, bp->b_wcred, (struct proc *)NULL);
+ (void) nfs_doio(bp, bp->b_wcred, (struct proc *)0);
} while ((bp = nbp) != NULL);
}
if (error) {
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index eb8f13e9b62..2a70e192865 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.7 1996/04/17 04:50:34 mickey Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.8 1996/04/21 22:30:34 deraadt Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46 1996/03/24 23:58:10 fvdl Exp $ */
/*
@@ -546,7 +546,7 @@ nfs_decode_args(nmp, argp)
if (nmp->nm_so && adjsock) {
nfs_disconnect(nmp);
if (nmp->nm_sotype == SOCK_DGRAM)
- while (nfs_connect(nmp, (struct nfsreq *)NULL)) {
+ while (nfs_connect(nmp, (struct nfsreq *)0)) {
printf("nfs_args: retrying connect\n");
(void) tsleep((caddr_t)&lbolt,
PSOCK, "nfscon", 0);
@@ -689,7 +689,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
* the first request, in case the server is not responding.
*/
if (nmp->nm_sotype == SOCK_DGRAM &&
- (error = nfs_connect(nmp, (struct nfsreq *)NULL)))
+ (error = nfs_connect(nmp, (struct nfsreq *)0)))
goto bad;
/*
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 */
diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h
index 883bdcb2459..6e4d2a77b1a 100644
--- a/sys/nfs/nfsm_subs.h
+++ b/sys/nfs/nfsm_subs.h
@@ -1,4 +1,3 @@
-/* $OpenBSD: nfsm_subs.h,v 1.5 1996/04/17 04:50:38 mickey Exp $ */
/* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */
/*
@@ -169,7 +168,7 @@
nfsm_adv(NFSX_V3FATTR); \
} \
if (f) \
- nfsm_loadattr((v), (struct vattr *)NULL); \
+ nfsm_loadattr((v), (struct vattr *)0); \
}
#define nfsm_getfh(f, s, v3) \
@@ -199,7 +198,7 @@
nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); \
if (((f) = fxdr_unsigned(int, *tl)) != 0) { \
if ((t1 = nfs_loadattrcache(&ttvp, &md, &dpos, \
- (struct vattr *)NULL)) != 0) { \
+ (struct vattr *)0)) != 0) { \
error = t1; \
(f) = 0; \
m_freem(mrep); \