diff options
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r-- | sys/fs/nwfs/nwfs.h | 4 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_io.c | 73 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_ioctl.c | 16 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_node.c | 44 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_node.h | 2 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_subr.c | 66 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_subr.h | 28 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_vfsops.c | 69 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_vnops.c | 131 |
9 files changed, 218 insertions, 215 deletions
diff --git a/sys/fs/nwfs/nwfs.h b/sys/fs/nwfs/nwfs.h index 41b25ae..3d2a262 100644 --- a/sys/fs/nwfs/nwfs.h +++ b/sys/fs/nwfs/nwfs.h @@ -75,9 +75,9 @@ struct nwmount { int ncp_conn_logged_in(struct nwmount *); int nwfs_ioctl(struct vop_ioctl_args *ap); -int nwfs_doio(struct buf *bp, struct ucred *cr, struct proc *p); +int nwfs_doio(struct buf *bp, struct ucred *cr, struct thread *td); int nwfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, - struct proc *p, int intrflg); + struct thread *td, int intrflg); #endif /* _KERNEL */ #endif /* _NWFS_H_ */ diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c index 0529158..7325ac3 100644 --- a/sys/fs/nwfs/nwfs_io.c +++ b/sys/fs/nwfs/nwfs_io.c @@ -92,7 +92,7 @@ nwfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) { count = 0; i = uio->uio_offset / DE_SIZE; /* offset in directory */ if (i == 0) { - error = ncp_initsearch(vp, uio->uio_procp, cred); + error = ncp_initsearch(vp, uio->uio_td, cred); if (error) { NCPVNDEBUG("cannot initialize search, error=%d",error); return( error ); @@ -114,7 +114,7 @@ nwfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) { dp.d_type = DT_DIR; break; default: - error = ncp_search_for_file_or_subdir(nmp, &np->n_seq, &fattr, uio->uio_procp, cred); + error = ncp_search_for_file_or_subdir(nmp, &np->n_seq, &fattr, uio->uio_td, cred); if (error && error < 0x80) break; dp.d_fileno = fattr.dirEntNum; dp.d_type = (fattr.attributes & aDIR) ? DT_DIR : DT_REG; @@ -158,7 +158,7 @@ int nwfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred) { struct nwmount *nmp = VFSTONWFS(vp->v_mount); struct nwnode *np = VTONW(vp); - struct proc *p; + struct thread *td; struct vattr vattr; int error, biosize; @@ -170,7 +170,7 @@ nwfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred) { if (uiop->uio_offset < 0) return EINVAL; /* if (uiop->uio_offset + uiop->uio_resid > nmp->nm_maxfilesize) return (EFBIG);*/ - p = uiop->uio_procp; + td = uiop->uio_td; if (vp->v_type == VDIR) { error = nwfs_readvdir(vp, uiop, cred); return error; @@ -178,14 +178,14 @@ nwfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred) { biosize = NWFSTOCONN(nmp)->buffer_size; if (np->n_flag & NMODIFIED) { nwfs_attr_cacheremove(vp); - 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) { - error = nwfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nwfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) return (error); np->n_mtime = vattr.va_mtime.tv_sec; } @@ -203,7 +203,7 @@ nwfs_writevnode(vp, uiop, cred, ioflag) { struct nwmount *nmp = VTONWFS(vp); struct nwnode *np = VTONW(vp); - struct proc *p; + struct thread *td; /* struct vattr vattr;*/ int error = 0; @@ -215,11 +215,11 @@ nwfs_writevnode(vp, uiop, cred, ioflag) if (uiop->uio_offset < 0) return EINVAL; /* if (uiop->uio_offset + uiop->uio_resid > nmp->nm_maxfilesize) return (EFBIG);*/ - p = uiop->uio_procp; + td = uiop->uio_td; if (ioflag & (IO_APPEND | IO_SYNC)) { if (np->n_flag & NMODIFIED) { nwfs_attr_cacheremove(vp); - error = nwfs_vinvalbuf(vp, V_SAVE, cred, p, 1); + error = nwfs_vinvalbuf(vp, V_SAVE, cred, td, 1); if (error) return (error); } if (ioflag & IO_APPEND) { @@ -228,17 +228,18 @@ nwfs_writevnode(vp, uiop, cred, ioflag) * the correct size. */ #if notyet nwfs_attr_cacheremove(vp); - error = VOP_GETATTR(vp, &vattr, cred, p); + error = VOP_GETATTR(vp, &vattr, cred, td); if (error) return (error); #endif uiop->uio_offset = np->n_size; } } if (uiop->uio_resid == 0) return 0; - if (p && uiop->uio_offset + uiop->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { - PROC_LOCK(p); - psignal(p, SIGXFSZ); - PROC_UNLOCK(p); + if (td && uiop->uio_offset + uiop->uio_resid + > td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur) { + PROC_LOCK(td->td_proc); + psignal(td->td_proc, SIGXFSZ); + PROC_UNLOCK(td->td_proc); return (EFBIG); } error = ncp_write(NWFSTOCONN(nmp), &np->n_fh, uiop, cred); @@ -256,10 +257,10 @@ nwfs_writevnode(vp, uiop, cred, ioflag) * Do an I/O operation to/from a cache block. */ int -nwfs_doio(bp, cr, p) +nwfs_doio(bp, cr, td) struct buf *bp; struct ucred *cr; - struct proc *p; + struct thread *td; { struct uio *uiop; struct vnode *vp; @@ -276,7 +277,7 @@ nwfs_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; if (bp->b_iocmd == BIO_READ) { io.iov_len = uiop->uio_resid = bp->b_bcount; io.iov_base = bp->b_data; @@ -399,14 +400,14 @@ nwfs_getpages(ap) vm_offset_t kva; struct buf *bp; struct vnode *vp; - struct proc *p; + struct thread *td; struct ucred *cred; struct nwmount *nmp; struct nwnode *np; vm_page_t *pages; vp = ap->a_vp; - p = curproc; /* XXX */ + td = curthread; /* XXX */ cred = curproc->p_ucred; /* XXX */ np = VTONW(vp); nmp = VFSTONWFS(vp->v_mount); @@ -431,7 +432,7 @@ nwfs_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 = ncp_read(NWFSTOCONN(nmp), &np->n_fh, &uio,cred); pmap_qremove(kva, npages); @@ -511,15 +512,15 @@ nwfs_putpages(ap) { int error; struct vnode *vp = ap->a_vp; - struct proc *p; + struct thread *td; struct ucred *cred; #ifndef NWFS_RWCACHE - p = curproc; /* XXX */ - cred = p->p_ucred; /* XXX */ - VOP_OPEN(vp, FWRITE, cred, p); + td = curthread; /* XXX */ + cred = td->td_proc->p_ucred; /* XXX */ + VOP_OPEN(vp, FWRITE, cred, td); error = vop_stdputpages(ap); - VOP_CLOSE(vp, FWRITE, cred, p); + VOP_CLOSE(vp, FWRITE, cred, td); return error; #else struct uio uio; @@ -532,9 +533,9 @@ nwfs_putpages(ap) struct nwnode *np; vm_page_t *pages; - p = curproc; /* XXX */ - cred = p->p_ucred; /* XXX */ -/* VOP_OPEN(vp, FWRITE, cred, p);*/ + td = curthread; /* XXX */ + cred = td->td_proc->p_ucred; /* XXX */ +/* VOP_OPEN(vp, FWRITE, cred, td);*/ np = VTONW(vp); nmp = VFSTONWFS(vp->v_mount); pages = ap->a_m; @@ -558,11 +559,11 @@ nwfs_putpages(ap) uio.uio_resid = count; uio.uio_segflg = UIO_SYSSPACE; uio.uio_rw = UIO_WRITE; - uio.uio_procp = p; + uio.uio_td = td; NCPVNDEBUG("ofs=%d,resid=%d\n",(int)uio.uio_offset, uio.uio_resid); error = ncp_write(NWFSTOCONN(nmp), &np->n_fh, &uio, cred); -/* VOP_CLOSE(vp, FWRITE, cred, p);*/ +/* VOP_CLOSE(vp, FWRITE, cred, td);*/ NCPVNDEBUG("paged write done: %d\n", error); pmap_qremove(kva, npages); @@ -583,11 +584,11 @@ nwfs_putpages(ap) * doing the flush, just wait for completion. */ int -nwfs_vinvalbuf(vp, flags, cred, p, intrflg) +nwfs_vinvalbuf(vp, flags, cred, td, intrflg) struct vnode *vp; int flags; struct ucred *cred; - struct proc *p; + struct thread *td; int intrflg; { struct nwnode *np = VTONW(vp); @@ -607,12 +608,12 @@ nwfs_vinvalbuf(vp, flags, cred, p, intrflg) while (np->n_flag & NFLUSHINPROG) { np->n_flag |= NFLUSHWANT; error = tsleep((caddr_t)&np->n_flag, PRIBIO + 2, "nwfsvinv", slptimeo); - error = ncp_chkintr(NWFSTOCONN(VTONWFS(vp)), p); + error = ncp_chkintr(NWFSTOCONN(VTONWFS(vp)), td->td_proc); if (error == EINTR && intrflg) return EINTR; } np->n_flag |= NFLUSHINPROG; - error = vinvalbuf(vp, flags, cred, p, slpflag, 0); + error = vinvalbuf(vp, flags, cred, td, slpflag, 0); while (error) { if (intrflg && (error == ERESTART || error == EINTR)) { np->n_flag &= ~NFLUSHINPROG; @@ -622,7 +623,7 @@ nwfs_vinvalbuf(vp, flags, cred, p, intrflg) } return EINTR; } - error = vinvalbuf(vp, flags, cred, p, slpflag, 0); + error = vinvalbuf(vp, flags, cred, td, slpflag, 0); } np->n_flag &= ~(NMODIFIED | NFLUSHINPROG); if (np->n_flag & NFLUSHWANT) { diff --git a/sys/fs/nwfs/nwfs_ioctl.c b/sys/fs/nwfs/nwfs_ioctl.c index 41c956c..fd8b944 100644 --- a/sys/fs/nwfs/nwfs_ioctl.c +++ b/sys/fs/nwfs/nwfs_ioctl.c @@ -53,11 +53,11 @@ nwfs_ioctl(ap) caddr_t a_data; int fflag; struct ucred *cred; - struct proc *p; + struct thread *td; } */ *ap; { int error; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct ucred *cred = ap->a_cred; struct vnode *vp = ap->a_vp; struct nwnode *np = VTONW(vp); @@ -69,23 +69,23 @@ nwfs_ioctl(ap) switch (ap->a_command) { case NWFSIOC_GETCONN: - error = ncp_conn_lock(conn, p, cred, NCPM_READ); + error = ncp_conn_lock(conn, td, cred, NCPM_READ); if (error) break; - error = ncp_conn_gethandle(conn, p, &hp); - ncp_conn_unlock(conn, p); + error = ncp_conn_gethandle(conn, td, &hp); + ncp_conn_unlock(conn, td); if (error) break; *(int*)data = hp->nh_id; break; case NWFSIOC_GETEINFO: - if ((error = VOP_ACCESS(vp, VEXEC, cred, p))) break; + if ((error = VOP_ACCESS(vp, VEXEC, cred, td))) break; fap = data; error = ncp_obtain_info(nmp, np->n_fid.f_id, 0, NULL, fap, - ap->a_p,ap->a_cred); + ap->a_td,ap->a_cred); strcpy(fap->entryName, np->n_name); fap->nameLen = np->n_nmlen; break; case NWFSIOC_GETNS: - if ((error = VOP_ACCESS(vp, VEXEC, cred, p))) break; + if ((error = VOP_ACCESS(vp, VEXEC, cred, td))) break; *(int*)data = nmp->name_space; break; default: diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c index c708e1d..8fce6ac 100644 --- a/sys/fs/nwfs/nwfs_node.c +++ b/sys/fs/nwfs/nwfs_node.c @@ -139,7 +139,7 @@ static int nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap, struct vnode *dvp, struct vnode **vpp) { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct nwnode *np; struct nwnode_hash_head *nhpp; struct nwmount *nmp = VFSTONWFS(mp); @@ -147,20 +147,20 @@ nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap, int error; loop: - lockmgr(&nwhashlock, LK_EXCLUSIVE, NULL, p); + lockmgr(&nwhashlock, LK_EXCLUSIVE, NULL, td); rescan: if (nwfs_hashlookup(nmp, fid, &np) == 0) { vp = NWTOV(np); mtx_lock(&vp->v_interlock); - lockmgr(&nwhashlock, LK_RELEASE, NULL, p); - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) + lockmgr(&nwhashlock, LK_RELEASE, NULL, td); + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) goto loop; if (fap) np->n_attr = fap->attributes; *vpp = vp; return(0); } - lockmgr(&nwhashlock, LK_RELEASE, NULL, p); + lockmgr(&nwhashlock, LK_RELEASE, NULL, td); if (fap == NULL || ((fap->attributes & aDIR) == 0 && dvp == NULL)) panic("nwfs_allocvp: fap = %p, dvp = %p\n", fap, dvp); @@ -186,7 +186,7 @@ rescan: np->n_parent = VTONW(dvp)->n_fid; } lockinit(&vp->v_lock, PINOD, "nwnode", 0, LK_CANRECURSE); - lockmgr(&nwhashlock, LK_EXCLUSIVE, NULL, p); + lockmgr(&nwhashlock, LK_EXCLUSIVE, NULL, td); /* * Another process can create vnode while we blocked in malloc() or * getnewvnode(). Rescan list again. @@ -201,8 +201,8 @@ rescan: *vpp = vp; nhpp = NWNOHASH(fid); LIST_INSERT_HEAD(nhpp, np, n_hash); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - lockmgr(&nwhashlock, LK_RELEASE, NULL, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); + lockmgr(&nwhashlock, LK_RELEASE, NULL, td); if (vp->v_type == VDIR && dvp && (dvp->v_flag & VROOT) == 0) { np->n_flag |= NREFPARENT; @@ -229,14 +229,14 @@ nwfs_nget(struct mount *mp, ncpfid fid, struct nw_entry_info *fap, } int -nwfs_lookupnp(struct nwmount *nmp, ncpfid fid, struct proc *p, +nwfs_lookupnp(struct nwmount *nmp, ncpfid fid, struct thread *td, struct nwnode **npp) { int error; - lockmgr(&nwhashlock, LK_EXCLUSIVE, NULL, p); + lockmgr(&nwhashlock, LK_EXCLUSIVE, NULL, td); error = nwfs_hashlookup(nmp, fid, npp); - lockmgr(&nwhashlock, LK_RELEASE, NULL, p); + lockmgr(&nwhashlock, LK_RELEASE, NULL, td); return error; } @@ -247,26 +247,26 @@ int nwfs_reclaim(ap) struct vop_reclaim_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *dvp = NULL, *vp = ap->a_vp; struct nwnode *dnp, *np = VTONW(vp); struct nwmount *nmp = VTONWFS(vp); - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; NCPVNDEBUG("%s,%d\n", np->n_name, vp->v_usecount); if (np->n_flag & NREFPARENT) { np->n_flag &= ~NREFPARENT; - if (nwfs_lookupnp(nmp, np->n_parent, p, &dnp) == 0) { + if (nwfs_lookupnp(nmp, np->n_parent, td, &dnp) == 0) { dvp = dnp->n_vnode; } else { NCPVNDEBUG("%s: has no parent ?\n",np->n_name); } } - lockmgr(&nwhashlock, LK_EXCLUSIVE, NULL, p); + lockmgr(&nwhashlock, LK_EXCLUSIVE, NULL, td); LIST_REMOVE(np, n_hash); - lockmgr(&nwhashlock, LK_RELEASE, NULL, p); + lockmgr(&nwhashlock, LK_RELEASE, NULL, td); cache_purge(vp); if (nmp->n_root == np) { nmp->n_root = NULL; @@ -283,22 +283,22 @@ int nwfs_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { - struct proc *p = ap->a_p; - struct ucred *cred = p->p_ucred; + struct thread *td = ap->a_td; + struct ucred *cred = td->td_proc->p_ucred; struct vnode *vp = ap->a_vp; struct nwnode *np = VTONW(vp); int error; NCPVNDEBUG("%s: %d\n", VTONW(vp)->n_name, vp->v_usecount); if (np->opened) { - error = nwfs_vinvalbuf(vp, V_SAVE, cred, p, 1); - error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh, p, cred); + error = nwfs_vinvalbuf(vp, V_SAVE, cred, td, 1); + error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh, td, cred); np->opened = 0; } - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); if (np->n_flag & NSHOULDFREE) { cache_purge(vp); vgone(vp); diff --git a/sys/fs/nwfs/nwfs_node.h b/sys/fs/nwfs/nwfs_node.h index 34c693d..fa5de92 100644 --- a/sys/fs/nwfs/nwfs_node.h +++ b/sys/fs/nwfs/nwfs_node.h @@ -83,7 +83,7 @@ struct uio; void nwfs_hash_init(void); void nwfs_hash_free(void); -int nwfs_lookupnp(struct nwmount *nmp, ncpfid fid, struct proc *p, +int nwfs_lookupnp(struct nwmount *nmp, ncpfid fid, struct thread *td, struct nwnode **npp); int nwfs_inactive(struct vop_inactive_args *); int nwfs_reclaim(struct vop_reclaim_args *); diff --git a/sys/fs/nwfs/nwfs_subr.c b/sys/fs/nwfs/nwfs_subr.c index b83e89b..4755891 100644 --- a/sys/fs/nwfs/nwfs_subr.c +++ b/sys/fs/nwfs/nwfs_subr.c @@ -71,7 +71,7 @@ ncp_extract_file_info(struct nwmount *nmp, struct ncp_rq *rqp, } int -ncp_initsearch(struct vnode *dvp,struct proc *p,struct ucred *cred) +ncp_initsearch(struct vnode *dvp, struct thread *td, struct ucred *cred) { struct nwmount *nmp = VTONWFS(dvp); struct ncp_conn *conn = NWFSTOCONN(nmp); @@ -82,7 +82,7 @@ ncp_initsearch(struct vnode *dvp,struct proc *p,struct ucred *cred) int error; NCPNDEBUG("vol=%d,dir=%d\n", volnum, dirent); - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 2); /* subfunction */ @@ -102,13 +102,13 @@ int ncp_search_for_file_or_subdir(struct nwmount *nmp, struct nw_search_seq *seq, struct nw_entry_info *target, - struct proc *p,struct ucred *cred) + struct thread *td,struct ucred *cred) { struct ncp_conn *conn = NWFSTOCONN(nmp); struct ncp_rq *rqp; int error; - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 3); /* subfunction */ @@ -138,7 +138,7 @@ ncp_search_for_file_or_subdir(struct nwmount *nmp, int ncp_obtain_info(struct nwmount *nmp, u_int32_t dirent, int namelen, char *path, struct nw_entry_info *target, - struct proc *p,struct ucred *cred) + struct thread *td,struct ucred *cred) { struct ncp_conn *conn=NWFSTOCONN(nmp); struct ncp_rq *rqp; @@ -150,7 +150,7 @@ ncp_obtain_info(struct nwmount *nmp, u_int32_t dirent, return EINVAL; } ns = (path == NULL || path[0] == 0) ? NW_NS_DOS : nmp->name_space; - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 6); /* subfunction */ @@ -173,7 +173,7 @@ ncp_obtain_info(struct nwmount *nmp, u_int32_t dirent, */ int ncp_lookup(struct vnode *dvp, int len, char *name, struct nw_entry_info *fap, - struct proc *p,struct ucred *cred) + struct thread *td,struct ucred *cred) { struct nwmount *nmp; struct nwnode *dnp = VTONW(dvp); @@ -190,10 +190,10 @@ ncp_lookup(struct vnode *dvp, int len, char *name, struct nw_entry_info *fap, if (len == 1 && name[0] == '.') { if (dnp->n_flag & NVOLUME) { error = ncp_obtain_info(nmp, dnp->n_fid.f_id, 0, NULL, - fap, p, cred); + fap, td, cred); } else { error = ncp_obtain_info(nmp, dnp->n_fid.f_parent, - dnp->n_nmlen, dnp->n_name, fap, p, cred); + dnp->n_nmlen, dnp->n_name, fap, td, cred); } return error; } else if (len == 2 && name[0] == '.' && name[1] == '.') { @@ -201,7 +201,7 @@ ncp_lookup(struct vnode *dvp, int len, char *name, struct nw_entry_info *fap, return EIO; } else { error = ncp_obtain_info(nmp, dnp->n_fid.f_id, - len, name, fap, p, cred); + len, name, fap, td, cred); } return error; } @@ -221,7 +221,7 @@ int ncp_open_create_file_or_subdir(struct nwmount *nmp,struct vnode *dvp,int namelen, char *name, int open_create_mode, u_int32_t create_attributes, int desired_acc_rights, struct ncp_open_info *nop, - struct proc *p,struct ucred *cred) + struct thread *td,struct ucred *cred) { struct ncp_conn *conn=NWFSTOCONN(nmp); @@ -231,7 +231,7 @@ ncp_open_create_file_or_subdir(struct nwmount *nmp,struct vnode *dvp,int namelen u_int32_t dirent; int error; - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; volnum = nmp->n_volume; @@ -267,12 +267,12 @@ ncp_open_create_file_or_subdir(struct nwmount *nmp,struct vnode *dvp,int namelen } int -ncp_close_file(struct ncp_conn *conn, ncp_fh *fh,struct proc *p,struct ucred *cred) +ncp_close_file(struct ncp_conn *conn, ncp_fh *fh,struct thread *td,struct ucred *cred) { struct ncp_rq *rqp; int error; - error = ncp_rq_alloc(66, conn, p, cred, &rqp); + error = ncp_rq_alloc(66, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 0); @@ -286,13 +286,13 @@ ncp_close_file(struct ncp_conn *conn, ncp_fh *fh,struct proc *p,struct ucred *cr int ncp_DeleteNSEntry(struct nwmount *nmp, u_int32_t dirent, - int namelen,char *name,struct proc *p,struct ucred *cred) + int namelen,char *name,struct thread *td,struct ucred *cred) { struct ncp_rq *rqp; int error; struct ncp_conn *conn=NWFSTOCONN(nmp); - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 8); /* subfunction */ @@ -311,12 +311,12 @@ ncp_nsrename(struct ncp_conn *conn, int volume, int ns, int oldtype, struct ncp_nlstables *nt, nwdirent fdir, char *old_name, int oldlen, nwdirent tdir, char *new_name, int newlen, - struct proc *p, struct ucred *cred) + struct thread *td, struct ucred *cred) { struct ncp_rq *rqp; int error; - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 4); @@ -345,7 +345,7 @@ int ncp_modify_file_or_subdir_dos_info(struct nwmount *nmp, struct vnode *vp, u_int32_t info_mask, struct nw_modify_dos_info *info, - struct proc *p,struct ucred *cred) + struct thread *td,struct ucred *cred) { struct nwnode *np=VTONW(vp); struct ncp_rq *rqp; @@ -354,7 +354,7 @@ ncp_modify_file_or_subdir_dos_info(struct nwmount *nmp, struct vnode *vp, struct ncp_conn *conn=NWFSTOCONN(nmp); int error; - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 7); /* subfunction */ @@ -371,11 +371,11 @@ ncp_modify_file_or_subdir_dos_info(struct nwmount *nmp, struct vnode *vp, } int -ncp_setattr(vp, vap, cred, procp) +ncp_setattr(vp, vap, cred, td) struct vnode *vp; struct vattr *vap; struct ucred *cred; - struct proc *procp; + struct thread *td; { struct nwmount *nmp=VTONWFS(vp); struct nwnode *np=VTONW(vp); @@ -387,12 +387,12 @@ ncp_setattr(vp, vap, cred, procp) if (vap->va_size != VNOVAL) { error = ncp_open_create_file_or_subdir(nmp, vp, 0, NULL, OC_MODE_OPEN, 0, - AR_WRITE | AR_READ, &nwn,procp,cred); + AR_WRITE | AR_READ, &nwn,td,cred); if (error) return error; - error = ncp_rq_alloc(73, conn, procp, cred, &rqp); + error = ncp_rq_alloc(73, conn, td, cred, &rqp); if (error) { - ncp_close_file(conn, &nwn.fh, procp, cred); + ncp_close_file(conn, &nwn.fh, td, cred); return error; } mb_put_uint8(&rqp->rq, 0); @@ -403,7 +403,7 @@ ncp_setattr(vp, vap, cred, procp) np->n_vattr.va_size = np->n_size = vap->va_size; if (!error) ncp_rq_done(rqp); - ncp_close_file(conn, &nwn.fh, procp, cred); + ncp_close_file(conn, &nwn.fh, td, cred); if (error) return error; } @@ -419,7 +419,7 @@ ncp_setattr(vp, vap, cred, procp) ncp_unix2dostime(&vap->va_atime, nmp->m.tz, &info.lastAccessDate, NULL, NULL); } if (info_mask) { - error = ncp_modify_file_or_subdir_dos_info(nmp, vp, info_mask, &info,procp,cred); + error = ncp_modify_file_or_subdir_dos_info(nmp, vp, info_mask, &info,td,cred); } return (error); } @@ -427,14 +427,14 @@ ncp_setattr(vp, vap, cred, procp) int ncp_get_volume_info_with_number(struct ncp_conn *conn, int n, struct ncp_volume_info *target, - struct proc *p,struct ucred *cred) + struct thread *td,struct ucred *cred) { struct ncp_rq *rqp; u_int32_t tmp32; u_int8_t len; int error; - error = ncp_rq_alloc_subfn(22, 44, conn, p, cred, &rqp); + error = ncp_rq_alloc_subfn(22, 44, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq,n); @@ -462,14 +462,14 @@ ncp_get_volume_info_with_number(struct ncp_conn *conn, int ncp_get_namespaces(struct ncp_conn *conn, u_int32_t volume, int *nsf, - struct proc *p,struct ucred *cred) + struct thread *td,struct ucred *cred) { struct ncp_rq *rqp; int error; u_int8_t ns; u_int16_t nscnt; - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 24); /* Subfunction: Get Loaded Name Spaces */ @@ -491,14 +491,14 @@ ncp_get_namespaces(struct ncp_conn *conn, u_int32_t volume, int *nsf, int ncp_lookup_volume(struct ncp_conn *conn, char *volname, u_char *volNum, u_int32_t *dirEnt, - struct proc *p,struct ucred *cred) + struct thread *td,struct ucred *cred) { struct ncp_rq *rqp; u_int32_t tmp32; int error; NCPNDEBUG("looking up vol %s\n", volname); - error = ncp_rq_alloc(87, conn, p, cred, &rqp); + error = ncp_rq_alloc(87, conn, td, cred, &rqp); if (error) return error; mb_put_uint8(&rqp->rq, 22); /* Subfunction: Generate dir handle */ diff --git a/sys/fs/nwfs/nwfs_subr.h b/sys/fs/nwfs/nwfs_subr.h index b603c76..4fece8a 100644 --- a/sys/fs/nwfs/nwfs_subr.h +++ b/sys/fs/nwfs/nwfs_subr.h @@ -46,48 +46,48 @@ struct ncp_open_info; struct nw_entry_info; struct nw_search_info; struct nwmount; -struct proc; +struct thread; struct timespec; struct ucred; struct vattr; struct vnode; -int ncp_initsearch(struct vnode *dvp,struct proc *p,struct ucred *cred); +int ncp_initsearch(struct vnode *dvp,struct thread *td, struct ucred *cred); int ncp_search_for_file_or_subdir(struct nwmount *nmp,struct nw_search_seq *seq, struct nw_entry_info *target, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_lookup(struct vnode *dvp, int len, char *name, struct nw_entry_info *fap, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_lookup_volume(struct ncp_conn *conn, char *volname, u_char *volNum, u_int32_t *dirEnt, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_close_file(struct ncp_conn *conn, ncp_fh *fh, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_open_create_file_or_subdir(struct nwmount *nmp,struct vnode *dvp, int namelen,char *name, int open_create_mode, u_int32_t create_attributes, int desired_acc_rights, struct ncp_open_info *nop, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_DeleteNSEntry(struct nwmount *nmp, u_int32_t dirent, int namelen, char *name, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_nsrename(struct ncp_conn *conn, int volume, int ns, int oldtype, struct ncp_nlstables *nt, nwdirent fdir, char *old_name, int oldlen, nwdirent tdir, char *new_name, int newlen, - struct proc *p, struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_obtain_info(struct nwmount *nmp, u_int32_t dirent, int namelen, char *path, struct nw_entry_info *target, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_modify_file_or_subdir_dos_info(struct nwmount *nmp, struct vnode *vp, u_int32_t info_mask, struct nw_modify_dos_info *info, - struct proc *p,struct ucred *cred); -int ncp_setattr(struct vnode *,struct vattr *,struct ucred *,struct proc *); + struct thread *td, struct ucred *cred); +int ncp_setattr(struct vnode *,struct vattr *,struct ucred *,struct thread *td); int ncp_get_namespaces(struct ncp_conn *conn, u_int32_t volume, int *nsf, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); int ncp_get_volume_info_with_number(struct ncp_conn *conn, int n, struct ncp_volume_info *target, - struct proc *p,struct ucred *cred); + struct thread *td, struct ucred *cred); void ncp_unix2dostime (struct timespec *tsp, int tz, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp); diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index 2fb0752..de5ae2f 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -71,13 +71,13 @@ MODULE_DEPEND(nwfs, ncp, 1, 1, 1); MODULE_DEPEND(nwfs, libmchain, 1, 1, 1); static int nwfs_mount(struct mount *, char *, caddr_t, - struct nameidata *, struct proc *); -static int nwfs_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *); + struct nameidata *, struct thread *); +static int nwfs_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *); static int nwfs_root(struct mount *, struct vnode **); -static int nwfs_start(struct mount *, int, struct proc *); -static int nwfs_statfs(struct mount *, struct statfs *, struct proc *); -static int nwfs_sync(struct mount *, int, struct ucred *, struct proc *); -static int nwfs_unmount(struct mount *, int, struct proc *); +static int nwfs_start(struct mount *, int, struct thread *); +static int nwfs_statfs(struct mount *, struct statfs *, struct thread *); +static int nwfs_sync(struct mount *, int, struct ucred *, struct thread *); +static int nwfs_unmount(struct mount *, int, struct thread *); static int nwfs_init(struct vfsconf *vfsp); static int nwfs_uninit(struct vfsconf *vfsp); @@ -144,7 +144,7 @@ nwfs_initnls(struct nwmount *nmp) { * data - addr in user space of mount params */ static int nwfs_mount(struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p) + struct nameidata *ndp, struct thread *td) { struct nwfs_args args; /* will hold data from mount request */ int error; @@ -169,7 +169,7 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data, nwfs_printf("mount version mismatch: kernel=%d, mount=%d\n",NWFS_VERSION,args.version); return (1); } - error = ncp_conn_getbyref(args.connRef,p,p->p_ucred,NCPM_EXECUTE,&conn); + error = ncp_conn_getbyref(args.connRef, td , td->td_proc->p_ucred,NCPM_EXECUTE,&conn); if (error) { nwfs_printf("invalid connection refernce %d\n",args.connRef); return (error); @@ -179,7 +179,7 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data, nwfs_printf("can't get connection handle\n"); return (error); } - ncp_conn_unlock(conn,p); /* we keep the ref */ + ncp_conn_unlock(conn, td); /* we keep the ref */ mp->mnt_stat.f_iosize = conn->buffer_size; /* We must malloc our own mount info */ MALLOC(nmp,struct nwmount *,sizeof(struct nwmount),M_NWFSDATA,M_USE_RESERVE | M_ZERO); @@ -220,7 +220,7 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data, /* * Lose the lock but keep the ref. */ - VOP_UNLOCK(vp, 0, curproc); + VOP_UNLOCK(vp, 0, curthread); NCPVODEBUG("rootvp.vrefcnt=%d\n",vp->v_usecount); return error; bad: @@ -233,7 +233,7 @@ bad: /* Unmount the filesystem described by mp. */ static int -nwfs_unmount(struct mount *mp, int mntflags, struct proc *p) +nwfs_unmount(struct mount *mp, int mntflags, struct thread *td) { struct nwmount *nmp = VFSTONWFS(mp); struct ncp_conn *conn; @@ -249,9 +249,9 @@ nwfs_unmount(struct mount *mp, int mntflags, struct proc *p) return (error); conn = NWFSTOCONN(nmp); ncp_conn_puthandle(nmp->connh,NULL,0); - if (ncp_conn_lock(conn,p,p->p_ucred,NCPM_WRITE | NCPM_EXECUTE) == 0) { + if (ncp_conn_lock(conn, td, td->td_proc->p_ucred,NCPM_WRITE | NCPM_EXECUTE) == 0) { if(ncp_conn_free(conn)) - ncp_conn_unlock(conn,p); + ncp_conn_unlock(conn, td); } mp->mnt_data = (qaddr_t)0; if (nmp->m.flags & NWFS_MOUNT_HAVE_NLS) @@ -269,8 +269,8 @@ nwfs_root(struct mount *mp, struct vnode **vpp) { struct nwnode *np; struct ncp_conn *conn; struct nw_entry_info fattr; - struct proc *p = curproc; - struct ucred *cred = p->p_ucred; + struct thread *td = curthread; + struct ucred *cred = td->td_proc->p_ucred; int error, nsf, opt; u_char vol; @@ -278,16 +278,16 @@ nwfs_root(struct mount *mp, struct vnode **vpp) { conn = NWFSTOCONN(nmp); if (nmp->n_root) { *vpp = NWTOV(nmp->n_root); - while (vget(*vpp, LK_EXCLUSIVE, curproc) != 0) + while (vget(*vpp, LK_EXCLUSIVE, curthread) != 0) ; return 0; } error = ncp_lookup_volume(conn, nmp->m.mounted_vol, &vol, - &nmp->n_rootent.f_id, p, cred); + &nmp->n_rootent.f_id, td, cred); if (error) return ENOENT; nmp->n_volume = vol; - error = ncp_get_namespaces(conn, vol, &nsf, p, cred); + error = ncp_get_namespaces(conn, vol, &nsf, td, cred); if (error) return ENOENT; if (nsf & NW_NSB_OS2) { @@ -313,7 +313,7 @@ nwfs_root(struct mount *mp, struct vnode **vpp) { if (nmp->m.root_path[0]) { nmp->m.root_path[0]--; error = ncp_obtain_info(nmp, nmp->n_rootent.f_id, - -nmp->m.root_path[0], nmp->m.root_path, &fattr, p, cred); + -nmp->m.root_path[0], nmp->m.root_path, &fattr, td, cred); if (error) { NCPFATAL("Invalid root path specified\n"); return ENOENT; @@ -321,7 +321,7 @@ nwfs_root(struct mount *mp, struct vnode **vpp) { nmp->n_rootent.f_parent = fattr.dirEntNum; nmp->m.root_path[0]++; error = ncp_obtain_info(nmp, nmp->n_rootent.f_id, - -nmp->m.root_path[0], nmp->m.root_path, &fattr, p, cred); + -nmp->m.root_path[0], nmp->m.root_path, &fattr, td, cred); if (error) { NCPFATAL("Invalid root path specified\n"); return ENOENT; @@ -329,7 +329,7 @@ nwfs_root(struct mount *mp, struct vnode **vpp) { nmp->n_rootent.f_id = fattr.dirEntNum; } else { error = ncp_obtain_info(nmp, nmp->n_rootent.f_id, - 0, NULL, &fattr, p, cred); + 0, NULL, &fattr, td, cred); if (error) { NCPFATAL("Can't obtain volume info\n"); return ENOENT; @@ -345,7 +345,7 @@ nwfs_root(struct mount *mp, struct vnode **vpp) { if (nmp->m.root_path[0] == 0) np->n_flag |= NVOLUME; nmp->n_root = np; -/* error = VOP_GETATTR(vp, &vattr, cred, p); +/* error = VOP_GETATTR(vp, &vattr, cred, td); if (error) { vput(vp); NCPFATAL("Can't get root directory entry\n"); @@ -360,10 +360,10 @@ nwfs_root(struct mount *mp, struct vnode **vpp) { */ /* ARGSUSED */ static int -nwfs_start(mp, flags, p) +nwfs_start(mp, flags, td) struct mount *mp; int flags; - struct proc *p; + struct thread *td; { NCPVODEBUG("flags=%04x\n",flags); return (0); @@ -374,12 +374,12 @@ nwfs_start(mp, flags, p) */ /* ARGSUSED */ static int -nwfs_quotactl(mp, cmd, uid, arg, p) +nwfs_quotactl(mp, cmd, uid, arg, td) struct mount *mp; int cmd; uid_t uid; caddr_t arg; - struct proc *p; + struct thread *td; { NCPVODEBUG("return EOPNOTSUPP\n"); return (EOPNOTSUPP); @@ -395,7 +395,7 @@ nwfs_init(struct vfsconf *vfsp) name[0] = CTL_HW; name[1] = HW_NCPU; - error = kernel_sysctl(curproc, name, 2, &ncpu, &olen, NULL, 0, &plen); + error = kernel_sysctl(curthread, name, 2, &ncpu, &olen, NULL, 0, &plen); if (error == 0 && ncpu > 1) printf("warning: nwfs module compiled without SMP support."); #endif @@ -419,10 +419,10 @@ nwfs_uninit(struct vfsconf *vfsp) * nwfs_statfs call */ int -nwfs_statfs(mp, sbp, p) +nwfs_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { struct nwmount *nmp = VFSTONWFS(mp); int error = 0, secsize; @@ -430,7 +430,8 @@ nwfs_statfs(mp, sbp, p) struct ncp_volume_info vi; if (np == NULL) return EINVAL; - error = ncp_get_volume_info_with_number(NWFSTOCONN(nmp), nmp->n_volume, &vi,p,p->p_ucred); + error = ncp_get_volume_info_with_number(NWFSTOCONN(nmp), + nmp->n_volume, &vi, td, td->td_proc->p_ucred); if (error) return error; secsize = 512; /* XXX how to get real value ??? */ sbp->f_spare2=0; /* placeholder */ @@ -465,11 +466,11 @@ nwfs_statfs(mp, sbp, p) */ /* ARGSUSED */ static int -nwfs_sync(mp, waitfor, cred, p) +nwfs_sync(mp, waitfor, cred, td) struct mount *mp; int waitfor; struct ucred *cred; - struct proc *p; + struct thread *td; { struct vnode *vp, *nvp; int error, allerror = 0; @@ -496,11 +497,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/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c index dc83b3d..9d773f8 100644 --- a/sys/fs/nwfs/nwfs_vnops.c +++ b/sys/fs/nwfs/nwfs_vnops.c @@ -132,7 +132,7 @@ nwfs_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -170,7 +170,7 @@ nwfs_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -181,24 +181,24 @@ nwfs_open(ap) struct vattr vattr; int error, nwm; - NCPVNDEBUG("%s,%d\n",np->n_name, np->opened); + NCPVNDEBUG("%s,%d\n", np->n_name, np->opened); if (vp->v_type != VREG && vp->v_type != VDIR) { NCPFATAL("open vtype = %d\n", vp->v_type); return (EACCES); } if (vp->v_type == VDIR) return 0; /* nothing to do now */ if (np->n_flag & NMODIFIED) { - if ((error = nwfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) + if ((error = nwfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_td, 1)) == EINTR) return (error); np->n_atime = 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 ((error = nwfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1)) == EINTR) + if ((error = nwfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_td, 1)) == EINTR) return (error); np->n_mtime = vattr.va_mtime.tv_sec; } @@ -211,13 +211,13 @@ nwfs_open(ap) if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) nwm |= AR_WRITE; error = ncp_open_create_file_or_subdir(nmp, vp, 0, NULL, OC_MODE_OPEN, - 0, nwm, &no, ap->a_p, ap->a_cred); + 0, nwm, &no, ap->a_td, ap->a_cred); if (error) { if (mode & FWRITE) return EACCES; nwm = AR_READ; error = ncp_open_create_file_or_subdir(nmp, vp, 0, NULL, OC_MODE_OPEN, 0, - nwm, &no, ap->a_p,ap->a_cred); + nwm, &no, ap->a_td, ap->a_cred); } if (!error) { np->opened++; @@ -235,14 +235,15 @@ nwfs_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *td; } */ *ap; { struct vnode *vp = ap->a_vp; struct nwnode *np = VTONW(vp); int error; - NCPVNDEBUG("name=%s,pid=%d,c=%d\n",np->n_name,ap->a_p->p_pid,np->opened); + NCPVNDEBUG("name=%s,pid=%d,c=%d\n", np->n_name, ap->a_td->td_proc->p_pid, + np->opened); if (vp->v_type == VDIR) return 0; /* nothing to do now */ error = 0; @@ -252,7 +253,7 @@ nwfs_close(ap) return 0; } mtx_unlock(&vp->v_interlock); - error = nwfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1); + error = nwfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_td, 1); mtx_lock(&vp->v_interlock); if (np->opened == 0) { mtx_unlock(&vp->v_interlock); @@ -261,7 +262,7 @@ nwfs_close(ap) if (--np->opened == 0) { mtx_unlock(&vp->v_interlock); error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh, - ap->a_p, ap->a_cred); + ap->a_td, ap->a_cred); } else mtx_unlock(&vp->v_interlock); np->n_atime = 0; @@ -277,7 +278,7 @@ nwfs_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -289,16 +290,16 @@ nwfs_getattr(ap) u_int32_t oldsize; NCPVNDEBUG("%lx:%d: '%s' %d\n", (long)vp, nmp->n_volume, np->n_name, (vp->v_flag & VROOT) != 0); - error = nwfs_attr_cachelookup(vp,va); + error = nwfs_attr_cachelookup(vp, va); if (!error) return 0; NCPVNDEBUG("not in cache\n"); oldsize = np->n_size; if (np->n_flag & NVOLUME) { error = ncp_obtain_info(nmp, np->n_fid.f_id, 0, NULL, &fattr, - ap->a_p,ap->a_cred); + ap->a_td, ap->a_cred); } else { error = ncp_obtain_info(nmp, np->n_fid.f_parent, np->n_nmlen, - np->n_name, &fattr, ap->a_p, ap->a_cred); + np->n_name, &fattr, ap->a_td, ap->a_cred); } if (error) { NCPVNDEBUG("error %d\n", error); @@ -319,7 +320,7 @@ nwfs_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -357,13 +358,13 @@ nwfs_setattr(ap) return EINVAL; }; } - error = ncp_setattr(vp, vap, ap->a_cred, ap->a_p); + error = ncp_setattr(vp, vap, ap->a_cred, ap->a_td); if (error && vap->va_size != VNOVAL) { np->n_size = tsize; vnode_pager_setsize(vp, (u_long)tsize); } np->n_atime = 0; /* invalidate cache */ - VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p); + VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td); np->n_mtime = vap->va_mtime.tv_sec; return (0); } @@ -403,11 +404,11 @@ nwfs_write(ap) struct uio *uio = ap->a_uio; int error; - NCPVNDEBUG("%d,ofs=%d,sz=%d\n",vp->v_type, (int)uio->uio_offset, uio->uio_resid); + NCPVNDEBUG("%d,ofs=%d,sz=%d\n", vp->v_type, (int)uio->uio_offset, uio->uio_resid); if (vp->v_type != VREG) return (EPERM); - error = nwfs_writevnode(vp, uio, ap->a_cred,ap->a_ioflag); + error = nwfs_writevnode(vp, uio, ap->a_cred, ap->a_ioflag); return(error); } /* @@ -443,18 +444,18 @@ nwfs_create(ap) *vpp = NULL; if (vap->va_type == VSOCK) return (EOPNOTSUPP); - if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc))) { + if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread))) { return (error); } fmode = AR_READ | AR_WRITE; /* if (vap->va_vaflags & VA_EXCLUSIVE) fmode |= AR_DENY_READ | AR_DENY_WRITE;*/ - error = ncp_open_create_file_or_subdir(nmp,dvp,cnp->cn_namelen,cnp->cn_nameptr, + error = ncp_open_create_file_or_subdir(nmp, dvp, cnp->cn_namelen, cnp->cn_nameptr, OC_MODE_CREATE | OC_MODE_OPEN | OC_MODE_REPLACE, - 0, fmode, &no, cnp->cn_proc, cnp->cn_cred); + 0, fmode, &no, cnp->cn_thread, cnp->cn_cred); if (!error) { - error = ncp_close_file(NWFSTOCONN(nmp), &no.fh, cnp->cn_proc,cnp->cn_cred); + error = ncp_close_file(NWFSTOCONN(nmp), &no.fh, cnp->cn_thread, cnp->cn_cred); fid.f_parent = VTONW(dvp)->n_fid.f_id; fid.f_id = no.fattr.dirEntNum; error = nwfs_nget(VTOVFS(dvp), fid, &no.fattr, dvp, &vp); @@ -493,7 +494,7 @@ nwfs_remove(ap) return EPERM; cache_purge(vp); error = ncp_DeleteNSEntry(nmp, VTONW(dvp)->n_fid.f_id, - cnp->cn_namelen,cnp->cn_nameptr,cnp->cn_proc,cnp->cn_cred); + cnp->cn_namelen, cnp->cn_nameptr, cnp->cn_thread, cnp->cn_cred); if (error == 0) np->n_flag |= NSHOULDFREE; else if (error == 0x899c) @@ -539,7 +540,7 @@ nwfs_rename(ap) if (tvp && tvp != fvp) { error = ncp_DeleteNSEntry(nmp, VTONW(tdvp)->n_fid.f_id, tcnp->cn_namelen, tcnp->cn_nameptr, - tcnp->cn_proc, tcnp->cn_cred); + tcnp->cn_thread, tcnp->cn_cred); if (error == 0x899c) error = EACCES; if (error) goto out; @@ -554,7 +555,7 @@ nwfs_rename(ap) oldtype, &nmp->m.nls, VTONW(fdvp)->n_fid.f_id, fcnp->cn_nameptr, fcnp->cn_namelen, VTONW(tdvp)->n_fid.f_id, tcnp->cn_nameptr, tcnp->cn_namelen, - tcnp->cn_proc,tcnp->cn_cred); + tcnp->cn_thread, tcnp->cn_cred); if (error == 0x8992) error = EEXIST; @@ -648,15 +649,15 @@ nwfs_mkdir(ap) struct vattr vattr; char *name=cnp->cn_nameptr; - if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc))) { + if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_thread))) { return (error); } if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.')))) { return EEXIST; } - if (ncp_open_create_file_or_subdir(VTONWFS(dvp),dvp, cnp->cn_namelen, - cnp->cn_nameptr,OC_MODE_CREATE, aDIR, 0xffff, - &no, cnp->cn_proc, cnp->cn_cred) != 0) { + if (ncp_open_create_file_or_subdir(VTONWFS(dvp), dvp, cnp->cn_namelen, + cnp->cn_nameptr, OC_MODE_CREATE, aDIR, 0xffff, + &no, cnp->cn_thread, cnp->cn_cred) != 0) { error = EACCES; } else { error = 0; @@ -697,7 +698,7 @@ nwfs_rmdir(ap) return EINVAL; error = ncp_DeleteNSEntry(nmp, dnp->n_fid.f_id, - cnp->cn_namelen, cnp->cn_nameptr,cnp->cn_proc,cnp->cn_cred); + cnp->cn_namelen, cnp->cn_nameptr, cnp->cn_thread, cnp->cn_cred); if (error == 0) np->n_flag |= NSHOULDFREE; else if (error == NWE_DIR_NOT_EMPTY) @@ -745,10 +746,10 @@ nwfs_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));*/ return (0); } @@ -800,16 +801,16 @@ static int nwfs_strategy (ap) { struct buf *bp=ap->a_bp; struct ucred *cr; - struct proc *p; + struct thread *td; int error = 0; NCPVNDEBUG("\n"); if (bp->b_flags & B_PHYS) panic("nwfs 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; else @@ -820,7 +821,7 @@ static int nwfs_strategy (ap) * otherwise just do it ourselves. */ if ((bp->b_flags & B_ASYNC) == 0 ) - error = nwfs_doio(bp, cr, p); + error = nwfs_doio(bp, cr, td); return (error); } @@ -851,9 +852,9 @@ nwfs_lookup(ap) ncpfid fid; int nameiop=cnp->cn_nameiop, islastcn; int lockparent, wantparent, error = 0, notfound; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; char _name[cnp->cn_namelen+1]; - bcopy(cnp->cn_nameptr,_name,cnp->cn_namelen); + bcopy(cnp->cn_nameptr, _name, cnp->cn_namelen); _name[cnp->cn_namelen]=0; if (dvp->v_type != VDIR) @@ -869,7 +870,7 @@ nwfs_lookup(ap) islastcn = flags & ISLASTCN; if (islastcn && (mp->mnt_flag & MNT_RDONLY) && (nameiop != LOOKUP)) return (EROFS); - if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, p))) + if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td))) return (error); lockparent = flags & LOCKPARENT; wantparent = flags & (LOCKPARENT|WANTPARENT); @@ -884,7 +885,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO return ENOENT; error = cache_lookup(dvp, vpp, cnp); - NCPVNDEBUG("cache_lookup returned %d\n",error); + NCPVNDEBUG("cache_lookup returned %d\n", error); if (error > 0) return error; if (error) { /* name was found */ @@ -898,18 +899,18 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO error = 0; NCPVNDEBUG("cached '.'"); } else if (flags & ISDOTDOT) { - VOP_UNLOCK(dvp, 0, p); /* unlock parent */ - error = vget(vp, LK_EXCLUSIVE, p); + VOP_UNLOCK(dvp, 0, td); /* unlock parent */ + error = vget(vp, LK_EXCLUSIVE, td); if (!error && lockparent && islastcn) - error = vn_lock(dvp, LK_EXCLUSIVE, p); + error = vn_lock(dvp, LK_EXCLUSIVE, td); } else { - error = vget(vp, LK_EXCLUSIVE, p); + error = vget(vp, LK_EXCLUSIVE, td); if (!lockparent || error || !islastcn) - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); } if (!error) { if (vpid == vp->v_id) { - if (!VOP_GETATTR(vp, &vattr, cnp->cn_cred, p) + if (!VOP_GETATTR(vp, &vattr, cnp->cn_cred, td) && vattr.va_ctime.tv_sec == VTONW(vp)->n_ctime) { if (nameiop != LOOKUP && islastcn) cnp->cn_flags |= SAVENAME; @@ -920,9 +921,9 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO } vput(vp); if (lockparent && dvp != vp && 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) return (error); @@ -937,7 +938,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO fap = NULL; notfound = 0; } else { - error = nwfs_lookupnp(nmp, dnp->n_parent, p, &npp); + error = nwfs_lookupnp(nmp, dnp->n_parent, td, &npp); if (error) { return error; } @@ -945,18 +946,18 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO fap = &fattr; /*np = *npp;*/ notfound = ncp_obtain_info(nmp, npp->n_dosfid, - 0, NULL, fap, p, cnp->cn_cred); + 0, NULL, fap, td, cnp->cn_cred); } } else { fap = &fattr; notfound = ncp_lookup(dvp, cnp->cn_namelen, cnp->cn_nameptr, - fap, p, cnp->cn_cred); + fap, td, cnp->cn_cred); fid.f_id = fap->dirEntNum; if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { fid.f_parent = dnp->n_fid.f_parent; } else fid.f_parent = dnp->n_fid.f_id; - NCPVNDEBUG("call to ncp_lookup returned=%d\n",notfound); + NCPVNDEBUG("call to ncp_lookup returned=%d\n", notfound); } if (notfound && notfound < 0x80 ) return (notfound); /* hard error */ @@ -965,7 +966,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO if ((nameiop == CREATE || nameiop == RENAME) && wantparent && islastcn) { cnp->cn_flags |= SAVENAME; if (!lockparent) - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); return (EJUSTRETURN); } return ENOENT; @@ -974,7 +975,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO }*/ /* handle DELETE case ... */ if (nameiop == DELETE && islastcn) { /* delete last component */ - error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_proc); + error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_thread); if (error) return (error); if (NWCMPF(&dnp->n_fid, &fid)) { /* we found ourselfs */ VREF(dvp); @@ -985,11 +986,11 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO if (error) return (error); *vpp = vp; cnp->cn_flags |= SAVENAME; /* I free it later */ - if (!lockparent) VOP_UNLOCK(dvp,0,p); + if (!lockparent) VOP_UNLOCK(dvp, 0, td); return (0); } if (nameiop == RENAME && islastcn && wantparent) { - error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_proc); + error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, cnp->cn_thread); if (error) return (error); if (NWCMPF(&dnp->n_fid, &fid)) return EISDIR; error = nwfs_nget(mp, fid, fap, dvp, &vp); @@ -997,18 +998,18 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO *vpp = vp; cnp->cn_flags |= SAVENAME; if (!lockparent) - VOP_UNLOCK(dvp,0,p); + VOP_UNLOCK(dvp, 0, td); return (0); } if (flags & ISDOTDOT) { - VOP_UNLOCK(dvp, 0, p); /* race to get the inode */ + VOP_UNLOCK(dvp, 0, td); /* race to get the inode */ error = nwfs_nget(mp, fid, NULL, NULL, &vp); if (error) { - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); return (error); } if (lockparent && islastcn && - (error = vn_lock(dvp, LK_EXCLUSIVE, p))) { + (error = vn_lock(dvp, LK_EXCLUSIVE, td))) { vput(vp); return (error); } @@ -1022,7 +1023,7 @@ printf("dvp %d:%d:%d\n", (int)mp, (int)dvp->v_flag & VROOT, (int)flags & ISDOTDO *vpp = vp; NCPVNDEBUG("lookup: getnewvp!\n"); if (!lockparent || !islastcn) - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); } if ((cnp->cn_flags & MAKEENTRY)/* && !islastcn*/) { VTONW(*vpp)->n_ctime = VTONW(*vpp)->n_vattr.va_ctime.tv_sec; |