diff options
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/bootp_subr.c | 98 | ||||
-rw-r--r-- | sys/nfs/krpc.h | 6 | ||||
-rw-r--r-- | sys/nfs/krpc_subr.c | 16 | ||||
-rw-r--r-- | sys/nfs/nfs.h | 68 | ||||
-rw-r--r-- | sys/nfs/nfs_bio.c | 140 | ||||
-rw-r--r-- | sys/nfs/nfs_common.c | 34 | ||||
-rw-r--r-- | sys/nfs/nfs_lock.c | 17 | ||||
-rw-r--r-- | sys/nfs/nfs_node.c | 20 | ||||
-rw-r--r-- | sys/nfs/nfs_nqlease.c | 58 | ||||
-rw-r--r-- | sys/nfs/nfs_serv.c | 292 | ||||
-rw-r--r-- | sys/nfs/nfs_socket.c | 67 | ||||
-rw-r--r-- | sys/nfs/nfs_subs.c | 34 | ||||
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 65 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 68 | ||||
-rw-r--r-- | sys/nfs/nfs_vnops.c | 228 | ||||
-rw-r--r-- | sys/nfs/nfsnode.h | 8 | ||||
-rw-r--r-- | sys/nfs/nqnfs.h | 14 |
17 files changed, 621 insertions, 612 deletions
diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c index 72fc393d0153..063f77f4a408 100644 --- a/sys/nfs/bootp_subr.c +++ b/sys/nfs/bootp_subr.c @@ -213,11 +213,11 @@ extern struct nfsv3_diskless nfsv3_diskless; /* mountd RPC */ static int md_mount(struct sockaddr_in *mdsin, char *path, u_char *fhp, int *fhsizep, - struct nfs_args *args,struct proc *procp); + struct nfs_args *args,struct thread *td); static int md_lookup_swap(struct sockaddr_in *mdsin,char *path, u_char *fhp, int *fhsizep, struct nfs_args *args, - struct proc *procp); + struct thread *td); static int setfs(struct sockaddr_in *addr, char *path, char *p); static int getdec(char **ptr); static char *substr(char *a,char *b); @@ -231,7 +231,7 @@ static struct bootpc_ifcontext *allocifctx(struct bootpc_globalcontext *gctx); static void bootpc_compose_query(struct bootpc_ifcontext *ifctx, struct bootpc_globalcontext *gctx, - struct proc *procp); + struct thread *td); static unsigned char *bootpc_tag(struct bootpc_tagcontext *tctx, struct bootp_packet *bp, int len, int tag); static void bootpc_tag_helper(struct bootpc_tagcontext *tctx, @@ -248,15 +248,15 @@ void bootpboot_p_iflist(void); #endif static int bootpc_call(struct bootpc_globalcontext *gctx, - struct proc *procp); + struct thread *td); static int bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct bootpc_globalcontext *gctx, - struct proc *procp); + struct thread *td); static int bootpc_adjust_interface(struct bootpc_ifcontext *ifctx, struct bootpc_globalcontext *gctx, - struct proc *procp); + struct thread *td); static void bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx, @@ -581,7 +581,7 @@ bootpc_received(struct bootpc_globalcontext *gctx, static int bootpc_call(struct bootpc_globalcontext *gctx, - struct proc *procp) + struct thread *td) { struct socket *so; struct sockaddr_in *sin, dst; @@ -601,7 +601,7 @@ bootpc_call(struct bootpc_globalcontext *gctx, /* * Create socket and set its recieve timeout. */ - error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp); + error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td); if (error != 0) goto out; @@ -648,7 +648,7 @@ bootpc_call(struct bootpc_globalcontext *gctx, sin = &dst; clear_sinaddr(sin); sin->sin_port = htons(IPPORT_BOOTPC); - error = sobind(so, (struct sockaddr *)sin, procp); + error = sobind(so, (struct sockaddr *)sin, td); if (error != 0) { printf("bind failed\n"); goto out; @@ -706,7 +706,7 @@ bootpc_call(struct bootpc_globalcontext *gctx, (ifctx->state == IF_BOOTP_UNRESOLVED && ifctx->dhcpquerytype != DHCP_NOMSG)) { ifctx->sentmsg = 0; - bootpc_compose_query(ifctx, gctx, procp); + bootpc_compose_query(ifctx, gctx, td); } /* Send BOOTP request (or re-send). */ @@ -743,21 +743,21 @@ bootpc_call(struct bootpc_globalcontext *gctx, auio.uio_rw = UIO_WRITE; auio.uio_offset = 0; auio.uio_resid = sizeof(ifctx->call); - auio.uio_procp = procp; + auio.uio_td = td; /* Set netmask to 0.0.0.0 */ sin = (struct sockaddr_in *) &ifctx->ireq.ifr_addr; clear_sinaddr(sin); error = ifioctl(ifctx->so, SIOCSIFNETMASK, - (caddr_t) &ifctx->ireq, procp); + (caddr_t) &ifctx->ireq, td); if (error != 0) panic("bootpc_call:" "set if netmask, error=%d", error); error = sosend(so, (struct sockaddr *) &dst, - &auio, NULL, NULL, 0, procp); + &auio, NULL, NULL, 0, td); if (error != 0) { printf("bootpc_call: sosend: %d state %08x\n", error, (int) so->so_state); @@ -772,7 +772,7 @@ bootpc_call(struct bootpc_globalcontext *gctx, clear_sinaddr(sin); sin->sin_addr.s_addr = htonl(0xff000000u); error = ifioctl(ifctx->so, SIOCSIFNETMASK, - (caddr_t) &ifctx->ireq, procp); + (caddr_t) &ifctx->ireq, td); if (error != 0) panic("bootpc_call:" "set if netmask, error=%d", @@ -810,7 +810,7 @@ bootpc_call(struct bootpc_globalcontext *gctx, auio.uio_rw = UIO_READ; auio.uio_offset = 0; auio.uio_resid = sizeof(gctx->reply); - auio.uio_procp = procp; + auio.uio_td = td; rcvflg = 0; error = soreceive(so, NULL, &auio, @@ -979,7 +979,7 @@ out: static int bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct bootpc_globalcontext *gctx, - struct proc *procp) + struct thread *td) { struct sockaddr_in *sin; int error; @@ -989,7 +989,7 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct ifaddr *ifa; struct sockaddr_dl *sdl; - error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, procp); + error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td); if (error != 0) panic("nfs_boot: socreate, error=%d", error); @@ -1002,11 +1002,11 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, * Get the old interface flags and or IFF_UP into them; if * IFF_UP set blindly, interface selection can be clobbered. */ - error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)ireq, procp); + error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)ireq, td); if (error != 0) panic("bootpc_fakeup_interface: GIFFLAGS, error=%d", error); ireq->ifr_flags |= IFF_UP; - error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)ireq, procp); + error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)ireq, td); if (error != 0) panic("bootpc_fakeup_interface: SIFFLAGS, error=%d", error); @@ -1019,7 +1019,7 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, sin = (struct sockaddr_in *) &ireq->ifr_addr; clear_sinaddr(sin); - error = ifioctl(so, SIOCSIFADDR, (caddr_t) ireq, procp); + error = ifioctl(so, SIOCSIFADDR, (caddr_t) ireq, td); if (error != 0 && (error != EEXIST || ifctx == gctx->interfaces)) panic("bootpc_fakeup_interface: " "set if addr, error=%d", error); @@ -1029,7 +1029,7 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, sin = (struct sockaddr_in *) &ireq->ifr_addr; clear_sinaddr(sin); sin->sin_addr.s_addr = htonl(0xff000000u); - error = ifioctl(so, SIOCSIFNETMASK, (caddr_t)ireq, procp); + error = ifioctl(so, SIOCSIFNETMASK, (caddr_t)ireq, td); if (error != 0) panic("bootpc_fakeup_interface: set if netmask, error=%d", error); @@ -1042,7 +1042,7 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, sin->sin_addr.s_addr = htonl(INADDR_BROADCAST); ifctx->broadcast.sin_addr.s_addr = sin->sin_addr.s_addr; - error = ifioctl(so, SIOCSIFBRDADDR, (caddr_t)ireq, procp); + error = ifioctl(so, SIOCSIFBRDADDR, (caddr_t)ireq, td); if (error != 0) panic("bootpc_fakeup_interface: " "set if broadcast addr, error=%d", @@ -1071,7 +1071,7 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, static int bootpc_adjust_interface(struct bootpc_ifcontext *ifctx, struct bootpc_globalcontext *gctx, - struct proc *procp) + struct thread *td) { int error; struct sockaddr_in defdst; @@ -1095,19 +1095,19 @@ bootpc_adjust_interface(struct bootpc_ifcontext *ifctx, /* Shutdown interfaces where BOOTP failed */ printf("Shutdown interface %s\n", ifctx->ireq.ifr_name); - error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)ireq, procp); + error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)ireq, td); if (error != 0) panic("bootpc_adjust_interface: " "SIOCGIFFLAGS, error=%d", error); ireq->ifr_flags &= ~IFF_UP; - error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)ireq, procp); + error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)ireq, td); if (error != 0) panic("bootpc_adjust_interface: " "SIOCSIFFLAGS, error=%d", error); sin = (struct sockaddr_in *) &ireq->ifr_addr; clear_sinaddr(sin); - error = ifioctl(so, SIOCDIFADDR, (caddr_t) ireq, procp); + error = ifioctl(so, SIOCDIFADDR, (caddr_t) ireq, td); if (error != 0 && (error != EEXIST || ifctx == gctx->interfaces)) panic("bootpc_adjust_interface: " @@ -1122,7 +1122,7 @@ bootpc_adjust_interface(struct bootpc_ifcontext *ifctx, * can talk to the servers. (just set the address) */ bcopy(netmask, &ireq->ifr_addr, sizeof(*netmask)); - error = ifioctl(so, SIOCSIFNETMASK, (caddr_t) ireq, procp); + error = ifioctl(so, SIOCSIFNETMASK, (caddr_t) ireq, td); if (error != 0) panic("bootpc_adjust_interface: " "set if netmask, error=%d", error); @@ -1133,13 +1133,13 @@ bootpc_adjust_interface(struct bootpc_ifcontext *ifctx, clear_sinaddr(sin); sin->sin_addr.s_addr = myaddr->sin_addr.s_addr | ~ netmask->sin_addr.s_addr; - error = ifioctl(so, SIOCSIFBRDADDR, (caddr_t) ireq, procp); + error = ifioctl(so, SIOCSIFBRDADDR, (caddr_t) ireq, td); if (error != 0) panic("bootpc_adjust_interface: " "set if broadcast addr, error=%d", error); bcopy(myaddr, &ireq->ifr_addr, sizeof(*myaddr)); - error = ifioctl(so, SIOCSIFADDR, (caddr_t) ireq, procp); + error = ifioctl(so, SIOCSIFADDR, (caddr_t) ireq, td); if (error != 0 && (error != EEXIST || ifctx == gctx->interfaces)) panic("bootpc_adjust_interface: " "set if addr, error=%d", error); @@ -1326,10 +1326,10 @@ print_in_addr(struct in_addr addr) } static void -bootpc_compose_query(ifctx, gctx, procp) +bootpc_compose_query(ifctx, gctx, td) struct bootpc_ifcontext *ifctx; struct bootpc_globalcontext *gctx; - struct proc *procp; + struct thread *td; { unsigned char *vendp; uint32_t leasetime; @@ -1670,10 +1670,10 @@ bootpc_init(void) struct ifnet *ifp; int error; struct nfsv3_diskless *nd; - struct proc *procp; + struct thread *td; nd = &nfsv3_diskless; - procp = curproc; + td = curthread; /* * If already filled in, don't touch it here @@ -1745,13 +1745,13 @@ bootpc_init(void) gctx->gotgw = 0; for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) - bootpc_fakeup_interface(ifctx, gctx, procp); + bootpc_fakeup_interface(ifctx, gctx, td); for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) - bootpc_compose_query(ifctx, gctx, procp); + bootpc_compose_query(ifctx, gctx, td); ifctx = gctx->interfaces; - error = bootpc_call(gctx, procp); + error = bootpc_call(gctx, td); if (error != 0) { #ifdef BOOTP_NFSROOT @@ -1777,7 +1777,7 @@ bootpc_init(void) #endif for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) { - bootpc_adjust_interface(ifctx, gctx, procp); + bootpc_adjust_interface(ifctx, gctx, td); soclose(ifctx->so); } @@ -1799,7 +1799,7 @@ bootpc_init(void) error = md_mount(&nd->root_saddr, nd->root_hostnam, nd->root_fh, &nd->root_fhsize, - &nd->root_args, procp); + &nd->root_args, td); if (error != 0) panic("nfs_boot: mountd root, error=%d", error); @@ -1808,7 +1808,7 @@ bootpc_init(void) error = md_mount(&nd->swap_saddr, nd->swap_hostnam, nd->swap_fh, &nd->swap_fhsize, - &nd->swap_args, procp); + &nd->swap_args, td); if (error != 0) panic("nfs_boot: mountd swap, error=%d", error); @@ -1816,7 +1816,7 @@ bootpc_init(void) error = md_lookup_swap(&nd->swap_saddr, gctx->lookup_path, nd->swap_fh, &nd->swap_fhsize, - &nd->swap_args, procp); + &nd->swap_args, td); if (error != 0) panic("nfs_boot: lookup swap, error=%d", error); @@ -1852,7 +1852,7 @@ md_mount(struct sockaddr_in *mdsin, /* mountd server address */ u_char *fhp, int *fhsizep, struct nfs_args *args, - struct proc *procp) + struct thread *td) { struct mbuf *m; int error; @@ -1864,13 +1864,13 @@ md_mount(struct sockaddr_in *mdsin, /* mountd server address */ /* First try NFS v3 */ /* Get port number for MOUNTD. */ error = krpc_portmap(mdsin, RPCPROG_MNT, RPCMNT_VER3, - &mdsin->sin_port, procp); + &mdsin->sin_port, td); if (error == 0) { m = xdr_string_encode(path, strlen(path)); /* Do RPC to mountd. */ error = krpc_call(mdsin, RPCPROG_MNT, RPCMNT_VER3, - RPCMNT_MOUNT, &m, NULL, procp); + RPCMNT_MOUNT, &m, NULL, td); } if (error == 0) { args->flags |= NFSMNT_NFSV3; @@ -1880,7 +1880,7 @@ md_mount(struct sockaddr_in *mdsin, /* mountd server address */ /* Get port number for MOUNTD. */ error = krpc_portmap(mdsin, RPCPROG_MNT, RPCMNT_VER1, - &mdsin->sin_port, procp); + &mdsin->sin_port, td); if (error != 0) return error; @@ -1888,7 +1888,7 @@ md_mount(struct sockaddr_in *mdsin, /* mountd server address */ /* Do RPC to mountd. */ error = krpc_call(mdsin, RPCPROG_MNT, RPCMNT_VER1, - RPCMNT_MOUNT, &m, NULL, procp); + RPCMNT_MOUNT, &m, NULL, td); if (error != 0) return error; /* message already freed */ @@ -1931,7 +1931,7 @@ md_mount(struct sockaddr_in *mdsin, /* mountd server address */ error = krpc_portmap(mdsin, NFS_PROG, (args->flags & NFSMNT_NFSV3) ? NFS_VER3 : NFS_VER2, - &mdsin->sin_port, procp); + &mdsin->sin_port, td); goto out; @@ -1950,7 +1950,7 @@ md_lookup_swap(struct sockaddr_in *mdsin, /* mountd server address */ u_char *fhp, int *fhsizep, struct nfs_args *args, - struct proc *procp) + struct thread *td) { struct mbuf *m; int error; @@ -1984,10 +1984,10 @@ md_lookup_swap(struct sockaddr_in *mdsin, /* mountd server address */ /* Do RPC to nfsd. */ if ((args->flags & NFSMNT_NFSV3) != 0) error = krpc_call(mdsin, NFS_PROG, NFS_VER3, - NFSPROC_LOOKUP, &m, NULL, procp); + NFSPROC_LOOKUP, &m, NULL, td); else error = krpc_call(mdsin, NFS_PROG, NFS_VER2, - NFSV2PROC_LOOKUP, &m, NULL, procp); + NFSV2PROC_LOOKUP, &m, NULL, td); if (error != 0) return error; /* message already freed */ diff --git a/sys/nfs/krpc.h b/sys/nfs/krpc.h index 6c889b57f77c..b6136e373889 100644 --- a/sys/nfs/krpc.h +++ b/sys/nfs/krpc.h @@ -4,16 +4,16 @@ #include <sys/cdefs.h> struct mbuf; -struct proc; +struct thread; struct sockaddr; struct sockaddr_in; int krpc_call __P((struct sockaddr_in *_sin, u_int prog, u_int vers, u_int func, - struct mbuf **data, struct sockaddr **from, struct proc *procp)); + struct mbuf **data, struct sockaddr **from, struct thread *td)); int krpc_portmap __P((struct sockaddr_in *_sin, - u_int prog, u_int vers, u_int16_t *portp,struct proc *procp)); + u_int prog, u_int vers, u_int16_t *portp,struct thread *td)); struct mbuf *xdr_string_encode __P((char *str, int len)); diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c index b7b1d2c28ebe..709af4a464aa 100644 --- a/sys/nfs/krpc_subr.c +++ b/sys/nfs/krpc_subr.c @@ -124,11 +124,11 @@ struct rpc_reply { * Returns non-zero error on failure. */ int -krpc_portmap(sin, prog, vers, portp, procp) +krpc_portmap(sin, prog, vers, portp, td) struct sockaddr_in *sin; /* server address */ u_int prog, vers; /* host order */ u_int16_t *portp; /* network order */ - struct proc *procp; + struct thread *td; { struct sdata { u_int32_t prog; /* call program */ @@ -163,7 +163,7 @@ krpc_portmap(sin, prog, vers, portp, procp) sin->sin_port = htons(PMAPPORT); error = krpc_call(sin, PMAPPROG, PMAPVERS, - PMAPPROC_GETPORT, &m, NULL, procp); + PMAPPROC_GETPORT, &m, NULL, td); if (error) return error; @@ -185,12 +185,12 @@ krpc_portmap(sin, prog, vers, portp, procp) * the address from whence the response came is saved there. */ int -krpc_call(sa, prog, vers, func, data, from_p, procp) +krpc_call(sa, prog, vers, func, data, from_p, td) struct sockaddr_in *sa; u_int prog, vers, func; struct mbuf **data; /* input/output */ struct sockaddr **from_p; /* output */ - struct proc *procp; + struct thread *td; { struct socket *so; struct sockaddr_in *sin, ssin; @@ -220,7 +220,7 @@ krpc_call(sa, prog, vers, func, data, from_p, procp) /* * Create socket and set its recieve timeout. */ - if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp))) + if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td))) goto out; tv.tv_sec = 1; @@ -260,7 +260,7 @@ krpc_call(sa, prog, vers, func, data, from_p, procp) do { tport--; sin->sin_port = htons(tport); - error = sobind(so, (struct sockaddr *)sin, procp); + error = sobind(so, (struct sockaddr *)sin, td); } while (error == EADDRINUSE && tport > IPPORT_RESERVED / 2); if (error) { @@ -321,7 +321,7 @@ krpc_call(sa, prog, vers, func, data, from_p, procp) goto out; } error = sosend(so, (struct sockaddr *)sa, NULL, m, - NULL, 0, procp); + NULL, 0, td); if (error) { printf("krpc_call: sosend: %d\n", error); goto out; diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h index 44d04b96270f..d5d0796245d2 100644 --- a/sys/nfs/nfs.h +++ b/sys/nfs/nfs.h @@ -348,7 +348,7 @@ struct nfsreq { int r_timer; /* tick counter on reply */ u_int32_t r_procnum; /* NFS procedure number */ int r_rtt; /* RTT for rpc */ - struct proc *r_procp; /* Proc that did I/O system call */ + struct thread *r_td; /* Proc that did I/O system call */ }; /* @@ -469,7 +469,7 @@ struct nfsd { u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ int nfsd_verflen; /* and the Verifier */ u_char nfsd_verfstr[RPCVERF_MAXSIZ]; - struct proc *nfsd_procp; /* Proc ptr */ + struct thread *nfsd_td; /* daemon thread ptr */ struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */ }; @@ -592,16 +592,16 @@ void nfs_sndunlock __P((struct nfsreq *)); int nfs_slplock __P((struct nfssvc_sock *, int)); void nfs_slpunlock __P((struct nfssvc_sock *)); int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *)); -int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *, +int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct thread *, int)); int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *)); int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *, int *)); int nfs_commit __P((struct vnode *vp, u_quad_t offset, int cnt, - struct ucred *cred, struct proc *procp)); + struct ucred *cred, struct thread *)); int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *)); -int nfs_asyncio __P((struct buf *, struct ucred *, struct proc *)); -int nfs_doio __P((struct buf *, struct ucred *, struct proc *)); +int nfs_asyncio __P((struct buf *, struct ucred *, struct thread *)); +int nfs_doio __P((struct buf *, struct ucred *, struct thread *)); int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *)); int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *)); int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *)); @@ -613,14 +613,14 @@ void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int, void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *, struct mbuf **, char **)); int netaddr_match __P((int, union nethostaddr *, struct sockaddr *)); -int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *, +int nfs_request __P((struct vnode *, struct mbuf *, int, struct thread *, struct ucred *, struct mbuf **, struct mbuf **, caddr_t *)); int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *, struct vattr *, int)); int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **, - caddr_t *, struct vnode **, struct proc *, int, int)); + caddr_t *, struct vnode **, struct thread *, int, int)); void nfsm_adj __P((struct mbuf *, int, int)); int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *)); void nfsrv_initcache __P((void)); @@ -652,21 +652,21 @@ void nfs_clearcommit __P((struct mount *)); int nfsrv_errmap __P((struct nfsrv_descript *, int)); void nfsrvw_sort __P((gid_t *, int)); void nfsrv_setcred __P((struct ucred *, struct ucred *)); -int nfs_writebp __P((struct buf *, int, struct proc *)); +int nfs_writebp __P((struct buf *, int, struct thread *)); int nfsrv_object_create __P((struct vnode *)); void nfsrv_wakenfsd __P((struct nfssvc_sock *slp)); int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *, - struct proc *, struct mbuf **)); + struct thread *, struct mbuf **)); int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *, - struct proc *p)); + struct thread *p)); int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *, struct nfssvc_sock *, struct sockaddr *, int *, int, int)); @@ -674,52 +674,52 @@ int nfsrv_setpublicfs __P((struct mount *, struct netexport *, struct export_args *)); int nfs_ispublicfh __P((fhandle_t *)); int nfsrv_fsinfo __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_getattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_link __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_lookup __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_mkdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_mknod __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_noop __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_null __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_pathconf __P((struct nfsrv_descript *nfsd, - struct nfssvc_sock *slp, struct proc *procp, + struct nfssvc_sock *slp, struct thread *td, struct mbuf **mrq)); int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd, - struct nfssvc_sock *slp, struct proc *procp, + struct nfssvc_sock *slp, struct thread *td, struct mbuf **mrq)); int nfsrv_readlink __P((struct nfsrv_descript *nfsd, - struct nfssvc_sock *slp, struct proc *procp, + struct nfssvc_sock *slp, struct thread *td, struct mbuf **mrq)); int nfsrv_remove __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, - struct proc *procp, struct mbuf **mrq)); + struct thread *td, struct mbuf **mrq)); void nfsrv_rcv __P((struct socket *so, void *arg, int waitflag)); void nfsrv_slpderef __P((struct nfssvc_sock *slp)); #endif /* _KERNEL */ diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 3bcdb324d175..e48cd5c4b5c2 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -72,7 +72,7 @@ static int nfs_bwrite(struct buf *bp) { - return (nfs_writebp(bp, 1, curproc)); + return (nfs_writebp(bp, 1, curthread)); } struct buf_ops buf_ops_nfs = { @@ -82,7 +82,7 @@ struct buf_ops buf_ops_nfs = { static struct buf *nfs_getcacheblk __P((struct vnode *vp, daddr_t bn, int size, - struct proc *p)); + struct thread *td)); extern int nfs_numasync; extern int nfs_pbuf_freecnt; @@ -107,7 +107,7 @@ nfs_getpages(ap) vm_offset_t kva; struct buf *bp; struct vnode *vp; - struct proc *p; + struct thread *td; struct ucred *cred; struct nfsmount *nmp; vm_page_t *pages; @@ -115,8 +115,8 @@ nfs_getpages(ap) GIANT_REQUIRED; vp = ap->a_vp; - p = curproc; /* XXX */ - cred = curproc->p_ucred; /* XXX */ + td = curthread; /* XXX */ + cred = curthread->td_proc->p_ucred; /* XXX */ nmp = VFSTONFS(vp->v_mount); pages = ap->a_m; count = ap->a_count; @@ -128,7 +128,7 @@ nfs_getpages(ap) if ((nmp->nm_flag & NFSMNT_NFSV3) != 0 && (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) { - (void)nfs_fsinfo(nmp, vp, cred, p); + (void)nfs_fsinfo(nmp, vp, cred, td); } npages = btoc(count); @@ -172,7 +172,7 @@ nfs_getpages(ap) uio.uio_resid = count; uio.uio_segflg = UIO_SYSSPACE; uio.uio_rw = UIO_READ; - uio.uio_procp = p; + uio.uio_td = td; error = nfs_readrpc(vp, &uio, cred); pmap_qremove(kva, npages); @@ -268,7 +268,7 @@ nfs_putpages(ap) off_t offset; int *rtvals; struct vnode *vp; - struct proc *p; + struct thread *td; struct ucred *cred; struct nfsmount *nmp; struct nfsnode *np; @@ -278,8 +278,8 @@ nfs_putpages(ap) vp = ap->a_vp; np = VTONFS(vp); - p = curproc; /* XXX */ - cred = curproc->p_ucred; /* XXX */ + td = curthread; /* XXX */ + cred = curthread->td_proc->p_ucred; /* XXX */ nmp = VFSTONFS(vp->v_mount); pages = ap->a_m; count = ap->a_count; @@ -291,7 +291,7 @@ nfs_putpages(ap) if ((nmp->nm_flag & NFSMNT_NFSV3) != 0 && (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) { - (void)nfs_fsinfo(nmp, vp, cred, p); + (void)nfs_fsinfo(nmp, vp, cred, td); } for (i = 0; i < npages; i++) { @@ -327,7 +327,7 @@ nfs_putpages(ap) uio.uio_resid = count; uio.uio_segflg = UIO_SYSSPACE; uio.uio_rw = UIO_WRITE; - uio.uio_procp = p; + uio.uio_td = td; if ((ap->a_sync & VM_PAGER_PUT_SYNC) == 0) iomode = NFSV3WRITE_UNSTABLE; @@ -366,7 +366,7 @@ nfs_bioread(vp, uio, ioflag, cred) register int biosize, i; struct buf *bp = 0, *rabp; struct vattr vattr; - struct proc *p; + struct thread *td; struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn, rabn; int bcount; @@ -381,11 +381,11 @@ nfs_bioread(vp, uio, ioflag, cred) return (0); if (uio->uio_offset < 0) /* XXX VDIR cookies can be negative */ return (EINVAL); - p = uio->uio_procp; + td = uio->uio_td; if ((nmp->nm_flag & NFSMNT_NFSV3) != 0 && (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) - (void)nfs_fsinfo(nmp, vp, cred, p); + (void)nfs_fsinfo(nmp, vp, cred, td); if (vp->v_type != VDIR && (uio->uio_offset + uio->uio_resid) > nmp->nm_maxfilesize) return (EFBIG); @@ -414,23 +414,23 @@ nfs_bioread(vp, uio, ioflag, cred) if (vp->v_type != VDIR) panic("nfs: bioread, not dir"); nfs_invaldir(vp); - error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) return (error); } np->n_attrstamp = 0; - error = VOP_GETATTR(vp, &vattr, cred, p); + error = VOP_GETATTR(vp, &vattr, cred, td); if (error) return (error); np->n_mtime = vattr.va_mtime.tv_sec; } else { - error = VOP_GETATTR(vp, &vattr, cred, p); + error = VOP_GETATTR(vp, &vattr, cred, td); if (error) return (error); if (np->n_mtime != vattr.va_mtime.tv_sec) { if (vp->v_type == VDIR) nfs_invaldir(vp); - error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) return (error); np->n_mtime = vattr.va_mtime.tv_sec; @@ -445,7 +445,7 @@ nfs_bioread(vp, uio, ioflag, cred) if (nmp->nm_flag & NFSMNT_NQNFS) { if (NQNFS_CKINVALID(vp, np, ND_READ)) { do { - error = nqnfs_getlease(vp, ND_READ, cred, p); + error = nqnfs_getlease(vp, ND_READ, cred, td); } while (error == NQNFS_EXPIRED); if (error) return (error); @@ -454,14 +454,14 @@ nfs_bioread(vp, uio, ioflag, cred) ((np->n_flag & NMODIFIED) && vp->v_type == VDIR)) { if (vp->v_type == VDIR) nfs_invaldir(vp); - error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) return (error); np->n_brev = np->n_lrev; } } else if (vp->v_type == VDIR && (np->n_flag & NMODIFIED)) { nfs_invaldir(vp); - error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) return (error); } @@ -493,14 +493,14 @@ nfs_bioread(vp, uio, ioflag, cred) (off_t)(lbn + 1 + nra) * biosize < np->n_size; nra++) { rabn = lbn + 1 + nra; if (!incore(vp, rabn)) { - rabp = nfs_getcacheblk(vp, rabn, biosize, p); + rabp = nfs_getcacheblk(vp, rabn, biosize, td); if (!rabp) return (EINTR); if ((rabp->b_flags & (B_CACHE|B_DELWRI)) == 0) { rabp->b_flags |= B_ASYNC; rabp->b_iocmd = BIO_READ; vfs_busy_pages(rabp, 0); - if (nfs_asyncio(rabp, cred, p)) { + if (nfs_asyncio(rabp, cred, td)) { rabp->b_flags |= B_INVAL; rabp->b_ioflags |= BIO_ERROR; vfs_unbusy_pages(rabp); @@ -534,7 +534,7 @@ again: bcount = np->n_size - (off_t)lbn * biosize; } if (bcount != biosize) { - switch(nfs_rslock(np, p)) { + switch(nfs_rslock(np, td)) { case ENOLCK: goto again; /* not reached */ @@ -547,10 +547,10 @@ again: } } - bp = nfs_getcacheblk(vp, lbn, bcount, p); + bp = nfs_getcacheblk(vp, lbn, bcount, td); if (bcount != biosize) - nfs_rsunlock(np, p); + nfs_rsunlock(np, td); if (!bp) return (EINTR); @@ -562,7 +562,7 @@ again: if ((bp->b_flags & B_CACHE) == 0) { bp->b_iocmd = BIO_READ; vfs_busy_pages(bp, 0); - error = nfs_doio(bp, cred, p); + error = nfs_doio(bp, cred, td); if (error) { brelse(bp); return (error); @@ -583,13 +583,13 @@ again: break; case VLNK: nfsstats.biocache_readlinks++; - bp = nfs_getcacheblk(vp, (daddr_t)0, NFS_MAXPATHLEN, p); + bp = nfs_getcacheblk(vp, (daddr_t)0, NFS_MAXPATHLEN, td); if (!bp) return (EINTR); if ((bp->b_flags & B_CACHE) == 0) { bp->b_iocmd = BIO_READ; vfs_busy_pages(bp, 0); - error = nfs_doio(bp, cred, p); + error = nfs_doio(bp, cred, td); if (error) { bp->b_ioflags |= BIO_ERROR; brelse(bp); @@ -607,20 +607,20 @@ again: } lbn = (uoff_t)uio->uio_offset / NFS_DIRBLKSIZ; on = uio->uio_offset & (NFS_DIRBLKSIZ - 1); - bp = nfs_getcacheblk(vp, lbn, NFS_DIRBLKSIZ, p); + bp = nfs_getcacheblk(vp, lbn, NFS_DIRBLKSIZ, td); if (!bp) return (EINTR); if ((bp->b_flags & B_CACHE) == 0) { bp->b_iocmd = BIO_READ; vfs_busy_pages(bp, 0); - error = nfs_doio(bp, cred, p); + error = nfs_doio(bp, cred, td); if (error) { brelse(bp); } while (error == NFSERR_BAD_COOKIE) { printf("got bad cookie vp %p bp %p\n", vp, bp); nfs_invaldir(vp); - error = nfs_vinvalbuf(vp, 0, cred, p, 1); + error = nfs_vinvalbuf(vp, 0, cred, td, 1); /* * Yuck! The directory has been modified on the * server. The only way to get the block is by @@ -635,13 +635,13 @@ again: if (np->n_direofoffset && (i * NFS_DIRBLKSIZ) >= np->n_direofoffset) return (0); - bp = nfs_getcacheblk(vp, i, NFS_DIRBLKSIZ, p); + bp = nfs_getcacheblk(vp, i, NFS_DIRBLKSIZ, td); if (!bp) return (EINTR); if ((bp->b_flags & B_CACHE) == 0) { bp->b_iocmd = BIO_READ; vfs_busy_pages(bp, 0); - error = nfs_doio(bp, cred, p); + error = nfs_doio(bp, cred, td); /* * no error + B_INVAL == directory EOF, * use the block. @@ -679,13 +679,13 @@ again: (lbn + 1) * NFS_DIRBLKSIZ < np->n_direofoffset) && !(np->n_flag & NQNFSNONCACHE) && !incore(vp, lbn + 1)) { - rabp = nfs_getcacheblk(vp, lbn + 1, NFS_DIRBLKSIZ, p); + rabp = nfs_getcacheblk(vp, lbn + 1, NFS_DIRBLKSIZ, td); if (rabp) { if ((rabp->b_flags & (B_CACHE|B_DELWRI)) == 0) { rabp->b_flags |= B_ASYNC; rabp->b_iocmd = BIO_READ; vfs_busy_pages(rabp, 0); - if (nfs_asyncio(rabp, cred, p)) { + if (nfs_asyncio(rabp, cred, td)) { rabp->b_flags |= B_INVAL; rabp->b_ioflags |= BIO_ERROR; vfs_unbusy_pages(rabp); @@ -756,7 +756,7 @@ nfs_write(ap) { int biosize; struct uio *uio = ap->a_uio; - struct proc *p = uio->uio_procp; + struct thread *td = uio->uio_td; struct vnode *vp = ap->a_vp; struct nfsnode *np = VTONFS(vp); struct ucred *cred = ap->a_cred; @@ -768,13 +768,14 @@ nfs_write(ap) int bcount; int n, on, error = 0, iomode, must_commit; int haverslock = 0; + struct proc *p = td?td->td_proc:NULL; GIANT_REQUIRED; #ifdef DIAGNOSTIC if (uio->uio_rw != UIO_WRITE) panic("nfs_write mode"); - if (uio->uio_segflg == UIO_USERSPACE && uio->uio_procp != curproc) + if (uio->uio_segflg == UIO_USERSPACE && uio->uio_td != curthread) panic("nfs_write proc"); #endif if (vp->v_type != VREG) @@ -785,7 +786,7 @@ nfs_write(ap) } if ((nmp->nm_flag & NFSMNT_NFSV3) != 0 && (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) - (void)nfs_fsinfo(nmp, vp, cred, p); + (void)nfs_fsinfo(nmp, vp, cred, td); /* * Synchronously flush pending buffers if we are in synchronous @@ -794,7 +795,7 @@ nfs_write(ap) if (ioflag & (IO_APPEND | IO_SYNC)) { if (np->n_flag & NMODIFIED) { np->n_attrstamp = 0; - error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) return (error); } @@ -807,7 +808,7 @@ nfs_write(ap) restart: if (ioflag & IO_APPEND) { np->n_attrstamp = 0; - error = VOP_GETATTR(vp, &vattr, cred, p); + error = VOP_GETATTR(vp, &vattr, cred, td); if (error) return (error); uio->uio_offset = np->n_size; @@ -836,7 +837,7 @@ restart: */ if ((ioflag & IO_APPEND) || uio->uio_offset + uio->uio_resid > np->n_size) { - switch(nfs_rslock(np, p)) { + switch(nfs_rslock(np, td)) { case ENOLCK: goto restart; /* not reached */ @@ -860,7 +861,7 @@ restart: psignal(p, SIGXFSZ); PROC_UNLOCK(p); if (haverslock) - nfs_rsunlock(np, p); + nfs_rsunlock(np, td); return (EFBIG); } @@ -873,13 +874,13 @@ restart: if ((nmp->nm_flag & NFSMNT_NQNFS) && NQNFS_CKINVALID(vp, np, ND_WRITE)) { do { - error = nqnfs_getlease(vp, ND_WRITE, cred, p); + error = nqnfs_getlease(vp, ND_WRITE, cred, td); } while (error == NQNFS_EXPIRED); if (error) break; if (np->n_lrev != np->n_brev || (np->n_flag & NQNFSNONCACHE)) { - error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) break; np->n_brev = np->n_lrev; @@ -910,7 +911,7 @@ again: * readers from reading garbage. */ bcount = on; - bp = nfs_getcacheblk(vp, lbn, bcount, p); + bp = nfs_getcacheblk(vp, lbn, bcount, td); if (bp != NULL) { long save; @@ -939,7 +940,7 @@ again: bcount = np->n_size - (off_t)lbn * biosize; } - bp = nfs_getcacheblk(vp, lbn, bcount, p); + bp = nfs_getcacheblk(vp, lbn, bcount, td); if (uio->uio_offset + n > np->n_size) { np->n_size = uio->uio_offset + n; @@ -981,7 +982,7 @@ again: if ((bp->b_flags & B_CACHE) == 0) { bp->b_iocmd = BIO_READ; vfs_busy_pages(bp, 0); - error = nfs_doio(bp, cred, p); + error = nfs_doio(bp, cred, td); if (error) { brelse(bp); break; @@ -1047,7 +1048,7 @@ again: if ((nmp->nm_flag & NFSMNT_NQNFS) && NQNFS_CKINVALID(vp, np, ND_WRITE)) { do { - error = nqnfs_getlease(vp, ND_WRITE, cred, p); + error = nqnfs_getlease(vp, ND_WRITE, cred, td); } while (error == NQNFS_EXPIRED); if (error) { brelse(bp); @@ -1056,7 +1057,7 @@ again: if (np->n_lrev != np->n_brev || (np->n_flag & NQNFSNONCACHE)) { brelse(bp); - error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) break; np->n_brev = np->n_lrev; @@ -1108,7 +1109,7 @@ again: if (error) break; if (np->n_flag & NQNFSNONCACHE) { - error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) break; } @@ -1122,7 +1123,7 @@ again: } while (uio->uio_resid > 0 && n > 0); if (haverslock) - nfs_rsunlock(np, p); + nfs_rsunlock(np, td); return (error); } @@ -1143,11 +1144,11 @@ again: * its EOF. */ static struct buf * -nfs_getcacheblk(vp, bn, size, p) +nfs_getcacheblk(vp, bn, size, td) struct vnode *vp; daddr_t bn; int size; - struct proc *p; + struct thread *td; { register struct buf *bp; struct mount *mp; @@ -1159,7 +1160,7 @@ 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)) + if (nfs_sigintr(nmp, (struct nfsreq *)0, td->td_proc)) return ((struct buf *)0); bp = getblk(vp, bn, size, 0, 2 * hz); } @@ -1181,11 +1182,11 @@ nfs_getcacheblk(vp, bn, size, p) * doing the flush, just wait for completion. */ int -nfs_vinvalbuf(vp, flags, cred, p, intrflg) +nfs_vinvalbuf(vp, flags, cred, td, intrflg) struct vnode *vp; int flags; struct ucred *cred; - struct proc *p; + struct thread *td; int intrflg; { register struct nfsnode *np = VTONFS(vp); @@ -1212,7 +1213,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 *)0, td->td_proc)) return (EINTR); } @@ -1220,9 +1221,9 @@ nfs_vinvalbuf(vp, flags, cred, p, intrflg) * Now, flush as required. */ np->n_flag |= NFLUSHINPROG; - error = vinvalbuf(vp, flags, cred, p, slpflag, 0); + error = vinvalbuf(vp, flags, cred, td, slpflag, 0); while (error) { - if (intrflg && nfs_sigintr(nmp, (struct nfsreq *)0, p)) { + if (intrflg && nfs_sigintr(nmp, (struct nfsreq *)0, td->td_proc)) { np->n_flag &= ~NFLUSHINPROG; if (np->n_flag & NFLUSHWANT) { np->n_flag &= ~NFLUSHWANT; @@ -1230,7 +1231,7 @@ nfs_vinvalbuf(vp, flags, cred, p, intrflg) } return (EINTR); } - error = vinvalbuf(vp, flags, cred, p, 0, slptimeo); + error = vinvalbuf(vp, flags, cred, td, 0, slptimeo); } np->n_flag &= ~(NMODIFIED | NFLUSHINPROG); if (np->n_flag & NFLUSHWANT) { @@ -1249,10 +1250,10 @@ nfs_vinvalbuf(vp, flags, cred, p, intrflg) * is eventually dequeued by the async daemon, nfs_doio() *will*. */ int -nfs_asyncio(bp, cred, procp) +nfs_asyncio(bp, cred, td) register struct buf *bp; struct ucred *cred; - struct proc *procp; + struct thread *td; { struct nfsmount *nmp; int i; @@ -1334,7 +1335,7 @@ again: error = tsleep(&nmp->nm_bufq, slpflag | PRIBIO, "nfsaio", slptimeo); if (error) { - if (nfs_sigintr(nmp, NULL, procp)) + if (nfs_sigintr(nmp, NULL, td->td_proc)) return (EINTR); if (slpflag == PCATCH) { slpflag = 0; @@ -1384,10 +1385,10 @@ again: * synchronously or from an nfsiod. */ int -nfs_doio(bp, cr, p) +nfs_doio(bp, cr, td) struct buf *bp; struct ucred *cr; - struct proc *p; + struct thread *td; { struct uio *uiop; struct vnode *vp; @@ -1396,6 +1397,7 @@ nfs_doio(bp, cr, p) int error = 0, iomode, must_commit = 0; struct uio uio; struct iovec io; + struct proc *p = td?td->td_proc:NULL; vp = bp->b_vp; np = VTONFS(vp); @@ -1404,7 +1406,7 @@ nfs_doio(bp, cr, p) uiop->uio_iov = &io; uiop->uio_iovcnt = 1; uiop->uio_segflg = UIO_SYSSPACE; - uiop->uio_procp = p; + uiop->uio_td = td; /* * clear BIO_ERROR and B_INVAL state prior to initiating the I/O. We @@ -1525,7 +1527,7 @@ nfs_doio(bp, cr, p) bp->b_flags |= B_WRITEINPROG; retv = nfs_commit( bp->b_vp, off, bp->b_dirtyend-bp->b_dirtyoff, - bp->b_wcred, p); + bp->b_wcred, td); bp->b_flags &= ~B_WRITEINPROG; if (retv == 0) { bp->b_dirtyoff = bp->b_dirtyend = 0; diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c index ad8891cc79ea..442512922127 100644 --- a/sys/nfs/nfs_common.c +++ b/sys/nfs/nfs_common.c @@ -554,11 +554,11 @@ extern struct nfsnodehashhead *nfsnodehashtbl; extern u_long nfsnodehash; struct nfssvc_args; -extern int nfssvc(struct proc *, struct nfssvc_args *, int *); +extern int nfssvc(struct thread *, struct nfssvc_args *, int *); LIST_HEAD(nfsnodehashhead, nfsnode); -int nfs_webnamei __P((struct nameidata *, struct vnode *, struct proc *)); +int nfs_webnamei __P((struct nameidata *, struct vnode *, struct thread *)); u_quad_t nfs_curusec() @@ -950,7 +950,7 @@ nfsm_disct(mdp, dposp, siz, left, cp2) { register struct mbuf *mp, *mp2; register int siz2, xfer; - register caddr_t p; + register caddr_t ptr; mp = *mdp; while (left == 0) { @@ -973,10 +973,10 @@ nfsm_disct(mdp, dposp, siz, left, cp2) mp->m_next = mp2; mp->m_len -= left; mp = mp2; - *cp2 = p = mtod(mp, caddr_t); - bcopy(*dposp, p, left); /* Copy what was left */ + *cp2 = ptr = mtod(mp, caddr_t); + bcopy(*dposp, ptr, left); /* Copy what was left */ siz2 = siz-left; - p += left; + ptr += left; mp2 = mp->m_next; /* Loop around copying up the siz2 bytes */ while (siz2 > 0) { @@ -984,10 +984,10 @@ nfsm_disct(mdp, dposp, siz, left, cp2) return (EBADRPC); xfer = (siz2 > mp2->m_len) ? mp2->m_len : siz2; if (xfer > 0) { - bcopy(mtod(mp2, caddr_t), p, xfer); + bcopy(mtod(mp2, caddr_t), ptr, xfer); NFSMADV(mp2, xfer); mp2->m_len -= xfer; - p += xfer; + ptr += xfer; siz2 -= xfer; } if (siz2 > 0) @@ -1464,7 +1464,7 @@ nfs_getattrcache(vp, vaper) * released by the caller. */ int -nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) +nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, td, kerbflag, pubflag) register struct nameidata *ndp; fhandle_t *fhp; int len; @@ -1473,7 +1473,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) struct mbuf **mdp; caddr_t *dposp; struct vnode **retdirp; - struct proc *p; + struct thread *td; int kerbflag, pubflag; { register int i, rem; @@ -1613,7 +1613,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) * becuase lookup() will dereference ni_startdir. */ - cnp->cn_proc = p; + cnp->cn_thread = td; VREF(dp); ndp->ni_startdir = dp; @@ -1649,7 +1649,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) * Validate symlink */ if ((cnp->cn_flags & LOCKPARENT) && ndp->ni_pathlen == 1) - VOP_UNLOCK(ndp->ni_dvp, 0, p); + VOP_UNLOCK(ndp->ni_dvp, 0, td); if (!pubflag) { error = EINVAL; goto badlink2; @@ -1670,7 +1670,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) auio.uio_offset = 0; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_SYSSPACE; - auio.uio_procp = (struct proc *)0; + auio.uio_td = (struct thread *)0; auio.uio_resid = MAXPATHLEN; error = VOP_READLINK(ndp->ni_vp, &auio, cnp->cn_cred); if (error) { @@ -1924,7 +1924,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag) int kerbflag; int pubflag; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ register struct mount *mp; register int i; struct ucred *credanon; @@ -1988,7 +1988,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag) nfsrv_object_create(*vpp); if (!lockflag) - VOP_UNLOCK(*vpp, 0, p); + VOP_UNLOCK(*vpp, 0, td); return (0); } @@ -2196,8 +2196,8 @@ nfsrv_object_create(vp) if (vp == NULL || vp->v_type != VREG) return (1); - return (vfs_object_create(vp, curproc, - curproc ? curproc->p_ucred : NULL)); + return (vfs_object_create(vp, curthread, + curthread ? curthread->td_proc->p_ucred : NULL)); } /* diff --git a/sys/nfs/nfs_lock.c b/sys/nfs/nfs_lock.c index e2fa91c1db54..b97b3b8213e6 100644 --- a/sys/nfs/nfs_lock.c +++ b/sys/nfs/nfs_lock.c @@ -87,14 +87,17 @@ nfs_dolock(ap) { LOCKD_MSG msg; struct nameidata nd; - struct proc *p; + struct thread *td; uid_t saved_uid; struct vnode *vp, *wvp; int error, error1; struct flock *fl; int fmode, ioflg; + struct proc *p; + + td = curthread; + p = td->td_proc; - p = curproc; vp = ap->a_vp; fl = ap->a_fl; @@ -148,7 +151,7 @@ nfs_dolock(ap) * complain that the user's file is missing, which isn't the case. * Note that we use proc0's cred, so the fifo is opened as root. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, _PATH_LCKFIFO, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, _PATH_LCKFIFO, td); /* * XXX Hack to temporarily allow this process (regardless of it's creds) @@ -166,15 +169,15 @@ nfs_dolock(ap) return (error == ENOENT ? EOPNOTSUPP : error); } wvp = nd.ni_vp; - VOP_UNLOCK(wvp, 0, p); /* vn_open leaves it locked */ + VOP_UNLOCK(wvp, 0, td); /* vn_open leaves it locked */ ioflg = IO_UNIT; for (;;) { - VOP_LEASE(wvp, p, proc0.p_ucred, LEASE_WRITE); + VOP_LEASE(wvp, td, proc0.p_ucred, LEASE_WRITE); error = vn_rdwr(UIO_WRITE, wvp, (caddr_t)&msg, sizeof(msg), 0, - UIO_SYSSPACE, ioflg, proc0.p_ucred, NULL, p); + UIO_SYSSPACE, ioflg, proc0.p_ucred, NULL, td); if (error && (((ioflg & IO_NDELAY) == 0) || error != EAGAIN)) { break; @@ -224,7 +227,7 @@ nfs_dolock(ap) break; } - if ((error1 = vn_close(wvp, FWRITE, proc0.p_ucred, p)) && error == 0) + if ((error1 = vn_close(wvp, FWRITE, proc0.p_ucred, td)) && error == 0) return (error1); return (error); diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c index dc21bc35eaeb..5fe3abc3bffa 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -169,7 +169,7 @@ nfs_nget(mntp, fhp, fhsize, npp) int fhsize; struct nfsnode **npp; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct nfsnode *np, *np2; struct nfsnodehashhead *nhpp; register struct vnode *vp; @@ -196,7 +196,7 @@ loop: bcmp((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize)) continue; vp = NFSTOV(np); - if (vget(vp, LK_EXCLUSIVE, p)) + if (vget(vp, LK_EXCLUSIVE, td)) goto loop; *npp = np; return(0); @@ -266,7 +266,7 @@ loop: /* * Lock the new nfsnode. */ - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); return (0); } @@ -275,12 +275,12 @@ int nfs_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct nfsnode *np; register struct sillyrename *sp; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ np = VTONFS(ap->a_vp); if (prtactive && ap->a_vp->v_usecount != 0) @@ -299,11 +299,11 @@ nfs_inactive(ap) * have our own reference. */ if (ap->a_vp->v_usecount > 0) - (void) nfs_vinvalbuf(ap->a_vp, 0, sp->s_cred, p, 1); - else if (vget(ap->a_vp, 0, p)) + (void) nfs_vinvalbuf(ap->a_vp, 0, sp->s_cred, td, 1); + else if (vget(ap->a_vp, 0, td)) panic("nfs_inactive: lost vnode"); else { - (void) nfs_vinvalbuf(ap->a_vp, 0, sp->s_cred, p, 1); + (void) nfs_vinvalbuf(ap->a_vp, 0, sp->s_cred, td, 1); vrele(ap->a_vp); } /* @@ -316,7 +316,7 @@ nfs_inactive(ap) } np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NQNFSEVICTED | NQNFSNONCACHE | NQNFSWRITE); - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); + VOP_UNLOCK(ap->a_vp, 0, ap->a_td); return (0); } @@ -459,7 +459,7 @@ int nfs_islocked(ap) struct vop_islocked_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { return VTONFS(ap->a_vp)->n_flag & NLOCKED ? 1 : 0; diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c index 55b44ba2b96f..86b5ef62e007 100644 --- a/sys/nfs/nfs_nqlease.c +++ b/sys/nfs/nfs_nqlease.c @@ -174,12 +174,12 @@ extern struct nfsstats nfsstats; * queue yet. (Ditto for the splsoftclock() and splx(s) calls) */ int -nqsrv_getlease(vp, duration, flags, slp, procp, nam, cachablep, frev, cred) +nqsrv_getlease(vp, duration, flags, slp, td, nam, cachablep, frev, cred) struct vnode *vp; u_int32_t *duration; int flags; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct sockaddr *nam; int *cachablep; u_quad_t *frev; @@ -198,7 +198,7 @@ nqsrv_getlease(vp, duration, flags, slp, procp, nam, cachablep, frev, cred) return (0); if (*duration > nqsrv_maxlease) *duration = nqsrv_maxlease; - error = VOP_GETATTR(vp, &vattr, cred, procp); + error = VOP_GETATTR(vp, &vattr, cred, td); if (error) return (error); *frev = vattr.va_filerev; @@ -340,9 +340,9 @@ doreply: * OS needs. */ void -nqnfs_lease_check(vp, p, cred, flag) +nqnfs_lease_check(vp, td, cred, flag) struct vnode *vp; - struct proc *p; + struct thread *td; struct ucred *cred; int flag; { @@ -351,14 +351,14 @@ nqnfs_lease_check(vp, p, cred, flag) u_quad_t frev; (void) nqsrv_getlease(vp, &duration, ND_CHECK | flag, NQLOCALSLP, - p, (struct sockaddr *)0, &cache, &frev, cred); + td, (struct sockaddr *)0, &cache, &frev, cred); } int nqnfs_vop_lease_check(ap) struct vop_lease_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; struct ucred *a_cred; int a_flag; } */ *ap; @@ -368,7 +368,7 @@ nqnfs_vop_lease_check(ap) u_quad_t frev; (void) nqsrv_getlease(ap->a_vp, &duration, ND_CHECK | ap->a_flag, - NQLOCALSLP, ap->a_p, (struct sockaddr *)0, + NQLOCALSLP, ap->a_td, (struct sockaddr *)0, &cache, &frev, ap->a_cred); return (0); } @@ -723,10 +723,10 @@ nqnfs_serverd() * do the real work. */ int -nqnfsrv_getlease(nfsd, slp, procp, mrq) +nqnfsrv_getlease(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -764,9 +764,9 @@ nqnfsrv_getlease(nfsd, slp, procp, mrq) vput(vp); nfsm_reply(0); } - (void) nqsrv_getlease(vp, &nfsd->nd_duration, flags, slp, procp, + (void) nqsrv_getlease(vp, &nfsd->nd_duration, flags, slp, td, nam, &cache, &frev, cred); - error = VOP_GETATTR(vp, vap, cred, procp); + error = VOP_GETATTR(vp, vap, cred, td); vput(vp); nfsm_reply(NFSX_V3FATTR + 4 * NFSX_UNSIGNED); nfsm_build(tl, u_int32_t *, 4 * NFSX_UNSIGNED); @@ -783,10 +783,10 @@ nqnfsrv_getlease(nfsd, slp, procp, mrq) * client. Find the entry and expire it. */ int -nqnfsrv_vacated(nfsd, slp, procp, mrq) +nqnfsrv_vacated(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -861,11 +861,11 @@ nfsmout: * Client get lease rpc function. */ int -nqnfs_getlease(vp, rwflag, cred, p) +nqnfs_getlease(vp, rwflag, cred, td) register struct vnode *vp; int rwflag; struct ucred *cred; - struct proc *p; + struct thread *td; { register u_int32_t *tl; register caddr_t cp; @@ -887,7 +887,7 @@ nqnfs_getlease(vp, rwflag, cred, p) *tl++ = txdr_unsigned(rwflag); *tl = txdr_unsigned(nmp->nm_leaseterm); reqtime = time_second; - nfsm_request(vp, NQNFSPROC_GETLEASE, p, cred); + nfsm_request(vp, NQNFSPROC_GETLEASE, td, cred); np = VTONFS(vp); nfsm_dissect(tl, u_int32_t *, 4 * NFSX_UNSIGNED); cachable = fxdr_unsigned(int, *tl++); @@ -1018,13 +1018,13 @@ nqnfs_callback(nmp, mrep, md, dpos) * the list asynchronously. */ int -nqnfs_clientd(nmp, cred, ncd, flag, argp, p) +nqnfs_clientd(nmp, cred, ncd, flag, argp, td) register struct nfsmount *nmp; struct ucred *cred; struct nfsd_cargs *ncd; int flag; caddr_t argp; - struct proc *p; + struct thread *td; { register struct nfsnode *np; struct vnode *vp; @@ -1078,7 +1078,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p) myrep.r_flags = R_GETONEREP; myrep.r_nmp = nmp; myrep.r_mrep = (struct mbuf *)0; - myrep.r_procp = (struct proc *)0; + myrep.r_td = (struct thread *)0; (void) nfs_reply(&myrep); } @@ -1091,7 +1091,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p) vp = NFSTOV(np); vpid = vp->v_id; if (np->n_expiry < time_second) { - if (vget(vp, LK_EXCLUSIVE, p) == 0) { + if (vget(vp, LK_EXCLUSIVE, td) == 0) { nmp->nm_inprog = vp; if (vpid == vp->v_id) { TAILQ_REMOVE(&nmp->nm_timerhead, np, n_timer); @@ -1102,12 +1102,12 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p) nfs_invaldir(vp); cache_purge(vp); (void) nfs_vinvalbuf(vp, - V_SAVE, cred, p, 0); + V_SAVE, cred, td, 0); np->n_flag &= ~NQNFSEVICTED; (void) nqnfs_vacated(vp, cred); } else if (vp->v_type == VREG) { (void) VOP_FSYNC(vp, cred, - MNT_WAIT, p); + MNT_WAIT, td); np->n_flag &= ~NMODIFIED; } } @@ -1119,10 +1119,10 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p) if ((np->n_flag & (NQNFSWRITE | NQNFSNONCACHE)) == NQNFSWRITE && !TAILQ_EMPTY(&vp->v_dirtyblkhd) && - vget(vp, LK_EXCLUSIVE, p) == 0) { + vget(vp, LK_EXCLUSIVE, td) == 0) { nmp->nm_inprog = vp; if (vpid == vp->v_id && - nqnfs_getlease(vp, ND_WRITE, cred, p)==0) + nqnfs_getlease(vp, ND_WRITE, cred, td)==0) np->n_brev = np->n_lrev; vput(vp); nmp->nm_inprog = NULLVP; @@ -1151,7 +1151,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p) error = tsleep((caddr_t)&nmp->nm_authstr, PSOCK | PCATCH, "nqnfstimr", hz / 3); if (error == EINTR || error == ERESTART) - (void) dounmount(nmp->nm_mountp, 0, p); + (void) dounmount(nmp->nm_mountp, 0, td); } } @@ -1180,7 +1180,7 @@ void nqnfs_lease_updatetime(deltat) register int deltat; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct nqlease *lp; struct nfsnode *np; struct mount *mp, *nxtmp; @@ -1200,7 +1200,7 @@ nqnfs_lease_updatetime(deltat) */ mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nxtmp) { - if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx, p)) { + if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx, td)) { nxtmp = TAILQ_NEXT(mp, mnt_list); continue; } @@ -1214,7 +1214,7 @@ nqnfs_lease_updatetime(deltat) } mtx_lock(&mountlist_mtx); nxtmp = TAILQ_NEXT(mp, mnt_list); - vfs_unbusy(mp, p); + vfs_unbusy(mp, td); } mtx_unlock(&mountlist_mtx); } diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index e015d1795fcd..0469388ef24e 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -145,7 +145,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks, 0, "") SYSCTL_INT(_vfs_nfs, OID_AUTO, commit_miss, CTLFLAG_RW, &nfs_commit_miss, 0, ""); static int nfsrv_access __P((struct vnode *,int,struct ucred *,int, - struct proc *, int)); + struct thread *, int)); static void nfsrvw_coalesce __P((struct nfsrv_descript *, struct nfsrv_descript *)); @@ -168,10 +168,10 @@ ndclear(struct nameidata *nd) * nfs v3 access service */ int -nfsrv3_access(nfsd, slp, procp, mrq) +nfsrv3_access(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -208,7 +208,7 @@ nfsrv3_access(nfsd, slp, procp, mrq) } nfsmode = fxdr_unsigned(u_int32_t, *tl); if ((nfsmode & NFSV3ACCESS_READ) && - nfsrv_access(vp, VREAD, cred, rdonly, procp, 0)) + nfsrv_access(vp, VREAD, cred, rdonly, td, 0)) nfsmode &= ~NFSV3ACCESS_READ; if (vp->v_type == VDIR) testmode = (NFSV3ACCESS_MODIFY | NFSV3ACCESS_EXTEND | @@ -216,16 +216,16 @@ nfsrv3_access(nfsd, slp, procp, mrq) else testmode = (NFSV3ACCESS_MODIFY | NFSV3ACCESS_EXTEND); if ((nfsmode & testmode) && - nfsrv_access(vp, VWRITE, cred, rdonly, procp, 0)) + nfsrv_access(vp, VWRITE, cred, rdonly, td, 0)) nfsmode &= ~testmode; if (vp->v_type == VDIR) testmode = NFSV3ACCESS_LOOKUP; else testmode = NFSV3ACCESS_EXECUTE; if ((nfsmode & testmode) && - nfsrv_access(vp, VEXEC, cred, rdonly, procp, 0)) + nfsrv_access(vp, VEXEC, cred, rdonly, td, 0)) nfsmode &= ~testmode; - getret = VOP_GETATTR(vp, vap, cred, procp); + getret = VOP_GETATTR(vp, vap, cred, td); vput(vp); vp = NULL; nfsm_reply(NFSX_POSTOPATTR(1) + NFSX_UNSIGNED); @@ -242,10 +242,10 @@ nfsmout: * nfs getattr service */ int -nfsrv_getattr(nfsd, slp, procp, mrq) +nfsrv_getattr(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -277,7 +277,7 @@ nfsrv_getattr(nfsd, slp, procp, mrq) goto nfsmout; } nqsrv_getl(vp, ND_READ); - error = VOP_GETATTR(vp, vap, cred, procp); + error = VOP_GETATTR(vp, vap, cred, td); vput(vp); vp = NULL; nfsm_reply(NFSX_FATTR(nfsd->nd_flag & ND_NFSV3)); @@ -299,10 +299,10 @@ nfsmout: * nfs setattr service */ int -nfsrv_setattr(nfsd, slp, procp, mrq) +nfsrv_setattr(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -399,7 +399,7 @@ nfsrv_setattr(nfsd, slp, procp, mrq) nqsrv_getl(vp, ND_WRITE); if (v3) { - error = preat_ret = VOP_GETATTR(vp, &preat, cred, procp); + error = preat_ret = VOP_GETATTR(vp, &preat, cred, td); if (!error && gcheck && (preat.va_ctime.tv_sec != guard.tv_sec || preat.va_ctime.tv_nsec != guard.tv_nsec)) @@ -428,11 +428,11 @@ nfsrv_setattr(nfsd, slp, procp, mrq) error = EISDIR; goto out; } else if ((error = nfsrv_access(vp, VWRITE, cred, rdonly, - procp, 0)) != 0) + td, 0)) != 0) goto out; } - error = VOP_SETATTR(vp, vap, cred, procp); - postat_ret = VOP_GETATTR(vp, vap, cred, procp); + error = VOP_SETATTR(vp, vap, cred, td); + postat_ret = VOP_GETATTR(vp, vap, cred, td); if (!error) error = postat_ret; out: @@ -462,10 +462,10 @@ nfsmout: * nfs lookup rpc */ int -nfsrv_lookup(nfsd, slp, procp, mrq) +nfsrv_lookup(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -501,7 +501,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq) nd.ni_cnd.cn_nameiop = LOOKUP; nd.ni_cnd.cn_flags = LOCKLEAF | SAVESTART; error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), pubflag); + &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), pubflag); /* * namei failure, only dirp to cleanup. Clear out garbarge from @@ -512,7 +512,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq) if (dirp) { if (v3) dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred, - procp); + td); vrele(dirp); dirp = NULL; } @@ -544,7 +544,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq) * via the original nd. Confused? You aren't alone! */ ind = nd; - VOP_UNLOCK(nd.ni_vp, 0, procp); + VOP_UNLOCK(nd.ni_vp, 0, td); ind.ni_pathlen = strlen(nfs_pub.np_index); ind.ni_cnd.cn_nameptr = ind.ni_cnd.cn_pnbuf = nfs_pub.np_index; @@ -586,7 +586,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq) if (dirp) { if (v3) dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred, - procp); + td); vrele(dirp); dirp = NULL; } @@ -624,7 +624,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq) fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; error = VFS_VPTOFH(vp, &fhp->fh_fid); if (!error) - error = VOP_GETATTR(vp, vap, cred, procp); + error = VOP_GETATTR(vp, vap, cred, td); vput(vp); ndp->ni_vp = NULL; @@ -658,10 +658,10 @@ nfsmout: * nfs readlink service */ int -nfsrv_readlink(nfsd, slp, procp, mrq) +nfsrv_readlink(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -720,7 +720,7 @@ 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_td = (struct thread *)0; error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE); if (error) { @@ -739,7 +739,7 @@ nfsrv_readlink(nfsd, slp, procp, mrq) nqsrv_getl(vp, ND_READ); error = VOP_READLINK(vp, uiop, cred); out: - getret = VOP_GETATTR(vp, &attr, cred, procp); + getret = VOP_GETATTR(vp, &attr, cred, td); vput(vp); vp = NULL; nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_UNSIGNED); @@ -771,10 +771,10 @@ nfsmout: * nfs read service */ int -nfsrv_read(nfsd, slp, procp, mrq) +nfsrv_read(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -840,10 +840,10 @@ nfsrv_read(nfsd, slp, procp, mrq) } if (!error) { nqsrv_getl(vp, ND_READ); - if ((error = nfsrv_access(vp, VREAD, cred, rdonly, procp, 1)) != 0) - error = nfsrv_access(vp, VEXEC, cred, rdonly, procp, 1); + if ((error = nfsrv_access(vp, VREAD, cred, rdonly, td, 1)) != 0) + error = nfsrv_access(vp, VEXEC, cred, rdonly, td, 1); } - getret = VOP_GETATTR(vp, vap, cred, procp); + getret = VOP_GETATTR(vp, vap, cred, td); if (!error) error = getret; if (error) { @@ -982,7 +982,7 @@ nfsrv_read(nfsd, slp, procp, mrq) off = uiop->uio_offset; nh->nh_nextr = off; FREE((caddr_t)iv2, M_TEMP); - if (error || (getret = VOP_GETATTR(vp, vap, cred, procp))) { + if (error || (getret = VOP_GETATTR(vp, vap, cred, td))) { if (!error) error = getret; m_freem(mreq); @@ -1022,10 +1022,10 @@ nfsmout: * nfs write service */ int -nfsrv_write(nfsd, slp, procp, mrq) +nfsrv_write(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -1137,7 +1137,7 @@ nfsrv_write(nfsd, slp, procp, mrq) goto nfsmout; } if (v3) - forat_ret = VOP_GETATTR(vp, &forat, cred, procp); + forat_ret = VOP_GETATTR(vp, &forat, cred, td); if (vp->v_type != VREG) { if (v3) error = EINVAL; @@ -1146,7 +1146,7 @@ nfsrv_write(nfsd, slp, procp, mrq) } if (!error) { nqsrv_getl(vp, ND_WRITE); - error = nfsrv_access(vp, VWRITE, cred, rdonly, procp, 1); + error = nfsrv_access(vp, VWRITE, cred, rdonly, td, 1); } if (error) { vput(vp); @@ -1188,13 +1188,13 @@ 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_td = (struct thread *)0; uiop->uio_offset = off; error = VOP_WRITE(vp, uiop, ioflags, cred); nfsstats.srvvop_writes++; FREE((caddr_t)iv, M_TEMP); } - aftat_ret = VOP_GETATTR(vp, vap, cred, procp); + aftat_ret = VOP_GETATTR(vp, vap, cred, td); vput(vp); vp = NULL; if (!error) @@ -1246,10 +1246,10 @@ nfsmout: * Jan. 1994. */ int -nfsrv_writegather(ndp, slp, procp, mrq) +nfsrv_writegather(ndp, slp, td, mrq) struct nfsrv_descript **ndp; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { register struct iovec *ivp; @@ -1427,7 +1427,7 @@ loop1: nfsd->nd_nam, &rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE); if (!error) { if (v3) - forat_ret = VOP_GETATTR(vp, &forat, cred, procp); + forat_ret = VOP_GETATTR(vp, &forat, cred, td); if (vp->v_type != VREG) { if (v3) error = EINVAL; @@ -1439,7 +1439,7 @@ loop1: } if (!error) { nqsrv_getl(vp, ND_WRITE); - error = nfsrv_access(vp, VWRITE, cred, rdonly, procp, 1); + error = nfsrv_access(vp, VWRITE, cred, rdonly, td, 1); } if (nfsd->nd_stable == NFSV3WRITE_UNSTABLE) @@ -1450,7 +1450,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_td = (struct thread *)0; uiop->uio_offset = nfsd->nd_off; uiop->uio_resid = nfsd->nd_eoff - nfsd->nd_off; if (uiop->uio_resid > 0) { @@ -1476,9 +1476,9 @@ loop1: } if (!error) { if (vn_start_write(vp, &mntp, V_NOWAIT) != 0) { - VOP_UNLOCK(vp, 0, procp); + VOP_UNLOCK(vp, 0, td); error = vn_start_write(NULL, &mntp, V_WAIT); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, procp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); } } if (!error) { @@ -1490,7 +1490,7 @@ loop1: } m_freem(mrep); if (vp) { - aftat_ret = VOP_GETATTR(vp, &va, cred, procp); + aftat_ret = VOP_GETATTR(vp, &va, cred, td); vput(vp); vp = NULL; } @@ -1631,10 +1631,10 @@ nfsrvw_coalesce(owp, nfsd) * now does a truncate to 0 length via. setattr if it already exists */ int -nfsrv_create(nfsd, slp, procp, mrq) +nfsrv_create(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -1696,11 +1696,11 @@ nfsrv_create(nfsd, slp, procp, mrq) * prior to calling nfsm_reply ( which might goto nfsmout ). */ error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { if (v3) { dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, - procp); + td); } else { vrele(dirp); dirp = NULL; @@ -1793,7 +1793,7 @@ nfsrv_create(nfsd, slp, procp, mrq) bcopy(cverf, (caddr_t)&vap->va_atime, NFSX_V3CREATEVERF); error = VOP_SETATTR(nd.ni_vp, vap, cred, - procp); + td); } } } else if ( @@ -1836,7 +1836,7 @@ nfsrv_create(nfsd, slp, procp, mrq) */ nd.ni_cnd.cn_nameiop = LOOKUP; nd.ni_cnd.cn_flags &= ~(LOCKPARENT); - nd.ni_cnd.cn_proc = procp; + nd.ni_cnd.cn_thread = td; nd.ni_cnd.cn_cred = cred; error = lookup(&nd); @@ -1857,14 +1857,14 @@ nfsrv_create(nfsd, slp, procp, mrq) } else { if (vap->va_size != -1) { error = nfsrv_access(nd.ni_vp, VWRITE, cred, - (nd.ni_cnd.cn_flags & RDONLY), procp, 0); + (nd.ni_cnd.cn_flags & RDONLY), td, 0); if (!error) { nqsrv_getl(nd.ni_vp, ND_WRITE); tempsize = vap->va_size; VATTR_NULL(vap); vap->va_size = tempsize; error = VOP_SETATTR(nd.ni_vp, vap, cred, - procp); + td); } } } @@ -1874,13 +1874,13 @@ nfsrv_create(nfsd, slp, procp, mrq) fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid; error = VFS_VPTOFH(nd.ni_vp, &fhp->fh_fid); if (!error) - error = VOP_GETATTR(nd.ni_vp, vap, cred, procp); + error = VOP_GETATTR(nd.ni_vp, vap, cred, td); } if (v3) { if (exclusive_flag && !error && bcmp(cverf, (caddr_t)&vap->va_atime, NFSX_V3CREATEVERF)) error = EEXIST; - diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp); + diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td); vrele(dirp); dirp = NULL; } @@ -1930,10 +1930,10 @@ nfsmout: * nfs v3 mknod service */ int -nfsrv_mknod(nfsd, slp, procp, mrq) +nfsrv_mknod(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -1986,9 +1986,9 @@ nfsrv_mknod(nfsd, slp, procp, mrq) */ error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) - dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, procp); + dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, td); if (error) { nfsm_reply(NFSX_WCCDATA(1)); nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft); @@ -2046,8 +2046,8 @@ nfsrv_mknod(nfsd, slp, procp, mrq) nd.ni_cnd.cn_nameiop = LOOKUP; nd.ni_cnd.cn_flags &= ~(LOCKPARENT); - nd.ni_cnd.cn_proc = procp; - nd.ni_cnd.cn_cred = procp->p_ucred; + nd.ni_cnd.cn_thread = td; + nd.ni_cnd.cn_cred = td->td_proc->p_ucred; error = lookup(&nd); nd.ni_dvp = NULL; @@ -2080,12 +2080,12 @@ out: fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; error = VFS_VPTOFH(vp, &fhp->fh_fid); if (!error) - error = VOP_GETATTR(vp, vap, cred, procp); + error = VOP_GETATTR(vp, vap, cred, td); vput(vp); vp = NULL; nd.ni_vp = NULL; } - diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp); + diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td); if (dirp) { vrele(dirp); dirp = NULL; @@ -2121,10 +2121,10 @@ nfsmout: * nfs remove service */ int -nfsrv_remove(nfsd, slp, procp, mrq) +nfsrv_remove(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -2169,11 +2169,11 @@ nfsrv_remove(nfsd, slp, procp, mrq) nd.ni_cnd.cn_nameiop = DELETE; nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF; error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { if (v3) { dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, - procp); + td); } else { vrele(dirp); dirp = NULL; @@ -2200,7 +2200,7 @@ out: } } if (dirp && v3) { - diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp); + diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td); vrele(dirp); dirp = NULL; } @@ -2228,10 +2228,10 @@ nfsmout: * nfs rename service */ int -nfsrv_rename(nfsd, slp, procp, mrq) +nfsrv_rename(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -2293,11 +2293,11 @@ nfsrv_rename(nfsd, slp, procp, mrq) fromnd.ni_cnd.cn_nameiop = DELETE; fromnd.ni_cnd.cn_flags = WANTPARENT | SAVESTART; error = nfs_namei(&fromnd, ffhp, len, slp, nam, &md, - &dpos, &fdirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dpos, &fdirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (fdirp) { if (v3) { fdirfor_ret = VOP_GETATTR(fdirp, &fdirfor, cred, - procp); + td); } else { vrele(fdirp); fdirp = NULL; @@ -2318,11 +2318,11 @@ nfsrv_rename(nfsd, slp, procp, mrq) tond.ni_cnd.cn_nameiop = RENAME; tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART; error = nfs_namei(&tond, tfhp, len2, slp, nam, &md, - &dpos, &tdirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dpos, &tdirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (tdirp) { if (v3) { tdirfor_ret = VOP_GETATTR(tdirp, &tdirfor, cred, - procp); + td); } else { vrele(tdirp); tdirp = NULL; @@ -2415,9 +2415,9 @@ out: out1: if (fdirp) - fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred, procp); + fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred, td); if (tdirp) - tdiraft_ret = VOP_GETATTR(tdirp, &tdiraft, cred, procp); + tdiraft_ret = VOP_GETATTR(tdirp, &tdiraft, cred, td); nfsm_reply(2 * NFSX_WCCDATA(v3)); if (v3) { nfsm_srvwcc_data(fdirfor_ret, &fdirfor, fdiraft_ret, &fdiraft); @@ -2465,10 +2465,10 @@ nfsmout: * nfs link service */ int -nfsrv_link(nfsd, slp, procp, mrq) +nfsrv_link(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -2528,11 +2528,11 @@ nfsrv_link(nfsd, slp, procp, mrq) nd.ni_cnd.cn_nameiop = CREATE; nd.ni_cnd.cn_flags = LOCKPARENT; error = nfs_namei(&nd, dfhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { if (v3) { dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, - procp); + td); } else { vrele(dirp); dirp = NULL; @@ -2560,9 +2560,9 @@ out: out1: if (v3) - getret = VOP_GETATTR(vp, &at, cred, procp); + getret = VOP_GETATTR(vp, &at, cred, td); if (dirp) - diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp); + diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td); ereply: nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_WCCDATA(v3)); if (v3) { @@ -2594,10 +2594,10 @@ nfsmout: * nfs symbolic link service */ int -nfsrv_symlink(nfsd, slp, procp, mrq) +nfsrv_symlink(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -2644,11 +2644,11 @@ nfsrv_symlink(nfsd, slp, procp, mrq) nd.ni_cnd.cn_nameiop = CREATE; nd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART; error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { if (v3) { dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, - procp); + td); } else { vrele(dirp); dirp = NULL; @@ -2670,7 +2670,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_td = (struct thread *)0; nfsm_mtouio(&io, len2); if (!v3) { nfsm_dissect(sp, struct nfsv2_sattr *, NFSX_V2SATTR); @@ -2712,7 +2712,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq) nd.ni_cnd.cn_nameiop = LOOKUP; nd.ni_cnd.cn_flags &= ~(LOCKPARENT | FOLLOW); nd.ni_cnd.cn_flags |= (NOFOLLOW | LOCKLEAF); - nd.ni_cnd.cn_proc = procp; + nd.ni_cnd.cn_thread = td; nd.ni_cnd.cn_cred = cred; error = lookup(&nd); @@ -2724,7 +2724,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq) error = VFS_VPTOFH(nd.ni_vp, &fhp->fh_fid); if (!error) error = VOP_GETATTR(nd.ni_vp, vap, cred, - procp); + td); vput(nd.ni_vp); nd.ni_vp = NULL; } @@ -2740,7 +2740,7 @@ out: pathcp = NULL; } if (dirp) { - diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp); + diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td); vrele(dirp); dirp = NULL; } @@ -2784,10 +2784,10 @@ nfsmout: * nfs mkdir service */ int -nfsrv_mkdir(nfsd, slp, procp, mrq) +nfsrv_mkdir(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -2836,11 +2836,11 @@ nfsrv_mkdir(nfsd, slp, procp, mrq) nd.ni_cnd.cn_flags = LOCKPARENT; error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { if (v3) { dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, - procp); + td); } else { vrele(dirp); dirp = NULL; @@ -2890,11 +2890,11 @@ nfsrv_mkdir(nfsd, slp, procp, mrq) fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid; error = VFS_VPTOFH(nd.ni_vp, &fhp->fh_fid); if (!error) - error = VOP_GETATTR(nd.ni_vp, vap, cred, procp); + error = VOP_GETATTR(nd.ni_vp, vap, cred, td); } out: if (dirp) - diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp); + diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td); nfsm_reply(NFSX_SRVFH(v3) + NFSX_POSTOPATTR(v3) + NFSX_WCCDATA(v3)); if (v3) { if (!error) { @@ -2935,10 +2935,10 @@ nfsmout: * nfs rmdir service */ int -nfsrv_rmdir(nfsd, slp, procp, mrq) +nfsrv_rmdir(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -2981,11 +2981,11 @@ nfsrv_rmdir(nfsd, slp, procp, mrq) nd.ni_cnd.cn_nameiop = DELETE; nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF; error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos, - &dirp, procp, (nfsd->nd_flag & ND_KERBAUTH), FALSE); + &dirp, td, (nfsd->nd_flag & ND_KERBAUTH), FALSE); if (dirp) { if (v3) { dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, - procp); + td); } else { vrele(dirp); dirp = NULL; @@ -3027,7 +3027,7 @@ out: NDFREE(&nd, NDF_ONLY_PNBUF); if (dirp) - diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp); + diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td); nfsm_reply(NFSX_WCCDATA(v3)); if (v3) { nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft); @@ -3091,10 +3091,10 @@ struct flrep { }; int -nfsrv_readdir(nfsd, slp, procp, mrq) +nfsrv_readdir(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -3163,7 +3163,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq) nqsrv_getl(vp, ND_READ); if (v3) { - error = getret = VOP_GETATTR(vp, &at, cred, procp); + error = getret = VOP_GETATTR(vp, &at, cred, td); #if 0 /* * XXX This check may be too strict for Solaris 2.5 clients. @@ -3173,7 +3173,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq) #endif } if (!error) - error = nfsrv_access(vp, VEXEC, cred, rdonly, procp, 0); + error = nfsrv_access(vp, VEXEC, cred, rdonly, td, 0); if (error) { vput(vp); vp = NULL; @@ -3182,7 +3182,7 @@ nfsrv_readdir(nfsd, slp, procp, mrq) error = 0; goto nfsmout; } - VOP_UNLOCK(vp, 0, procp); + VOP_UNLOCK(vp, 0, td); /* * end section. Allocate rbuf and continue @@ -3197,9 +3197,9 @@ again: io.uio_resid = fullsiz; io.uio_segflg = UIO_SYSSPACE; io.uio_rw = UIO_READ; - io.uio_procp = (struct proc *)0; + io.uio_td = (struct thread *)0; eofflag = 0; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, procp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (cookies) { free((caddr_t)cookies, M_TEMP); cookies = NULL; @@ -3209,11 +3209,11 @@ again: if (!cookies && !error) error = NFSERR_PERM; if (v3) { - getret = VOP_GETATTR(vp, &at, cred, procp); + getret = VOP_GETATTR(vp, &at, cred, td); if (!error) error = getret; } - VOP_UNLOCK(vp, 0, procp); + VOP_UNLOCK(vp, 0, td); if (error) { vrele(vp); vp = NULL; @@ -3384,10 +3384,10 @@ nfsmout: } int -nfsrv_readdirplus(nfsd, slp, procp, mrq) +nfsrv_readdirplus(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -3445,7 +3445,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq) error = 0; goto nfsmout; } - error = getret = VOP_GETATTR(vp, &at, cred, procp); + error = getret = VOP_GETATTR(vp, &at, cred, td); #if 0 /* * XXX This check may be too strict for Solaris 2.5 clients. @@ -3455,7 +3455,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq) #endif if (!error) { nqsrv_getl(vp, ND_READ); - error = nfsrv_access(vp, VEXEC, cred, rdonly, procp, 0); + error = nfsrv_access(vp, VEXEC, cred, rdonly, td, 0); } if (error) { vput(vp); @@ -3465,7 +3465,7 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq) error = 0; goto nfsmout; } - VOP_UNLOCK(vp, 0, procp); + VOP_UNLOCK(vp, 0, td); MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); again: iv.iov_base = rbuf; @@ -3476,17 +3476,17 @@ again: io.uio_resid = fullsiz; io.uio_segflg = UIO_SYSSPACE; io.uio_rw = UIO_READ; - io.uio_procp = (struct proc *)0; + io.uio_td = (struct thread *)0; eofflag = 0; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, procp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (cookies) { free((caddr_t)cookies, M_TEMP); cookies = NULL; } error = VOP_READDIR(vp, &io, cred, &eofflag, &ncookies, &cookies); off = (u_quad_t)io.uio_offset; - getret = VOP_GETATTR(vp, &at, cred, procp); - VOP_UNLOCK(vp, 0, procp); + getret = VOP_GETATTR(vp, &at, cred, td); + VOP_UNLOCK(vp, 0, td); if (!cookies && !error) error = NFSERR_PERM; if (!error) @@ -3603,7 +3603,7 @@ again: nvp = NULL; goto invalid; } - if (VOP_GETATTR(nvp, vap, cred, procp)) { + if (VOP_GETATTR(nvp, vap, cred, td)) { vput(nvp); nvp = NULL; goto invalid; @@ -3721,10 +3721,10 @@ nfsmout: * nfs commit service */ int -nfsrv_commit(nfsd, slp, procp, mrq) +nfsrv_commit(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -3778,7 +3778,7 @@ nfsrv_commit(nfsd, slp, procp, mrq) error = 0; goto nfsmout; } - for_ret = VOP_GETATTR(vp, &bfor, cred, procp); + for_ret = VOP_GETATTR(vp, &bfor, cred, td); if (cnt > MAX_COMMIT_COUNT) { /* @@ -3788,7 +3788,7 @@ nfsrv_commit(nfsd, slp, procp, mrq) (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) { vm_object_page_clean(vp->v_object, 0, 0, OBJPC_SYNC); } - error = VOP_FSYNC(vp, cred, MNT_WAIT, procp); + error = VOP_FSYNC(vp, cred, MNT_WAIT, td); } else { /* * Locate and synchronously write any buffers that fall @@ -3846,7 +3846,7 @@ nfsrv_commit(nfsd, slp, procp, mrq) splx(s); } - aft_ret = VOP_GETATTR(vp, &aft, cred, procp); + aft_ret = VOP_GETATTR(vp, &aft, cred, td); vput(vp); vp = NULL; ereply: @@ -3872,10 +3872,10 @@ nfsmout: * nfs statfs service */ int -nfsrv_statfs(nfsd, slp, procp, mrq) +nfsrv_statfs(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -3913,8 +3913,8 @@ nfsrv_statfs(nfsd, slp, procp, mrq) goto nfsmout; } sf = &statfs; - error = VFS_STATFS(vp->v_mount, sf, procp); - getret = VOP_GETATTR(vp, &at, cred, procp); + error = VFS_STATFS(vp->v_mount, sf, td); + getret = VOP_GETATTR(vp, &at, cred, td); vput(vp); vp = NULL; nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_STATFS(v3)); @@ -3959,10 +3959,10 @@ nfsmout: * nfs fsinfo service */ int -nfsrv_fsinfo(nfsd, slp, procp, mrq) +nfsrv_fsinfo(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -3999,10 +3999,10 @@ nfsrv_fsinfo(nfsd, slp, procp, mrq) } /* XXX Try to make a guess on the max file size. */ - VFS_STATFS(vp->v_mount, &sb, procp); + VFS_STATFS(vp->v_mount, &sb, td); maxfsize = (u_quad_t)0x80000000 * sb.f_bsize - 1; - getret = VOP_GETATTR(vp, &at, cred, procp); + getret = VOP_GETATTR(vp, &at, cred, td); vput(vp); vp = NULL; nfsm_reply(NFSX_V3POSTOPATTR + NFSX_V3FSINFO); @@ -4041,10 +4041,10 @@ nfsmout: * nfs pathconf service */ int -nfsrv_pathconf(nfsd, slp, procp, mrq) +nfsrv_pathconf(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep, *md = nfsd->nd_md; @@ -4086,7 +4086,7 @@ nfsrv_pathconf(nfsd, slp, procp, mrq) error = VOP_PATHCONF(vp, _PC_CHOWN_RESTRICTED, &chownres); if (!error) error = VOP_PATHCONF(vp, _PC_NO_TRUNC, ¬runc); - getret = VOP_GETATTR(vp, &at, cred, procp); + getret = VOP_GETATTR(vp, &at, cred, td); vput(vp); vp = NULL; nfsm_reply(NFSX_V3POSTOPATTR + NFSX_V3PATHCONF); @@ -4120,10 +4120,10 @@ nfsmout: */ /* ARGSUSED */ int -nfsrv_null(nfsd, slp, procp, mrq) +nfsrv_null(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep; @@ -4145,10 +4145,10 @@ nfsrv_null(nfsd, slp, procp, mrq) */ /* ARGSUSED */ int -nfsrv_noop(nfsd, slp, procp, mrq) +nfsrv_noop(nfsd, slp, td, mrq) struct nfsrv_descript *nfsd; struct nfssvc_sock *slp; - struct proc *procp; + struct thread *td; struct mbuf **mrq; { struct mbuf *mrep = nfsd->nd_mrep; @@ -4184,12 +4184,12 @@ nfsrv_noop(nfsd, slp, procp, mrq) * will return EPERM instead of EACCESS. EPERM is always an error. */ static int -nfsrv_access(vp, flags, cred, rdonly, p, override) +nfsrv_access(vp, flags, cred, rdonly, td, override) register struct vnode *vp; int flags; register struct ucred *cred; int rdonly; - struct proc *p; + struct thread *td; int override; { struct vattr vattr; @@ -4220,10 +4220,10 @@ nfsrv_access(vp, flags, cred, rdonly, p, override) if (vp->v_flag & VTEXT) return (ETXTBSY); } - error = VOP_GETATTR(vp, &vattr, cred, p); + error = VOP_GETATTR(vp, &vattr, cred, td); if (error) return (error); - error = VOP_ACCESS(vp, flags, cred, p); + error = VOP_ACCESS(vp, flags, cred, td); /* * Allow certain operations for the owner (reads and writes * on files that are already open). diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index 5772e4b06d5f..89916723ecbf 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -149,7 +149,7 @@ int nfsrtton = 0; struct nfsrtt nfsrtt; struct callout_handle nfs_timer_handle; -static int nfs_msg __P((struct proc *,char *,char *)); +static int nfs_msg __P((struct thread *,char *,char *)); static int nfs_rcvlock __P((struct nfsreq *)); static void nfs_rcvunlock __P((struct nfsreq *)); static void nfs_realign __P((struct mbuf **pm, int hsiz)); @@ -162,7 +162,7 @@ static int nfsrv_getstream __P((struct nfssvc_sock *,int)); int (*nfsrv3_procs[NFS_NPROCS]) __P((struct nfsrv_descript *nd, struct nfssvc_sock *slp, - struct proc *procp, + struct thread *td, struct mbuf **mreqp)) = { nfsrv_null, nfsrv_getattr, @@ -207,12 +207,12 @@ nfs_connect(nmp, rep) int pktscale; struct sockaddr *saddr; struct sockaddr_in *sin; - struct proc *p = &proc0; /* only used for socreate and sobind */ + struct thread *td = thread0; /* only used for socreate and sobind */ nmp->nm_so = (struct socket *)0; saddr = nmp->nm_nam; error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype, - nmp->nm_soproto, p); + nmp->nm_soproto, td); if (error) goto bad; so = nmp->nm_so; @@ -233,7 +233,7 @@ nfs_connect(nmp, rep) sopt.sopt_name = IP_PORTRANGE; sopt.sopt_val = (void *)&ip; sopt.sopt_valsize = sizeof(ip); - sopt.sopt_p = NULL; + sopt.sopt_td = NULL; error = sosetopt(so, &sopt); if (error) goto bad; @@ -243,7 +243,7 @@ nfs_connect(nmp, rep) sin->sin_family = AF_INET; sin->sin_addr.s_addr = INADDR_ANY; sin->sin_port = htons(0); - error = sobind(so, (struct sockaddr *)sin, p); + error = sobind(so, (struct sockaddr *)sin, td); if (error) goto bad; bzero(&sopt, sizeof sopt); @@ -253,7 +253,7 @@ nfs_connect(nmp, rep) sopt.sopt_name = IP_PORTRANGE; sopt.sopt_val = (void *)&ip; sopt.sopt_valsize = sizeof(ip); - sopt.sopt_p = NULL; + sopt.sopt_td = NULL; error = sosetopt(so, &sopt); if (error) goto bad; @@ -269,7 +269,7 @@ nfs_connect(nmp, rep) goto bad; } } else { - error = soconnect(so, nmp->nm_nam, p); + error = soconnect(so, nmp->nm_nam, td); if (error) goto bad; @@ -284,7 +284,8 @@ nfs_connect(nmp, rep) "nfscon", 2 * hz); if ((so->so_state & SS_ISCONNECTING) && so->so_error == 0 && rep && - (error = nfs_sigintr(nmp, rep, rep->r_procp)) != 0){ + (error = nfs_sigintr(nmp, rep, + (rep->r_td ? rep->r_td->td_proc : NULL))) != 0){ so->so_state &= ~SS_ISCONNECTING; splx(s); goto bad; @@ -489,7 +490,7 @@ nfs_send(so, nam, top, rep) flags = 0; error = so->so_proto->pr_usrreqs->pru_sosend(so, sendnam, 0, top, 0, - flags, curproc /*XXX*/); + flags, curthread /*XXX*/); /* * ENOBUFS for dgram sockets is transient and non fatal. * No need to log, and no need to break a soft mount. @@ -547,7 +548,7 @@ nfs_receive(rep, aname, mp) u_int32_t len; struct sockaddr **getnam; int error, sotype, rcvflg; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ /* * Set up arguments for soreceive() @@ -614,7 +615,7 @@ tryagain: auio.uio_rw = UIO_READ; auio.uio_offset = 0; auio.uio_resid = sizeof(u_int32_t); - auio.uio_procp = p; + auio.uio_td = td; do { rcvflg = MSG_WAITALL; error = so->so_proto->pr_usrreqs->pru_soreceive @@ -682,7 +683,7 @@ tryagain: * on. */ auio.uio_resid = len = 100000000; /* Anything Big */ - auio.uio_procp = p; + auio.uio_td = td; do { rcvflg = 0; error = so->so_proto->pr_usrreqs->pru_soreceive @@ -727,7 +728,7 @@ errout: else getnam = aname; auio.uio_resid = len = 1000000; - auio.uio_procp = p; + auio.uio_td = td; do { rcvflg = 0; error = so->so_proto->pr_usrreqs->pru_soreceive @@ -937,11 +938,11 @@ nfsmout: * nb: always frees up mreq mbuf list */ int -nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp) +nfs_request(vp, mrest, procnum, td, cred, mrp, mdp, dposp) struct vnode *vp; struct mbuf *mrest; int procnum; - struct proc *procp; + struct thread *td; struct ucred *cred; struct mbuf **mrp; struct mbuf **mdp; @@ -969,7 +970,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp) MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), M_NFSREQ, M_WAITOK); rep->r_nmp = nmp; rep->r_vp = vp; - rep->r_procp = procp; + rep->r_td = td; rep->r_procnum = procnum; i = 0; m = mrest; @@ -1100,7 +1101,7 @@ tryagain: * tprintf a response. */ if (!error && (rep->r_flags & R_TPRINTFMSG)) - nfs_msg(rep->r_procp, nmp->nm_mountp->mnt_stat.f_mntfromname, + nfs_msg(rep->r_td, nmp->nm_mountp->mnt_stat.f_mntfromname, "is alive again"); mrep = rep->r_mrep; md = rep->r_md; @@ -1394,14 +1395,15 @@ nfs_timer(arg) register struct nfssvc_sock *slp; u_quad_t cur_usec; #endif /* NFS_NOSERVER */ - struct proc *p = &proc0; /* XXX for credentials, will break if sleep */ + struct thread *td = thread0; /* XXX for credentials, will break if sleep */ s = splnet(); for (rep = nfs_reqq.tqh_first; rep != 0; rep = rep->r_chain.tqe_next) { nmp = rep->r_nmp; if (rep->r_mrep || (rep->r_flags & R_SOFTTERM)) continue; - if (nfs_sigintr(nmp, rep, rep->r_procp)) { + if (nfs_sigintr(nmp, rep, + (rep->r_td ? rep->r_td->td_proc : NULL))) { nfs_softterm(rep); continue; } @@ -1423,7 +1425,7 @@ nfs_timer(arg) */ if ((rep->r_flags & R_TPRINTFMSG) == 0 && rep->r_rexmit > nmp->nm_deadthresh) { - nfs_msg(rep->r_procp, + nfs_msg(rep->r_td, nmp->nm_mountp->mnt_stat.f_mntfromname, "not responding"); rep->r_flags |= R_TPRINTFMSG; @@ -1455,11 +1457,11 @@ nfs_timer(arg) if ((nmp->nm_flag & NFSMNT_NOCONN) == 0) error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, (struct sockaddr *)0, - (struct mbuf *)0, p); + (struct mbuf *)0, td); else error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, nmp->nm_nam, (struct mbuf *)0, - p); + td); if (error) { if (NFSIGNORE_SOERROR(nmp->nm_soflags, error)) so->so_error = 0; @@ -1566,17 +1568,17 @@ nfs_sndlock(rep) struct nfsreq *rep; { register int *statep = &rep->r_nmp->nm_state; - struct proc *p; + struct thread *td; int slpflag = 0, slptimeo = 0; if (rep) { - p = rep->r_procp; + td = rep->r_td; if (rep->r_nmp->nm_flag & NFSMNT_INT) slpflag = PCATCH; } else - p = (struct proc *)0; + td = (struct thread *)0; while (*statep & NFSSTA_SNDLOCK) { - if (nfs_sigintr(rep->r_nmp, rep, p)) + if (nfs_sigintr(rep->r_nmp, rep, td ? td->td_proc : NULL)) return (EINTR); *statep |= NFSSTA_WANTSND; (void) tsleep((caddr_t)statep, slpflag | (PZERO - 1), @@ -1620,7 +1622,8 @@ nfs_rcvlock(rep) else slpflag = 0; while (*statep & NFSSTA_RCVLOCK) { - if (nfs_sigintr(rep->r_nmp, rep, rep->r_procp)) + if (nfs_sigintr(rep->r_nmp, rep, + (rep->r_td ? rep->r_td->td_proc : NULL))) return (EINTR); *statep |= NFSSTA_WANTRCV; (void) tsleep((caddr_t)statep, slpflag | (PZERO - 1), "nfsrcvlk", @@ -1966,12 +1969,12 @@ nfsmout: #endif static int -nfs_msg(p, server, msg) - struct proc *p; +nfs_msg(td, server, msg) + struct thread *td; char *server, *msg; { - tprintf(p, LOG_INFO, "nfs server %s: %s\n", server, msg); + tprintf(td->td_proc, LOG_INFO, "nfs server %s: %s\n", server, msg); return (0); } @@ -2005,7 +2008,7 @@ nfsrv_rcv(so, arg, waitflag) slp->ns_flag |= SLP_NEEDQ; goto dorecs; } #endif - auio.uio_procp = NULL; + auio.uio_td = NULL; if (so->so_type == SOCK_STREAM) { /* * If there are already records on the queue, defer soreceive() diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index ad8891cc79ea..442512922127 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -554,11 +554,11 @@ extern struct nfsnodehashhead *nfsnodehashtbl; extern u_long nfsnodehash; struct nfssvc_args; -extern int nfssvc(struct proc *, struct nfssvc_args *, int *); +extern int nfssvc(struct thread *, struct nfssvc_args *, int *); LIST_HEAD(nfsnodehashhead, nfsnode); -int nfs_webnamei __P((struct nameidata *, struct vnode *, struct proc *)); +int nfs_webnamei __P((struct nameidata *, struct vnode *, struct thread *)); u_quad_t nfs_curusec() @@ -950,7 +950,7 @@ nfsm_disct(mdp, dposp, siz, left, cp2) { register struct mbuf *mp, *mp2; register int siz2, xfer; - register caddr_t p; + register caddr_t ptr; mp = *mdp; while (left == 0) { @@ -973,10 +973,10 @@ nfsm_disct(mdp, dposp, siz, left, cp2) mp->m_next = mp2; mp->m_len -= left; mp = mp2; - *cp2 = p = mtod(mp, caddr_t); - bcopy(*dposp, p, left); /* Copy what was left */ + *cp2 = ptr = mtod(mp, caddr_t); + bcopy(*dposp, ptr, left); /* Copy what was left */ siz2 = siz-left; - p += left; + ptr += left; mp2 = mp->m_next; /* Loop around copying up the siz2 bytes */ while (siz2 > 0) { @@ -984,10 +984,10 @@ nfsm_disct(mdp, dposp, siz, left, cp2) return (EBADRPC); xfer = (siz2 > mp2->m_len) ? mp2->m_len : siz2; if (xfer > 0) { - bcopy(mtod(mp2, caddr_t), p, xfer); + bcopy(mtod(mp2, caddr_t), ptr, xfer); NFSMADV(mp2, xfer); mp2->m_len -= xfer; - p += xfer; + ptr += xfer; siz2 -= xfer; } if (siz2 > 0) @@ -1464,7 +1464,7 @@ nfs_getattrcache(vp, vaper) * released by the caller. */ int -nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) +nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, td, kerbflag, pubflag) register struct nameidata *ndp; fhandle_t *fhp; int len; @@ -1473,7 +1473,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) struct mbuf **mdp; caddr_t *dposp; struct vnode **retdirp; - struct proc *p; + struct thread *td; int kerbflag, pubflag; { register int i, rem; @@ -1613,7 +1613,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) * becuase lookup() will dereference ni_startdir. */ - cnp->cn_proc = p; + cnp->cn_thread = td; VREF(dp); ndp->ni_startdir = dp; @@ -1649,7 +1649,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) * Validate symlink */ if ((cnp->cn_flags & LOCKPARENT) && ndp->ni_pathlen == 1) - VOP_UNLOCK(ndp->ni_dvp, 0, p); + VOP_UNLOCK(ndp->ni_dvp, 0, td); if (!pubflag) { error = EINVAL; goto badlink2; @@ -1670,7 +1670,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag) auio.uio_offset = 0; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_SYSSPACE; - auio.uio_procp = (struct proc *)0; + auio.uio_td = (struct thread *)0; auio.uio_resid = MAXPATHLEN; error = VOP_READLINK(ndp->ni_vp, &auio, cnp->cn_cred); if (error) { @@ -1924,7 +1924,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag) int kerbflag; int pubflag; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ register struct mount *mp; register int i; struct ucred *credanon; @@ -1988,7 +1988,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag) nfsrv_object_create(*vpp); if (!lockflag) - VOP_UNLOCK(*vpp, 0, p); + VOP_UNLOCK(*vpp, 0, td); return (0); } @@ -2196,8 +2196,8 @@ nfsrv_object_create(vp) if (vp == NULL || vp->v_type != VREG) return (1); - return (vfs_object_create(vp, curproc, - curproc ? curproc->p_ucred : NULL)); + return (vfs_object_create(vp, curthread, + curthread ? curthread->td_proc->p_ucred : NULL)); } /* diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index e378cc52ad59..657f299cf70e 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -78,7 +78,7 @@ static MALLOC_DEFINE(M_NFSSVC, "NFS srvsock", "Nfs server structure"); /* Global defs. */ extern int32_t (*nfsrv3_procs[NFS_NPROCS]) __P((struct nfsrv_descript *nd, struct nfssvc_sock *slp, - struct proc *procp, + struct thread *td, struct mbuf **mreqp)); extern int nfs_numasync; extern time_t nqnfsstarttime; @@ -92,7 +92,7 @@ static int nuidhash_max = NFS_MAXUIDHASH; #ifndef NFS_NOSERVER static void nfsrv_zapsock __P((struct nfssvc_sock *slp)); #endif -static int nfssvc_iod __P((struct proc *)); +static int nfssvc_iod __P((struct thread *)); #define TRUE 1 #define FALSE 0 @@ -110,8 +110,9 @@ static int modify_flag = 0; static void nfsd_rt __P((int sotype, struct nfsrv_descript *nd, int cacherep)); static int nfssvc_addsock __P((struct file *, struct sockaddr *, - struct proc *)); -static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *)); + struct thread *)); +static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t, + struct thread *)); static int nfs_privport = 0; SYSCTL_INT(_vfs_nfs, NFS_NFSPRIVPORT, nfs_privport, CTLFLAG_RW, &nfs_privport, 0, ""); @@ -140,8 +141,8 @@ struct nfssvc_args { * MPSAFE */ int -nfssvc(p, uap) - struct proc *p; +nfssvc(td, uap) + struct thread *td; register struct nfssvc_args *uap; { #ifndef NFS_NOSERVER @@ -165,13 +166,13 @@ nfssvc(p, uap) error = copyin(uap->argp, &la, sizeof(la)); if (error == 0) - error = nfslockdans(p, &la); + error = nfslockdans(td->td_proc, &la); goto done2; } /* * Must be super user */ - error = suser(p); + error = suser_td(td); if (error) goto done2; while (nfssvc_sockhead_flag & SLP_INIT) { @@ -179,7 +180,7 @@ nfssvc(p, uap) (void) tsleep((caddr_t)&nfssvc_sockhead, PSOCK, "nfsd init", 0); } if (uap->flag & NFSSVC_BIOD) - error = nfssvc_iod(p); + error = nfssvc_iod(td); #ifdef NFS_NOSERVER else error = ENXIO; @@ -189,7 +190,7 @@ nfssvc(p, uap) if (error) goto done2; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, - ncd.ncd_dirp, p); + ncd.ncd_dirp, td); error = namei(&nd); if (error) goto done2; @@ -206,13 +207,13 @@ nfssvc(p, uap) goto done2; } nmp->nm_state |= NFSSTA_MNTD; - error = nqnfs_clientd(nmp, p->p_ucred, &ncd, uap->flag, - uap->argp, p); + error = nqnfs_clientd(nmp, td->td_proc->p_ucred, &ncd, uap->flag, + uap->argp, td); } else if (uap->flag & NFSSVC_ADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfsdarg, sizeof(nfsdarg)); if (error) goto done2; - error = holdsock(p->p_fd, nfsdarg.sock, &fp); + error = holdsock(td->td_proc->p_fd, nfsdarg.sock, &fp); if (error) goto done2; /* @@ -224,12 +225,12 @@ nfssvc(p, uap) error = getsockaddr(&nam, nfsdarg.name, nfsdarg.namelen); if (error) { - fdrop(fp, p); + fdrop(fp, td); goto done2; } } - error = nfssvc_addsock(fp, nam, p); - fdrop(fp, p); + error = nfssvc_addsock(fp, nam, td); + fdrop(fp, td); } else { error = copyin(uap->argp, (caddr_t)nsd, sizeof (*nsd)); if (error) @@ -327,7 +328,7 @@ nfssvc(p, uap) } if ((uap->flag & NFSSVC_AUTHINFAIL) && (nfsd = nsd->nsd_nfsd)) nfsd->nfsd_flag |= NFSD_AUTHFAIL; - error = nfssvc_nfsd(nsd, uap->argp, p); + error = nfssvc_nfsd(nsd, uap->argp, td); } #endif /* NFS_NOSERVER */ if (error == EINTR || error == ERESTART) @@ -342,10 +343,10 @@ done2: * Adds a socket to the list for servicing by nfsds. */ static int -nfssvc_addsock(fp, mynam, p) +nfssvc_addsock(fp, mynam, td) struct file *fp; struct sockaddr *mynam; - struct proc *p; + struct thread *td; { register int siz; register struct nfssvc_sock *slp; @@ -439,10 +440,10 @@ nfssvc_addsock(fp, mynam, p) * until it is killed by a signal. */ static int -nfssvc_nfsd(nsd, argp, p) +nfssvc_nfsd(nsd, argp, td) struct nfsd_srvargs *nsd; caddr_t argp; - struct proc *p; + struct thread *td; { register int siz; register struct nfssvc_sock *slp; @@ -461,7 +462,7 @@ nfssvc_nfsd(nsd, argp, p) nsd->nsd_nfsd = nfsd = (struct nfsd *) malloc(sizeof (struct nfsd), M_NFSD, M_WAITOK | M_ZERO); s = splnet(); - nfsd->nfsd_procp = p; + nfsd->nfsd_td = td; TAILQ_INSERT_TAIL(&nfsd_head, nfsd, nfsd_chain); nfs_numnfsd++; } else @@ -622,10 +623,10 @@ nfssvc_nfsd(nsd, argp, p) if (writes_todo || (nd->nd_procnum == NFSPROC_WRITE && procrastinate > 0 && !notstarted)) error = nfsrv_writegather(&nd, slp, - nfsd->nfsd_procp, &mreq); + nfsd->nfsd_td, &mreq); else error = (*(nfsrv3_procs[nd->nd_procnum]))(nd, - slp, nfsd->nfsd_procp, &mreq); + slp, nfsd->nfsd_td, &mreq); if (mreq == NULL) break; if (error != 0 && error != NFSERR_RETVOID) { @@ -757,7 +758,7 @@ nfsrv_zapsock(slp) so->so_upcall = NULL; so->so_upcallarg = NULL; soshutdown(so, 2); - closef(fp, (struct proc *)0); + closef(fp, (struct thread *)0); if (slp->ns_nam) FREE(slp->ns_nam, M_SONAME); m_freem(slp->ns_raw); @@ -935,8 +936,8 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, defect, CTLFLAG_RW, &nfs_defect, 0, ""); * Never returns unless it fails or gets killed. */ static int -nfssvc_iod(p) - struct proc *p; +nfssvc_iod(td) + struct thread *td; { register struct buf *bp; register int i, myiod; @@ -965,7 +966,7 @@ nfssvc_iod(p) && error == 0) { if (nmp) nmp->nm_bufqiods--; - nfs_iodwant[myiod] = p; + nfs_iodwant[myiod] = td->td_proc; nfs_iodmount[myiod] = NULL; error = tsleep((caddr_t)&nfs_iodwant[myiod], PWAIT | PCATCH, "nfsidl", 0); @@ -988,9 +989,9 @@ nfssvc_iod(p) wakeup(&nmp->nm_bufq); } if (bp->b_iocmd == BIO_READ) - (void) nfs_doio(bp, bp->b_rcred, (struct proc *)0); + (void) nfs_doio(bp, bp->b_rcred, (struct thread *)0); else - (void) nfs_doio(bp, bp->b_wcred, (struct proc *)0); + (void) nfs_doio(bp, bp->b_wcred, (struct thread *)0); /* * If there are more than one iod on this mount, then defect * so that the iods can be shared out fairly between the mounts @@ -1029,7 +1030,7 @@ nfs_getauth(nmp, rep, cred, auth_str, auth_len, verf_str, verf_len, key) nmp->nm_state |= NFSSTA_WANTAUTH; (void) tsleep((caddr_t)&nmp->nm_authtype, PSOCK, "nfsauth1", 2 * hz); - error = nfs_sigintr(nmp, rep, rep->r_procp); + error = nfs_sigintr(nmp, rep, rep->r_td->td_proc); if (error) { nmp->nm_state &= ~NFSSTA_WANTAUTH; return (error); @@ -1049,7 +1050,7 @@ nfs_getauth(nmp, rep, cred, auth_str, auth_len, verf_str, verf_len, key) while ((nmp->nm_state & NFSSTA_HASAUTH) == 0 && error == 0) { (void) tsleep((caddr_t)&nmp->nm_authlen, PSOCK, "nfsauth2", 2 * hz); - error = nfs_sigintr(nmp, rep, rep->r_procp); + error = nfs_sigintr(nmp, rep, rep->r_td->td_proc); } if (nmp->nm_state & NFSSTA_AUTHERR) { nmp->nm_state &= ~NFSSTA_AUTHERR; diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index bc6f3c09adb9..c70600f5c1c6 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -101,14 +101,14 @@ static void nfs_decode_args __P((struct nfsmount *nmp, static int mountnfs __P((struct nfs_args *,struct mount *, struct sockaddr *,char *,char *,struct vnode **)); static int nfs_mount __P(( struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p)); + struct nameidata *ndp, struct thread *p)); static int nfs_unmount __P(( struct mount *mp, int mntflags, - struct proc *p)); + struct thread *p)); static int nfs_root __P(( struct mount *mp, struct vnode **vpp)); static int nfs_statfs __P(( struct mount *mp, struct statfs *sbp, - struct proc *p)); + struct thread *p)); static int nfs_sync __P(( struct mount *mp, int waitfor, - struct ucred *cred, struct proc *p)); + struct ucred *cred, struct thread *p)); /* * nfs vfs operations. @@ -161,7 +161,7 @@ SYSCTL_OPAQUE(_vfs_nfs, OID_AUTO, diskless_swapaddr, CTLFLAG_RD, void nfsargs_ntoh __P((struct nfs_args *)); static int nfs_mountdiskless __P((char *, char *, int, struct sockaddr_in *, struct nfs_args *, - struct proc *, struct vnode **, + struct thread *, struct vnode **, struct mount **)); static void nfs_convert_diskless __P((void)); static void nfs_convert_oargs __P((struct nfs_args *args, @@ -241,10 +241,10 @@ nfs_convert_diskless() * nfs statfs call */ int -nfs_statfs(mp, sbp, p) +nfs_statfs(mp, sbp, td) struct mount *mp; register struct statfs *sbp; - struct proc *p; + struct thread *td; { register struct vnode *vp; register struct nfs_statfs *sfp; @@ -266,11 +266,11 @@ nfs_statfs(mp, sbp, p) return (error); vp = NFSTOV(np); if (v3 && (nmp->nm_state & NFSSTA_GOTFSINFO) == 0) - (void)nfs_fsinfo(nmp, vp, p->p_ucred, p); + (void)nfs_fsinfo(nmp, vp, td->td_proc->p_ucred, td); nfsstats.rpccnt[NFSPROC_FSSTAT]++; nfsm_reqhead(vp, NFSPROC_FSSTAT, NFSX_FH(v3)); nfsm_fhtom(vp, v3); - nfsm_request(vp, NFSPROC_FSSTAT, p, p->p_ucred); + nfsm_request(vp, NFSPROC_FSSTAT, td, td->td_proc->p_ucred); if (v3) nfsm_postop_attr(vp, retattr); if (error) { @@ -315,11 +315,11 @@ nfs_statfs(mp, sbp, p) * nfs version 3 fsinfo rpc call */ int -nfs_fsinfo(nmp, vp, cred, p) +nfs_fsinfo(nmp, vp, cred, td) register struct nfsmount *nmp; register struct vnode *vp; struct ucred *cred; - struct proc *p; + struct thread *td; { register struct nfsv3_fsinfo *fsp; register caddr_t cp; @@ -333,7 +333,7 @@ nfs_fsinfo(nmp, vp, cred, p) nfsstats.rpccnt[NFSPROC_FSINFO]++; nfsm_reqhead(vp, NFSPROC_FSINFO, NFSX_FH(1)); nfsm_fhtom(vp, 1); - nfsm_request(vp, NFSPROC_FSINFO, p, cred); + nfsm_request(vp, NFSPROC_FSINFO, td, cred); nfsm_postop_attr(vp, retattr); if (!error) { nfsm_dissect(fsp, struct nfsv3_fsinfo *, NFSX_V3FSINFO); @@ -394,7 +394,7 @@ nfs_mountroot(mp) struct nfsv3_diskless *nd = &nfsv3_diskless; struct socket *so; struct vnode *vp; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ int error, i; u_long l; char buf[128]; @@ -433,7 +433,7 @@ nfs_mountroot(mp) * Do enough of ifconfig(8) so that the critical net interface can * talk to the server. */ - error = socreate(nd->myif.ifra_addr.sa_family, &so, SOCK_DGRAM, 0, p); + error = socreate(nd->myif.ifra_addr.sa_family, &so, SOCK_DGRAM, 0, td); if (error) panic("nfs_mountroot: socreate(%04x): %d", nd->myif.ifra_addr.sa_family, error); @@ -449,12 +449,12 @@ nfs_mountroot(mp) nd->myif.ifra_name[i] >= '0' && nd->myif.ifra_name[i] <= '9'; nd->myif.ifra_name[i] ++) { - error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, p); + error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td); if(!error) break; } #endif - error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, p); + error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td); if (error) panic("nfs_mountroot: SIOCAIFADDR: %d", error); soclose(so); @@ -488,7 +488,7 @@ nfs_mountroot(mp) (l >> 8) & 0xff, (l >> 0) & 0xff,nd->root_hostnam); printf("NFS ROOT: %s\n",buf); if ((error = nfs_mountdiskless(buf, "/", MNT_RDONLY, - &nd->root_saddr, &nd->root_args, p, &vp, &mp)) != 0) { + &nd->root_saddr, &nd->root_args, td, &vp, &mp)) != 0) { if (swap_mp) { mp->mnt_vfc->vfc_refcount--; free(swap_mp, M_MOUNT); @@ -514,9 +514,9 @@ nfs_mountroot(mp) (l >> 8) & 0xff, (l >> 0) & 0xff,nd->swap_hostnam); printf("NFS SWAP: %s\n",buf); if ((error = nfs_mountdiskless(buf, "/swap", 0, - &nd->swap_saddr, &nd->swap_args, p, &vp, &swap_mp)) != 0) + &nd->swap_saddr, &nd->swap_args, td, &vp, &swap_mp)) != 0) return (error); - vfs_unbusy(swap_mp, p); + vfs_unbusy(swap_mp, td); VTONFS(vp)->n_size = VTONFS(vp)->n_vattr.va_size = nd->swap_nblks * DEV_BSIZE ; @@ -528,13 +528,13 @@ nfs_mountroot(mp) vp->v_type = VREG; vp->v_flag = 0; VREF(vp); - swaponvp(p, vp, NODEV, nd->swap_nblks); + swaponvp(td, vp, NODEV, nd->swap_nblks); } mp->mnt_flag |= MNT_ROOTFS; mp->mnt_vnodecovered = NULLVP; rootvp = vp; - vfs_unbusy(mp, p); + vfs_unbusy(mp, td); /* * This is not really an nfs issue, but it is much easier to @@ -554,13 +554,13 @@ nfs_mountroot(mp) * Internal version of mount system call for diskless setup. */ static int -nfs_mountdiskless(path, which, mountflag, sin, args, p, vpp, mpp) +nfs_mountdiskless(path, which, mountflag, sin, args, td, vpp, mpp) char *path; char *which; int mountflag; struct sockaddr_in *sin; struct nfs_args *args; - struct proc *p; + struct thread *td; struct vnode **vpp; struct mount **mpp; { @@ -581,7 +581,7 @@ nfs_mountdiskless(path, which, mountflag, sin, args, p, vpp, mpp) if ((error = mountnfs(args, mp, nam, which, path, vpp)) != 0) { printf("nfs_mountroot: mount %s on %s: %d", path, which, error); mp->mnt_vfc->vfc_refcount--; - vfs_unbusy(mp, p); + vfs_unbusy(mp, td); free(mp, M_MOUNT); FREE(nam, M_SONAME); return (error); @@ -750,12 +750,12 @@ nfs_decode_args(nmp, argp) */ /* ARGSUSED */ static int -nfs_mount(mp, path, data, ndp, p) +nfs_mount(mp, path, data, ndp, td) struct mount *mp; char *path; caddr_t data; struct nameidata *ndp; - struct proc *p; + struct thread *td; { int error; struct nfs_args args; @@ -930,12 +930,12 @@ mountnfs(argp, mp, nam, pth, hst, vpp) * Get file attributes for the mountpoint. This has the side * effect of filling in (*vpp)->v_type with the correct value. */ - VOP_GETATTR(*vpp, &attrs, curproc->p_ucred, curproc); + VOP_GETATTR(*vpp, &attrs, curthread->td_proc->p_ucred, curthread); /* * Lose the lock but keep the ref. */ - VOP_UNLOCK(*vpp, 0, curproc); + VOP_UNLOCK(*vpp, 0, curthread); return (0); bad: @@ -949,10 +949,10 @@ bad: * unmount system call */ static int -nfs_unmount(mp, mntflags, p) +nfs_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { register struct nfsmount *nmp; int error, flags = 0; @@ -1027,11 +1027,11 @@ extern int syncprt; */ /* ARGSUSED */ static int -nfs_sync(mp, waitfor, cred, p) +nfs_sync(mp, waitfor, cred, td) struct mount *mp; int waitfor; struct ucred *cred; - struct proc *p; + struct thread *td; { struct vnode *vp, *vnp; int error, allerror = 0; @@ -1059,11 +1059,11 @@ loop: mtx_lock(&mntvnode_mtx); continue; } - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) { + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) { mtx_lock(&mntvnode_mtx); goto loop; } - error = VOP_FSYNC(vp, cred, waitfor, p); + error = VOP_FSYNC(vp, cred, waitfor, td); if (error) allerror = error; vput(vp); diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 5b84741de52f..8f9ff7ddc167 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -102,8 +102,8 @@ static int nfsfifo_write __P((struct vop_write_args *)); static int nfsspec_close __P((struct vop_close_args *)); static int nfsfifo_close __P((struct vop_close_args *)); #define nfs_poll vop_nopoll -static int nfs_flush __P((struct vnode *,struct ucred *,int,struct proc *,int)); -static int nfs_setattrrpc __P((struct vnode *,struct vattr *,struct ucred *,struct proc *)); +static int nfs_flush __P((struct vnode *,struct ucred *,int,struct thread *,int)); +static int nfs_setattrrpc __P((struct vnode *,struct vattr *,struct ucred *,struct thread *)); static int nfs_lookup __P((struct vop_lookup_args *)); static int nfs_create __P((struct vop_create_args *)); static int nfs_mknod __P((struct vop_mknod_args *)); @@ -123,7 +123,7 @@ static int nfs_symlink __P((struct vop_symlink_args *)); static int nfs_readdir __P((struct vop_readdir_args *)); static int nfs_strategy __P((struct vop_strategy_args *)); static int nfs_lookitup __P((struct vnode *, const char *, int, - struct ucred *, struct proc *, struct nfsnode **)); + struct ucred *, struct thread *, struct nfsnode **)); static int nfs_sillyrename __P((struct vnode *,struct vnode *,struct componentname *)); static int nfsspec_access __P((struct vop_access_args *)); static int nfs_readlink __P((struct vop_readlink_args *)); @@ -224,11 +224,11 @@ static int nfs_mknodrpc __P((struct vnode *dvp, struct vnode **vpp, struct vattr *vap)); static int nfs_removerpc __P((struct vnode *dvp, const char *name, int namelen, - struct ucred *cred, struct proc *proc)); + struct ucred *cred, struct thread *td)); static int nfs_renamerpc __P((struct vnode *fdvp, const char *fnameptr, int fnamelen, struct vnode *tdvp, const char *tnameptr, int tnamelen, - struct ucred *cred, struct proc *proc)); + struct ucred *cred, struct thread *td)); static int nfs_renameit __P((struct vnode *sdvp, struct componentname *scnp, struct sillyrename *sp)); @@ -268,7 +268,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_misses, CTLFLAG_RD, static int nfs3_access_otw(struct vnode *vp, int wmode, - struct proc *p, + struct thread *td, struct ucred *cred) { const int v3 = 1; @@ -287,7 +287,7 @@ nfs3_access_otw(struct vnode *vp, nfsm_fhtom(vp, v3); nfsm_build(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(wmode); - nfsm_request(vp, NFSPROC_ACCESS, p, cred); + nfsm_request(vp, NFSPROC_ACCESS, td, cred); nfsm_postop_attr(vp, attrflag); if (!error) { nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); @@ -312,7 +312,7 @@ nfs_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vnode *vp = ap->a_vp; @@ -383,7 +383,7 @@ nfs_access(ap) * Either a no, or a don't know. Go to the wire. */ nfsstats.accesscache_misses++; - error = nfs3_access_otw(vp, wmode, ap->a_p,ap->a_cred); + error = nfs3_access_otw(vp, wmode, ap->a_td,ap->a_cred); if (!error) { if ((np->n_mode & mode) != mode) { error = EACCES; @@ -416,7 +416,7 @@ nfs_access(ap) auio.uio_resid = 1; auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_READ; - auio.uio_procp = ap->a_p; + auio.uio_td = ap->a_td; if (vp->v_type == VREG) error = nfs_readrpc(vp, &auio, ap->a_cred); @@ -450,7 +450,7 @@ nfs_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vnode *vp = ap->a_vp; @@ -472,14 +472,14 @@ nfs_open(ap) if (NQNFS_CKINVALID(vp, np, ND_READ)) { do { error = nqnfs_getlease(vp, ND_READ, ap->a_cred, - ap->a_p); + ap->a_td); } while (error == NQNFS_EXPIRED); if (error) return (error); if (np->n_lrev != np->n_brev || (np->n_flag & NQNFSNONCACHE)) { if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, - ap->a_p, 1)) == EINTR) + ap->a_td, 1)) == EINTR) return (error); np->n_brev = np->n_lrev; } @@ -487,24 +487,24 @@ nfs_open(ap) } else { if (np->n_flag & NMODIFIED) { if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, - ap->a_p, 1)) == EINTR) + ap->a_td, 1)) == EINTR) return (error); np->n_attrstamp = 0; if (vp->v_type == VDIR) np->n_direofoffset = 0; - error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p); + error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td); if (error) return (error); np->n_mtime = vattr.va_mtime.tv_sec; } else { - error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_p); + error = VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td); if (error) return (error); if (np->n_mtime != vattr.va_mtime.tv_sec) { if (vp->v_type == VDIR) np->n_direofoffset = 0; if ((error = nfs_vinvalbuf(vp, V_SAVE, - ap->a_cred, ap->a_p, 1)) == EINTR) + ap->a_cred, ap->a_td, 1)) == EINTR) return (error); np->n_mtime = vattr.va_mtime.tv_sec; } @@ -553,7 +553,7 @@ nfs_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vnode *vp = ap->a_vp; @@ -578,10 +578,10 @@ nfs_close(ap) * cannot clear it if we don't commit. */ int cm = nfsv3_commit_on_close ? 1 : 0; - error = nfs_flush(vp, ap->a_cred, MNT_WAIT, ap->a_p, cm); + error = nfs_flush(vp, ap->a_cred, MNT_WAIT, ap->a_td, cm); /* np->n_flag &= ~NMODIFIED; */ } else { - error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1); + error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_td, 1); } np->n_attrstamp = 0; } @@ -602,7 +602,7 @@ nfs_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vnode *vp = ap->a_vp; @@ -628,7 +628,7 @@ nfs_getattr(ap) if (v3 && nfsaccess_cache_timeout > 0) { nfsstats.accesscache_misses++; - nfs3_access_otw(vp, NFSV3ACCESS_ALL, ap->a_p, ap->a_cred); + nfs3_access_otw(vp, NFSV3ACCESS_ALL, ap->a_td, ap->a_cred); if (nfs_getattrcache(vp, ap->a_vap) == 0) return (0); } @@ -636,7 +636,7 @@ nfs_getattr(ap) nfsstats.rpccnt[NFSPROC_GETATTR]++; nfsm_reqhead(vp, NFSPROC_GETATTR, NFSX_FH(v3)); nfsm_fhtom(vp, v3); - nfsm_request(vp, NFSPROC_GETATTR, ap->a_p, ap->a_cred); + nfsm_request(vp, NFSPROC_GETATTR, ap->a_td, ap->a_cred); if (!error) { nfsm_loadattr(vp, ap->a_vap); } @@ -654,7 +654,7 @@ nfs_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vnode *vp = ap->a_vp; @@ -708,10 +708,10 @@ nfs_setattr(ap) if (np->n_flag & NMODIFIED) { if (vap->va_size == 0) error = nfs_vinvalbuf(vp, 0, - ap->a_cred, ap->a_p, 1); + ap->a_cred, ap->a_td, 1); else error = nfs_vinvalbuf(vp, V_SAVE, - ap->a_cred, ap->a_p, 1); + ap->a_cred, ap->a_td, 1); if (error) { vnode_pager_setsize(vp, np->n_size); return (error); @@ -724,9 +724,9 @@ nfs_setattr(ap) vap->va_atime.tv_sec != VNOVAL) && (np->n_flag & NMODIFIED) && vp->v_type == VREG && (error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, - ap->a_p, 1)) == EINTR) + ap->a_td, 1)) == EINTR) return (error); - error = nfs_setattrrpc(vp, vap, ap->a_cred, ap->a_p); + error = nfs_setattrrpc(vp, vap, ap->a_cred, ap->a_td); if (error && vap->va_size != VNOVAL) { np->n_size = np->n_vattr.va_size = tsize; vnode_pager_setsize(vp, np->n_size); @@ -738,11 +738,11 @@ nfs_setattr(ap) * Do an nfs setattr rpc. */ static int -nfs_setattrrpc(vp, vap, cred, procp) +nfs_setattrrpc(vp, vap, cred, td) register struct vnode *vp; register struct vattr *vap; struct ucred *cred; - struct proc *procp; + struct thread *td; { register struct nfsv2_sattr *sp; register caddr_t cp; @@ -778,7 +778,7 @@ nfs_setattrrpc(vp, vap, cred, procp) txdr_nfsv2time(&vap->va_atime, &sp->sa_atime); txdr_nfsv2time(&vap->va_mtime, &sp->sa_mtime); } - nfsm_request(vp, NFSPROC_SETATTR, procp, cred); + nfsm_request(vp, NFSPROC_SETATTR, td, cred); if (v3) { nfsm_wcc_data(vp, wccflag); } else @@ -817,7 +817,7 @@ nfs_lookup(ap) struct nfsnode *np; int lockparent, wantparent, error = 0, attrflag, fhsize; int v3 = NFS_ISV3(dvp); - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; *vpp = NULLVP; cnp->cn_flags &= ~PDIRUNLOCK; @@ -834,7 +834,7 @@ nfs_lookup(ap) struct vattr vattr; int vpid; - if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, p)) != 0) { + if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) { *vpp = NULLVP; return (error); } @@ -849,24 +849,24 @@ nfs_lookup(ap) VREF(newvp); error = 0; } else if (flags & ISDOTDOT) { - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); cnp->cn_flags |= PDIRUNLOCK; - error = vget(newvp, LK_EXCLUSIVE, p); + error = vget(newvp, LK_EXCLUSIVE, td); if (!error && lockparent && (flags & ISLASTCN)) { - error = vn_lock(dvp, LK_EXCLUSIVE, p); + error = vn_lock(dvp, LK_EXCLUSIVE, td); if (error == 0) cnp->cn_flags &= ~PDIRUNLOCK; } } else { - error = vget(newvp, LK_EXCLUSIVE, p); + error = vget(newvp, LK_EXCLUSIVE, td); if (!lockparent || error || !(flags & ISLASTCN)) { - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); cnp->cn_flags |= PDIRUNLOCK; } } if (!error) { if (vpid == newvp->v_id) { - if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, p) + if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td) && vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && @@ -878,9 +878,9 @@ nfs_lookup(ap) } vput(newvp); if (lockparent && dvp != newvp && (flags & ISLASTCN)) - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); } - error = vn_lock(dvp, LK_EXCLUSIVE, p); + error = vn_lock(dvp, LK_EXCLUSIVE, td); *vpp = NULLVP; if (error) { cnp->cn_flags |= PDIRUNLOCK; @@ -897,7 +897,7 @@ nfs_lookup(ap) NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, len, NFS_MAXNAMLEN); - nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_proc, cnp->cn_cred); + nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_thread, cnp->cn_cred); if (error) { nfsm_postop_attr(dvp, attrflag); m_freem(mrep); @@ -928,22 +928,22 @@ nfs_lookup(ap) m_freem(mrep); cnp->cn_flags |= SAVENAME; if (!lockparent) { - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); cnp->cn_flags |= PDIRUNLOCK; } return (0); } if (flags & ISDOTDOT) { - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); error = nfs_nget(dvp->v_mount, fhp, fhsize, &np); if (error) { - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); return (error); } newvp = NFSTOV(np); if (lockparent && (flags & ISLASTCN)) { - error = vn_lock(dvp, LK_EXCLUSIVE, p); + error = vn_lock(dvp, LK_EXCLUSIVE, td); if (error) { cnp->cn_flags |= PDIRUNLOCK; vput(newvp); @@ -962,7 +962,7 @@ nfs_lookup(ap) } if (!lockparent || !(flags & ISLASTCN)) { cnp->cn_flags |= PDIRUNLOCK; - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); } newvp = NFSTOV(np); } @@ -988,7 +988,7 @@ nfs_lookup(ap) if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) && (flags & ISLASTCN) && error == ENOENT) { if (!lockparent) { - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); cnp->cn_flags |= PDIRUNLOCK; } if (dvp->v_mount->mnt_flag & MNT_RDONLY) @@ -1061,7 +1061,7 @@ nfs_readlinkrpc(vp, uiop, cred) nfsstats.rpccnt[NFSPROC_READLINK]++; nfsm_reqhead(vp, NFSPROC_READLINK, NFSX_FH(v3)); nfsm_fhtom(vp, v3); - nfsm_request(vp, NFSPROC_READLINK, uiop->uio_procp, cred); + nfsm_request(vp, NFSPROC_READLINK, uiop->uio_td, cred); if (v3) nfsm_postop_attr(vp, attrflag); if (!error) { @@ -1117,7 +1117,7 @@ nfs_readrpc(vp, uiop, cred) *tl++ = txdr_unsigned(len); *tl = 0; } - nfsm_request(vp, NFSPROC_READ, uiop->uio_procp, cred); + nfsm_request(vp, NFSPROC_READ, uiop->uio_td, cred); if (v3) { nfsm_postop_attr(vp, attrflag); if (error) { @@ -1195,7 +1195,7 @@ nfs_writerpc(vp, uiop, cred, iomode, must_commit) *tl = x; /* size of this write */ } nfsm_uiotom(uiop, len); - nfsm_request(vp, NFSPROC_WRITE, uiop->uio_procp, cred); + nfsm_request(vp, NFSPROC_WRITE, uiop->uio_td, cred); if (v3) { wccflag = NFSV3_WCCCHK; nfsm_wcc_data(vp, wccflag); @@ -1288,7 +1288,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap) else { return (EOPNOTSUPP); } - if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) { + if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)) != 0) { return (error); } nfsstats.rpccnt[NFSPROC_MKNOD]++; @@ -1314,7 +1314,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap) txdr_nfsv2time(&vap->va_atime, &sp->sa_atime); txdr_nfsv2time(&vap->va_mtime, &sp->sa_mtime); } - nfsm_request(dvp, NFSPROC_MKNOD, cnp->cn_proc, cnp->cn_cred); + nfsm_request(dvp, NFSPROC_MKNOD, cnp->cn_thread, cnp->cn_cred); if (!error) { nfsm_mtofh(dvp, newvp, v3, gotvp); if (!gotvp) { @@ -1323,7 +1323,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap) newvp = (struct vnode *)0; } error = nfs_lookitup(dvp, cnp->cn_nameptr, - cnp->cn_namelen, cnp->cn_cred, cnp->cn_proc, &np); + cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread, &np); if (!error) newvp = NFSTOV(np); } @@ -1396,7 +1396,7 @@ nfs_create(ap) if (vap->va_type == VSOCK) return (nfs_mknodrpc(dvp, ap->a_vpp, cnp, vap)); - if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) { + if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)) != 0) { return (error); } if (vap->va_vaflags & VA_EXCLUSIVE) @@ -1432,7 +1432,7 @@ again: txdr_nfsv2time(&vap->va_atime, &sp->sa_atime); txdr_nfsv2time(&vap->va_mtime, &sp->sa_mtime); } - nfsm_request(dvp, NFSPROC_CREATE, cnp->cn_proc, cnp->cn_cred); + nfsm_request(dvp, NFSPROC_CREATE, cnp->cn_thread, cnp->cn_cred); if (!error) { nfsm_mtofh(dvp, newvp, v3, gotvp); if (!gotvp) { @@ -1441,7 +1441,7 @@ again: newvp = (struct vnode *)0; } error = nfs_lookitup(dvp, cnp->cn_nameptr, - cnp->cn_namelen, cnp->cn_cred, cnp->cn_proc, &np); + cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread, &np); if (!error) newvp = NFSTOV(np); } @@ -1469,7 +1469,7 @@ again: vfs_timestamp(&vap->va_mtime); if (vap->va_atime.tv_sec == VNOVAL) vap->va_atime = vap->va_mtime; - error = nfs_setattrrpc(newvp, vap, cnp->cn_cred, cnp->cn_proc); + error = nfs_setattrrpc(newvp, vap, cnp->cn_cred, cnp->cn_thread); } if (!error) { if (cnp->cn_flags & MAKEENTRY) @@ -1518,7 +1518,7 @@ nfs_remove(ap) if (vp->v_type == VDIR) error = EPERM; else if (vp->v_usecount == 1 || (np->n_sillyrename && - VOP_GETATTR(vp, &vattr, cnp->cn_cred, cnp->cn_proc) == 0 && + VOP_GETATTR(vp, &vattr, cnp->cn_cred, cnp->cn_thread) == 0 && vattr.va_nlink > 1)) { /* * Purge the name cache so that the chance of a lookup for @@ -1532,11 +1532,11 @@ nfs_remove(ap) * throw away biocache buffers, mainly to avoid * unnecessary delayed writes later. */ - error = nfs_vinvalbuf(vp, 0, cnp->cn_cred, cnp->cn_proc, 1); + error = nfs_vinvalbuf(vp, 0, cnp->cn_cred, cnp->cn_thread, 1); /* Do the rpc */ if (error != EINTR) error = nfs_removerpc(dvp, cnp->cn_nameptr, - cnp->cn_namelen, cnp->cn_cred, cnp->cn_proc); + cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread); /* * Kludge City: If the first reply to the remove rpc is lost.. * the reply to the retransmitted request will be ENOENT @@ -1560,19 +1560,19 @@ nfs_removeit(sp) { return (nfs_removerpc(sp->s_dvp, sp->s_name, sp->s_namlen, sp->s_cred, - (struct proc *)0)); + (struct thread *)0)); } /* * Nfs remove rpc, called from nfs_remove() and nfs_removeit(). */ static int -nfs_removerpc(dvp, name, namelen, cred, proc) +nfs_removerpc(dvp, name, namelen, cred, td) register struct vnode *dvp; const char *name; int namelen; struct ucred *cred; - struct proc *proc; + struct thread *td; { register u_int32_t *tl; register caddr_t cp; @@ -1587,7 +1587,7 @@ nfs_removerpc(dvp, name, namelen, cred, proc) NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(namelen)); nfsm_fhtom(dvp, v3); nfsm_strtom(name, namelen, NFS_MAXNAMLEN); - nfsm_request(dvp, NFSPROC_REMOVE, proc, cred); + nfsm_request(dvp, NFSPROC_REMOVE, td, cred); if (v3) nfsm_wcc_data(dvp, wccflag); nfsm_reqdone; @@ -1640,9 +1640,9 @@ nfs_rename(ap) * often. */ - VOP_FSYNC(fvp, fcnp->cn_cred, MNT_WAIT, fcnp->cn_proc); + VOP_FSYNC(fvp, fcnp->cn_cred, MNT_WAIT, fcnp->cn_thread); if (tvp) - VOP_FSYNC(tvp, tcnp->cn_cred, MNT_WAIT, tcnp->cn_proc); + VOP_FSYNC(tvp, tcnp->cn_cred, MNT_WAIT, tcnp->cn_thread); /* * If the tvp exists and is in use, sillyrename it before doing the @@ -1657,7 +1657,7 @@ nfs_rename(ap) error = nfs_renamerpc(fdvp, fcnp->cn_nameptr, fcnp->cn_namelen, tdvp, tcnp->cn_nameptr, tcnp->cn_namelen, tcnp->cn_cred, - tcnp->cn_proc); + tcnp->cn_thread); if (fvp->v_type == VDIR) { if (tvp != NULL && tvp->v_type == VDIR) @@ -1692,14 +1692,14 @@ nfs_renameit(sdvp, scnp, sp) register struct sillyrename *sp; { return (nfs_renamerpc(sdvp, scnp->cn_nameptr, scnp->cn_namelen, - sdvp, sp->s_name, sp->s_namlen, scnp->cn_cred, scnp->cn_proc)); + sdvp, sp->s_name, sp->s_namlen, scnp->cn_cred, scnp->cn_thread)); } /* * Do an nfs rename rpc. Called from nfs_rename() and nfs_renameit(). */ static int -nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, proc) +nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, td) register struct vnode *fdvp; const char *fnameptr; int fnamelen; @@ -1707,7 +1707,7 @@ nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, proc) const char *tnameptr; int tnamelen; struct ucred *cred; - struct proc *proc; + struct thread *td; { register u_int32_t *tl; register caddr_t cp; @@ -1725,7 +1725,7 @@ nfs_renamerpc(fdvp, fnameptr, fnamelen, tdvp, tnameptr, tnamelen, cred, proc) nfsm_strtom(fnameptr, fnamelen, NFS_MAXNAMLEN); nfsm_fhtom(tdvp, v3); nfsm_strtom(tnameptr, tnamelen, NFS_MAXNAMLEN); - nfsm_request(fdvp, NFSPROC_RENAME, proc, cred); + nfsm_request(fdvp, NFSPROC_RENAME, td, cred); if (v3) { nfsm_wcc_data(fdvp, fwccflag); nfsm_wcc_data(tdvp, twccflag); @@ -1771,7 +1771,7 @@ nfs_link(ap) * doesn't get "out of sync" with the server. * XXX There should be a better way! */ - VOP_FSYNC(vp, cnp->cn_cred, MNT_WAIT, cnp->cn_proc); + VOP_FSYNC(vp, cnp->cn_cred, MNT_WAIT, cnp->cn_thread); v3 = NFS_ISV3(vp); nfsstats.rpccnt[NFSPROC_LINK]++; @@ -1780,7 +1780,7 @@ nfs_link(ap) nfsm_fhtom(vp, v3); nfsm_fhtom(tdvp, v3); nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN); - nfsm_request(vp, NFSPROC_LINK, cnp->cn_proc, cnp->cn_cred); + nfsm_request(vp, NFSPROC_LINK, cnp->cn_thread, cnp->cn_cred); if (v3) { nfsm_postop_attr(vp, attrflag); nfsm_wcc_data(tdvp, wccflag); @@ -1852,7 +1852,7 @@ nfs_symlink(ap) * a file handle that can be converted into newvp without having * to do an extra lookup rpc. */ - nfsm_request(dvp, NFSPROC_SYMLINK, cnp->cn_proc, cnp->cn_cred); + nfsm_request(dvp, NFSPROC_SYMLINK, cnp->cn_thread, cnp->cn_cred); if (v3) { if (error == 0) nfsm_mtofh(dvp, newvp, v3, gotvp); @@ -1882,7 +1882,7 @@ nfs_symlink(ap) struct nfsnode *np = NULL; error = nfs_lookitup(dvp, cnp->cn_nameptr, cnp->cn_namelen, - cnp->cn_cred, cnp->cn_proc, &np); + cnp->cn_cred, cnp->cn_thread, &np); if (!error) newvp = NFSTOV(np); } @@ -1927,7 +1927,7 @@ nfs_mkdir(ap) struct vattr vattr; int v3 = NFS_ISV3(dvp); - if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) { + if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread)) != 0) { return (error); } len = cnp->cn_namelen; @@ -1947,7 +1947,7 @@ nfs_mkdir(ap) txdr_nfsv2time(&vap->va_atime, &sp->sa_atime); txdr_nfsv2time(&vap->va_mtime, &sp->sa_mtime); } - nfsm_request(dvp, NFSPROC_MKDIR, cnp->cn_proc, cnp->cn_cred); + nfsm_request(dvp, NFSPROC_MKDIR, cnp->cn_thread, cnp->cn_cred); if (!error) nfsm_mtofh(dvp, newvp, v3, gotvp); if (v3) @@ -1966,7 +1966,7 @@ nfs_mkdir(ap) newvp = (struct vnode *)0; } error = nfs_lookitup(dvp, cnp->cn_nameptr, len, cnp->cn_cred, - cnp->cn_proc, &np); + cnp->cn_thread, &np); if (!error) { newvp = NFSTOV(np); if (newvp->v_type != VDIR) @@ -2010,7 +2010,7 @@ nfs_rmdir(ap) NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(cnp->cn_namelen)); nfsm_fhtom(dvp, v3); nfsm_strtom(cnp->cn_nameptr, cnp->cn_namelen, NFS_MAXNAMLEN); - nfsm_request(dvp, NFSPROC_RMDIR, cnp->cn_proc, cnp->cn_cred); + nfsm_request(dvp, NFSPROC_RMDIR, cnp->cn_thread, cnp->cn_cred); if (v3) nfsm_wcc_data(dvp, wccflag); nfsm_reqdone; @@ -2056,7 +2056,7 @@ nfs_readdir(ap) nfsstats.direofcache_hits++; return (0); } - } else if (VOP_GETATTR(vp, &vattr, ap->a_cred, uio->uio_procp) == 0 && + } else if (VOP_GETATTR(vp, &vattr, ap->a_cred, uio->uio_td) == 0 && np->n_mtime == vattr.va_mtime.tv_sec) { nfsstats.direofcache_hits++; return (0); @@ -2136,7 +2136,7 @@ nfs_readdirrpc(vp, uiop, cred) *tl++ = cookie.nfsuquad[0]; } *tl = txdr_unsigned(nmp->nm_readdirsize); - nfsm_request(vp, NFSPROC_READDIR, uiop->uio_procp, cred); + nfsm_request(vp, NFSPROC_READDIR, uiop->uio_td, cred); if (v3) { nfsm_postop_attr(vp, attrflag); if (!error) { @@ -2326,7 +2326,7 @@ nfs_readdirplusrpc(vp, uiop, cred) *tl++ = dnp->n_cookieverf.nfsuquad[1]; *tl++ = txdr_unsigned(nmp->nm_readdirsize); *tl = txdr_unsigned(nmp->nm_rsize); - nfsm_request(vp, NFSPROC_READDIRPLUS, uiop->uio_procp, cred); + nfsm_request(vp, NFSPROC_READDIRPLUS, uiop->uio_td, cred); nfsm_postop_attr(vp, attrflag); if (error) { m_freem(mrep); @@ -2525,12 +2525,12 @@ nfs_sillyrename(dvp, vp, cnp) VREF(dvp); /* Fudge together a funny name */ - pid = cnp->cn_proc->p_pid; + pid = cnp->cn_thread->td_proc->p_pid; sp->s_namlen = sprintf(sp->s_name, ".nfsA%04x4.4", pid); /* 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_thread, (struct nfsnode **)0) == 0) { sp->s_name[4]++; if (sp->s_name[4] > 'z') { error = EINVAL; @@ -2541,7 +2541,7 @@ nfs_sillyrename(dvp, vp, cnp) if (error) goto bad; error = nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred, - cnp->cn_proc, &np); + cnp->cn_thread, &np); np->n_sillyrename = sp; return (0); bad: @@ -2560,12 +2560,12 @@ bad: * *npp != NULL --> update the file handle in the vnode */ static int -nfs_lookitup(dvp, name, len, cred, procp, npp) +nfs_lookitup(dvp, name, len, cred, td, npp) register struct vnode *dvp; const char *name; int len; struct ucred *cred; - struct proc *procp; + struct thread *td; struct nfsnode **npp; { register u_int32_t *tl; @@ -2584,7 +2584,7 @@ nfs_lookitup(dvp, name, len, cred, procp, npp) NFSX_FH(v3) + NFSX_UNSIGNED + nfsm_rndup(len)); nfsm_fhtom(dvp, v3); nfsm_strtom(name, len, NFS_MAXNAMLEN); - nfsm_request(dvp, NFSPROC_LOOKUP, procp, cred); + nfsm_request(dvp, NFSPROC_LOOKUP, td, cred); if (npp && !error) { nfsm_getfh(nfhp, fhlen, v3); if (*npp) { @@ -2640,12 +2640,12 @@ nfs_lookitup(dvp, name, len, cred, procp, npp) * Nfs Version 3 commit rpc */ int -nfs_commit(vp, offset, cnt, cred, procp) +nfs_commit(vp, offset, cnt, cred, td) struct vnode *vp; u_quad_t offset; int cnt; struct ucred *cred; - struct proc *procp; + struct thread *td; { register caddr_t cp; register u_int32_t *tl; @@ -2664,7 +2664,7 @@ nfs_commit(vp, offset, cnt, cred, procp) txdr_hyper(offset, tl); tl += 2; *tl = txdr_unsigned(cnt); - nfsm_request(vp, NFSPROC_COMMIT, procp, cred); + nfsm_request(vp, NFSPROC_COMMIT, td, cred); nfsm_wcc_data(vp, wccflag); if (!error) { nfsm_dissect(tl, u_int32_t *, NFSX_V3WRITEVERF); @@ -2691,7 +2691,7 @@ nfs_strategy(ap) { register struct buf *bp = ap->a_bp; struct ucred *cr; - struct proc *p; + struct thread *td; int error = 0; KASSERT(!(bp->b_flags & B_DONE), ("nfs_strategy: buffer %p unexpectedly marked B_DONE", bp)); @@ -2701,9 +2701,9 @@ nfs_strategy(ap) panic("nfs physio"); if (bp->b_flags & B_ASYNC) - p = (struct proc *)0; + td = (struct thread *)0; else - p = curproc; /* XXX */ + td = curthread; /* XXX */ if (bp->b_iocmd == BIO_READ) cr = bp->b_rcred; @@ -2716,8 +2716,8 @@ nfs_strategy(ap) * otherwise just do it ourselves. */ if ((bp->b_flags & B_ASYNC) == 0 || - nfs_asyncio(bp, NOCRED, p)) - error = nfs_doio(bp, cr, p); + nfs_asyncio(bp, NOCRED, td)) + error = nfs_doio(bp, cr, td); return (error); } @@ -2732,11 +2732,11 @@ nfs_fsync(ap) struct vnode * a_vp; struct ucred * a_cred; int a_waitfor; - struct proc * a_p; + struct thread * a_td; } */ *ap; { - return (nfs_flush(ap->a_vp, ap->a_cred, ap->a_waitfor, ap->a_p, 1)); + return (nfs_flush(ap->a_vp, ap->a_cred, ap->a_waitfor, ap->a_td, 1)); } /* @@ -2745,11 +2745,11 @@ nfs_fsync(ap) * associated with the vnode. */ static int -nfs_flush(vp, cred, waitfor, p, commit) +nfs_flush(vp, cred, waitfor, td, commit) register struct vnode *vp; struct ucred *cred; int waitfor; - struct proc *p; + struct thread *td; int commit; { register struct nfsnode *np = VTONFS(vp); @@ -2878,7 +2878,7 @@ again: */ if (wcred != NOCRED) retv = nfs_commit(vp, off, (int)(endoff - off), - wcred, p); + wcred, td); else { retv = 0; for (i = 0; i < bvecpos; i++) { @@ -2889,7 +2889,7 @@ again: size = (u_quad_t)(bp->b_dirtyend - bp->b_dirtyoff); retv = nfs_commit(vp, off, (int)size, - bp->b_wcred, p); + bp->b_wcred, td); if (retv) break; } } @@ -2949,7 +2949,7 @@ loop: panic("nfs_fsync: inconsistent lock"); if (error == ENOLCK) goto loop; - if (nfs_sigintr(nmp, (struct nfsreq *)0, p)) { + if (nfs_sigintr(nmp, (struct nfsreq *)0, td->td_proc)) { error = EINTR; goto done; } @@ -2985,7 +2985,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 *)0, td->td_proc)) { error = EINTR; goto done; } @@ -3053,10 +3053,10 @@ nfs_print(ap) * We set B_CACHE if this is a VMIO buffer. */ int -nfs_writebp(bp, force, procp) +nfs_writebp(bp, force, td) register struct buf *bp; int force; - struct proc *procp; + struct thread *td; { int s; int oldflags = bp->b_flags; @@ -3086,7 +3086,7 @@ nfs_writebp(bp, force, procp) bp->b_iocmd = BIO_WRITE; bp->b_vp->v_numoutput++; - curproc->p_stats->p_ru.ru_oublock++; + curthread->td_proc->p_stats->p_ru.ru_oublock++; splx(s); /* @@ -3127,7 +3127,7 @@ nfsspec_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vattr *vap; @@ -3161,7 +3161,7 @@ nfsspec_access(ap) if (cred->cr_uid == 0) return (0); vap = &vattr; - error = VOP_GETATTR(vp, vap, cred, ap->a_p); + error = VOP_GETATTR(vp, vap, cred, ap->a_td); if (error) return (error); /* @@ -3238,7 +3238,7 @@ nfsspec_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vnode *vp = ap->a_vp; @@ -3254,7 +3254,7 @@ nfsspec_close(ap) vattr.va_atime = np->n_atim; if (np->n_flag & NUPD) vattr.va_mtime = np->n_mtim; - (void)VOP_SETATTR(vp, &vattr, ap->a_cred, ap->a_p); + (void)VOP_SETATTR(vp, &vattr, ap->a_cred, ap->a_td); } } return (VOCALL(spec_vnodeop_p, VOFFSET(vop_close), ap)); @@ -3315,7 +3315,7 @@ nfsfifo_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vnode *vp = ap->a_vp; @@ -3337,7 +3337,7 @@ nfsfifo_close(ap) vattr.va_atime = np->n_atim; if (np->n_flag & NUPD) vattr.va_mtime = np->n_mtim; - (void)VOP_SETATTR(vp, &vattr, ap->a_cred, ap->a_p); + (void)VOP_SETATTR(vp, &vattr, ap->a_cred, ap->a_td); } } return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h index 968f39cef9bf..ba99fea47c91 100644 --- a/sys/nfs/nfsnode.h +++ b/sys/nfs/nfsnode.h @@ -171,16 +171,16 @@ extern struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON]; static __inline int -nfs_rslock(struct nfsnode *np, struct proc *p) +nfs_rslock(struct nfsnode *np, struct thread *td) { - return(lockmgr(&np->n_rslock, LK_EXCLUSIVE | LK_CANRECURSE | LK_SLEEPFAIL, NULL, p)); + return(lockmgr(&np->n_rslock, LK_EXCLUSIVE | LK_CANRECURSE | LK_SLEEPFAIL, NULL, td)); } static __inline void -nfs_rsunlock(struct nfsnode *np, struct proc *p) +nfs_rsunlock(struct nfsnode *np, struct thread *td) { - (void)lockmgr(&np->n_rslock, LK_RELEASE, NULL, p); + (void)lockmgr(&np->n_rslock, LK_RELEASE, NULL, td); } extern vop_t **fifo_nfsv2nodeop_p; diff --git a/sys/nfs/nqnfs.h b/sys/nfs/nqnfs.h index 94a8e271e356..ce8d692c5e83 100644 --- a/sys/nfs/nqnfs.h +++ b/sys/nfs/nqnfs.h @@ -146,7 +146,7 @@ struct nqm { (void) nqsrv_getlease((v), &nfsd->nd_duration, \ ((nfsd->nd_flag & ND_LEASE) ? (nfsd->nd_flag & ND_LEASE) : \ ((l) | ND_CHECK)), \ - slp, procp, nfsd->nd_nam, &cache, &frev, cred) + slp, td, nfsd->nd_nam, &cache, &frev, cred) /* * Client side macros that check for a valid lease. @@ -189,20 +189,20 @@ extern u_long nqfhhash; #define NQNFS_EXPIRED 500 #define NQNFS_TRYLATER 501 -void nqnfs_lease_check __P((struct vnode *, struct proc *, struct ucred *, int)); +void nqnfs_lease_check __P((struct vnode *, struct thread *, struct ucred *, int)); void nqnfs_lease_updatetime __P((int)); int nqsrv_getlease __P((struct vnode *, u_int32_t *, int, - struct nfssvc_sock *, struct proc *, + struct nfssvc_sock *, struct thread *, struct sockaddr *, int *, u_quad_t *, struct ucred *)); -int nqnfs_getlease __P((struct vnode *,int,struct ucred *,struct proc *)); +int nqnfs_getlease __P((struct vnode *,int,struct ucred *,struct thread *)); int nqnfs_callback __P((struct nfsmount *,struct mbuf *,struct mbuf *,caddr_t)); -int nqnfs_clientd __P((struct nfsmount *,struct ucred *,struct nfsd_cargs *,int,caddr_t,struct proc *)); +int nqnfs_clientd __P((struct nfsmount *,struct ucred *,struct nfsd_cargs *,int,caddr_t,struct thread *)); struct nfsnode; void nqnfs_clientlease __P((struct nfsmount *, struct nfsnode *, int, int, time_t, u_quad_t)); void nqnfs_serverd __P((void)); -int nqnfsrv_getlease __P((struct nfsrv_descript *, struct nfssvc_sock *, struct proc *, struct mbuf **)); -int nqnfsrv_vacated __P((struct nfsrv_descript *, struct nfssvc_sock *, struct proc *, struct mbuf **)); +int nqnfsrv_getlease __P((struct nfsrv_descript *, struct nfssvc_sock *, struct thread *, struct mbuf **)); +int nqnfsrv_vacated __P((struct nfsrv_descript *, struct nfssvc_sock *, struct thread *, struct mbuf **)); #endif #endif |