Eliminate several uses of `curproc' from the socket-layer code and from NFS.

Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded  by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize.   Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.
This commit is contained in:
jonathan 2004-05-22 22:52:13 +00:00
parent 223d219efc
commit 230fb9b8ab
23 changed files with 194 additions and 164 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_net.c,v 1.35 2003/09/13 08:32:10 jdolecek Exp $ */
/* $NetBSD: svr4_net.c,v 1.36 2004/05/22 22:52:13 jonathan Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_net.c,v 1.35 2003/09/13 08:32:10 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_net.c,v 1.36 2004/05/22 22:52:13 jonathan Exp $");
#define COMPAT_SVR4 1
@ -203,7 +203,7 @@ svr4_netopen(dev, flag, mode, p)
if ((error = falloc(p, &fp, &fd)) != 0)
return error;
if ((error = socreate(family, &so, type, protocol)) != 0) {
if ((error = socreate(family, &so, type, protocol, p)) != 0) {
DPRINTF(("socreate error %d\n", error));
fdremove(p->p_fd, fd);
FILE_UNUSE(fp, NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_socket.c,v 1.39 2003/09/21 19:17:08 jdolecek Exp $ */
/* $NetBSD: sys_socket.c,v 1.40 2004/05/22 22:52:13 jonathan Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.39 2003/09/21 19:17:08 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.40 2004/05/22 22:52:13 jonathan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -79,7 +79,7 @@ soo_write(fp, offset, uio, cred, flags)
{
struct socket *so = (struct socket *) fp->f_data;
return ((*so->so_send)(so, (struct mbuf *)0,
uio, (struct mbuf *)0, (struct mbuf *)0, 0));
uio, (struct mbuf *)0, (struct mbuf *)0, 0, uio->uio_procp));
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_socket.c,v 1.101 2004/05/01 02:24:38 matt Exp $ */
/* $NetBSD: uipc_socket.c,v 1.102 2004/05/22 22:52:13 jonathan Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.101 2004/05/01 02:24:38 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.102 2004/05/22 22:52:13 jonathan Exp $");
#include "opt_sock_counters.h"
#include "opt_sosend_loan.h"
@ -407,6 +407,7 @@ sosend_loan(struct socket *so, struct uio *uio, struct mbuf *m, long space)
/* XXX KDASSERT */
KASSERT(npgs <= M_EXT_MAXPAGES);
KASSERT(uio->uio_procp != NULL);
lva = sokvaalloc(len, so);
if (lva == 0)
@ -450,14 +451,12 @@ sosend_loan(struct socket *so, struct uio *uio, struct mbuf *m, long space)
*/
/*ARGSUSED*/
int
socreate(int dom, struct socket **aso, int type, int proto)
socreate(int dom, struct socket **aso, int type, int proto, struct proc *p)
{
struct proc *p;
const struct protosw *prp;
struct socket *so;
int error, s;
p = curproc; /* XXX */
if (proto)
prp = pffindproto(dom, proto, type);
else
@ -650,12 +649,10 @@ soaccept(struct socket *so, struct mbuf *nam)
}
int
soconnect(struct socket *so, struct mbuf *nam)
soconnect(struct socket *so, struct mbuf *nam, struct proc *p)
{
struct proc *p;
int s, error;
p = curproc; /* XXX */
if (so->so_options & SO_ACCEPTCONN)
return (EOPNOTSUPP);
s = splsoftnet();
@ -732,16 +729,14 @@ sodisconnect(struct socket *so)
*/
int
sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
struct mbuf *control, int flags)
struct mbuf *control, int flags, struct proc *p)
{
struct proc *p;
struct mbuf **mp, *m;
long space, len, resid, clen, mlen;
int error, s, dontroute, atomic;
sodopendfree(so);
p = curproc; /* XXX */
clen = 0;
atomic = sosendallatonce(so) || top;
if (uio)
@ -762,7 +757,8 @@ sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
dontroute =
(flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 &&
(so->so_proto->pr_flags & PR_ATOMIC);
p->p_stats->p_ru.ru_msgsnd++;
if (p)
p->p_stats->p_ru.ru_msgsnd++;
if (control)
clen = control->m_len;
#define snderr(errno) { error = errno; splx(s); goto release; }
@ -935,6 +931,7 @@ int
soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
{
struct proc * p;
struct mbuf *m, **mp;
int flags, len, error, s, offset, moff, type, orig_resid;
const struct protosw *pr;
@ -945,6 +942,8 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
mp = mp0;
type = 0;
orig_resid = uio->uio_resid;
p = uio->uio_procp;
if (paddr)
*paddr = 0;
if (controlp)
@ -960,8 +959,8 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
if (flags & MSG_OOB) {
m = m_get(M_WAIT, MT_DATA);
error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m,
(struct mbuf *)(long)(flags & MSG_PEEK), (struct mbuf *)0,
(struct proc *)0);
(struct mbuf *)(long)(flags & MSG_PEEK),
(struct mbuf *)0, p);
if (error)
goto bad;
do {
@ -978,7 +977,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
*mp = (struct mbuf *)0;
if (so->so_state & SS_ISCONFIRMING && uio->uio_resid)
(*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0,
(struct mbuf *)0, (struct mbuf *)0, (struct proc *)0);
(struct mbuf *)0, (struct mbuf *)0, p);
restart:
if ((error = sblock(&so->so_rcv, SBLOCKWAIT(flags))) != 0)
@ -1052,8 +1051,8 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
* info, we save a copy of m->m_nextpkt into nextrecord.
*/
#ifdef notyet /* XXXX */
if (uio->uio_procp)
uio->uio_procp->p_stats->p_ru.ru_msgrcv++;
if (p)
p->p_stats->p_ru.ru_msgrcv++;
#endif
KASSERT(m == so->so_rcv.sb_mb);
SBLASTRECORDCHK(&so->so_rcv, "soreceive 1");
@ -1092,10 +1091,11 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
sbfree(&so->so_rcv, m);
mbuf_removed = 1;
if (controlp) {
if (pr->pr_domain->dom_externalize &&
struct domain *dom = pr->pr_domain;
if (dom->dom_externalize && p &&
mtod(m, struct cmsghdr *)->cmsg_type ==
SCM_RIGHTS)
error = (*pr->pr_domain->dom_externalize)(m);
error = (*dom->dom_externalize)(m, p);
*controlp = m;
so->so_rcv.sb_mb = m->m_next;
m->m_next = 0;
@ -1281,8 +1281,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
(*pr->pr_usrreq)(so, PRU_RCVD,
(struct mbuf *)0,
(struct mbuf *)(long)flags,
(struct mbuf *)0,
(struct proc *)0);
(struct mbuf *)0, p);
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 2");
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 2");
error = sbwait(&so->so_rcv);
@ -1319,8 +1318,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
SBLASTMBUFCHK(&so->so_rcv, "soreceive 4");
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb)
(*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0,
(struct mbuf *)(long)flags, (struct mbuf *)0,
(struct proc *)0);
(struct mbuf *)(long)flags, (struct mbuf *)0, p);
}
if (orig_resid == uio->uio_resid && orig_resid &&
(flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_syscalls.c,v 1.87 2004/05/18 11:31:49 ragge Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.88 2004/05/22 22:52:13 jonathan Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.87 2004/05/18 11:31:49 ragge Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.88 2004/05/22 22:52:13 jonathan Exp $");
#include "opt_ktrace.h"
#include "opt_pipe.h"
@ -90,7 +90,7 @@ sys_socket(struct lwp *l, void *v, register_t *retval)
fp->f_type = DTYPE_SOCKET;
fp->f_ops = &socketops;
error = socreate(SCARG(uap, domain), &so, SCARG(uap, type),
SCARG(uap, protocol));
SCARG(uap, protocol), p);
if (error) {
FILE_UNUSE(fp, p);
fdremove(fdp, fd);
@ -288,7 +288,7 @@ sys_connect(struct lwp *l, void *v, register_t *retval)
if (error)
goto out;
MCLAIM(nam, so->so_mowner);
error = soconnect(so, nam);
error = soconnect(so, nam, p);
if (error)
goto bad;
if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
@ -340,11 +340,11 @@ sys_socketpair(struct lwp *l, void *v, register_t *retval)
p = l->l_proc;
fdp = p->p_fd;
error = socreate(SCARG(uap, domain), &so1, SCARG(uap, type),
SCARG(uap, protocol));
SCARG(uap, protocol), p);
if (error)
return (error);
error = socreate(SCARG(uap, domain), &so2, SCARG(uap, type),
SCARG(uap, protocol));
SCARG(uap, protocol), p);
if (error)
goto free1;
/* falloc() will use the descriptor for us */
@ -535,7 +535,7 @@ sendit(struct proc *p, int s, struct msghdr *mp, int flags, register_t *retsize)
}
#endif
len = auio.uio_resid;
error = (*so->so_send)(so, to, &auio, NULL, control, flags);
error = (*so->so_send)(so, to, &auio, NULL, control, flags, p);
if (error) {
if (auio.uio_resid != len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
@ -907,9 +907,9 @@ sys_pipe(struct lwp *l, void *v, register_t *retval)
p = l->l_proc;
fdp = p->p_fd;
if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0)) != 0)
if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, p)) != 0)
return (error);
if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0)) != 0)
if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, p)) != 0)
goto free1;
/* remember this socket pair implements a pipe */
wso->so_state |= SS_ISAPIPE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_usrreq.c,v 1.77 2004/04/18 22:20:32 matt Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.78 2004/05/22 22:52:13 jonathan Exp $ */
/*-
* Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@ -103,7 +103,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.77 2004/04/18 22:20:32 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.78 2004/05/22 22:52:13 jonathan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -834,9 +834,8 @@ unp_drain(void)
#endif
int
unp_externalize(struct mbuf *rights)
unp_externalize(struct mbuf *rights, struct proc *p)
{
struct proc *p = curproc; /* XXX */
struct cmsghdr *cm = mtod(rights, struct cmsghdr *);
int i, *fdp;
struct file **rp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fifo_vnops.c,v 1.48 2004/05/12 02:07:37 jrf Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.49 2004/05/22 22:52:14 jonathan Exp $ */
/*
* Copyright (c) 1990, 1993, 1995
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.48 2004/05/12 02:07:37 jrf Exp $");
__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.49 2004/05/22 22:52:14 jonathan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -162,13 +162,15 @@ fifo_open(void *v)
if ((fip = vp->v_fifoinfo) == NULL) {
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);
vp->v_fifoinfo = fip;
if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0)) != 0) {
error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, p);
if (error != 0) {
free(fip, M_VNODE);
vp->v_fifoinfo = NULL;
return (error);
}
fip->fi_readsock = rso;
if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0)) != 0) {
error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, p);
if (error != 0) {
(void)soclose(rso);
free(fip, M_VNODE);
vp->v_fifoinfo = NULL;
@ -310,7 +312,7 @@ fifo_write(void *v)
wso->so_state |= SS_NBIO;
VOP_UNLOCK(ap->a_vp, 0);
error = (*wso->so_send)(wso, (struct mbuf *)0, ap->a_uio, 0,
(struct mbuf *)0, 0);
(struct mbuf *)0, 0, curproc /*XXX*/);
vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
if (ap->a_ioflag & IO_NDELAY)
wso->so_state &= ~SS_NBIO;

View File

@ -1,4 +1,4 @@
/* $NetBSD: portal_vnops.c,v 1.54 2004/04/29 16:10:55 jrf Exp $ */
/* $NetBSD: portal_vnops.c,v 1.55 2004/05/22 22:52:14 jonathan Exp $ */
/*
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: portal_vnops.c,v 1.54 2004/04/29 16:10:55 jrf Exp $");
__KERNEL_RCSID(0, "$NetBSD: portal_vnops.c,v 1.55 2004/05/22 22:52:14 jonathan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -345,7 +345,7 @@ portal_open(v)
/*
* Create a new socket.
*/
error = socreate(AF_LOCAL, &so, SOCK_STREAM, 0);
error = socreate(AF_LOCAL, &so, SOCK_STREAM, 0, p);
if (error)
goto bad;
@ -420,7 +420,7 @@ portal_open(v)
auio.uio_resid = aiov[0].iov_len + aiov[1].iov_len;
error = (*so->so_send)(so, (struct mbuf *) 0, &auio,
(struct mbuf *) 0, (struct mbuf *) 0, 0);
(struct mbuf *) 0, (struct mbuf *) 0, 0, p);
if (error)
goto bad;

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_trantcp.c,v 1.15 2003/06/29 22:32:11 fvdl Exp $ */
/* $NetBSD: smb_trantcp.c,v 1.16 2004/05/22 22:52:15 jonathan Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smb_trantcp.c,v 1.15 2003/06/29 22:32:11 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: smb_trantcp.c,v 1.16 2004/05/22 22:52:15 jonathan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -83,7 +83,7 @@ SYSCTL_INT(_net_smb, OID_AUTO, tcprcvbuf, CTLFLAG_RW, &nb_tcprcvbuf, 0, "");
so, NULL, 0, m, 0, flags, p)
#else
#define nb_sosend(so,m,flags,p) (*(so)->so_send)(so, NULL, (struct uio *)0, \
m, (struct mbuf *)0, flags)
m, (struct mbuf *)0, flags, p)
#endif
static int nbssn_recv(struct nbpcb *nbp, struct mbuf **mpp, int *lenp,
@ -267,7 +267,7 @@ nb_connect_in(struct nbpcb *nbp, struct sockaddr_in *to, struct proc *p)
struct mbuf *m;
#endif
error = socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP);
error = socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP, p);
if (error)
return error;
nbp->nbp_tso = so;
@ -289,7 +289,7 @@ nb_connect_in(struct nbpcb *nbp, struct sockaddr_in *to, struct proc *p)
m = m_get(M_WAIT, MT_SONAME);
*mtod(m, struct sockaddr *) = *(struct sockaddr *)to;
m->m_len = sizeof(struct sockaddr);
error = soconnect(so, m);
error = soconnect(so, m, p);
m_free(m);
#endif
if (error)

View File

@ -1,14 +1,15 @@
/* $NetBSD: krpc.h,v 1.6 2003/05/05 13:21:00 yamt Exp $ */
/* $NetBSD: krpc.h,v 1.7 2004/05/22 22:52:15 jonathan Exp $ */
#include <sys/cdefs.h>
#ifdef _KERNEL
int krpc_call __P((struct sockaddr_in *sin,
u_int prog, u_int vers, u_int func,
struct mbuf **data, struct mbuf **from));
struct mbuf **data, struct mbuf **from, struct proc *p));
int krpc_portmap __P((struct sockaddr_in *sin,
u_int prog, u_int vers, u_int proto, u_int16_t *portp));
u_int prog, u_int vers, u_int proto, u_int16_t *portp,
struct proc *p));
struct mbuf *xdr_string_encode __P((char *str, int len));
struct mbuf *xdr_string_decode __P((struct mbuf *m, char *str, int *len_p));

View File

@ -1,4 +1,4 @@
/* $NetBSD: krpc_subr.c,v 1.27 2003/02/26 06:31:18 matt Exp $ */
/* $NetBSD: krpc_subr.c,v 1.28 2004/05/22 22:52:15 jonathan Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: krpc_subr.c,v 1.27 2003/02/26 06:31:18 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: krpc_subr.c,v 1.28 2004/05/22 22:52:15 jonathan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -131,10 +131,11 @@ static int krpccheck __P((struct mbuf*, void*));
* Returns non-zero error on failure.
*/
int
krpc_portmap(sin, prog, vers, proto, portp)
krpc_portmap(sin, prog, vers, proto, portp, p)
struct sockaddr_in *sin; /* server address */
u_int prog, vers, proto; /* host order */
u_int16_t *portp; /* network order */
struct proc *p;
{
struct sdata {
u_int32_t prog; /* call program */
@ -167,7 +168,7 @@ krpc_portmap(sin, prog, vers, proto, portp)
sin->sin_port = htons(PMAPPORT);
error = krpc_call(sin, PMAPPROG, PMAPVERS,
PMAPPROC_GETPORT, &m, NULL);
PMAPPROC_GETPORT, &m, NULL, p);
if (error)
return error;
@ -215,11 +216,12 @@ void *context;
* the address from whence the response came is saved there.
*/
int
krpc_call(sa, prog, vers, func, data, from_p)
krpc_call(sa, prog, vers, func, data, from_p, p)
struct sockaddr_in *sa;
u_int prog, vers, func;
struct mbuf **data; /* input/output */
struct mbuf **from_p; /* output */
struct proc *p;
{
struct socket *so;
struct sockaddr_in *sin;
@ -244,7 +246,7 @@ krpc_call(sa, prog, vers, func, data, from_p)
/*
* Create socket and set its receive timeout.
*/
if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0)))
if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, p)))
goto out;
if ((error = nfs_boot_setrecvtimo(so)))
@ -266,7 +268,7 @@ krpc_call(sa, prog, vers, func, data, from_p)
tport = IPPORT_RESERVED;
do {
tport--;
error = nfs_boot_sobind_ipport(so, tport);
error = nfs_boot_sobind_ipport(so, tport, p);
} while (error == EADDRINUSE &&
tport > IPPORT_RESERVED / 2);
if (error) {
@ -317,7 +319,8 @@ krpc_call(sa, prog, vers, func, data, from_p)
mhead->m_pkthdr.len = len;
mhead->m_pkthdr.rcvif = NULL;
error = nfs_boot_sendrecv(so, nam, 0, mhead, krpccheck, &m, &from, &xid);
error = nfs_boot_sendrecv(so, nam, 0, mhead, krpccheck, &m, &from,
&xid, p);
if (error)
goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_boot.c,v 1.60 2004/03/11 21:48:43 cl Exp $ */
/* $NetBSD: nfs_boot.c,v 1.61 2004/05/22 22:52:15 jonathan Exp $ */
/*-
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_boot.c,v 1.60 2004/03/11 21:48:43 cl Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_boot.c,v 1.61 2004/05/22 22:52:15 jonathan Exp $");
#include "opt_nfs.h"
#include "opt_nfs_boot.h"
@ -95,10 +95,10 @@ int nfs_boot_bootstatic = 1; /* BOOTSTATIC enabled (default) */
/* mountd RPC */
static int md_mount __P((struct sockaddr_in *mdsin, char *path,
struct nfs_args *argp));
struct nfs_args *argp, struct proc *procp));
static void nfs_boot_defrt __P((struct in_addr *));
static int nfs_boot_getfh __P((struct nfs_dlmount *ndm));
static int nfs_boot_getfh __P((struct nfs_dlmount *ndm, struct proc *));
/*
@ -161,7 +161,7 @@ nfs_boot_init(nd, procp)
/*
* Now fetch the NFS file handles as appropriate.
*/
error = nfs_boot_getfh(&nd->nd_root);
error = nfs_boot_getfh(&nd->nd_root, procp);
if (error)
nfs_boot_cleanup(nd, procp);
@ -197,7 +197,7 @@ nfs_boot_ifupdown(ifp, procp, up)
* Get a socket to use for various things in here.
* After this, use "goto out" to cleanup and return.
*/
error = socreate(AF_INET, &so, SOCK_DGRAM, 0);
error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp);
if (error) {
printf("ifupdown: socreate, error=%d\n", error);
return (error);
@ -246,7 +246,7 @@ nfs_boot_setaddress(ifp, procp, addr, netmask, braddr)
* Get a socket to use for various things in here.
* After this, use "goto out" to cleanup and return.
*/
error = socreate(AF_INET, &so, SOCK_DGRAM, 0);
error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp);
if (error) {
printf("setaddress: socreate, error=%d\n", error);
return (error);
@ -305,7 +305,7 @@ nfs_boot_deladdress(ifp, procp, addr)
* Get a socket to use for various things in here.
* After this, use "goto out" to cleanup and return.
*/
error = socreate(AF_INET, &so, SOCK_DGRAM, 0);
error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp);
if (error) {
printf("deladdress: socreate, error=%d\n", error);
return (error);
@ -360,9 +360,10 @@ nfs_boot_enbroadcast(so)
}
int
nfs_boot_sobind_ipport(so, port)
nfs_boot_sobind_ipport(so, port, procp)
struct socket *so;
u_int16_t port;
struct proc *procp;
{
struct mbuf *m;
struct sockaddr_in *sin;
@ -374,7 +375,7 @@ nfs_boot_sobind_ipport(so, port)
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
sin->sin_port = htons(port);
error = sobind(so, m, curproc);
error = sobind(so, m, procp);
m_freem(m);
return (error);
}
@ -389,7 +390,7 @@ nfs_boot_sobind_ipport(so, port)
#define TOTAL_TIMEOUT 30 /* seconds */
int
nfs_boot_sendrecv(so, nam, sndproc, snd, rcvproc, rcv, from_p, context)
nfs_boot_sendrecv(so, nam, sndproc, snd, rcvproc, rcv, from_p, context, procp)
struct socket *so;
struct mbuf *nam;
int (*sndproc) __P((struct mbuf*, void*, int));
@ -397,6 +398,7 @@ nfs_boot_sendrecv(so, nam, sndproc, snd, rcvproc, rcv, from_p, context)
int (*rcvproc) __P((struct mbuf*, void*));
struct mbuf **rcv, **from_p;
void *context;
struct proc *procp;
{
int error, rcvflg, timo, secs, waited;
struct mbuf *m, *from;
@ -434,7 +436,7 @@ send_again:
error = ENOBUFS;
goto out;
}
error = (*so->so_send)(so, nam, NULL, m, NULL, 0);
error = (*so->so_send)(so, nam, NULL, m, NULL, 0, procp);
if (error) {
printf("nfs_boot: sosend: %d\n", error);
goto out;
@ -457,6 +459,7 @@ send_again:
m = NULL;
}
uio.uio_resid = 1 << 16; /* ??? */
uio.uio_procp = procp;
rcvflg = 0;
error = (*so->so_receive)(so, &from, &uio, &m, NULL, &rcvflg);
if (error == EWOULDBLOCK) {
@ -557,8 +560,9 @@ nfs_boot_flushrt(ifp)
* (once for root and once for swap)
*/
static int
nfs_boot_getfh(ndm)
nfs_boot_getfh(ndm, p)
struct nfs_dlmount *ndm; /* output */
struct proc *p;
{
struct nfs_args *args;
struct sockaddr_in *sin;
@ -613,7 +617,7 @@ nfs_boot_getfh(ndm)
* Get file handle using RPC to mountd/mount
*/
sin = (struct sockaddr_in *)&ndm->ndm_saddr;
error = md_mount(sin, pathname, args);
error = md_mount(sin, pathname, args, p);
if (error) {
printf("nfs_boot: mountd `%s', error=%d\n",
ndm->ndm_host, error);
@ -628,7 +632,7 @@ retry:
error = krpc_portmap(sin, NFS_PROG,
(args->flags & NFSMNT_NFSV3) ? NFS_VER3 : NFS_VER2,
(args->sotype == SOCK_STREAM) ? IPPROTO_TCP : IPPROTO_UDP,
&port);
&port, p);
if (port == htons(0))
error = EIO;
if (error) {
@ -652,10 +656,11 @@ retry:
* Also, sets sin->sin_port to the NFS service port.
*/
static int
md_mount(mdsin, path, argp)
md_mount(mdsin, path, argp, procp)
struct sockaddr_in *mdsin; /* mountd server address */
char *path;
struct nfs_args *argp;
struct proc *procp;
{
/* The RPC structures */
struct rdata {
@ -679,7 +684,7 @@ md_mount(mdsin, path, argp)
* Get port number for MOUNTD.
*/
error = krpc_portmap(mdsin, RPCPROG_MNT, mntver,
IPPROTO_UDP, &mdsin->sin_port);
IPPROTO_UDP, &mdsin->sin_port, procp);
if (error)
continue;
@ -690,7 +695,7 @@ md_mount(mdsin, path, argp)
/* Do RPC to mountd. */
error = krpc_call(mdsin, RPCPROG_MNT, mntver,
RPCMNT_MOUNT, &m, NULL);
RPCMNT_MOUNT, &m, NULL, procp);
if (error != EPROGMISMATCH)
break;
/* Try lower version of mountd. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_bootdhcp.c,v 1.26 2004/05/06 12:32:59 drochner Exp $ */
/* $NetBSD: nfs_bootdhcp.c,v 1.27 2004/05/22 22:52:15 jonathan Exp $ */
/*-
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_bootdhcp.c,v 1.26 2004/05/06 12:32:59 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_bootdhcp.c,v 1.27 2004/05/22 22:52:15 jonathan Exp $");
#include "opt_nfs_boot.h"
@ -451,7 +451,7 @@ bootpc_call(nd, procp)
int vcilen;
#endif
error = socreate(AF_INET, &so, SOCK_DGRAM, 0);
error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp);
if (error) {
printf("bootp: socreate, error=%d\n", error);
return (error);
@ -538,7 +538,7 @@ bootpc_call(nd, procp)
/*
* Bind the local endpoint to a bootp client port.
*/
if ((error = nfs_boot_sobind_ipport(so, IPPORT_BOOTPC))) {
if ((error = nfs_boot_sobind_ipport(so, IPPORT_BOOTPC, procp))) {
DPRINT("bind failed\n");
goto out;
}
@ -607,7 +607,7 @@ bootpc_call(nd, procp)
#endif
error = nfs_boot_sendrecv(so, nam, bootpset, m,
bootpcheck, 0, 0, &bpc);
bootpcheck, 0, 0, &bpc, procp);
if (error)
goto out;
@ -633,7 +633,7 @@ bootpc_call(nd, procp)
bpc.expected_dhcpmsgtype = DHCPACK;
error = nfs_boot_sendrecv(so, nam, bootpset, m,
bootpcheck, 0, 0, &bpc);
bootpcheck, 0, 0, &bpc, procp);
if (error)
goto out;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_bootparam.c,v 1.23 2003/06/29 22:32:15 fvdl Exp $ */
/* $NetBSD: nfs_bootparam.c,v 1.24 2004/05/22 22:52:15 jonathan Exp $ */
/*-
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_bootparam.c,v 1.23 2003/06/29 22:32:15 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_bootparam.c,v 1.24 2004/05/22 22:52:15 jonathan Exp $");
#include "opt_nfs_boot.h"
#include "opt_inet.h"
@ -94,9 +94,9 @@ __KERNEL_RCSID(0, "$NetBSD: nfs_bootparam.c,v 1.23 2003/06/29 22:32:15 fvdl Exp
/* bootparam RPC */
static int bp_whoami __P((struct sockaddr_in *bpsin,
struct in_addr *my_ip, struct in_addr *gw_ip));
struct in_addr *my_ip, struct in_addr *gw_ip, struct proc *p));
static int bp_getfile __P((struct sockaddr_in *bpsin, char *key,
struct nfs_dlmount *ndm));
struct nfs_dlmount *ndm, struct proc *p));
/*
@ -180,7 +180,7 @@ nfs_bootparam(nd, procp)
sin->sin_addr.s_addr = INADDR_BROADCAST;
/* Do the RPC/bootparam/whoami. */
error = bp_whoami(sin, &my_ip, &gw_ip);
error = bp_whoami(sin, &my_ip, &gw_ip, procp);
if (error) {
printf("nfs_boot: bootparam whoami, error=%d\n", error);
goto delout;
@ -192,7 +192,7 @@ nfs_bootparam(nd, procp)
* Now fetch the server:pathname strings and server IP
* for root and swap. Missing swap is not fatal.
*/
error = bp_getfile(sin, "root", &nd->nd_root);
error = bp_getfile(sin, "root", &nd->nd_root, procp);
if (error) {
printf("nfs_boot: bootparam get root: %d\n", error);
goto delout;
@ -201,7 +201,7 @@ nfs_bootparam(nd, procp)
#ifndef NFS_BOOTPARAM_NOGATEWAY
gw_ndm = malloc(sizeof(*gw_ndm), M_NFSMNT, M_WAITOK);
memset((caddr_t)gw_ndm, 0, sizeof(*gw_ndm));
error = bp_getfile(sin, "gateway", gw_ndm);
error = bp_getfile(sin, "gateway", gw_ndm, procp);
if (error) {
/* No gateway supplied. No error, but try fallback. */
error = 0;
@ -291,10 +291,11 @@ gwok:
* know about us (don't want to broadcast a getport call).
*/
static int
bp_whoami(bpsin, my_ip, gw_ip)
bp_whoami(bpsin, my_ip, gw_ip, p)
struct sockaddr_in *bpsin;
struct in_addr *my_ip;
struct in_addr *gw_ip;
struct proc *p;
{
/* RPC structures for PMAPPROC_CALLIT */
struct whoami_call {
@ -334,7 +335,7 @@ bp_whoami(bpsin, my_ip, gw_ip)
bpsin->sin_port = htons(PMAPPORT);
from = NULL;
error = krpc_call(bpsin, PMAPPROG, PMAPVERS,
PMAPPROC_CALLIT, &m, &from);
PMAPPROC_CALLIT, &m, &from, p);
if (error)
return error;
@ -398,10 +399,11 @@ out:
* server pathname
*/
static int
bp_getfile(bpsin, key, ndm)
bp_getfile(bpsin, key, ndm, p)
struct sockaddr_in *bpsin;
char *key;
struct nfs_dlmount *ndm;
struct proc *p;
{
char pathname[MNAMELEN];
struct in_addr inaddr;
@ -426,7 +428,7 @@ bp_getfile(bpsin, key, ndm)
/* RPC: bootparam/getfile */
error = krpc_call(bpsin, BOOTPARAM_PROG, BOOTPARAM_VERS,
BOOTPARAM_GETFILE, &m, NULL);
BOOTPARAM_GETFILE, &m, NULL, p);
if (error)
return error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_nqlease.c,v 1.55 2004/04/21 02:22:49 christos Exp $ */
/* $NetBSD: nfs_nqlease.c,v 1.56 2004/05/22 22:52:15 jonathan Exp $ */
/*
* Copyright (c) 1992, 1993
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_nqlease.c,v 1.55 2004/04/21 02:22:49 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_nqlease.c,v 1.56 2004/05/22 22:52:15 jonathan Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -270,7 +270,7 @@ nqsrv_getlease(vp, duration, flags, slp, procp, nam, cachablep, frev, cred)
} else {
lp->lc_flag |= LC_NONCACHABLE;
nqsrv_locklease(lp);
nqsrv_send_eviction(vp, lp, slp, nam, cred);
nqsrv_send_eviction(vp, lp, slp, nam, cred, procp);
nqsrv_waitfor_expiry(lp);
nqsrv_unlocklease(lp);
}
@ -453,12 +453,13 @@ nqsrv_cmpnam(slp, nam, lph)
* Send out eviction notice messages to all other hosts for the lease.
*/
void
nqsrv_send_eviction(vp, lp, slp, nam, cred)
nqsrv_send_eviction(vp, lp, slp, nam, cred, p)
struct vnode *vp;
struct nqlease *lp;
struct nfssvc_sock *slp;
struct mbuf *nam;
struct ucred *cred;
struct proc *p;
{
struct nqhost *lph = &lp->lc_host;
struct mbuf *m;
@ -549,7 +550,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 *)0, p);
if (solockp)
nfs_sndunlock(solockp);
}
@ -888,9 +889,10 @@ nqnfs_getlease(vp, rwflag, cred, p)
* Client vacated message function.
*/
int
nqnfs_vacated(vp, cred)
nqnfs_vacated(vp, cred, p)
struct vnode *vp;
struct ucred *cred;
struct proc *p;
{
caddr_t cp;
struct mbuf *m;
@ -927,7 +929,7 @@ nqnfs_vacated(vp, cred)
myrep.r_nmp = nmp;
if (nmp->nm_soflags & PR_CONNREQUIRED)
(void) nfs_sndlock(&nmp->nm_iflag, (struct nfsreq *)0);
(void) nfs_send(nmp->nm_so, nmp->nm_nam, m, &myrep);
(void) nfs_send(nmp->nm_so, nmp->nm_nam, m, &myrep, p);
if (nmp->nm_soflags & PR_CONNREQUIRED)
nfs_sndunlock(&nmp->nm_iflag);
nfsmout:
@ -1081,7 +1083,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, l)
myrep.r_nmp = nmp;
myrep.r_mrep = (struct mbuf *)0;
myrep.r_procp = (struct proc *)0;
(void) nfs_reply(&myrep);
(void) nfs_reply(&myrep, p);
}
/*
@ -1105,7 +1107,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, l)
(void) nfs_vinvalbuf(vp,
V_SAVE, cred, p, 0);
np->n_flag &= ~NQNFSEVICTED;
(void) nqnfs_vacated(vp, cred);
(void) nqnfs_vacated(vp, cred, p);
} else if (vp->v_type == VREG) {
(void) VOP_FSYNC(vp, cred,
FSYNC_WAIT, 0, 0, p);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_socket.c,v 1.104 2004/05/10 10:40:42 yamt Exp $ */
/* $NetBSD: nfs_socket.c,v 1.105 2004/05/22 22:52:15 jonathan Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1995
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.104 2004/05/10 10:40:42 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.105 2004/05/22 22:52:15 jonathan Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -154,9 +154,10 @@ struct callout nfs_timer_ch = CALLOUT_INITIALIZER_SETFUNC(nfs_timer, NULL);
* We do not free the sockaddr if error.
*/
int
nfs_connect(nmp, rep)
nfs_connect(nmp, rep, p)
struct nfsmount *nmp;
struct nfsreq *rep;
struct proc *p;
{
struct socket *so;
int s, error, rcvreserve, sndreserve;
@ -169,8 +170,8 @@ nfs_connect(nmp, rep)
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);
error = socreate(saddr->sa_family, &nmp->nm_so,
nmp->nm_sotype, nmp->nm_soproto, p);
if (error)
goto bad;
so = nmp->nm_so;
@ -235,7 +236,7 @@ nfs_connect(nmp, rep)
goto bad;
}
} else {
error = soconnect(so, nmp->nm_nam);
error = soconnect(so, nmp->nm_nam, p);
if (error)
goto bad;
@ -332,15 +333,16 @@ bad:
* nb: Must be called with the nfs_sndlock() set on the mount point.
*/
int
nfs_reconnect(rep)
nfs_reconnect(rep, p)
struct nfsreq *rep;
struct proc *p;
{
struct nfsreq *rp;
struct nfsmount *nmp = rep->r_nmp;
int error;
nfs_disconnect(nmp);
while ((error = nfs_connect(nmp, rep)) != 0) {
while ((error = nfs_connect(nmp, rep, p)) != 0) {
if (error == EINTR || error == ERESTART)
return (EINTR);
(void) tsleep((caddr_t)&lbolt, PSOCK, "nfscn2", 0);
@ -421,15 +423,25 @@ nfs_safedisconnect(nmp)
* - do any cleanup required by recoverable socket errors (? ? ?)
*/
int
nfs_send(so, nam, top, rep)
nfs_send(so, nam, top, rep, p)
struct socket *so;
struct mbuf *nam;
struct mbuf *top;
struct nfsreq *rep;
struct proc *p;
{
struct mbuf *sendnam;
int error, soflags, flags;
/* XXX nfs_doio()/nfs_request() calls with rep->r_procp == NULL */
if (p == NULL && rep->r_procp == NULL) {
#ifdef DIAGNOSTIC
printf("nfs_send: proc botch: rep %p arg %p curproc %p\n",
rep->r_procp, p, curproc );
#endif
p = curproc;
}
if (rep) {
if (rep->r_flags & R_SOFTTERM) {
m_freem(top);
@ -454,7 +466,7 @@ nfs_send(so, nam, top, rep)
flags = 0;
error = (*so->so_send)(so, sendnam, (struct uio *)0, top,
(struct mbuf *)0, flags);
(struct mbuf *)0, flags, p);
if (error) {
if (rep) {
if (error == ENOBUFS && so->so_type == SOCK_DGRAM) {
@ -514,10 +526,11 @@ nfs_send(so, nam, top, rep)
* we have read any of it, even if the system call has been interrupted.
*/
int
nfs_receive(rep, aname, mp)
nfs_receive(rep, aname, mp, p)
struct nfsreq *rep;
struct mbuf **aname;
struct mbuf **mp;
struct proc *p;
{
struct socket *so;
struct uio auio;
@ -527,7 +540,6 @@ nfs_receive(rep, aname, mp)
u_int32_t len;
struct mbuf **getnam;
int error, sotype, rcvflg;
struct proc *p = curproc; /* XXX */
/*
* Set up arguments for soreceive()
@ -564,7 +576,7 @@ tryagain:
}
so = rep->r_nmp->nm_so;
if (!so) {
error = nfs_reconnect(rep);
error = nfs_reconnect(rep, p);
if (error) {
nfs_sndunlock(&rep->r_nmp->nm_iflag);
return (error);
@ -574,10 +586,10 @@ tryagain:
while (rep->r_flags & R_MUSTRESEND) {
m = m_copym(rep->r_mreq, 0, M_COPYALL, M_WAIT);
nfsstats.rpcretries++;
error = nfs_send(so, rep->r_nmp->nm_nam, m, rep);
error = nfs_send(so, rep->r_nmp->nm_nam, m, rep, p);
if (error) {
if (error == EINTR || error == ERESTART ||
(error = nfs_reconnect(rep)) != 0) {
(error = nfs_reconnect(rep, p)) != 0) {
nfs_sndunlock(&rep->r_nmp->nm_iflag);
return (error);
}
@ -689,7 +701,7 @@ errout:
rep->r_nmp->nm_mountp->mnt_stat.f_mntfromname);
error = nfs_sndlock(&rep->r_nmp->nm_iflag, rep);
if (!error)
error = nfs_reconnect(rep);
error = nfs_reconnect(rep, p);
if (!error)
goto tryagain;
else
@ -730,8 +742,9 @@ errout:
*/
/* ARGSUSED */
int
nfs_reply(myrep)
nfs_reply(myrep, procp)
struct nfsreq *myrep;
struct proc *procp;
{
struct nfsreq *rep;
struct nfsmount *nmp = myrep->r_nmp;
@ -760,7 +773,7 @@ nfs_reply(myrep)
* Get the next Rpc reply off the socket
*/
nmp->nm_waiters++;
error = nfs_receive(myrep, &nam, &mrep);
error = nfs_receive(myrep, &nam, &mrep, procp);
nfs_rcvunlock(nmp);
if (error) {
@ -1050,7 +1063,7 @@ tryagain:
error = nfs_sndlock(&nmp->nm_iflag, rep);
if (!error) {
m = m_copym(rep->r_mreq, 0, M_COPYALL, M_WAIT);
error = nfs_send(nmp->nm_so, nmp->nm_nam, m, rep);
error = nfs_send(nmp->nm_so, nmp->nm_nam, m, rep, procp);
if (nmp->nm_soflags & PR_CONNREQUIRED)
nfs_sndunlock(&nmp->nm_iflag);
}
@ -1067,7 +1080,7 @@ tryagain:
* Wait for the reply from our send or the timer's.
*/
if (!error || error == EPIPE)
error = nfs_reply(rep);
error = nfs_reply(rep, procp);
/*
* RPC done, unlink the request.
@ -2009,7 +2022,8 @@ nfsrv_rcv(so, arg, waitflag)
slp->ns_flag |= SLP_NEEDQ; goto dorecs;
}
#endif
auio.uio_procp = NULL;
/* XXX: was NULL, soreceive() requires non-NULL uio->uio_procp */
auio.uio_procp = curproc; /* XXX curproc */
if (so->so_type == SOCK_STREAM) {
/*
* If there are already records on the queue, defer soreceive()

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_syscalls.c,v 1.74 2004/03/17 10:43:35 yamt Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.75 2004/05/22 22:52:16 jonathan Exp $ */
/*
* Copyright (c) 1989, 1993
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.74 2004/03/17 10:43:35 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.75 2004/05/22 22:52:16 jonathan Exp $");
#include "fs_nfs.h"
#include "opt_nfs.h"
@ -750,7 +750,7 @@ nfssvc_nfsd(nsd, argp, l)
(void) nfs_sndlock(solockp, NULL);
if (slp->ns_flag & SLP_VALID) {
error =
nfs_send(so, nd->nd_nam2, m, NULL);
nfs_send(so, nd->nd_nam2, m, NULL, p);
} else {
error = EPIPE;
m_freem(m);

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_var.h,v 1.44 2004/05/10 10:40:42 yamt Exp $ */
/* $NetBSD: nfs_var.h,v 1.45 2004/05/22 22:52:16 jonathan Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -144,7 +144,7 @@ void nqsrv_instimeq __P((struct nqlease *, u_int32_t));
int nqsrv_cmpnam __P((struct nfssvc_sock *, struct mbuf *, struct nqhost *));
void nqsrv_send_eviction __P((struct vnode *, struct nqlease *,
struct nfssvc_sock *, struct mbuf *,
struct ucred *));
struct ucred *, struct proc *));
void nqsrv_waitfor_expiry __P((struct nqlease *));
void nqnfs_serverd __P((void));
int nqnfsrv_getlease __P((struct nfsrv_descript *, struct nfssvc_sock *,
@ -152,7 +152,7 @@ int nqnfsrv_getlease __P((struct nfsrv_descript *, struct nfssvc_sock *,
int nqnfsrv_vacated __P((struct nfsrv_descript *, struct nfssvc_sock *,
struct proc *, struct mbuf **));
int nqnfs_getlease __P((struct vnode *, int, struct ucred *, struct proc *));
int nqnfs_vacated __P((struct vnode *, struct ucred *));
int nqnfs_vacated __P((struct vnode *, struct ucred *, struct proc *));
int nqnfs_callback __P((struct nfsmount *, struct mbuf *, struct mbuf *,
caddr_t));
@ -210,14 +210,15 @@ int nfsrv_access __P((struct vnode *, int, struct ucred *, int, struct proc *,
int));
/* nfs_socket.c */
int nfs_connect __P((struct nfsmount *, struct nfsreq *));
int nfs_reconnect __P((struct nfsreq *));
int nfs_connect __P((struct nfsmount *, struct nfsreq *, struct proc *));
int nfs_reconnect __P((struct nfsreq *, struct proc *));
void nfs_disconnect __P((struct nfsmount *));
void nfs_safedisconnect __P((struct nfsmount *));
int nfs_send __P((struct socket *, struct mbuf *, struct mbuf *,
struct nfsreq *));
int nfs_receive __P((struct nfsreq *, struct mbuf **, struct mbuf **));
int nfs_reply __P((struct nfsreq *));
struct nfsreq *, struct proc *));
int nfs_receive __P((struct nfsreq *, struct mbuf **, struct mbuf **,
struct proc *));
int nfs_reply __P((struct nfsreq *, struct proc *));
int nfs_request __P((struct nfsnode *, struct mbuf *, int, struct proc *,
struct ucred *, struct mbuf **, struct mbuf **,
caddr_t *, int *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vfsops.c,v 1.137 2004/04/27 17:37:31 jrf Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.138 2004/05/22 22:52:16 jonathan Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.137 2004/04/27 17:37:31 jrf Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.138 2004/05/22 22:52:16 jonathan Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -415,9 +415,10 @@ nfs_mount_diskless(ndmntp, mntname, mpp, vpp, p)
}
void
nfs_decode_args(nmp, argp)
nfs_decode_args(nmp, argp, p)
struct nfsmount *nmp;
struct nfs_args *argp;
struct proc *p;
{
int s;
int adjsock;
@ -538,7 +539,7 @@ nfs_decode_args(nmp, argp)
if (nmp->nm_so && adjsock) {
nfs_safedisconnect(nmp);
if (nmp->nm_sotype == SOCK_DGRAM)
while (nfs_connect(nmp, (struct nfsreq *)0)) {
while (nfs_connect(nmp, (struct nfsreq *)0, p)) {
printf("nfs_args: retrying connect\n");
(void) tsleep((caddr_t)&lbolt,
PSOCK, "nfscn3", 0);
@ -629,7 +630,7 @@ nfs_mount(mp, path, data, ndp, p)
~(NFSMNT_NFSV3|NFSMNT_NQNFS|NFSMNT_XLATECOOKIE)) |
(nmp->nm_flag &
(NFSMNT_NFSV3|NFSMNT_NQNFS|NFSMNT_XLATECOOKIE));
nfs_decode_args(nmp, &args);
nfs_decode_args(nmp, &args, p);
return (0);
}
if (args.fhsize < 0 || args.fhsize > NFSX_V3FHMAX)
@ -752,7 +753,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp, p)
nmp->nm_sotype = argp->sotype;
nmp->nm_soproto = argp->proto;
nfs_decode_args(nmp, argp);
nfs_decode_args(nmp, argp, p);
mp->mnt_fs_bshift = ffs(MIN(nmp->nm_rsize, nmp->nm_wsize)) - 1;
mp->mnt_dev_bshift = DEV_BSHIFT;
@ -762,7 +763,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp, p)
* 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 *)0, p)))
goto bad;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfsdiskless.h,v 1.22 2004/05/01 06:16:42 matt Exp $ */
/* $NetBSD: nfsdiskless.h,v 1.23 2004/05/22 22:52:16 jonathan Exp $ */
/*-
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@ -77,11 +77,11 @@ int nfs_boot_deladdress __P((struct ifnet *, struct proc *, u_int32_t));
void nfs_boot_flushrt __P((struct ifnet *));
int nfs_boot_setrecvtimo __P((struct socket *));
int nfs_boot_enbroadcast __P((struct socket *));
int nfs_boot_sobind_ipport __P((struct socket *, u_int16_t));
int nfs_boot_sobind_ipport __P((struct socket *, u_int16_t, struct proc *));
int nfs_boot_sendrecv __P((struct socket *, struct mbuf *,
int (*)(struct mbuf*, void*, int), struct mbuf*,
int (*)(struct mbuf*, void*), struct mbuf**,
struct mbuf**, void*));
struct mbuf**, void*, struct proc *));
int nfs_bootdhcp __P((struct nfs_diskless *, struct proc *));
int nfs_bootparam __P((struct nfs_diskless *, struct proc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfsmount.h,v 1.31 2004/04/27 17:37:31 jrf Exp $ */
/* $NetBSD: nfsmount.h,v 1.32 2004/05/22 22:52:16 jonathan Exp $ */
/*
* Copyright (c) 1989, 1993
@ -180,7 +180,8 @@ int mountnfs __P((struct nfs_args *argp, struct mount *mp,
struct mbuf *nam, const char *pth, const char *hst,
struct vnode **vpp, struct proc *p));
int nfs_mountroot __P((void));
void nfs_decode_args __P((struct nfsmount *, struct nfs_args *));
void nfs_decode_args __P((struct nfsmount *, struct nfs_args *,
struct proc *p));
int nfs_start __P((struct mount *mp, int flags, struct proc *p));
int nfs_unmount __P((struct mount *mp, int mntflags, struct proc *p));
int nfs_root __P((struct mount *mp, struct vnode **vpp));

View File

@ -1,4 +1,4 @@
/* $NetBSD: domain.h,v 1.18 2004/04/22 01:34:17 matt Exp $ */
/* $NetBSD: domain.h,v 1.19 2004/05/22 22:52:16 jonathan Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -42,6 +42,7 @@
/*
* Forward structure declarations for function prototypes [sic].
*/
struct proc;
struct mbuf;
struct ifnet;
@ -51,7 +52,7 @@ struct domain {
void (*dom_init) /* initialize domain data structures */
(void);
int (*dom_externalize) /* externalize access rights */
(struct mbuf *);
(struct mbuf *, struct proc *);
void (*dom_dispose) /* dispose of internalized rights */
(struct mbuf *);
const struct protosw *dom_protosw, *dom_protoswNPROTOSW;

View File

@ -1,4 +1,4 @@
/* $NetBSD: socketvar.h,v 1.74 2004/04/22 01:01:42 matt Exp $ */
/* $NetBSD: socketvar.h,v 1.75 2004/05/22 22:52:16 jonathan Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
@ -122,7 +122,7 @@ struct socket {
caddr_t so_upcallarg; /* Arg for above */
int (*so_send) (struct socket *, struct mbuf *,
struct uio *, struct mbuf *,
struct mbuf *, int);
struct mbuf *, int, struct proc *);
int (*so_receive) (struct socket *,
struct mbuf **,
struct uio *, struct mbuf **,
@ -303,9 +303,9 @@ int sobind(struct socket *, struct mbuf *, struct proc *);
void socantrcvmore(struct socket *);
void socantsendmore(struct socket *);
int soclose(struct socket *);
int soconnect(struct socket *, struct mbuf *);
int soconnect(struct socket *, struct mbuf *, struct proc *);
int soconnect2(struct socket *, struct socket *);
int socreate(int, struct socket **, int, int);
int socreate(int, struct socket **, int, int, struct proc *);
int sodisconnect(struct socket *);
void sofree(struct socket *);
int sogetopt(struct socket *, int, int, struct mbuf **);
@ -324,7 +324,7 @@ int soreceive(struct socket *, struct mbuf **, struct uio *,
int soreserve(struct socket *, u_long, u_long);
void sorflush(struct socket *);
int sosend(struct socket *, struct mbuf *, struct uio *,
struct mbuf *, struct mbuf *, int);
struct mbuf *, struct mbuf *, int, struct proc *);
int sosetopt(struct socket *, int, int, struct mbuf *);
int soshutdown(struct socket *, int);
void sowakeup(struct socket *, struct sockbuf *, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: un.h,v 1.35 2004/04/18 21:43:45 matt Exp $ */
/* $NetBSD: un.h,v 1.36 2004/05/22 22:52:17 jonathan Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -79,7 +79,7 @@ void unp_gc (void);
void unp_mark (struct file *);
void unp_scan (struct mbuf *, void (*)(struct file *), int);
void unp_shutdown (struct unpcb *);
int unp_externalize (struct mbuf *);
int unp_externalize (struct mbuf *, struct proc *);
int unp_internalize (struct mbuf *, struct proc *);
void unp_dispose (struct mbuf *);
int unp_output (struct mbuf *, struct mbuf *, struct unpcb *,