summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/nfs/krpc.h1
-rw-r--r--sys/nfs/krpc_subr.c1
-rw-r--r--sys/nfs/nfs.h2
-rw-r--r--sys/nfs/nfs_bio.c20
-rw-r--r--sys/nfs/nfs_node.c8
-rw-r--r--sys/nfs/nfs_nqlease.c48
-rw-r--r--sys/nfs/nfs_serv.c70
-rw-r--r--sys/nfs/nfs_socket.c69
-rw-r--r--sys/nfs/nfs_srvcache.c4
-rw-r--r--sys/nfs/nfs_subs.c25
-rw-r--r--sys/nfs/nfs_syscalls.c40
-rw-r--r--sys/nfs/nfs_vfsops.c11
-rw-r--r--sys/nfs/nfs_vnops.c55
-rw-r--r--sys/nfs/nfsdiskless.h8
-rw-r--r--sys/nfs/nfsm_subs.h6
-rw-r--r--sys/nfs/nfsproto.h1
-rw-r--r--sys/nfs/nfsrtt.h1
-rw-r--r--sys/nfs/nfsrvcache.h1
-rw-r--r--sys/nfs/nfsv2.h1
-rw-r--r--sys/nfs/nqnfs.h1
-rw-r--r--sys/nfs/rpcv2.h1
-rw-r--r--sys/nfs/swapnfs.c1
22 files changed, 190 insertions, 185 deletions
diff --git a/sys/nfs/krpc.h b/sys/nfs/krpc.h
index dbd251b825d..423367426ef 100644
--- a/sys/nfs/krpc.h
+++ b/sys/nfs/krpc.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: krpc.h,v 1.3 1996/04/17 04:50:21 mickey Exp $ */
/* $NetBSD: krpc.h,v 1.4 1995/12/19 23:07:11 cgd Exp $ */
#include <sys/cdefs.h>
diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c
index b321ee44a46..87c48056056 100644
--- a/sys/nfs/krpc_subr.c
+++ b/sys/nfs/krpc_subr.c
@@ -1,3 +1,4 @@
+/* $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 $ */
/*
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index 61ae3432d85..3c36b931653 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,4 +1,6 @@
+/* $OpenBSD: nfs.h,v 1.4 1996/04/17 04:50:23 mickey Exp $ */
/* $NetBSD: nfs.h,v 1.10 1996/02/18 11:53:38 fvdl Exp $ */
+
/*
* Copyright (c) 1989, 1993, 1995
* The Regents of the University of California. All rights reserved.
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index 297ec531ab9..a40c48454c5 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.4 1996/03/31 13:15:32 mickey Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.5 1996/04/17 04:50:24 mickey Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25 1996/02/29 20:26:16 fvdl Exp $ */
/*
@@ -191,7 +191,7 @@ nfs_bioread(vp, uio, ioflag, cred)
vp->v_type);
};
}
- baddr = (caddr_t)0;
+ baddr = NULL;
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 *)0;
+ bp->b_proc = (struct proc *)NULL;
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 == (struct buf *)0) {
- if (nfs_sigintr(nmp, (struct nfsreq *)0, p))
- return ((struct buf *)0);
+ while (bp == NULL) {
+ if (nfs_sigintr(nmp, (struct nfsreq *)NULL, p))
+ return ((struct buf *)NULL);
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 *)0, p))
+ if (error && intrflg && nfs_sigintr(nmp, (struct nfsreq *)NULL, 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 *)0, p)) {
+ if (intrflg && nfs_sigintr(nmp, (struct nfsreq *)NULL, 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 *)0;
+ nfs_iodwant[i] = (struct proc *)NULL;
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)0;
+ uiop->uio_offset = (off_t)NULL;
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 3431867fdfa..15af282b536 100644
--- a/sys/nfs/nfs_node.c
+++ b/sys/nfs/nfs_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_node.c,v 1.4 1996/03/31 13:15:36 mickey Exp $ */
+/* $OpenBSD: nfs_node.c,v 1.5 1996/04/17 04:50:25 mickey 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 = (struct sillyrename *)0;
- np->n_sillyrename = (struct sillyrename *)0;
+ sp = NULL;
+ np->n_sillyrename = NULL;
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 = (void *)0;
+ vp->v_data = NULL;
return (0);
}
diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c
index ef628160a12..a3ed2b6dba4 100644
--- a/sys/nfs/nfs_nqlease.c
+++ b/sys/nfs/nfs_nqlease.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_nqlease.c,v 1.4 1996/03/31 13:15:38 mickey Exp $ */
+/* $OpenBSD: nfs_nqlease.c,v 1.5 1996/04/17 04:50:26 mickey 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 == 0) {
+ if (tlp == NULL) {
/*
* 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 != 0) {
+ if (lp != NULL) {
if ((lp->lc_flag & LC_NONCACHABLE) ||
- (lp->lc_morehosts == (struct nqm *)0 &&
+ (lp->lc_morehosts == NULL &&
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 *)0, &cache, &frev, ap->a_cred);
+ NQLOCALSLP, ap->a_p, (struct mbuf *)NULL, &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 != 0)
+ if (lp->lc_timer.cqe_next != NULL)
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 *)0;
+ nam2 = (struct mbuf *)NULL;
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 *)0;
- nfsm_reqhead((struct vnode *)0, NQNFSPROC_EVICTED,
+ solockp = (int *)NULL;
+ nfsm_reqhead((struct vnode *)NULL, 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, (char *)0,
- 0, (char *)0, mreq, siz, &mheadend, &xid);
+ RPCAUTH_UNIX, 5 * NFSX_UNSIGNED, NULL,
+ 0, NULL, 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 *)0);
+ (struct nfsreq *)NULL);
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 *)0;
+ lp->lc_vp->v_lease = (struct nqlease *)NULL;
lph = &lp->lc_host;
lphnext = lp->lc_morehosts;
- olphnext = (struct nqm *)0;
+ olphnext = (struct nqm *)NULL;
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 *)0;
+ olphnext = (struct nqm *)NULL;
}
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 = (struct nqlease *)0;
+ struct nqlease *tlp = NULL;
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 != 0) {
+ if (tlp != NULL) {
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 *)0);
+ nfsm_loadattr(vp, (struct vattr *)NULL);
} 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, (char *)0,
- 0, (char *)0, mreq, i, &mheadend, &xid);
+ RPCAUTH_UNIX, 5 * NFSX_UNSIGNED, NULL,
+ 0, NULL, 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 *)0);
+ (void) nfs_sndlock(&nmp->nm_flag, (struct nfsreq *)NULL);
(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 = (struct mbuf **)0, *mb, *mreq;
+ struct mbuf **mrq = NULL, *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 *)0;
- myrep.r_procp = (struct proc *)0;
+ myrep.r_mrep = (struct mbuf *)NULL;
+ myrep.r_procp = (struct proc *)NULL;
(void) nfs_reply(&myrep);
}
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 88115b259ae..0bfad995359 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_serv.c,v 1.4 1996/03/31 13:15:41 mickey Exp $ */
+/* $OpenBSD: nfs_serv.c,v 1.5 1996/04/17 04:50:27 mickey 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 *)0);
+ nfsm_srvpostop_attr(1, (struct vattr *)NULL);
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 *)0;
+ uiop->uio_procp = (struct proc *)NULL;
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 *)0);
+ nfsm_srvpostop_attr(1, (struct vattr *)NULL);
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 *)0);
+ nfsm_srvpostop_attr(1, (struct vattr *)NULL);
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 *)0;
+ uiop->uio_procp = (struct proc *)NULL;
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 *)0;
+ uiop->uio_procp = (struct proc *)NULL;
uiop->uio_offset = nfsd->nd_off;
uiop->uio_resid = nfsd->nd_eoff - nfsd->nd_off;
if (uiop->uio_resid > 0) {
@@ -1235,7 +1235,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
register int32_t t1;
caddr_t bpos;
int error = 0, cache, len, tsize, dirfor_ret = 1, diraft_ret = 1;
- int rdev = 0;
+ dev_t rdev = 0;
int v3 = (nfsd->nd_flag & ND_NFSV3), how, exclusive_flag = 0;
char *cp2;
struct mbuf *mb, *mb2, *mreq;
@@ -1260,7 +1260,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)0;
+ dirp = (struct vnode *)NULL;
}
}
if (error) {
@@ -1307,7 +1307,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
case VCHR:
case VBLK:
case VFIFO:
- rdev = fxdr_unsigned(int32_t, sp->sa_size);
+ rdev = (dev_t)fxdr_unsigned(int32_t, sp->sa_size);
break;
default:
break;
@@ -1339,8 +1339,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
va.va_type == VFIFO) {
if (va.va_type == VCHR && rdev == 0xffffffff)
va.va_type = VFIFO;
- error = suser(cred, (u_short *)0);
- if (error) {
+ if ((error = suser(cred, NULL)) != 0) {
vrele(nd.ni_startdir);
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -1473,7 +1472,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
enum vtype vtyp;
char *cp2;
struct mbuf *mb, *mb2, *mreq;
- struct vnode *vp, *dirp = (struct vnode *)0;
+ struct vnode *vp, *dirp = NULL;
nfsfh_t nfh;
fhandle_t *fhp;
u_quad_t frev;
@@ -1534,8 +1533,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
if (!error)
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
} else {
- error = suser(cred, (u_short *)0);
- if (error) {
+ if ((error = suser(cred, NULL)) != 0) {
vrele(nd.ni_startdir);
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
@@ -1621,15 +1619,12 @@ nfsrv_remove(nfsd, slp, procp, mrq)
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
- struct vnode *vp, *dirp;
+ struct vnode *vp = NULL, *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);
@@ -1648,7 +1643,7 @@ nfsrv_remove(nfsd, slp, procp, mrq)
if (!error) {
vp = nd.ni_vp;
if (vp->v_type == VDIR &&
- (error = suser(cred, (u_short *)0)) != 0)
+ (error = suser(cred, NULL)) != 0)
goto out;
/*
* The root of a mounted filesystem cannot be deleted.
@@ -1708,17 +1703,14 @@ nfsrv_rename(nfsd, slp, procp, mrq)
char *cp2;
struct mbuf *mb, *mreq;
struct nameidata fromnd, tond;
- struct vnode *fvp, *tvp, *tdvp, *fdirp = (struct vnode *)0;
- struct vnode *tdirp = (struct vnode *)0;
+ struct vnode *fvp = NULL, *tvp, *tdvp, *fdirp = NULL;
+ struct vnode *tdirp = NULL;
struct vattr fdirfor, fdiraft, tdirfor, tdiraft;
nfsfh_t fnfh, tnfh;
fhandle_t *ffhp, *tfhp;
u_quad_t frev;
uid_t saved_uid;
-#ifndef nolint
- fvp = (struct vnode *)0;
-#endif
ffhp = &fnfh.fh_generic;
tfhp = &tnfh.fh_generic;
fromnd.ni_cnd.cn_nameiop = 0;
@@ -1741,7 +1733,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
procp);
else {
vrele(fdirp);
- fdirp = (struct vnode *)0;
+ fdirp = (struct vnode *)NULL;
}
}
if (error) {
@@ -1767,7 +1759,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
procp);
else {
vrele(tdirp);
- tdirp = (struct vnode *)0;
+ tdirp = (struct vnode *)NULL;
}
}
if (error) {
@@ -1912,7 +1904,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 = (struct vnode *)0;
+ struct vnode *vp, *xp, *dirp = NULL;
struct vattr dirfor, diraft, at;
nfsfh_t nfh, dnfh;
fhandle_t *fhp, *dfhp;
@@ -1931,7 +1923,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, (u_short *)0)) != 0)
+ if (vp->v_type == VDIR && (error = suser(cred, NULL)) != 0)
goto out1;
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameiop = CREATE;
@@ -1944,7 +1936,7 @@ nfsrv_link(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)0;
+ dirp = (struct vnode *)NULL;
}
}
if (error)
@@ -2013,7 +2005,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 = (struct vnode *)0;
+ struct vnode *dirp = NULL;
nfsfh_t nfh;
fhandle_t *fhp;
u_quad_t frev;
@@ -2033,7 +2025,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)0;
+ dirp = (struct vnode *)NULL;
}
}
if (error)
@@ -2051,7 +2043,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 *)0;
+ io.uio_procp = (struct proc *)NULL;
nfsm_mtouio(&io, len2);
if (!v3) {
nfsm_dissect(sp, struct nfsv2_sattr *, NFSX_V2SATTR);
@@ -2155,7 +2147,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 = (struct vnode *)0;
+ struct vnode *vp, *dirp = NULL;
nfsfh_t nfh;
fhandle_t *fhp;
u_quad_t frev;
@@ -2174,7 +2166,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)0;
+ dirp = (struct vnode *)NULL;
}
}
if (error) {
@@ -2266,7 +2258,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 *)0;
+ struct vnode *vp, *dirp = (struct vnode *)NULL;
struct vattr dirfor, diraft;
nfsfh_t nfh;
fhandle_t *fhp;
@@ -2287,7 +2279,7 @@ nfsrv_rmdir(nfsd, slp, procp, mrq)
procp);
else {
vrele(dirp);
- dirp = (struct vnode *)0;
+ dirp = (struct vnode *)NULL;
}
}
if (error) {
@@ -2474,7 +2466,7 @@ again:
io.uio_resid = fullsiz;
io.uio_segflg = UIO_SYSSPACE;
io.uio_rw = UIO_READ;
- io.uio_procp = (struct proc *)0;
+ io.uio_procp = (struct proc *)NULL;
eofflag = 0;
#ifdef Lite2_integrated
VOP_LOCK(vp, 0, procp);
@@ -2743,7 +2735,7 @@ again:
io.uio_resid = fullsiz;
io.uio_segflg = UIO_SYSSPACE;
io.uio_rw = UIO_READ;
- io.uio_procp = (struct proc *)0;
+ io.uio_procp = (struct proc *)NULL;
eofflag = 0;
#ifdef Lite2_integrated
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index bd01a9830a3..a21236d1a87 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.4 1996/03/31 13:15:47 mickey Exp $ */
+/* $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 $ */
/*
@@ -154,7 +154,7 @@ nfs_connect(nmp, rep)
struct mbuf *m;
u_int16_t tport;
- nmp->nm_so = (struct socket *)0;
+ nmp->nm_so = (struct socket *)NULL;
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 *)0;
+ nmp->nm_so = (struct socket *)NULL;
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 *)0;
+ sendnam = (struct mbuf *)NULL;
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 *)0, top,
- (struct mbuf *)0, flags);
+ error = sosend(so, sendnam, (struct uio *)NULL, top,
+ (struct mbuf *)NULL, 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 *)0;
- *aname = (struct mbuf *)0;
+ *mp = (struct mbuf *)NULL;
+ *aname = (struct mbuf *)NULL;
sotype = rep->r_nmp->nm_sotype;
/*
@@ -495,8 +495,8 @@ tryagain:
auio.uio_procp = p;
do {
rcvflg = MSG_WAITALL;
- error = soreceive(so, (struct mbuf **)0, &auio,
- (struct mbuf **)0, (struct mbuf **)0, &rcvflg);
+ error = soreceive(so, (struct mbuf **)NULL, &auio,
+ (struct mbuf **)NULL, (struct mbuf **)NULL, &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 **)0,
- &auio, mp, (struct mbuf **)0, &rcvflg);
+ error = soreceive(so, (struct mbuf **)NULL,
+ &auio, mp, (struct mbuf **)NULL, &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 **)0,
+ error = soreceive(so, (struct mbuf **)NULL,
&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 *)0;
+ *mp = (struct mbuf *)NULL;
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 **)0;
+ getnam = (struct mbuf **)NULL;
else
getnam = aname;
auio.uio_resid = len = 1000000;
@@ -595,7 +595,7 @@ errout:
do {
rcvflg = 0;
error = soreceive(so, getnam, &auio, mp,
- (struct mbuf **)0, &rcvflg);
+ (struct mbuf **)NULL, &rcvflg);
if (error == EWOULDBLOCK &&
(rep->r_flags & R_SOFTTERM))
return (EINTR);
@@ -604,7 +604,7 @@ errout:
}
if (error) {
m_freem(*mp);
- *mp = (struct mbuf *)0;
+ *mp = (struct mbuf *)NULL;
}
/*
* 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 *)0;
+ verf_str = auth_str = (char *)NULL;
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 *)0;
+ mheadend->m_next = (struct mbuf *)NULL;
m_freem(mrep);
m_freem(rep->r_mreq);
goto kerbauth;
@@ -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 *)0, (struct mbuf *)0);
+ (struct mbuf *)NULL, (struct mbuf *)NULL);
else
error = (*so->so_proto->pr_usrreq)(so, PRU_SEND, m,
- nmp->nm_nam, (struct mbuf *)0);
+ nmp->nm_nam, (struct mbuf *)NULL);
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, (void *)0, nfs_ticks);
+ timeout(nfs_timer, NULL, nfs_ticks);
}
/*
@@ -1396,7 +1396,7 @@ nfs_sndlock(flagp, rep)
if (rep->r_nmp->nm_flag & NFSMNT_INT)
slpflag = PCATCH;
} else
- p = (struct proc *)0;
+ p = (struct proc *)NULL;
while (*flagp & NFSMNT_SNDLOCK) {
if (nfs_sigintr(rep->r_nmp, rep, p))
return (EINTR);
@@ -1899,8 +1899,9 @@ nfsrv_rcv(so, arg, waitflag)
*/
auio.uio_resid = 1000000000;
flags = MSG_DONTWAIT;
- error = soreceive(so, &nam, &auio, &mp, (struct mbuf **)0, &flags);
- if (error || mp == (struct mbuf *)0) {
+ error = soreceive(so, &nam, &auio, &mp,
+ (struct mbuf **)NULL, &flags);
+ if (error || mp == NULL) {
if (error == EWOULDBLOCK)
slp->ns_flag |= SLP_NEEDQ;
else
@@ -1934,7 +1935,7 @@ nfsrv_rcv(so, arg, waitflag)
auio.uio_resid = 1000000000;
flags = MSG_DONTWAIT;
error = soreceive(so, &nam, &auio, &mp,
- (struct mbuf **)0, &flags);
+ (struct mbuf **)NULL, &flags);
if (mp) {
nfs_realign(mp, 10 * NFSX_UNSIGNED);
if (nam) {
@@ -1947,7 +1948,7 @@ nfsrv_rcv(so, arg, waitflag)
else
slp->ns_rec = m;
slp->ns_recend = m;
- m->m_nextpkt = (struct mbuf *)0;
+ m->m_nextpkt = (struct mbuf *)NULL;
}
if (error) {
if ((so->so_proto->pr_flags & PR_CONNREQUIRED)
@@ -2029,12 +2030,12 @@ nfsrv_getstream(slp, waitflag)
*/
if (slp->ns_cc == slp->ns_reclen) {
recm = slp->ns_raw;
- slp->ns_raw = slp->ns_rawend = (struct mbuf *)0;
+ slp->ns_raw = slp->ns_rawend = (struct mbuf *)NULL;
slp->ns_cc = slp->ns_reclen = 0;
} else if (slp->ns_cc > slp->ns_reclen) {
len = 0;
m = slp->ns_raw;
- om = (struct mbuf *)0;
+ om = (struct mbuf *)NULL;
while (len < slp->ns_reclen) {
if ((len + m->m_len) > slp->ns_reclen) {
m2 = m_copym(m, 0, slp->ns_reclen - len,
@@ -2057,7 +2058,7 @@ nfsrv_getstream(slp, waitflag)
len += m->m_len;
m = m->m_next;
recm = slp->ns_raw;
- om->m_next = (struct mbuf *)0;
+ om->m_next = (struct mbuf *)NULL;
} else {
om = m;
len += m->m_len;
@@ -2086,7 +2087,7 @@ nfsrv_getstream(slp, waitflag)
else
slp->ns_rec = slp->ns_frag;
slp->ns_recend = slp->ns_frag;
- slp->ns_frag = (struct mbuf *)0;
+ slp->ns_frag = (struct mbuf *)NULL;
}
}
}
@@ -2106,13 +2107,13 @@ nfsrv_dorec(slp, nfsd, ndp)
*ndp = NULL;
if ((slp->ns_flag & SLP_VALID) == 0 ||
- (m = slp->ns_rec) == (struct mbuf *)0)
+ (m = slp->ns_rec) == NULL)
return (ENOBUFS);
slp->ns_rec = m->m_nextpkt;
if (slp->ns_rec)
- m->m_nextpkt = (struct mbuf *)0;
+ m->m_nextpkt = (struct mbuf *)NULL;
else
- slp->ns_recend = (struct mbuf *)0;
+ slp->ns_recend = (struct mbuf *)NULL;
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 0da62453b67..16e0d630fd2 100644
--- a/sys/nfs/nfs_srvcache.c
+++ b/sys/nfs/nfs_srvcache.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_srvcache.c,v 1.3 1996/03/31 13:15:50 mickey Exp $ */
+/* $OpenBSD: nfs_srvcache.c,v 1.4 1996/04/17 04:50:30 mickey 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 *)0, repp, &mb, &bpos);
+ 0, (u_quad_t *)NULL, 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 edc395c5bd7..2ce960fbb44 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.5 1996/03/31 13:15:53 mickey Exp $ */
+/* $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 $ */
/*
@@ -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 *)0;
+ mreq->m_pkthdr.rcvif = (struct ifnet *)NULL;
*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 *)0;
+ nfs_iodwant[i] = (struct proc *)NULL;
TAILQ_INIT(&nfs_bufq);
nfs_nhinit(); /* Init the nfsnode table */
#endif /* NFSCLIENT */
@@ -1364,7 +1364,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 *)0;
+ *retdirp = (struct vnode *)NULL;
MALLOC(cnp->cn_pnbuf, char *, len + 1, M_NAMEI, M_WAITOK);
/*
* Copy the name from the mbuf list to ndp->ni_pnbuf
@@ -1374,6 +1374,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag)
tocp = cnp->cn_pnbuf;
md = *mdp;
rem = mtod(md, caddr_t) + md->m_len - fromcp;
+ cnp->cn_hash = 0;
for (i = 0; i < len; i++) {
while (rem == 0) {
md = md->m_next;
@@ -1388,6 +1389,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag)
error = EACCES;
goto out;
}
+ cnp->cn_hash += (u_char)*fromcp;
*tocp++ = *fromcp++;
rem--;
}
@@ -1426,8 +1428,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag)
* And call lookup() to do the real work
*/
cnp->cn_proc = p;
- error = lookup(ndp);
- if (error)
+ if ((error = lookup(ndp)) != 0)
goto out;
/*
* Check for encountering a symbolic link
@@ -1479,7 +1480,7 @@ nfsm_adj(mp, len, nul)
m = mp;
for (;;) {
count += m->m_len;
- if (m->m_next == (struct mbuf *)0)
+ if (m->m_next == (struct mbuf *)NULL)
break;
m = m->m_next;
}
@@ -1645,7 +1646,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
struct ucred *credanon;
int error, exflags;
- *vpp = (struct vnode *)0;
+ *vpp = (struct vnode *)NULL;
#ifdef Lite2_integrated
mp = vfs_getvfs(&fhp->fh_fsid);
#else
@@ -1761,14 +1762,14 @@ nfs_getcookie(np, off, add)
dp->ndm_eocookie = 0;
LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list);
} else
- return ((nfsuint64 *)0);
+ return ((nfsuint64 *)NULL);
}
while (pos >= NFSNUMCOOKIES) {
pos -= NFSNUMCOOKIES;
if (dp->ndm_list.le_next) {
if (!add && dp->ndm_eocookie < NFSNUMCOOKIES &&
pos >= dp->ndm_eocookie)
- return ((nfsuint64 *)0);
+ return ((nfsuint64 *)NULL);
dp = dp->ndm_list.le_next;
} else if (add) {
MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap),
@@ -1777,13 +1778,13 @@ nfs_getcookie(np, off, add)
LIST_INSERT_AFTER(dp, dp2, ndm_list);
dp = dp2;
} else
- return ((nfsuint64 *)0);
+ return ((nfsuint64 *)NULL);
}
if (pos >= dp->ndm_eocookie) {
if (add)
dp->ndm_eocookie = pos + 1;
else
- return ((nfsuint64 *)0);
+ return ((nfsuint64 *)NULL);
}
return (&dp->ndm_cookies[pos]);
}
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index a7b9088f6c8..410d85b385f 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_syscalls.c,v 1.4 1996/03/31 13:15:56 mickey Exp $ */
+/* $OpenBSD: nfs_syscalls.c,v 1.5 1996/04/17 04:50:33 mickey 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 *)0;
+ nam = (struct mbuf *)NULL;
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 *)0;
+ nuidp = (struct nfsuid *)NULL;
if ((slp->ns_flag & SLP_VALID) == 0) {
if (nuidp)
free((caddr_t)nuidp, M_NFSUID);
} else {
- if (nuidp == (struct nfsuid *)0) {
+ if (nuidp == NULL) {
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 *)0;
+ tslp = (struct nfssvc_sock *)NULL;
/*
* Add it to the list, as required.
*/
@@ -472,7 +472,7 @@ nfssvc_nfsd(nsd, argp, p)
writes_todo = 0;
#endif
s = splsoftnet();
- if (nfsd == (struct nfsd *)0) {
+ if (nfsd == NULL) {
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 == (struct nfssvc_sock *)0 &&
+ while (nfsd->nfsd_slp == NULL &&
(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 == (struct nfssvc_sock *)0 &&
+ if (nfsd->nfsd_slp == NULL &&
(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) == (struct nfssvc_sock *)0)
+ if ((slp = nfsd->nfsd_slp) == NULL)
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,
- (struct nfsreq *)0);
+ NULL);
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 *)0;
+ nfsd->nfsd_slp = (struct nfssvc_sock *)NULL;
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 *)0;
+ solockp = (int *)NULL;
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 *)0;
+ nd->nd_mrep = (struct mbuf *)NULL;
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 *)0;
+ m->m_pkthdr.rcvif = (struct ifnet *)NULL;
/*
* 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 *)0);
+ (void) nfs_sndlock(solockp, (struct nfsreq *)NULL);
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 *)0;
+ nsd->nsd_nfsd = (struct nfsd *)NULL;
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 *)0;
+ slp->ns_fp = (struct file *)NULL;
so = slp->ns_so;
so->so_upcall = NULL;
soshutdown(so, 2);
- closef(fp, (struct proc *)0);
+ closef(fp, (struct proc *)NULL);
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 *)0);
+ (void) nfs_doio(bp, bp->b_rcred, (struct proc *)NULL);
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 *)0);
+ (void) nfs_doio(bp, bp->b_wcred, (struct proc *)NULL);
} while ((bp = nbp) != NULL);
}
if (error) {
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index 6f74f820909..eb8f13e9b62 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.6 1996/03/31 13:16:00 mickey Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.7 1996/04/17 04:50:34 mickey Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46 1996/03/24 23:58:10 fvdl Exp $ */
/*
@@ -117,7 +117,7 @@ nfs_statfs(mp, sbp, p)
struct proc *p;
{
register struct vnode *vp;
- register struct nfs_statfs *sfp;
+ register struct nfs_statfs *sfp = NULL;
register caddr_t cp;
register u_int32_t *tl;
register int32_t t1, t2;
@@ -129,9 +129,6 @@ nfs_statfs(mp, sbp, p)
struct nfsnode *np;
u_quad_t tquad;
-#ifndef nolint
- sfp = (struct nfs_statfs *)0;
-#endif
error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np);
if (error)
return (error);
@@ -549,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 *)0)) {
+ while (nfs_connect(nmp, (struct nfsreq *)NULL)) {
printf("nfs_args: retrying connect\n");
(void) tsleep((caddr_t)&lbolt,
PSOCK, "nfscon", 0);
@@ -692,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 *)0)))
+ (error = nfs_connect(nmp, (struct nfsreq *)NULL)))
goto bad;
/*
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 13e6c9a335c..08903b91418 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.5 1996/03/31 13:16:03 mickey Exp $ */
+/* $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 $ */
/*
@@ -587,6 +587,7 @@ 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:
@@ -610,12 +611,9 @@ nfs_setattr(v)
*/
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
- if (vap->va_size == 0)
- error = nfs_vinvalbuf(vp, 0,
+ error = nfs_vinvalbuf(vp,
+ ((vap->va_size == 0)? 0 : V_SAVE),
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);
tsize = np->n_size;
@@ -628,6 +626,7 @@ 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;
@@ -741,7 +740,7 @@ nfs_setattrrpc(vp, vap, cred, procp)
if (v3) {
nfsm_wcc_data(vp, wccflag);
} else
- nfsm_loadattr(vp, (struct vattr *)0);
+ nfsm_loadattr(vp, (struct vattr *)NULL);
nfsm_reqdone;
return (error);
}
@@ -858,7 +857,7 @@ nfs_lookup(v)
nfsm_postop_attr(newvp, attrflag);
nfsm_postop_attr(dvp, attrflag);
} else
- nfsm_loadattr(newvp, (struct vattr *)0);
+ nfsm_loadattr(newvp, (struct vattr *)NULL);
*vpp = newvp;
m_freem(mrep);
cnp->cn_flags |= SAVENAME;
@@ -880,7 +879,7 @@ nfs_lookup(v)
nfsm_postop_attr(newvp, attrflag);
nfsm_postop_attr(dvp, attrflag);
} else
- nfsm_loadattr(newvp, (struct vattr *)0);
+ nfsm_loadattr(newvp, (struct vattr *)NULL);
if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))
cnp->cn_flags |= SAVENAME;
if ((cnp->cn_flags & MAKEENTRY) &&
@@ -1028,7 +1027,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 *)0);
+ nfsm_loadattr(vp, (struct vattr *)NULL);
nfsm_strsiz(retlen, nmp->nm_rsize);
nfsm_mtouio(uiop, retlen);
m_freem(mrep);
@@ -1139,7 +1138,7 @@ nfs_writerpc(vp, uiop, cred, iomode, must_commit)
}
}
} else
- nfsm_loadattr(vp, (struct vattr *)0);
+ nfsm_loadattr(vp, (struct vattr *)NULL);
if (wccflag)
VTONFS(vp)->n_mtime = VTONFS(vp)->n_vattr.va_mtime.tv_sec;
m_freem(mrep);
@@ -1169,7 +1168,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
register u_int32_t *tl;
register caddr_t cp;
register int32_t t1, t2;
- struct vnode *newvp = (struct vnode *)0;
+ struct vnode *newvp = NULL;
struct nfsnode *np;
char *cp2;
caddr_t bpos, dpos;
@@ -1217,7 +1216,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
if (!gotvp) {
if (newvp) {
vrele(newvp);
- newvp = (struct vnode *)0;
+ newvp = (struct vnode *)NULL;
}
error = nfs_lookitup(dvp, cnp->cn_nameptr,
cnp->cn_namelen, cnp->cn_cred, cnp->cn_proc, &np);
@@ -1290,8 +1289,8 @@ nfs_create(v)
register u_int32_t *tl;
register caddr_t cp;
register int32_t t1, t2;
- struct nfsnode *np = (struct nfsnode *)0;
- struct vnode *newvp = (struct vnode *)0;
+ struct nfsnode *np = NULL;
+ struct vnode *newvp = NULL;
caddr_t bpos, dpos, cp2;
int error = 0, wccflag = NFSV3_WCCRATTR, gotvp = 0, fmode = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
@@ -1344,7 +1343,7 @@ again:
if (!gotvp) {
if (newvp) {
vrele(newvp);
- newvp = (struct vnode *)0;
+ newvp = (struct vnode *)NULL;
}
error = nfs_lookitup(dvp, cnp->cn_nameptr,
cnp->cn_namelen, cnp->cn_cred, cnp->cn_proc, &np);
@@ -1457,7 +1456,7 @@ nfs_removeit(sp)
{
return (nfs_removerpc(sp->s_dvp, sp->s_name, sp->s_namlen, sp->s_cred,
- (struct proc *)0));
+ (struct proc *)NULL));
}
/*
@@ -1715,7 +1714,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 = (struct vnode *)0;
+ struct vnode *newvp = NULL;
int v3 = NFS_ISV3(dvp);
nfsstats.rpccnt[NFSPROC_SYMLINK]++;
@@ -1782,8 +1781,8 @@ nfs_mkdir(v)
register caddr_t cp;
register int32_t t1, t2;
register int len;
- struct nfsnode *np = (struct nfsnode *)0;
- struct vnode *newvp = (struct vnode *)0;
+ struct nfsnode *np = NULL;
+ struct vnode *newvp = NULL;
caddr_t bpos, dpos, cp2;
int error = 0, wccflag = NFSV3_WCCRATTR;
int gotvp = 0;
@@ -1824,7 +1823,7 @@ nfs_mkdir(v)
if (error == EEXIST || (!error && !gotvp)) {
if (newvp) {
vrele(newvp);
- newvp = (struct vnode *)0;
+ newvp = (struct vnode *)NULL;
}
error = nfs_lookitup(dvp, cnp->cn_nameptr, len, cnp->cn_cred,
cnp->cn_proc, &np);
@@ -2330,7 +2329,7 @@ nfs_readdirplusrpc(vp, uiop, cred)
dpos = dpossav1;
mdsav2 = md;
md = mdsav1;
- nfsm_loadattr(newvp, (struct vattr *)0);
+ nfsm_loadattr(newvp, (struct vattr *)NULL);
dpos = dpossav2;
md = mdsav2;
dp->d_type =
@@ -2438,7 +2437,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 **)0) == 0) {
+ cnp->cn_proc, (struct nfsnode **)NULL) == 0) {
sp->s_name[4]++;
if (sp->s_name[4] > 'z') {
error = EINVAL;
@@ -2479,7 +2478,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 = (struct vnode *)0;
+ struct vnode *newvp = NULL;
struct nfsnode *np, *dnp = VTONFS(dvp);
caddr_t bpos, dpos, cp2;
int error = 0, fhlen, attrflag;
@@ -2524,7 +2523,7 @@ nfs_lookitup(dvp, name, len, cred, procp, npp)
return (ENOENT);
}
} else
- nfsm_loadattr(newvp, (struct vattr *)0);
+ nfsm_loadattr(newvp, (struct vattr *)NULL);
}
nfsm_reqdone;
if (npp && *npp == NULL) {
@@ -2628,7 +2627,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 *)0;
+ p = (struct proc *)NULL;
else
p = curproc; /* XXX */
if (bp->b_flags & B_READ)
@@ -2827,7 +2826,7 @@ loop:
"nfsfsync", slptimeo);
splx(s);
if (error) {
- if (nfs_sigintr(nmp, (struct nfsreq *)0, p))
+ if (nfs_sigintr(nmp, (struct nfsreq *)NULL, p))
return (EINTR);
if (slpflag == PCATCH) {
slpflag = 0;
@@ -2860,7 +2859,7 @@ loop:
error = tsleep((caddr_t)&vp->v_numoutput,
slpflag | (PRIBIO + 1), "nfsfsync", slptimeo);
if (error) {
- if (nfs_sigintr(nmp, (struct nfsreq *)0, p))
+ if (nfs_sigintr(nmp, (struct nfsreq *)NULL, p))
return (EINTR);
if (slpflag == PCATCH) {
slpflag = 0;
diff --git a/sys/nfs/nfsdiskless.h b/sys/nfs/nfsdiskless.h
index 4ab41fecaf2..ff8bae1309a 100644
--- a/sys/nfs/nfsdiskless.h
+++ b/sys/nfs/nfsdiskless.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsdiskless.h,v 1.3 1996/03/31 13:16:07 mickey Exp $ */
+/* $OpenBSD: nfsdiskless.h,v 1.4 1996/04/17 04:50:37 mickey Exp $ */
/* $NetBSD: nfsdiskless.h,v 1.9 1996/02/18 11:54:00 fvdl Exp $ */
/*
@@ -36,9 +36,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfsdiskless.h 8.1 (Berkeley) 6/10/93
+ * @(#)nfsdiskless.h 8.2 (Berkeley) 3/30/95
*/
+#ifndef _NFS_DISKLESS_H_
+#define _NFS_DISKLESS_H_
+
/*
* Structure that must be initialized for a diskless nfs client.
* This structure is used by nfs_mountroot() to set up the root and swap
@@ -64,4 +67,5 @@ struct nfs_diskless {
int nfs_boot_init __P((struct nfs_diskless *nd, struct proc *procp));
void nfs_boot_getfh __P((struct sockaddr_in *bpsin, char *key,
struct nfs_dlmount *ndmntp));
+#endif _NFS_DISKLESS_H_
diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h
index 005374fa327..883bdcb2459 100644
--- a/sys/nfs/nfsm_subs.h
+++ b/sys/nfs/nfsm_subs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsm_subs.h,v 1.4 1996/03/31 13:16:09 mickey Exp $ */
+/* $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 +169,7 @@
nfsm_adv(NFSX_V3FATTR); \
} \
if (f) \
- nfsm_loadattr((v), (struct vattr *)0); \
+ nfsm_loadattr((v), (struct vattr *)NULL); \
}
#define nfsm_getfh(f, s, v3) \
@@ -199,7 +199,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 *)0)) != 0) { \
+ (struct vattr *)NULL)) != 0) { \
error = t1; \
(f) = 0; \
m_freem(mrep); \
diff --git a/sys/nfs/nfsproto.h b/sys/nfs/nfsproto.h
index eda087fe34d..2c22258ff93 100644
--- a/sys/nfs/nfsproto.h
+++ b/sys/nfs/nfsproto.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: nfsproto.h,v 1.2 1996/04/17 04:50:39 mickey Exp $ */
/* $NetBSD: nfsproto.h,v 1.1 1996/02/18 11:54:06 fvdl Exp $ */
/*
diff --git a/sys/nfs/nfsrtt.h b/sys/nfs/nfsrtt.h
index 6e2bd20d3a8..4d368d7307c 100644
--- a/sys/nfs/nfsrtt.h
+++ b/sys/nfs/nfsrtt.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: nfsrtt.h,v 1.4 1996/04/17 04:50:39 mickey Exp $ */
/* $NetBSD: nfsrtt.h,v 1.4 1996/02/18 11:54:07 fvdl Exp $ */
/*
diff --git a/sys/nfs/nfsrvcache.h b/sys/nfs/nfsrvcache.h
index dab859df4ff..29241af6635 100644
--- a/sys/nfs/nfsrvcache.h
+++ b/sys/nfs/nfsrvcache.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: nfsrvcache.h,v 1.4 1996/04/17 04:50:40 mickey Exp $ */
/* $NetBSD: nfsrvcache.h,v 1.10 1996/02/18 11:54:08 fvdl Exp $ */
/*
diff --git a/sys/nfs/nfsv2.h b/sys/nfs/nfsv2.h
index a9e8eb9e276..542628fc709 100644
--- a/sys/nfs/nfsv2.h
+++ b/sys/nfs/nfsv2.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: nfsv2.h,v 1.3 1996/04/17 04:50:41 mickey Exp $ */
/* $NetBSD: nfsv2.h,v 1.10 1995/12/19 23:08:15 cgd Exp $ */
/*
diff --git a/sys/nfs/nqnfs.h b/sys/nfs/nqnfs.h
index aa91fa3f768..4764c32bcd2 100644
--- a/sys/nfs/nqnfs.h
+++ b/sys/nfs/nqnfs.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: nqnfs.h,v 1.4 1996/04/17 04:50:42 mickey Exp $ */
/* $NetBSD: nqnfs.h,v 1.6 1996/02/18 11:54:10 fvdl Exp $ */
/*
diff --git a/sys/nfs/rpcv2.h b/sys/nfs/rpcv2.h
index 6c8c237eff3..e78d184e7e0 100644
--- a/sys/nfs/rpcv2.h
+++ b/sys/nfs/rpcv2.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: rpcv2.h,v 1.4 1996/04/17 04:50:42 mickey Exp $ */
/* $NetBSD: rpcv2.h,v 1.8 1996/02/18 11:54:11 fvdl Exp $ */
/*
diff --git a/sys/nfs/swapnfs.c b/sys/nfs/swapnfs.c
index aea8c28d232..34f224c735c 100644
--- a/sys/nfs/swapnfs.c
+++ b/sys/nfs/swapnfs.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: swapnfs.c,v 1.2 1996/04/17 04:50:43 mickey Exp $ */
/* $NetBSD: swapnfs.c,v 1.9 1995/04/30 07:03:13 cgd Exp $ */
/*