diff options
Diffstat (limited to 'sys/fs')
68 files changed, 1233 insertions, 1212 deletions
diff --git a/sys/fs/cd9660/cd9660_lookup.c b/sys/fs/cd9660/cd9660_lookup.c index b2d5057..979c0bd 100644 --- a/sys/fs/cd9660/cd9660_lookup.c +++ b/sys/fs/cd9660/cd9660_lookup.c @@ -120,7 +120,7 @@ cd9660_lookup(ap) struct componentname *cnp = ap->a_cnp; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; bp = NULL; *vpp = NULL; @@ -351,16 +351,16 @@ found: * it's a relocated directory. */ if (flags & ISDOTDOT) { - VOP_UNLOCK(pdp, 0, p); /* race to get the inode */ + VOP_UNLOCK(pdp, 0, td); /* race to get the inode */ error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp, dp->i_ino != ino, ep); brelse(bp); if (error) { - vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td); return (error); } if (lockparent && (flags & ISLASTCN)) { - if ((error = vn_lock(pdp, LK_EXCLUSIVE, p)) != 0) { + if ((error = vn_lock(pdp, LK_EXCLUSIVE, td)) != 0) { cnp->cn_flags |= PDIRUNLOCK; vput(tdp); return (error); @@ -380,7 +380,7 @@ found: return (error); if (!lockparent || !(flags & ISLASTCN)) { cnp->cn_flags |= PDIRUNLOCK; - VOP_UNLOCK(pdp, 0, p); + VOP_UNLOCK(pdp, 0, td); } *vpp = tdp; } diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index 00f79e8..53ffeca 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/cd9660/cd9660_node.c @@ -97,7 +97,7 @@ cd9660_ihashget(dev, inum) dev_t dev; ino_t inum; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct iso_node *ip; struct vnode *vp; @@ -108,7 +108,7 @@ loop: vp = ITOV(ip); mtx_lock(&vp->v_interlock); mtx_unlock(&cd9660_ihash_mtx); - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) goto loop; return (vp); } @@ -124,7 +124,6 @@ void cd9660_ihashins(ip) struct iso_node *ip; { - struct proc *p = curproc; /* XXX */ struct iso_node **ipp, *iq; mtx_lock(&cd9660_ihash_mtx); @@ -136,7 +135,7 @@ cd9660_ihashins(ip) *ipp = ip; mtx_unlock(&cd9660_ihash_mtx); - lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, p); + lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, curthread); } /* @@ -167,11 +166,11 @@ int cd9660_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; register struct iso_node *ip = VTOI(vp); int error = 0; @@ -179,13 +178,13 @@ cd9660_inactive(ap) vprint("cd9660_inactive: pushing active", vp); ip->i_flag = 0; - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); /* * If we are done with the inode, reclaim it * so that it can be reused immediately. */ if (ip->inode.iso_mode == 0) - vrecycle(vp, NULL, p); + vrecycle(vp, NULL, td); return error; } @@ -196,7 +195,7 @@ int cd9660_reclaim(ap) struct vop_reclaim_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { register struct vnode *vp = ap->a_vp; diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 0b42933..73a5bce 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -65,10 +65,10 @@ MALLOC_DEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure"); MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part"); static int cd9660_mount __P((struct mount *, - char *, caddr_t, struct nameidata *, struct proc *)); -static int cd9660_unmount __P((struct mount *, int, struct proc *)); + char *, caddr_t, struct nameidata *, struct thread *)); +static int cd9660_unmount __P((struct mount *, int, struct thread *)); static int cd9660_root __P((struct mount *, struct vnode **)); -static int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *)); +static int cd9660_statfs __P((struct mount *, struct statfs *, struct thread *)); static int cd9660_vget __P((struct mount *, ino_t, struct vnode **)); static int cd9660_fhtovp __P((struct mount *, struct fid *, struct vnode **)); static int cd9660_vptofh __P((struct vnode *, struct fid *)); @@ -97,9 +97,9 @@ MODULE_VERSION(cd9660, 1); * Called by vfs_mountroot when iso is going to be mounted as root. */ -static int iso_get_ssector __P((dev_t dev, struct proc *p)); +static int iso_get_ssector __P((dev_t dev, struct thread *td)); static int iso_mountfs __P((struct vnode *devvp, struct mount *mp, - struct proc *p, struct iso_args *argp)); + struct thread *td, struct iso_args *argp)); /* * Try to find the start of the last data track on this CD-ROM. This @@ -107,9 +107,9 @@ static int iso_mountfs __P((struct vnode *devvp, struct mount *mp, * and return 0 if we fail, this is always a safe bet. */ static int -iso_get_ssector(dev, p) +iso_get_ssector(dev, td) dev_t dev; - struct proc *p; + struct thread *td; { struct ioc_toc_header h; struct ioc_read_toc_single_entry t; @@ -122,13 +122,13 @@ iso_get_ssector(dev, p) if (ioctlp == NULL) return 0; - if (ioctlp(dev, CDIOREADTOCHEADER, (caddr_t)&h, FREAD, p) != 0) + if (ioctlp(dev, CDIOREADTOCHEADER, (caddr_t)&h, FREAD, td) != 0) return 0; for (i = h.ending_track; i >= 0; i--) { t.address_format = CD_LBA_FORMAT; t.track = i; - if (ioctlp(dev, CDIOREADTOCENTRY, (caddr_t)&t, FREAD, p) != 0) + if (ioctlp(dev, CDIOREADTOCENTRY, (caddr_t)&t, FREAD, td) != 0) return 0; if ((t.entry.control & 4) != 0) /* found a data track */ @@ -141,12 +141,12 @@ iso_get_ssector(dev, p) return ntohl(t.entry.addr.lba); } -static int iso_mountroot __P((struct mount *mp, struct proc *p)); +static int iso_mountroot __P((struct mount *mp, struct thread *td)); static int -iso_mountroot(mp, p) +iso_mountroot(mp, td) struct mount *mp; - struct proc *p; + struct thread *td; { struct iso_args args; int error; @@ -156,14 +156,14 @@ iso_mountroot(mp, p) return (error); } args.flags = ISOFSMNT_ROOT; - args.ssector = iso_get_ssector(rootdev, p); + args.ssector = iso_get_ssector(rootdev, td); if (bootverbose) printf("iso_mountroot(): using session at block %d\n", args.ssector); - if ((error = iso_mountfs(rootvp, mp, p, &args)) != 0) + if ((error = iso_mountfs(rootvp, mp, td, &args)) != 0) return (error); - (void)cd9660_statfs(mp, &mp->mnt_stat, p); + (void)cd9660_statfs(mp, &mp->mnt_stat, td); return (0); } @@ -173,12 +173,12 @@ iso_mountroot(mp, p) * mount system call */ static int -cd9660_mount(mp, path, data, ndp, p) +cd9660_mount(mp, path, data, ndp, td) register struct mount *mp; char *path; caddr_t data; struct nameidata *ndp; - struct proc *p; + struct thread *td; { struct vnode *devvp; struct iso_args args; @@ -188,7 +188,7 @@ cd9660_mount(mp, path, data, ndp, p) struct iso_mnt *imp = 0; if ((mp->mnt_flag & MNT_ROOTFS) != 0) { - return (iso_mountroot(mp, p)); + return (iso_mountroot(mp, td)); } if ((error = copyin(data, (caddr_t)&args, sizeof (struct iso_args)))) return (error); @@ -209,7 +209,7 @@ cd9660_mount(mp, path, data, ndp, p) * Not an update, or updating the name: look up the name * and verify that it refers to a sensible block device. */ - NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); + NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td); if ((error = namei(ndp))) return (error); NDFREE(ndp, NDF_ONLY_PNBUF); @@ -225,18 +225,18 @@ cd9660_mount(mp, path, data, ndp, p) * or has superuser abilities */ accessmode = VREAD; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p); + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td); if (error) - error = suser(p); + error = suser_td(td); if (error) { vput(devvp); return (error); } - VOP_UNLOCK(devvp, 0, p); + VOP_UNLOCK(devvp, 0, td); if ((mp->mnt_flag & MNT_UPDATE) == 0) { - error = iso_mountfs(devvp, mp, p, &args); + error = iso_mountfs(devvp, mp, td, &args); } else { if (devvp != imp->im_devvp) error = EINVAL; /* needs translation */ @@ -251,7 +251,7 @@ cd9660_mount(mp, path, data, ndp, p) (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void) cd9660_statfs(mp, &mp->mnt_stat, p); + (void) cd9660_statfs(mp, &mp->mnt_stat, td); return 0; } @@ -259,10 +259,10 @@ cd9660_mount(mp, path, data, ndp, p) * Common code for mount and mountroot */ static int -iso_mountfs(devvp, mp, p, argp) +iso_mountfs(devvp, mp, td, argp) register struct vnode *devvp; struct mount *mp; - struct proc *p; + struct thread *td; struct iso_args *argp; { register struct iso_mnt *isomp = (struct iso_mnt *)0; @@ -295,12 +295,12 @@ iso_mountfs(devvp, mp, p, argp) return error; if (vcount(devvp) > 1 && devvp != rootvp) return EBUSY; - if ((error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0))) + if ((error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0))) return (error); - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_OPEN(devvp, FREAD, FSCRED, p); - VOP_UNLOCK(devvp, 0, p); + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_OPEN(devvp, FREAD, FSCRED, td); + VOP_UNLOCK(devvp, 0, td); if (error) return error; @@ -510,7 +510,7 @@ out: if (supbp) brelse(supbp); if (needclose) - (void)VOP_CLOSE(devvp, FREAD, NOCRED, p); + (void)VOP_CLOSE(devvp, FREAD, NOCRED, td); if (isomp) { free((caddr_t)isomp, M_ISOFSMNT); mp->mnt_data = (qaddr_t)0; @@ -522,10 +522,10 @@ out: * unmount system call */ static int -cd9660_unmount(mp, mntflags, p) +cd9660_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { register struct iso_mnt *isomp; int error, flags = 0; @@ -543,7 +543,7 @@ cd9660_unmount(mp, mntflags, p) isomp = VFSTOISOFS(mp); isomp->im_devvp->v_rdev->si_mountpoint = NULL; - error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED, p); + error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED, td); vrele(isomp->im_devvp); free((caddr_t)isomp, M_ISOFSMNT); mp->mnt_data = (qaddr_t)0; @@ -576,10 +576,10 @@ cd9660_root(mp, vpp) * Get file system statistics. */ int -cd9660_statfs(mp, sbp, p) +cd9660_statfs(mp, sbp, td) struct mount *mp; register struct statfs *sbp; - struct proc *p; + struct thread *td; { register struct iso_mnt *isomp; diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 702823e..a902b58 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -87,7 +87,7 @@ cd9660_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -128,7 +128,7 @@ cd9660_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -162,7 +162,7 @@ cd9660_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { @@ -197,7 +197,7 @@ cd9660_getattr(ap) auio.uio_offset = 0; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_SYSSPACE; - auio.uio_procp = ap->a_p; + auio.uio_td = ap->a_td; auio.uio_resid = MAXPATHLEN; rdlnk.a_uio = &auio; rdlnk.a_vp = ap->a_vp; @@ -226,7 +226,7 @@ cd9660_ioctl(ap) caddr_t a_data; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; diff --git a/sys/fs/coda/coda_psdev.c b/sys/fs/coda/coda_psdev.c index 0d8560f..2346c7c 100644 --- a/sys/fs/coda/coda_psdev.c +++ b/sys/fs/coda/coda_psdev.c @@ -117,11 +117,11 @@ vcodaattach(n) } int -vc_nb_open(dev, flag, mode, p) +vc_nb_open(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; /* NetBSD only */ + struct thread *td; /* NetBSD only */ { register struct vcomm *vcp; @@ -149,11 +149,11 @@ vc_nb_open(dev, flag, mode, p) } int -vc_nb_close (dev, flag, mode, p) +vc_nb_close (dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { register struct vcomm *vcp; register struct vmsg *vmp, *nvmp = NULL; @@ -225,7 +225,7 @@ vc_nb_close (dev, flag, mode, p) #endif } - err = dounmount(mi->mi_vfsp, flag, p); + err = dounmount(mi->mi_vfsp, flag, td); if (err) myprintf(("Error %d unmounting vfs in vcclose(%d)\n", err, minor(dev))); @@ -387,12 +387,12 @@ vc_nb_write(dev, uiop, flag) } int -vc_nb_ioctl(dev, cmd, addr, flag, p) +vc_nb_ioctl(dev, cmd, addr, flag, td) dev_t dev; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { ENTRY; @@ -441,10 +441,10 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) } int -vc_nb_poll(dev, events, p) +vc_nb_poll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { register struct vcomm *vcp; int event_msk = 0; @@ -463,7 +463,7 @@ vc_nb_poll(dev, events, p) if (!EMPTY(vcp->vc_requests)) return(events & (POLLIN|POLLRDNORM)); - selrecord(p, &(vcp->vc_selproc)); + selrecord(curthread, &(vcp->vc_selproc)); return(0); } @@ -490,7 +490,8 @@ coda_call(mntinfo, inSize, outSize, buffer) struct vmsg *vmp; int error; #ifdef CTL_C - struct proc *p = curproc; + struct thread *td = curthread; + struct proc *p = td->td_proc; sigset_t psig_omask; sigset_t tempset; int i; diff --git a/sys/fs/coda/coda_psdev.h b/sys/fs/coda/coda_psdev.h index c6276f3..c6ecf7f 100644 --- a/sys/fs/coda/coda_psdev.h +++ b/sys/fs/coda/coda_psdev.h @@ -31,9 +31,9 @@ * */ -int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p); -int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p); +int vc_nb_open(dev_t dev, int flag, int mode, struct thread *p); +int vc_nb_close (dev_t dev, int flag, int mode, struct thread *p); int vc_nb_read(dev_t dev, struct uio *uiop, int flag); int vc_nb_write(dev_t dev, struct uio *uiop, int flag); -int vc_nb_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p); -int vc_nb_poll(dev_t dev, int events, struct proc *p); +int vc_nb_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *p); +int vc_nb_poll(dev_t dev, int events, struct thread *p); diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index 8bcd36f..d01d5a7 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -83,7 +83,7 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE]; #define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++) extern int coda_nc_initialized; /* Set if cache has been initialized */ -extern int vc_nb_open __P((dev_t, int, int, struct proc *)); +extern int vc_nb_open __P((dev_t, int, int, struct thread *)); int coda_vfsopstats_init(void) @@ -107,12 +107,12 @@ coda_vfsopstats_init(void) */ /*ARGSUSED*/ int -coda_mount(vfsp, path, data, ndp, p) +coda_mount(vfsp, path, data, ndp, td) struct mount *vfsp; /* Allocated and initialized by mount(2) */ char *path; /* path covered: ignored by the fs-layer */ caddr_t data; /* Need to define a data type for this in netbsd? */ struct nameidata *ndp; /* Clobber this to lookup the device name */ - struct proc *p; /* The ever-famous proc pointer */ + struct thread *td; /* The ever-famous proc pointer */ { struct vnode *dvp; struct cnode *cp; @@ -135,7 +135,7 @@ coda_mount(vfsp, path, data, ndp, p) } /* Validate mount device. Similar to getmdev(). */ - NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, p); + NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, td); error = namei(ndp); dvp = ndp->ni_vp; @@ -233,10 +233,10 @@ coda_mount(vfsp, path, data, ndp, p) } int -coda_unmount(vfsp, mntflags, p) +coda_unmount(vfsp, mntflags, td) struct mount *vfsp; int mntflags; - struct proc *p; + struct thread *td; { struct coda_mntinfo *mi = vftomi(vfsp); int active, error = 0; @@ -292,8 +292,12 @@ coda_root(vfsp, vpp) struct coda_mntinfo *mi = vftomi(vfsp); struct vnode **result; int error; - struct proc *p = curproc; /* XXX - bnoble */ + struct thread *td = curthread; /* XXX - bnoble */ + struct proc *p = td->td_proc; ViceFid VFid; + + ENTRY; + ENTRY; MARK_ENTRY(CODA_ROOT_STATS); @@ -308,9 +312,9 @@ coda_root(vfsp, vpp) /* On Mach, this is vref. On NetBSD, VOP_LOCK */ #if 1 vref(*vpp); - vn_lock(*vpp, LK_EXCLUSIVE, p); + vn_lock(*vpp, LK_EXCLUSIVE, td); #else - vget(*vpp, LK_EXCLUSIVE, p); + vget(*vpp, LK_EXCLUSIVE, td); #endif MARK_INT_SAT(CODA_ROOT_STATS); return(0); @@ -331,9 +335,9 @@ coda_root(vfsp, vpp) *vpp = mi->mi_rootvp; #if 1 vref(*vpp); - vn_lock(*vpp, LK_EXCLUSIVE, p); + vn_lock(*vpp, LK_EXCLUSIVE, td); #else - vget(*vpp, LK_EXCLUSIVE, p); + vget(*vpp, LK_EXCLUSIVE, td); #endif MARK_INT_SAT(CODA_ROOT_STATS); @@ -351,9 +355,9 @@ coda_root(vfsp, vpp) *vpp = mi->mi_rootvp; #if 1 vref(*vpp); - vn_lock(*vpp, LK_EXCLUSIVE, p); + vn_lock(*vpp, LK_EXCLUSIVE, td); #else - vget(*vpp, LK_EXCLUSIVE, p); + vget(*vpp, LK_EXCLUSIVE, td); #endif MARK_INT_FAIL(CODA_ROOT_STATS); @@ -374,10 +378,10 @@ coda_root(vfsp, vpp) * Get file system statistics. */ int -coda_nb_statfs(vfsp, sbp, p) +coda_nb_statfs(vfsp, sbp, td) register struct mount *vfsp; struct statfs *sbp; - struct proc *p; + struct thread *td; { ENTRY; /* MARK_ENTRY(CODA_STATFS_STATS); */ @@ -412,11 +416,11 @@ coda_nb_statfs(vfsp, sbp, p) * Flush any pending I/O. */ int -coda_sync(vfsp, waitfor, cred, p) +coda_sync(vfsp, waitfor, cred, td) struct mount *vfsp; int waitfor; struct ucred *cred; - struct proc *p; + struct thread *td; { ENTRY; MARK_ENTRY(CODA_SYNC_STATS); @@ -441,7 +445,8 @@ coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp) struct cfid *cfid = (struct cfid *)fhp; struct cnode *cp = 0; int error; - struct proc *p = curproc; /* XXX -mach */ + struct thread *td = curthread; /* XXX -mach */ + struct proc *p = td->td_proc; ViceFid VFid; int vtype; diff --git a/sys/fs/coda/coda_vfsops.h b/sys/fs/coda/coda_vfsops.h index 7fc9adf..57b9a5a 100644 --- a/sys/fs/coda/coda_vfsops.h +++ b/sys/fs/coda/coda_vfsops.h @@ -48,13 +48,13 @@ struct mount; int coda_vfsopstats_init(void); int coda_mount(struct mount *, char *, caddr_t, struct nameidata *, - struct proc *); -int coda_start(struct mount *, int, struct proc *); -int coda_unmount(struct mount *, int, struct proc *); + struct thread *); +int coda_start(struct mount *, int, struct thread *); +int coda_unmount(struct mount *, int, struct thread *); int coda_root(struct mount *, struct vnode **); -int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *); -int coda_nb_statfs(struct mount *, struct statfs *, struct proc *); -int coda_sync(struct mount *, int, struct ucred *, struct proc *); +int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *); +int coda_nb_statfs(struct mount *, struct statfs *, struct thread *); +int coda_sync(struct mount *, int, struct ucred *, struct thread *); int coda_vget(struct mount *, ino_t, struct vnode **); int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **); diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index dd0a96e..8fd7170d 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -235,7 +235,7 @@ coda_open(v) struct cnode *cp = VTOC(*vpp); int flag = ap->a_mode & (~O_EXCL); struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* locals */ int error; struct vnode *vp; @@ -256,7 +256,7 @@ coda_open(v) return(0); } - error = venus_open(vtomi((*vpp)), &cp->c_fid, flag, cred, p, &dev, &inode); + error = venus_open(vtomi((*vpp)), &cp->c_fid, flag, cred, td->td_proc, &dev, &inode); if (error) return (error); if (!error) { @@ -272,7 +272,7 @@ coda_open(v) return (error); /* We get the vnode back locked. Needs unlocked */ - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); /* Keep a reference until the close comes in. */ vref(*vpp); @@ -297,14 +297,14 @@ coda_open(v) cp->c_inode = inode; /* Open the cache file. */ - error = VOP_OPEN(vp, flag, cred, p); + error = VOP_OPEN(vp, flag, cred, td); if (error) { printf("coda_open: VOP_OPEN on container failed %d\n", error); return (error); } /* grab (above) does this when it calls newvnode unless it's in the cache*/ if (vp->v_type == VREG) { - error = vfs_object_create(vp, p, cred); + error = vfs_object_create(vp, td, cred); if (error != 0) { printf("coda_open: vfs_object_create() returns %d\n", error); vput(vp); @@ -327,7 +327,7 @@ coda_close(v) struct cnode *cp = VTOC(vp); int flag = ap->a_fflag; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* locals */ int error; @@ -348,7 +348,7 @@ coda_close(v) #ifdef hmm vgone(cp->c_ovp); #else - VOP_CLOSE(cp->c_ovp, flag, cred, p); /* Do errors matter here? */ + VOP_CLOSE(cp->c_ovp, flag, cred, td); /* Do errors matter here? */ vrele(cp->c_ovp); #endif } else { @@ -358,7 +358,7 @@ coda_close(v) } return ENODEV; } else { - VOP_CLOSE(cp->c_ovp, flag, cred, p); /* Do errors matter here? */ + VOP_CLOSE(cp->c_ovp, flag, cred, td); /* Do errors matter here? */ vrele(cp->c_ovp); } @@ -368,7 +368,7 @@ coda_close(v) if (flag & FWRITE) /* file was opened for write */ --cp->c_owrite; - error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, p); + error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, td->td_proc); vrele(CTOV(cp)); CODADEBUG(CODA_CLOSE, myprintf(("close: result %d\n",error)); ) @@ -383,7 +383,7 @@ coda_read(v) ENTRY; return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_READ, - ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp)); + ap->a_ioflag, ap->a_cred, ap->a_uio->uio_td)); } int @@ -394,24 +394,25 @@ coda_write(v) ENTRY; return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, - ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp)); + ap->a_ioflag, ap->a_cred, ap->a_uio->uio_td)); } int -coda_rdwr(vp, uiop, rw, ioflag, cred, p) +coda_rdwr(vp, uiop, rw, ioflag, cred, td) struct vnode *vp; struct uio *uiop; enum uio_rw rw; int ioflag; struct ucred *cred; - struct proc *p; + struct thread *td; { /* upcall decl */ /* NOTE: container file operation!!! */ /* locals */ struct cnode *cp = VTOC(vp); struct vnode *cfvp = cp->c_ovp; - struct proc *lp = p; + struct proc *p = td->td_proc; + struct thread *ltd = td; int igot_internally = 0; int opened_internally = 0; int error = 0; @@ -448,7 +449,7 @@ coda_rdwr(vp, uiop, rw, ioflag, cred, p) PROC_UNLOCK(p); } else - lp = curproc; + ltd = curthread; if (cp->c_inode != 0 && !iscore) { igot_internally = 1; @@ -458,23 +459,23 @@ coda_rdwr(vp, uiop, rw, ioflag, cred, p) return(error); } /* - * We get the vnode back locked by curproc in both Mach and + * We get the vnode back locked by curthread in both Mach and * NetBSD. Needs unlocked */ - VOP_UNLOCK(cfvp, 0, lp); + VOP_UNLOCK(cfvp, 0, ltd); } else { opened_internally = 1; MARK_INT_GEN(CODA_OPEN_STATS); error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), - cred, p); + cred, td); printf("coda_rdwr: Internally Opening %p\n", vp); if (error) { printf("coda_rdwr: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { - error = vfs_object_create(vp, p, cred); + error = vfs_object_create(vp, td, cred); if (error != 0) { printf("coda_rdwr: vfs_object_create() returns %d\n", error); vput(vp); @@ -501,7 +502,7 @@ printf("coda_rdwr: Internally Opening %p\n", vp); { struct vattr attr; - if (VOP_GETATTR(cfvp, &attr, cred, p) == 0) { + if (VOP_GETATTR(cfvp, &attr, cred, td) == 0) { vnode_pager_setsize(vp, attr.va_size); } } @@ -515,7 +516,7 @@ printf("coda_rdwr: Internally Opening %p\n", vp); /* Do an internal close if necessary. */ if (opened_internally) { MARK_INT_GEN(CODA_CLOSE_STATS); - (void)VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p); + (void)VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, td); } /* Invalidate cached attributes if writing. */ @@ -537,7 +538,7 @@ coda_ioctl(v) caddr_t data = ap->a_data; int flag = ap->a_fflag; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* locals */ int error; struct vnode *tvp; @@ -562,7 +563,7 @@ coda_ioctl(v) /* Should we use the name cache here? It would get it from lookupname sooner or later anyway, right? */ - NDINIT(&ndp, LOOKUP, (iap->follow ? FOLLOW : NOFOLLOW), UIO_USERSPACE, iap->path, p); + NDINIT(&ndp, LOOKUP, (iap->follow ? FOLLOW : NOFOLLOW), UIO_USERSPACE, iap->path, td); error = namei(&ndp); tvp = ndp.ni_vp; @@ -591,7 +592,7 @@ coda_ioctl(v) NDFREE(&ndp, 0); return(EINVAL); } - error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, p); + error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, td->td_proc); if (error) MARK_INT_FAIL(CODA_IOCTL_STATS); @@ -622,7 +623,7 @@ coda_getattr(v) struct cnode *cp = VTOC(vp); struct vattr *vap = ap->a_vap; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* locals */ int error; @@ -651,7 +652,7 @@ coda_getattr(v) return(0); } - error = venus_getattr(vtomi(vp), &cp->c_fid, cred, p, vap); + error = venus_getattr(vtomi(vp), &cp->c_fid, cred, td->td_proc, vap); if (!error) { CODADEBUG(CODA_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n", @@ -689,7 +690,7 @@ coda_setattr(v) struct cnode *cp = VTOC(vp); register struct vattr *vap = ap->a_vap; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* locals */ int error; @@ -704,7 +705,7 @@ coda_setattr(v) if (codadebug & CODADBGMSK(CODA_SETATTR)) { print_vattr(vap); } - error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, p); + error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, td->td_proc); if (!error) cp->c_flags &= ~C_VATTR; @@ -729,7 +730,7 @@ coda_access(v) struct cnode *cp = VTOC(vp); int mode = ap->a_mode; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* locals */ int error; @@ -758,7 +759,7 @@ coda_access(v) } } - error = venus_access(vtomi(vp), &cp->c_fid, mode, cred, p); + error = venus_access(vtomi(vp), &cp->c_fid, mode, cred, td->td_proc); return(error); } @@ -773,7 +774,7 @@ coda_readlink(v) struct cnode *cp = VTOC(vp); struct uio *uiop = ap->a_uio; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; /* locals */ int error; char *str; @@ -797,7 +798,7 @@ coda_readlink(v) return(error); } - error = venus_readlink(vtomi(vp), &cp->c_fid, cred, p, &str, &len); + error = venus_readlink(vtomi(vp), &cp->c_fid, cred, td->td_proc, &str, &len); if (!error) { uiop->uio_rw = UIO_READ; @@ -824,7 +825,7 @@ coda_fsync(v) struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* locals */ struct vnode *convp = cp->c_ovp; int error; @@ -847,7 +848,7 @@ coda_fsync(v) } if (convp) - VOP_FSYNC(convp, cred, MNT_WAIT, p); + VOP_FSYNC(convp, cred, MNT_WAIT, td); /* * We see fsyncs with usecount == 1 then usecount == 0. @@ -873,7 +874,7 @@ coda_fsync(v) /* needs research */ return 0; - error = venus_fsync(vtomi(vp), &cp->c_fid, cred, p); + error = venus_fsync(vtomi(vp), &cp->c_fid, cred, td->td_proc); CODADEBUG(CODA_FSYNC, myprintf(("in fsync result %d\n",error)); ); return(error); @@ -890,7 +891,7 @@ coda_inactive(v) struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct ucred *cred __attribute__((unused)) = NULL; - struct proc *p __attribute__((unused)) = curproc; + struct thread *td __attribute__((unused)) = curthread; /* upcall decl */ /* locals */ @@ -930,7 +931,7 @@ coda_inactive(v) printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp); #endif - lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, p); + lockmgr(&cp->c_lock, LK_RELEASE, &vp->v_interlock, td); } else { #ifdef OLD_DIAGNOSTIC if (CTOV(cp)->v_usecount) { @@ -940,7 +941,7 @@ coda_inactive(v) panic("coda_inactive: cp->ovp != NULL"); } #endif - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); vgone(vp); } @@ -972,7 +973,7 @@ coda_lookup(v) */ struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; /* locals */ struct cnode *cp; const char *nm = cnp->cn_nameptr; @@ -1015,7 +1016,7 @@ coda_lookup(v) } else { /* The name wasn't cached, so we need to contact Venus */ - error = venus_lookup(vtomi(dvp), &dcp->c_fid, nm, len, cred, p, &VFid, &vtype); + error = venus_lookup(vtomi(dvp), &dcp->c_fid, nm, len, cred, td->td_proc, &VFid, &vtype); if (error) { MARK_INT_FAIL(CODA_LOOKUP_STATS); @@ -1086,7 +1087,7 @@ coda_lookup(v) */ if (!error || (error == EJUSTRETURN)) { if (!(cnp->cn_flags & LOCKPARENT) || !(cnp->cn_flags & ISLASTCN)) { - if ((error = VOP_UNLOCK(dvp, 0, p))) { + if ((error = VOP_UNLOCK(dvp, 0, td))) { return error; } /* @@ -1094,7 +1095,7 @@ coda_lookup(v) * lock it without bothering to check anything else. */ if (*ap->a_vpp) { - if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) { printf("coda_lookup: "); panic("unlocked parent but couldn't lock child"); } @@ -1103,7 +1104,7 @@ coda_lookup(v) /* The parent is locked, and may be the same as the child */ if (*ap->a_vpp && (*ap->a_vpp != dvp)) { /* Different, go ahead and lock it. */ - if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) { printf("coda_lookup: "); panic("unlocked parent but couldn't lock child"); } @@ -1132,7 +1133,7 @@ coda_create(v) struct vnode **vpp = ap->a_vpp; struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; /* locals */ int error; struct cnode *cp; @@ -1153,7 +1154,7 @@ coda_create(v) return(EACCES); } - error = venus_create(vtomi(dvp), &dcp->c_fid, nm, len, exclusive, mode, va, cred, p, &VFid, &attr); + error = venus_create(vtomi(dvp), &dcp->c_fid, nm, len, exclusive, mode, va, cred, td->td_proc, &VFid, &attr); if (!error) { @@ -1192,7 +1193,7 @@ coda_create(v) if (!error) { if (cnp->cn_flags & LOCKLEAF) { - if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, p))) { + if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) { printf("coda_create: "); panic("unlocked parent but couldn't lock child"); } @@ -1216,7 +1217,7 @@ coda_remove(v) struct cnode *cp = VTOC(dvp); struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; /* locals */ int error; const char *nm = cnp->cn_nameptr; @@ -1259,7 +1260,7 @@ coda_remove(v) return(ENOENT); } - error = venus_remove(vtomi(dvp), &cp->c_fid, nm, len, cred, p); + error = venus_remove(vtomi(dvp), &cp->c_fid, nm, len, cred, td->td_proc); CODADEBUG(CODA_REMOVE, myprintf(("in remove result %d\n",error)); ) @@ -1278,7 +1279,7 @@ coda_link(v) struct cnode *tdcp = VTOC(tdvp); struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; /* locals */ int error; const char *nm = cnp->cn_nameptr; @@ -1308,7 +1309,7 @@ coda_link(v) return(EACCES); } - error = venus_link(vtomi(vp), &cp->c_fid, &tdcp->c_fid, nm, len, cred, p); + error = venus_link(vtomi(vp), &cp->c_fid, &tdcp->c_fid, nm, len, cred, td->td_proc); /* Invalidate the parent's attr cache, the modification time has changed */ VTOC(tdvp)->c_flags &= ~C_VATTR; @@ -1332,7 +1333,7 @@ coda_rename(v) struct cnode *ndcp = VTOC(ndvp); struct componentname *tcnp = ap->a_tcnp; struct ucred *cred = fcnp->cn_cred; - struct proc *p = fcnp->cn_proc; + struct thread *td = fcnp->cn_thread; /* true args */ int error; const char *fnm = fcnp->cn_nameptr; @@ -1346,7 +1347,7 @@ coda_rename(v) This could be Bad. XXX */ #ifdef OLD_DIAGNOSTIC if ((fcnp->cn_cred != tcnp->cn_cred) - || (fcnp->cn_proc != tcnp->cn_proc)) + || (fcnp->cn_thread != tcnp->cn_thread)) { panic("coda_rename: component names don't agree"); } @@ -1389,7 +1390,7 @@ coda_rename(v) goto exit; } - error = venus_rename(vtomi(odvp), &odcp->c_fid, &ndcp->c_fid, fnm, flen, tnm, tlen, cred, p); + error = venus_rename(vtomi(odvp), &odcp->c_fid, &ndcp->c_fid, fnm, flen, tnm, tlen, cred, td->td_proc); exit: CODADEBUG(CODA_RENAME, myprintf(("in rename result %d\n",error));) @@ -1426,7 +1427,7 @@ coda_mkdir(v) register struct vattr *va = ap->a_vap; struct vnode **vpp = ap->a_vpp; struct ucred *cred = cnp->cn_cred; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; /* locals */ int error; const char *nm = cnp->cn_nameptr; @@ -1450,7 +1451,7 @@ coda_mkdir(v) return(EACCES); } - error = venus_mkdir(vtomi(dvp), &dcp->c_fid, nm, len, va, cred, p, &VFid, &ova); + error = venus_mkdir(vtomi(dvp), &dcp->c_fid, nm, len, va, cred, td->td_proc, &VFid, &ova); if (!error) { if (coda_find(&VFid) != NULL) @@ -1495,7 +1496,7 @@ coda_rmdir(v) struct cnode *dcp = VTOC(dvp); struct componentname *cnp = ap->a_cnp; struct ucred *cred = cnp->cn_cred; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; /* true args */ int error; const char *nm = cnp->cn_nameptr; @@ -1527,7 +1528,7 @@ coda_rmdir(v) /* Invalidate the parent's attr cache, the modification time has changed */ dcp->c_flags &= ~C_VATTR; - error = venus_rmdir(vtomi(dvp), &dcp->c_fid, nm, len, cred, p); + error = venus_rmdir(vtomi(dvp), &dcp->c_fid, nm, len, cred, td->td_proc); CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); ) @@ -1546,7 +1547,7 @@ coda_symlink(v) struct vattr *tva = ap->a_vap; char *path = ap->a_target; struct ucred *cred = cnp->cn_cred; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode **vpp = ap->a_vpp; /* locals */ int error; @@ -1589,7 +1590,7 @@ coda_symlink(v) goto exit; } - error = venus_symlink(vtomi(tdvp), &tdcp->c_fid, path, plen, nm, len, tva, cred, p); + error = venus_symlink(vtomi(tdvp), &tdcp->c_fid, path, plen, nm, len, tva, cred, td->td_proc); /* Invalidate the parent's attr cache, the modification time has changed */ tdcp->c_flags &= ~C_VATTR; @@ -1618,7 +1619,7 @@ coda_readdir(v) int *eofflag = ap->a_eofflag; u_long **cookies = ap->a_cookies; int *ncookies = ap->a_ncookies; - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; /* upcall decl */ /* locals */ int error = 0; @@ -1643,14 +1644,14 @@ coda_readdir(v) if (cp->c_ovp == NULL) { opened_internally = 1; MARK_INT_GEN(CODA_OPEN_STATS); - error = VOP_OPEN(vp, FREAD, cred, p); + error = VOP_OPEN(vp, FREAD, cred, td); printf("coda_readdir: Internally Opening %p\n", vp); if (error) { printf("coda_readdir: VOP_OPEN on container failed %d\n", error); return (error); } if (vp->v_type == VREG) { - error = vfs_object_create(vp, p, cred); + error = vfs_object_create(vp, td, cred); if (error != 0) { printf("coda_readdir: vfs_object_create() returns %d\n", error); vput(vp); @@ -1672,7 +1673,7 @@ printf("coda_readdir: Internally Opening %p\n", vp); /* Do an "internal close" if necessary. */ if (opened_internally) { MARK_INT_GEN(CODA_CLOSE_STATS); - (void)VOP_CLOSE(vp, FREAD, cred, p); + (void)VOP_CLOSE(vp, FREAD, cred, td); } } @@ -1693,7 +1694,7 @@ coda_bmap(v) daddr_t bn __attribute__((unused)) = ap->a_bn; /* fs block number */ struct vnode **vpp = ap->a_vpp; /* RETURN vp of device */ daddr_t *bnp __attribute__((unused)) = ap->a_bnp; /* RETURN device block number */ - struct proc *p __attribute__((unused)) = curproc; + struct thread *td __attribute__((unused)) = curthread; /* upcall decl */ /* locals */ @@ -1731,7 +1732,7 @@ coda_strategy(v) /* true args */ struct vop_strategy_args *ap = v; register struct buf *bp __attribute__((unused)) = ap->a_bp; - struct proc *p __attribute__((unused)) = curproc; + struct thread *td __attribute__((unused)) = curthread; /* upcall decl */ /* locals */ @@ -1786,7 +1787,7 @@ coda_lock(v) struct vop_lock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* upcall decl */ /* locals */ @@ -1798,9 +1799,9 @@ coda_lock(v) } #ifndef DEBUG_LOCKS - return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p)); + return (lockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, td)); #else - return (debuglockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, p, + return (debuglockmgr(&cp->c_lock, ap->a_flags, &vp->v_interlock, td, "coda_lock", vp->filename, vp->line)); #endif } @@ -1813,7 +1814,7 @@ coda_unlock(v) struct vop_unlock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; /* upcall decl */ /* locals */ @@ -1823,7 +1824,7 @@ coda_unlock(v) cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique)); } - return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, p)); + return (lockmgr(&cp->c_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock, td)); } int @@ -1835,7 +1836,7 @@ coda_islocked(v) struct cnode *cp = VTOC(ap->a_vp); ENTRY; - return (lockstatus(&cp->c_lock, ap->a_p)); + return (lockstatus(&cp->c_lock, ap->a_td)); } /* How one looks up a vnode given a device/inode pair: */ diff --git a/sys/fs/coda/coda_vnops.h b/sys/fs/coda/coda_vnops.h index 9fcd978..663d357 100644 --- a/sys/fs/coda/coda_vnops.h +++ b/sys/fs/coda/coda_vnops.h @@ -82,7 +82,7 @@ int coda_fbsd_getpages __P((void *)); int (**coda_vnodeop_p)(void *); int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, - int ioflag, struct ucred *cred, struct proc *p); + int ioflag, struct ucred *cred, struct thread *td); int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred); diff --git a/sys/fs/devfs/devfs.h b/sys/fs/devfs/devfs.h index 28640ce..598fbf0 100644 --- a/sys/fs/devfs/devfs.h +++ b/sys/fs/devfs/devfs.h @@ -104,7 +104,7 @@ struct devfs_mount { extern vop_t **devfs_vnodeop_p; extern vop_t **devfs_specop_p; -int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct proc *p); +int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td); dev_t *devfs_itod (int inode); struct devfs_dirent **devfs_itode (struct devfs_mount *dm, int inode); int devfs_populate (struct devfs_mount *dm); diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 9f19fca..6b406be 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -283,7 +283,7 @@ devfs_populate(struct devfs_mount *dm) if (dm->dm_generation == devfs_generation) return (0); - lockmgr(&dm->dm_lock, LK_UPGRADE, 0, curproc); + lockmgr(&dm->dm_lock, LK_UPGRADE, 0, curthread); if (devfs_noverflow && dm->dm_overflow == NULL) { i = devfs_noverflow * sizeof (struct devfs_dirent *); MALLOC(dm->dm_overflow, struct devfs_dirent **, i, @@ -358,7 +358,7 @@ devfs_populate(struct devfs_mount *dm) #endif } } - lockmgr(&dm->dm_lock, LK_DOWNGRADE, 0, curproc); + lockmgr(&dm->dm_lock, LK_DOWNGRADE, 0, curthread); return (0); } diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 2d1aa90..e970c5a 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -52,23 +52,23 @@ MALLOC_DEFINE(M_DEVFS, "DEVFS", "DEVFS data"); static int devfs_mount __P((struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p)); + struct nameidata *ndp, struct thread *td)); static int devfs_unmount __P((struct mount *mp, int mntflags, - struct proc *p)); + struct thread *td)); static int devfs_root __P((struct mount *mp, struct vnode **vpp)); static int devfs_statfs __P((struct mount *mp, struct statfs *sbp, - struct proc *p)); + struct thread *td)); /* * Mount the filesystem */ static int -devfs_mount(mp, path, data, ndp, p) +devfs_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 devfs_mount *fmp; @@ -101,20 +101,20 @@ devfs_mount(mp, path, data, ndp, p) FREE(fmp, M_DEVFS); return (error); } - VOP_UNLOCK(rvp, 0, p); + VOP_UNLOCK(rvp, 0, td); bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); bcopy("devfs", mp->mnt_stat.f_mntfromname, sizeof("devfs")); - (void)devfs_statfs(mp, &mp->mnt_stat, p); + (void)devfs_statfs(mp, &mp->mnt_stat, td); return (0); } static int -devfs_unmount(mp, mntflags, p) +devfs_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { int error; int flags = 0; @@ -142,13 +142,13 @@ devfs_root(mp, vpp) struct vnode **vpp; { int error; - struct proc *p; + struct thread *td; struct vnode *vp; struct devfs_mount *dmp; - p = curproc; /* XXX */ + td = curthread; /* XXX */ dmp = VFSTODEVFS(mp); - error = devfs_allocv(dmp->dm_rootdir, mp, &vp, p); + error = devfs_allocv(dmp->dm_rootdir, mp, &vp, td); if (error) return (error); vp->v_flag |= VROOT; @@ -157,10 +157,10 @@ devfs_root(mp, vpp) } static int -devfs_statfs(mp, sbp, p) +devfs_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { sbp->f_flags = 0; diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index bafc3b3..ba6231c 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -111,18 +111,18 @@ devfs_fqpn(char *buf, struct vnode *dvp, struct componentname *cnp) } int -devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct proc *p) +devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td) { int error; struct vnode *vp; dev_t dev; - if (p == NULL) - p = curproc; /* XXX */ + if (td == NULL) + td = curthread; /* XXX */ loop: vp = de->de_vnode; if (vp != NULL) { - if (vget(vp, LK_EXCLUSIVE, p ? p : curproc)) + if (vget(vp, LK_EXCLUSIVE, td ? td : curthread)) goto loop; *vpp = vp; return (0); @@ -153,7 +153,7 @@ loop: } vp->v_data = de; de->de_vnode = vp; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); *vpp = vp; return (0); } @@ -164,7 +164,7 @@ devfs_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -184,7 +184,7 @@ devfs_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -252,7 +252,7 @@ devfs_lookupx(ap) { struct componentname *cnp; struct vnode *dvp, **vpp; - struct proc *p; + struct thread *td; struct devfs_dirent *de, *dd; struct devfs_mount *dmp; dev_t cdev, *cpdev; @@ -263,7 +263,7 @@ devfs_lookupx(ap) vpp = ap->a_vpp; dvp = ap->a_dvp; pname = cnp->cn_nameptr; - p = cnp->cn_proc; + td = cnp->cn_thread; flags = cnp->cn_flags; nameiop = cnp->cn_nameiop; dmp = VFSTODEVFS(dvp->v_mount); @@ -281,7 +281,7 @@ devfs_lookupx(ap) if ((flags & ISDOTDOT) && (dvp->v_flag & VROOT)) return (EIO); - error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, cnp->cn_proc); + error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td); if (error) return (error); @@ -296,17 +296,17 @@ devfs_lookupx(ap) if (flags & ISDOTDOT) { if (nameiop != LOOKUP) return (EINVAL); - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); de = TAILQ_FIRST(&dd->de_dlist); /* "." */ de = TAILQ_NEXT(de, de_list); /* ".." */ de = de->de_dir; - error = devfs_allocv(de, dvp->v_mount, vpp, p); + error = devfs_allocv(de, dvp->v_mount, vpp, td); if (error) { - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); return (error); } if ((flags & LOCKPARENT) && (flags & ISLASTCN)) - error = vn_lock(dvp, LK_EXCLUSIVE, p); + error = vn_lock(dvp, LK_EXCLUSIVE, td); if (error) vput(*vpp); return (error); @@ -357,7 +357,7 @@ notfound: (flags & (LOCKPARENT | WANTPARENT)) && (flags & ISLASTCN)) { cnp->cn_flags |= SAVENAME; if (!(flags & LOCKPARENT)) - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); return (EJUSTRETURN); } return (ENOENT); @@ -366,7 +366,7 @@ notfound: found: if ((cnp->cn_nameiop == DELETE) && (flags & ISLASTCN)) { - error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, p); + error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, td); if (error) return (error); if (*vpp == dvp) { @@ -374,18 +374,18 @@ found: *vpp = dvp; return (0); } - error = devfs_allocv(de, dvp->v_mount, vpp, p); + error = devfs_allocv(de, dvp->v_mount, vpp, td); if (error) return (error); if (!(flags & LOCKPARENT)) - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); return (0); } - error = devfs_allocv(de, dvp->v_mount, vpp, p); + error = devfs_allocv(de, dvp->v_mount, vpp, td); if (error) return (error); if (!(flags & LOCKPARENT) || !(flags & ISLASTCN)) - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); return (0); } @@ -396,9 +396,9 @@ devfs_lookup(struct vop_lookup_args *ap) struct devfs_mount *dmp; dmp = VFSTODEVFS(ap->a_dvp->v_mount); - lockmgr(&dmp->dm_lock, LK_SHARED, 0, curproc); + lockmgr(&dmp->dm_lock, LK_SHARED, 0, curthread); j = devfs_lookupx(ap); - lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curproc); + lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curthread); return (j); } @@ -416,7 +416,7 @@ struct vop_mknod_args { { struct componentname *cnp; struct vnode *dvp, **vpp; - struct proc *p; + struct thread *td; struct devfs_dirent *dd, *de; struct devfs_mount *dmp; int cloned, flags, nameiop; @@ -424,11 +424,11 @@ struct vop_mknod_args { dvp = ap->a_dvp; dmp = VFSTODEVFS(dvp->v_mount); - lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, curproc); + lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, curthread); cnp = ap->a_cnp; vpp = ap->a_vpp; - p = cnp->cn_proc; + td = cnp->cn_thread; flags = cnp->cn_flags; nameiop = cnp->cn_nameiop; cloned = 0; @@ -448,9 +448,9 @@ struct vop_mknod_args { if (de == NULL) goto notfound; de->de_flags &= ~DE_WHITEOUT; - error = devfs_allocv(de, dvp->v_mount, vpp, p); + error = devfs_allocv(de, dvp->v_mount, vpp, td); notfound: - lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curproc); + lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curthread); return (error); } @@ -512,7 +512,7 @@ devfs_readdir(ap) return (EINVAL); dmp = VFSTODEVFS(ap->a_vp->v_mount); - lockmgr(&dmp->dm_lock, LK_SHARED, 0, curproc); + lockmgr(&dmp->dm_lock, LK_SHARED, 0, curthread); devfs_populate(dmp); error = 0; de = ap->a_vp->v_data; @@ -553,7 +553,7 @@ devfs_readdir(ap) *ap->a_ncookies = ncookies; *ap->a_cookies = cookiebuf; } - lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curproc); + lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curthread); uio->uio_offset = off; return (error); } @@ -610,11 +610,11 @@ devfs_remove(ap) struct devfs_dirent *de; struct devfs_mount *dmp = VFSTODEVFS(vp->v_mount); - lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, curproc); + lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, curthread); dd = ap->a_dvp->v_data; de = vp->v_data; de->de_flags |= DE_WHITEOUT; - lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curproc); + lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curthread); return (0); } @@ -683,7 +683,7 @@ devfs_setattr(ap) if (uid != de->de_uid || gid != de->de_gid) { if (((ap->a_cred->cr_uid != de->de_uid) || uid != de->de_uid || (gid != de->de_gid && !groupmember(gid, ap->a_cred))) && - (error = suser(ap->a_p)) != 0) + (error = suser(ap->a_td->td_proc)) != 0) return (error); de->de_uid = uid; de->de_gid = gid; @@ -691,21 +691,21 @@ devfs_setattr(ap) } if (vap->va_mode != (mode_t)VNOVAL) { if ((ap->a_cred->cr_uid != de->de_uid) && - (error = suser(ap->a_p))) + (error = suser(ap->a_td->td_proc))) return (error); de->de_mode = vap->va_mode; c = 1; } if (vap->va_atime.tv_sec != VNOVAL) { if ((ap->a_cred->cr_uid != de->de_uid) && - (error = suser(ap->a_p))) + (error = suser(ap->a_td->td_proc))) return (error); de->de_atime = vap->va_atime; c = 1; } if (vap->va_mtime.tv_sec != VNOVAL) { if ((ap->a_cred->cr_uid != de->de_uid) && - (error = suser(ap->a_p))) + (error = suser(ap->a_td->td_proc))) return (error); de->de_mtime = vap->va_mtime; c = 1; @@ -731,7 +731,7 @@ devfs_symlink(ap) struct devfs_dirent *de; struct devfs_mount *dmp; - error = suser(ap->a_cnp->cn_proc); + error = suser(ap->a_cnp->cn_thread->td_proc); if (error) return(error); dmp = VFSTODEVFS(ap->a_dvp->v_mount); @@ -745,10 +745,10 @@ devfs_symlink(ap) i = strlen(ap->a_target) + 1; MALLOC(de->de_symlink, char *, i, M_DEVFS, M_WAITOK); bcopy(ap->a_target, de->de_symlink, i); - lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, curproc); + lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, curthread); TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp, 0); - lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curproc); + lockmgr(&dmp->dm_lock, LK_RELEASE, 0, curthread); return (0); } diff --git a/sys/fs/fdescfs/fdesc.h b/sys/fs/fdescfs/fdesc.h index b78d132..f90ea8d 100644 --- a/sys/fs/fdescfs/fdesc.h +++ b/sys/fs/fdescfs/fdesc.h @@ -65,5 +65,5 @@ struct fdescnode { extern int fdesc_init __P((struct vfsconf *)); extern int fdesc_root __P((struct mount *, struct vnode **)); extern int fdesc_allocvp __P((fdntype, int, struct mount *, struct vnode **, - struct proc *)); + struct thread *)); #endif /* _KERNEL */ diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index ed16306..11da211 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -59,22 +59,22 @@ static MALLOC_DEFINE(M_FDESCMNT, "FDESC mount", "FDESC mount structure"); static int fdesc_mount __P((struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p)); + struct nameidata *ndp, struct thread *td)); static int fdesc_unmount __P((struct mount *mp, int mntflags, - struct proc *p)); + struct thread *td)); static int fdesc_statfs __P((struct mount *mp, struct statfs *sbp, - struct proc *p)); + struct thread *td)); /* * Mount the per-process file descriptors (/dev/fd) */ static int -fdesc_mount(mp, path, data, ndp, p) +fdesc_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 = 0; struct fdescmount *fmp; @@ -86,7 +86,7 @@ fdesc_mount(mp, path, data, ndp, p) if (mp->mnt_flag & MNT_UPDATE) return (EOPNOTSUPP); - error = fdesc_allocvp(Froot, FD_ROOT, mp, &rvp, p); + error = fdesc_allocvp(Froot, FD_ROOT, mp, &rvp, td); if (error) return (error); @@ -102,15 +102,15 @@ fdesc_mount(mp, path, data, ndp, p) bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc")); - (void)fdesc_statfs(mp, &mp->mnt_stat, p); + (void)fdesc_statfs(mp, &mp->mnt_stat, td); return (0); } static int -fdesc_unmount(mp, mntflags, p) +fdesc_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { int error; int flags = 0; @@ -143,7 +143,7 @@ fdesc_root(mp, vpp) struct mount *mp; struct vnode **vpp; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct vnode *vp; /* @@ -151,16 +151,16 @@ fdesc_root(mp, vpp) */ vp = VFSTOFDESC(mp)->f_root; VREF(vp); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); *vpp = vp; return (0); } static int -fdesc_statfs(mp, sbp, p) +fdesc_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { struct filedesc *fdp; int lim; @@ -174,8 +174,8 @@ fdesc_statfs(mp, sbp, p) * limit is ever reduced below the current number * of open files... ] */ - lim = p->p_rlimit[RLIMIT_NOFILE].rlim_cur; - fdp = p->p_fd; + lim = td->td_proc->p_rlimit[RLIMIT_NOFILE].rlim_cur; + fdp = td->td_proc->p_fd; last = min(fdp->fd_nfiles, lim); freefd = 0; for (i = fdp->fd_freefile; i < last; i++) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 8d5b95e..6a9f897 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -95,12 +95,12 @@ fdesc_init(vfsp) } int -fdesc_allocvp(ftype, ix, mp, vpp, p) +fdesc_allocvp(ftype, ix, mp, vpp, td) fdntype ftype; int ix; struct mount *mp; struct vnode **vpp; - struct proc *p; + struct thread *td; { struct fdhashhead *fc; struct fdescnode *fd; @@ -110,7 +110,7 @@ fdesc_allocvp(ftype, ix, mp, vpp, p) loop: LIST_FOREACH(fd, fc, fd_hash) { if (fd->fd_ix == ix && fd->fd_vnode->v_mount == mp) { - if (vget(fd->fd_vnode, 0, p)) + if (vget(fd->fd_vnode, 0, td)) goto loop; *vpp = fd->fd_vnode; return (error); @@ -174,9 +174,9 @@ fdesc_lookup(ap) struct vnode *dvp = ap->a_dvp; struct componentname *cnp = ap->a_cnp; char *pname = cnp->cn_nameptr; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; int nlen = cnp->cn_namelen; - int nfiles = p->p_fd->fd_nfiles; + int nfiles = td->td_proc->p_fd->fd_nfiles; u_int fd; int error; struct vnode *fvp; @@ -186,11 +186,11 @@ fdesc_lookup(ap) goto bad; } - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); if (cnp->cn_namelen == 1 && *pname == '.') { *vpp = dvp; VREF(dvp); - vn_lock(dvp, LK_SHARED | LK_RETRY, p); + vn_lock(dvp, LK_SHARED | LK_RETRY, td); return (0); } @@ -213,21 +213,21 @@ fdesc_lookup(ap) fd = 10 * fd + *pname++ - '0'; } - if (fd >= nfiles || p->p_fd->fd_ofiles[fd] == NULL) { + if (fd >= nfiles || td->td_proc->p_fd->fd_ofiles[fd] == NULL) { error = EBADF; goto bad; } - error = fdesc_allocvp(Fdesc, FD_DESC+fd, dvp->v_mount, &fvp, p); + error = fdesc_allocvp(Fdesc, FD_DESC+fd, dvp->v_mount, &fvp, td); if (error) goto bad; VTOFDESC(fvp)->fd_fd = fd; - vn_lock(fvp, LK_SHARED | LK_RETRY, p); + vn_lock(fvp, LK_SHARED | LK_RETRY, td); *vpp = fvp; return (0); bad: - vn_lock(dvp, LK_SHARED | LK_RETRY, p); + vn_lock(dvp, LK_SHARED | LK_RETRY, td); *vpp = NULL; return (error); } @@ -238,7 +238,7 @@ fdesc_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -247,14 +247,14 @@ fdesc_open(ap) return (0); /* - * XXX Kludge: set p->p_dupfd to contain the value of the the file + * XXX Kludge: set td->td_proc->p_dupfd to contain the value of the the file * descriptor being sought for duplication. The error return ensures * that the vnode for this device will be released by vn_open. Open * will detect this special error and take the actions in dupfdopen. * Other callers of vn_open or VOP_OPEN will simply report the * error. */ - ap->a_p->p_dupfd = VTOFDESC(vp)->fd_fd; /* XXX */ + ap->a_td->td_dupfd = VTOFDESC(vp)->fd_fd; /* XXX */ return (ENODEV); } @@ -264,12 +264,12 @@ fdesc_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; struct vattr *vap = ap->a_vap; - struct filedesc *fdp = ap->a_p->p_fd; + struct filedesc *fdp = ap->a_td->td_proc->p_fd; struct file *fp; struct stat stb; u_int fd; @@ -304,7 +304,7 @@ fdesc_getattr(ap) return (EBADF); bzero(&stb, sizeof(stb)); - error = fo_stat(fp, &stb, ap->a_p); + error = fo_stat(fp, &stb, ap->a_td); if (error == 0) { VATTR_NULL(vap); vap->va_type = IFTOVT(stb.st_mode); @@ -360,7 +360,7 @@ fdesc_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vattr *vap = ap->a_vap; @@ -381,7 +381,7 @@ fdesc_setattr(ap) /* * Allow setattr where there is an underlying vnode. */ - error = getvnode(ap->a_p->p_fd, fd, &fp); + error = getvnode(ap->a_td->td_proc->p_fd, fd, &fp); if (error) { /* * getvnode() returns EINVAL if the file descriptor is not @@ -399,7 +399,7 @@ fdesc_setattr(ap) vp = (struct vnode *)fp->f_data; if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) return (error); - error = VOP_SETATTR(vp, ap->a_vap, ap->a_cred, ap->a_p); + error = VOP_SETATTR(vp, ap->a_vap, ap->a_cred, ap->a_td); vn_finished_write(mp); return (error); } @@ -438,7 +438,7 @@ fdesc_readdir(ap) uio->uio_resid < UIO_MX) return (EINVAL); i = (u_int)off / UIO_MX; - fdp = uio->uio_procp->p_fd; + fdp = uio->uio_td->td_proc->p_fd; error = 0; fcnt = i - 2; /* The first two nodes are `.' and `..' */ @@ -488,17 +488,17 @@ fdesc_poll(ap) struct vnode *a_vp; int a_events; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { - return seltrue(0, ap->a_events, ap->a_p); + return seltrue(0, ap->a_events, ap->a_td); } static int fdesc_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -507,7 +507,7 @@ fdesc_inactive(ap) * Clear out the v_type field to avoid * nasty things happening in vgone(). */ - VOP_UNLOCK(vp, 0, ap->a_p); + VOP_UNLOCK(vp, 0, ap->a_td); vp->v_type = VNON; return (0); } diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 5fadba2..baddfa4 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -41,6 +41,7 @@ #include <sys/lock.h> #include <sys/malloc.h> #include <sys/vnode.h> +#include <sys/proc.h> /* XXXKSE */ #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/filio.h> @@ -161,26 +162,26 @@ fifo_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; struct fifoinfo *fip; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct socket *rso, *wso; int error; if ((fip = vp->v_fifoinfo) == NULL) { MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK); vp->v_fifoinfo = fip; - error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, ap->a_p); + error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, ap->a_td); if (error) { free(fip, M_VNODE); vp->v_fifoinfo = NULL; return (error); } fip->fi_readsock = rso; - error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, ap->a_p); + error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, ap->a_td); if (error) { (void)soclose(rso); free(fip, M_VNODE); @@ -222,10 +223,10 @@ fifo_open(ap) } if ((ap->a_mode & FREAD) && (ap->a_mode & O_NONBLOCK) == 0) { while (fip->fi_writers == 0) { - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); error = tsleep((caddr_t)&fip->fi_readers, PCATCH | PSOCK, "fifoor", 0); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (error) goto bad; } @@ -238,10 +239,10 @@ fifo_open(ap) } } else { while (fip->fi_readers == 0) { - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); error = tsleep((caddr_t)&fip->fi_writers, PCATCH | PSOCK, "fifoow", 0); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (error) goto bad; } @@ -249,7 +250,7 @@ fifo_open(ap) } return (0); bad: - VOP_CLOSE(vp, ap->a_mode, ap->a_cred, p); + VOP_CLOSE(vp, ap->a_mode, ap->a_cred, td); return (error); } @@ -268,7 +269,7 @@ fifo_read(ap) { struct uio *uio = ap->a_uio; struct socket *rso = ap->a_vp->v_fifoinfo->fi_readsock; - struct proc *p = uio->uio_procp; + struct thread *td = uio->uio_td; int error, startresid; #ifdef DIAGNOSTIC @@ -280,10 +281,10 @@ fifo_read(ap) if (ap->a_ioflag & IO_NDELAY) rso->so_state |= SS_NBIO; startresid = uio->uio_resid; - VOP_UNLOCK(ap->a_vp, 0, p); + VOP_UNLOCK(ap->a_vp, 0, td); error = soreceive(rso, (struct sockaddr **)0, uio, (struct mbuf **)0, (struct mbuf **)0, (int *)0); - vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td); if (ap->a_ioflag & IO_NDELAY) rso->so_state &= ~SS_NBIO; return (error); @@ -303,7 +304,7 @@ fifo_write(ap) } */ *ap; { struct socket *wso = ap->a_vp->v_fifoinfo->fi_writesock; - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; int error; #ifdef DIAGNOSTIC @@ -312,10 +313,10 @@ fifo_write(ap) #endif if (ap->a_ioflag & IO_NDELAY) wso->so_state |= SS_NBIO; - VOP_UNLOCK(ap->a_vp, 0, p); + VOP_UNLOCK(ap->a_vp, 0, td); error = sosend(wso, (struct sockaddr *)0, ap->a_uio, 0, - (struct mbuf *)0, 0, p); - vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p); + (struct mbuf *)0, 0, td); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td); if (ap->a_ioflag & IO_NDELAY) wso->so_state &= ~SS_NBIO; return (error); @@ -333,7 +334,7 @@ fifo_ioctl(ap) caddr_t a_data; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct file filetmp; @@ -343,13 +344,13 @@ fifo_ioctl(ap) return (0); if (ap->a_fflag & FREAD) { filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_readsock; - error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_p); + error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_td); if (error) return (error); } if (ap->a_fflag & FWRITE) { filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_writesock; - error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_p); + error = soo_ioctl(&filetmp, ap->a_command, ap->a_data, ap->a_td); if (error) return (error); } @@ -446,7 +447,7 @@ fifo_poll(ap) struct vnode *a_vp; int a_events; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct file filetmp; @@ -456,13 +457,13 @@ fifo_poll(ap) filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_readsock; if (filetmp.f_data) revents |= soo_poll(&filetmp, ap->a_events, ap->a_cred, - ap->a_p); + ap->a_td); } if (ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND)) { filetmp.f_data = (caddr_t)ap->a_vp->v_fifoinfo->fi_writesock; if (filetmp.f_data) revents |= soo_poll(&filetmp, ap->a_events, ap->a_cred, - ap->a_p); + ap->a_td); } return (revents); } @@ -477,7 +478,7 @@ fifo_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; diff --git a/sys/fs/hpfs/hpfs.h b/sys/fs/hpfs/hpfs.h index f354b6b..f0253d5 100644 --- a/sys/fs/hpfs/hpfs.h +++ b/sys/fs/hpfs/hpfs.h @@ -417,7 +417,7 @@ void hpfs_hphashinit __P((void)); void hpfs_hphashdestroy __P((void)); struct hpfsnode *hpfs_hphashlookup __P((dev_t, lsn_t)); struct hpfsnode *hpfs_hphashget __P((dev_t, lsn_t)); -struct vnode *hpfs_hphashvget __P((dev_t, lsn_t, struct proc *)); +struct vnode *hpfs_hphashvget __P((dev_t, lsn_t, struct thread *)); void hpfs_hphashins __P((register struct hpfsnode *)); void hpfs_hphashrem __P((register struct hpfsnode *)); extern struct lock hpfs_hphash_lock; diff --git a/sys/fs/hpfs/hpfs_hash.c b/sys/fs/hpfs/hpfs_hash.c index 791680c..fd8eeca 100644 --- a/sys/fs/hpfs/hpfs_hash.c +++ b/sys/fs/hpfs/hpfs_hash.c @@ -123,10 +123,10 @@ loop: #endif struct vnode * -hpfs_hphashvget(dev, ino, p) +hpfs_hphashvget(dev, ino, td) dev_t dev; lsn_t ino; - struct proc *p; + struct thread *td; { struct hpfsnode *hp; struct vnode *vp; @@ -138,7 +138,7 @@ loop: vp = HPTOV(hp); mtx_lock(&vp->v_interlock); mtx_unlock(&hpfs_hphash_mtx); - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) goto loop; return (vp); } diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 46e197d..e83f356 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -64,37 +64,37 @@ MALLOC_DEFINE(M_HPFSNO, "HPFS node", "HPFS node structure"); static int hpfs_root __P((struct mount *, struct vnode **)); static int hpfs_statfs __P((struct mount *, struct statfs *, - struct proc *)); -static int hpfs_unmount __P((struct mount *, int, struct proc *)); + struct thread *)); +static int hpfs_unmount __P((struct mount *, int, struct thread *)); static int hpfs_vget __P((struct mount *mp, ino_t ino, struct vnode **vpp)); static int hpfs_mountfs __P((register struct vnode *, struct mount *, - struct hpfs_args *, struct proc *)); + struct hpfs_args *, struct thread *)); static int hpfs_vptofh __P((struct vnode *, struct fid *)); static int hpfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); #if !defined(__FreeBSD__) static int hpfs_quotactl __P((struct mount *, int, uid_t, caddr_t, - struct proc *)); -static int hpfs_start __P((struct mount *, int, struct proc *)); + struct lwp *)); +static int hpfs_start __P((struct mount *, int, struct lwp *)); static int hpfs_sync __P((struct mount *, int, struct ucred *, - struct proc *)); + struct lwp *)); #endif #if defined(__FreeBSD__) struct sockaddr; static int hpfs_mount __P((struct mount *, char *, caddr_t, - struct nameidata *, struct proc *)); + struct nameidata *, struct thread *)); static int hpfs_init __P((struct vfsconf *)); static int hpfs_uninit __P((struct vfsconf *)); #else /* defined(__NetBSD__) */ static int hpfs_mount __P((struct mount *, const char *, void *, - struct nameidata *, struct proc *)); + struct nameidata *, struct thread *)); static void hpfs_init __P((void)); static int hpfs_mountroot __P((void)); static int hpfs_sysctl __P((int *, u_int, void *, size_t *, void *, - size_t, struct proc *)); + size_t, struct thread *)); static int hpfs_checkexp __P((struct mount *, struct mbuf *, int *, struct ucred **)); #endif @@ -127,14 +127,14 @@ hpfs_checkexp(mp, nam, exflagsp, credanonp) #if !defined(__FreeBSD__) /*ARGSUSED*/ static int -hpfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) +hpfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, td) int *name; u_int namelen; void *oldp; size_t *oldlenp; void *newp; size_t newlen; - struct proc *p; + struct lwp *td; { return (EINVAL); } @@ -179,12 +179,14 @@ hpfs_mount ( #if defined(__FreeBSD__) char *path, caddr_t data, + struct nameidata *ndp, + struct thread *td ) #else /* defined(__NetBSD__) */ const char *path, void *data, -#endif struct nameidata *ndp, - struct proc *p ) + struct lwp *l ) +#endif { u_int size; int err = 0; @@ -237,7 +239,11 @@ hpfs_mount ( * Not an update, or updating the name: look up the name * and verify that it refers to a sensible block device. */ - NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); +#ifdef __FreeBSD__ + NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td); +#else + NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, l); +#endif err = namei(ndp); if (err) { /* can't get devvp!*/ @@ -282,7 +288,7 @@ hpfs_mount ( &size); /* real size*/ bzero( mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - err = hpfs_mountfs(devvp, mp, &args, p); + err = hpfs_mountfs(devvp, mp, &args, td); if (err) goto error_2; @@ -292,7 +298,7 @@ hpfs_mount ( * * This code is common to root and non-root mounts */ - (void)VFS_STATFS(mp, &mp->mnt_stat, p); + (void)VFS_STATFS(mp, &mp->mnt_stat, td); goto success; @@ -312,11 +318,11 @@ success: * Common code for mount and mountroot */ int -hpfs_mountfs(devvp, mp, argsp, p) +hpfs_mountfs(devvp, mp, argsp, td) register struct vnode *devvp; struct mount *mp; struct hpfs_args *argsp; - struct proc *p; + struct thread *td; { int error, ncount, ronly; struct sublock *sup; @@ -345,19 +351,19 @@ hpfs_mountfs(devvp, mp, argsp, p) return (EBUSY); #if defined(__FreeBSD__) - VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0); - VOP__UNLOCK(devvp, 0, p); + VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0); + VOP__UNLOCK(devvp, 0, td); #else - error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0); + error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0); #endif if (error) return (error); ronly = (mp->mnt_flag & MNT_RDONLY) != 0; - VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p); - VOP__UNLOCK(devvp, 0, p); + VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td); + VOP__UNLOCK(devvp, 0, td); if (error) return (error); @@ -443,7 +449,7 @@ failed: #else devvp->v_specflags &= ~SI_MOUNTEDON; #endif - (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); + (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, td); return (error); } @@ -452,7 +458,7 @@ static int hpfs_start ( struct mount *mp, int flags, - struct proc *p ) + struct lwp *td ) { return (0); } @@ -462,7 +468,7 @@ static int hpfs_unmount( struct mount *mp, int mntflags, - struct proc *p) + struct thread *td) { int error, flags, ronly; register struct hpfsmount *hpmp = VFSTOHPFS(mp); @@ -489,9 +495,9 @@ hpfs_unmount( hpmp->hpm_devvp->v_specflags &= ~SI_MOUNTEDON; #endif - vinvalbuf(hpmp->hpm_devvp, V_SAVE, NOCRED, p, 0, 0); + vinvalbuf(hpmp->hpm_devvp, V_SAVE, NOCRED, td, 0, 0); error = VOP_CLOSE(hpmp->hpm_devvp, ronly ? FREAD : FREAD|FWRITE, - NOCRED, p); + NOCRED, td); vrele(hpmp->hpm_devvp); @@ -527,7 +533,7 @@ static int hpfs_statfs( struct mount *mp, struct statfs *sbp, - struct proc *p) + struct thread *td) { struct hpfsmount *hpmp = VFSTOHPFS(mp); @@ -562,7 +568,7 @@ hpfs_sync ( struct mount *mp, int waitfor, struct ucred *cred, - struct proc *p) + struct lwp *td) { return (0); } @@ -573,7 +579,7 @@ hpfs_quotactl ( int cmds, uid_t uid, caddr_t arg, - struct proc *p) + struct lwp *td) { printf("hpfs_quotactl():\n"); return (EOPNOTSUPP); @@ -628,7 +634,7 @@ hpfs_vget( struct vnode *vp; struct hpfsnode *hp; struct buf *bp; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ int error; dprintf(("hpfs_vget(0x%x): ",ino)); @@ -637,7 +643,7 @@ hpfs_vget( hp = NULL; vp = NULL; - if ((*vpp = hpfs_hphashvget(hpmp->hpm_dev, ino, p)) != NULL) { + if ((*vpp = hpfs_hphashvget(hpmp->hpm_dev, ino, td)) != NULL) { dprintf(("hashed\n")); return (0); } @@ -686,14 +692,14 @@ hpfs_vget( hp->h_devvp = hpmp->hpm_devvp; VREF(hp->h_devvp); - error = VN_LOCK(vp, LK_EXCLUSIVE, p); + error = VN_LOCK(vp, LK_EXCLUSIVE, td); if (error) { vput(vp); return (error); } do { - if ((*vpp = hpfs_hphashvget(hpmp->hpm_dev, ino, p)) != NULL) { + if ((*vpp = hpfs_hphashvget(hpmp->hpm_dev, ino, td)) != NULL) { dprintf(("hashed2\n")); vput(vp); return (0); diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index 0e2a4b7..e612a24 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -102,7 +102,7 @@ hpfs_fsync(ap) struct vnode *a_vp; struct ucred *a_cred; int a_waitfor; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -153,7 +153,7 @@ hpfs_ioctl ( caddr_t a_data; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap) { register struct vnode *vp = ap->a_vp; @@ -465,7 +465,7 @@ hpfs_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; @@ -517,14 +517,14 @@ hpfs_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; struct hpfsnode *hp = VTOHP(vp); struct vattr *vap = ap->a_vap; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; int error; dprintf(("hpfs_setattr(0x%x):\n", hp->h_no)); @@ -563,9 +563,9 @@ hpfs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != hp->h_uid && - (error = suser_xxx(cred, p, PRISON_ROOT)) && + (error = suser_xxx(cred, td->td_proc, PRISON_ROOT)) && ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || - (error = VOP_ACCESS(vp, VWRITE, cred, p)))) + (error = VOP_ACCESS(vp, VWRITE, cred, td)))) return (error); if (vap->va_atime.tv_sec != VNOVAL) hp->h_atime = vap->va_atime.tv_sec; @@ -590,7 +590,7 @@ hpfs_setattr(ap) if (vap->va_size < hp->h_fn.fn_size) { #if defined(__FreeBSD__) - error = vtruncbuf(vp, cred, p, vap->va_size, DEV_BSIZE); + error = vtruncbuf(vp, cred, td, vap->va_size, DEV_BSIZE); if (error) return (error); #else /* defined(__NetBSD__) */ @@ -646,16 +646,16 @@ hpfs_inactive(ap) vprint("hpfs_inactive: pushing active", vp); if (hp->h_flag & H_INVAL) { - VOP__UNLOCK(vp,0,ap->a_p); + VOP__UNLOCK(vp,0,ap->a_td); #if defined(__FreeBSD__) - vrecycle(vp, NULL, ap->a_p); + vrecycle(vp, NULL, ap->a_td); #else /* defined(__NetBSD__) */ vgone(vp); #endif return (0); } - VOP__UNLOCK(vp,0,ap->a_p); + VOP__UNLOCK(vp,0,ap->a_td); return (0); } @@ -759,7 +759,7 @@ hpfs_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -800,7 +800,7 @@ hpfs_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { #if HPFS_DEBUG @@ -829,7 +829,7 @@ hpfs_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { #if HPFS_DEBUG @@ -1131,7 +1131,7 @@ hpfs_lookup(ap) return (EOPNOTSUPP); } - error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_proc); + error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_thread); if(error) return (error); @@ -1148,17 +1148,17 @@ hpfs_lookup(ap) dprintf(("hpfs_lookup(0x%x,...): .. faked (0x%x)\n", dhp->h_no, dhp->h_fn.fn_parent)); - VOP__UNLOCK(dvp,0,cnp->cn_proc); + VOP__UNLOCK(dvp,0,cnp->cn_thread); error = VFS_VGET(hpmp->hpm_mp, dhp->h_fn.fn_parent, ap->a_vpp); if(error) { - VOP__LOCK(dvp, 0, cnp->cn_proc); + VOP__LOCK(dvp, 0, cnp->cn_thread); return(error); } if( lockparent && (flags & ISLASTCN) && - (error = VOP__LOCK(dvp, 0, cnp->cn_proc)) ) { + (error = VOP__LOCK(dvp, 0, cnp->cn_thread)) ) { vput( *(ap->a_vpp) ); return (error); } @@ -1174,7 +1174,7 @@ hpfs_lookup(ap) if ((error == ENOENT) && (flags & ISLASTCN) && (nameiop == CREATE || nameiop == RENAME)) { if(!lockparent) - VOP__UNLOCK(dvp, 0, cnp->cn_proc); + VOP__UNLOCK(dvp, 0, cnp->cn_thread); cnp->cn_flags |= SAVENAME; return (EJUSTRETURN); } @@ -1186,7 +1186,7 @@ hpfs_lookup(ap) dep->de_fnode, dep->de_cpid)); if (nameiop == DELETE && (flags & ISLASTCN)) { - error = VOP_ACCESS(dvp, VWRITE, cred, cnp->cn_proc); + error = VOP_ACCESS(dvp, VWRITE, cred, cnp->cn_thread); if (error) { brelse(bp); return (error); @@ -1220,7 +1220,7 @@ hpfs_lookup(ap) brelse(bp); if(!lockparent || !(flags & ISLASTCN)) - VOP__UNLOCK(dvp, 0, cnp->cn_proc); + VOP__UNLOCK(dvp, 0, cnp->cn_thread); if ((flags & MAKEENTRY) && (!(flags & ISLASTCN) || (nameiop != DELETE && nameiop != CREATE))) diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h index f7ba83b..6083de6 100644 --- a/sys/fs/msdosfs/denode.h +++ b/sys/fs/msdosfs/denode.h @@ -280,6 +280,6 @@ int dosdirempty __P((struct denode *dep)); int createde __P((struct denode *dep, struct denode *ddep, struct denode **depp, struct componentname *cnp)); int deupdat __P((struct denode *dep, int waitfor)); int removede __P((struct denode *pdep, struct denode *dep)); -int detrunc __P((struct denode *dep, u_long length, int flags, struct ucred *cred, struct proc *p)); +int detrunc __P((struct denode *dep, u_long length, int flags, struct ucred *cred, struct thread *td)); int doscheckpath __P(( struct denode *source, struct denode *target)); #endif /* _KERNEL */ diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index bf176bd..8ab7f11 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -125,7 +125,7 @@ msdosfs_hashget(dev, dirclust, diroff) u_long dirclust; u_long diroff; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct denode *dep; struct vnode *vp; @@ -139,7 +139,7 @@ loop: vp = DETOV(dep); mtx_lock(&vp->v_interlock); mtx_unlock(&dehash_mtx); - if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) goto loop; return (dep); } @@ -209,7 +209,7 @@ deget(pmp, dirclust, diroffset, depp) struct denode *ldep; struct vnode *nvp; struct buf *bp; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct timeval tv; #ifdef MSDOSFS_DEBUG @@ -278,7 +278,7 @@ deget(pmp, dirclust, diroffset, depp) * of at the start of msdosfs_hashins() so that reinsert() can * call msdosfs_hashins() with a locked denode. */ - if (VOP_LOCK(nvp, LK_EXCLUSIVE, p) != 0) + if (VOP_LOCK(nvp, LK_EXCLUSIVE, td) != 0) panic("deget: unexpected lock failure"); /* @@ -414,12 +414,12 @@ deupdat(dep, waitfor) * Truncate the file described by dep to the length specified by length. */ int -detrunc(dep, length, flags, cred, p) +detrunc(dep, length, flags, cred, td) struct denode *dep; u_long length; int flags; struct ucred *cred; - struct proc *p; + struct thread *td; { int error; int allerror; @@ -520,7 +520,7 @@ detrunc(dep, length, flags, cred, p) dep->de_FileSize = length; if (!isadir) dep->de_flag |= DE_UPDATE|DE_MODIFIED; - allerror = vtruncbuf(DETOV(dep), cred, p, length, pmp->pm_bpcluster); + allerror = vtruncbuf(DETOV(dep), cred, td, length, pmp->pm_bpcluster); #ifdef MSDOSFS_DEBUG if (allerror) printf("detrunc(): vtruncbuf error %d\n", allerror); @@ -671,12 +671,12 @@ int msdosfs_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; struct denode *dep = VTODE(vp); - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; int error = 0; #ifdef MSDOSFS_DEBUG @@ -702,14 +702,14 @@ msdosfs_inactive(ap) dep, dep->de_refcnt, vp->v_mount->mnt_flag, MNT_RDONLY); #endif if (dep->de_refcnt <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { - error = detrunc(dep, (u_long) 0, 0, NOCRED, p); + error = detrunc(dep, (u_long) 0, 0, NOCRED, td); dep->de_flag |= DE_UPDATE; dep->de_Name[0] = SLOT_DELETED; } deupdat(dep, 0); out: - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); /* * If we are done with the denode, reclaim it * so that it can be reused immediately. @@ -719,6 +719,6 @@ out: dep->de_Name[0]); #endif if (dep->de_Name[0] == SLOT_DELETED) - vrecycle(vp, NULL, p); + vrecycle(vp, NULL, td); return (error); } diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index 987ac3b..3f0bb76 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -110,7 +110,7 @@ msdosfs_lookup(ap) u_char dosfilename[12]; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; int unlen; int wincnt = 1; @@ -340,7 +340,7 @@ notfound: * Access for write is interpreted as allowing * creation of files in the directory. */ - error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc); + error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_thread); if (error) return (error); /* @@ -365,7 +365,7 @@ notfound: */ cnp->cn_flags |= SAVENAME; if (!lockparent) { - VOP_UNLOCK(vdp, 0, p); + VOP_UNLOCK(vdp, 0, td); cnp->cn_flags |= PDIRUNLOCK; } return (EJUSTRETURN); @@ -438,7 +438,7 @@ foundroot: /* * Write access to directory required to delete files. */ - error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc); + error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_thread); if (error) return (error); @@ -456,7 +456,7 @@ foundroot: return (error); *vpp = DETOV(tdp); if (!lockparent) { - VOP_UNLOCK(vdp, 0, p); + VOP_UNLOCK(vdp, 0, td); cnp->cn_flags |= PDIRUNLOCK; } return (0); @@ -473,7 +473,7 @@ foundroot: if (blkoff == MSDOSFSROOT_OFS) return EROFS; /* really? XXX */ - error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_proc); + error = VOP_ACCESS(vdp, VWRITE, cnp->cn_cred, cnp->cn_thread); if (error) return (error); @@ -489,7 +489,7 @@ foundroot: *vpp = DETOV(tdp); cnp->cn_flags |= SAVENAME; if (!lockparent) { - VOP_UNLOCK(vdp, 0, p); + VOP_UNLOCK(vdp, 0, td); cnp->cn_flags |= PDIRUNLOCK; } return (0); @@ -516,16 +516,16 @@ foundroot: */ pdp = vdp; if (flags & ISDOTDOT) { - VOP_UNLOCK(pdp, 0, p); + VOP_UNLOCK(pdp, 0, td); cnp->cn_flags |= PDIRUNLOCK; error = deget(pmp, cluster, blkoff, &tdp); if (error) { - vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td); cnp->cn_flags &= ~PDIRUNLOCK; return (error); } if (lockparent && (flags & ISLASTCN)) { - error = vn_lock(pdp, LK_EXCLUSIVE, p); + error = vn_lock(pdp, LK_EXCLUSIVE, td); if (error) { vput(DETOV(tdp)); return (error); @@ -540,7 +540,7 @@ foundroot: if ((error = deget(pmp, cluster, blkoff, &tdp)) != 0) return (error); if (!lockparent || !(flags & ISLASTCN)) { - VOP_UNLOCK(pdp, 0, p); + VOP_UNLOCK(pdp, 0, td); cnp->cn_flags |= PDIRUNLOCK; } *vpp = DETOV(tdp); diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 1962daf..cd1e404 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -88,17 +88,17 @@ static MALLOC_DEFINE(M_MSDOSFSFAT, "MSDOSFS FAT", "MSDOSFS file allocation table static int update_mp __P((struct mount *mp, struct msdosfs_args *argp)); static int mountmsdosfs __P((struct vnode *devvp, struct mount *mp, - struct proc *p, struct msdosfs_args *argp)); + struct thread *td, struct msdosfs_args *argp)); static int msdosfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); static int msdosfs_mount __P((struct mount *, char *, caddr_t, - struct nameidata *, struct proc *)); + struct nameidata *, struct thread *)); static int msdosfs_root __P((struct mount *, struct vnode **)); static int msdosfs_statfs __P((struct mount *, struct statfs *, - struct proc *)); + struct thread *)); static int msdosfs_sync __P((struct mount *, int, struct ucred *, - struct proc *)); -static int msdosfs_unmount __P((struct mount *, int, struct proc *)); + struct thread *)); +static int msdosfs_unmount __P((struct mount *, int, struct thread *)); static int msdosfs_vptofh __P((struct vnode *, struct fid *)); static int @@ -159,7 +159,7 @@ int msdosfs_mountroot() { register struct mount *mp; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ size_t size; int error; struct msdosfs_args args; @@ -189,13 +189,13 @@ msdosfs_mountroot() } if ((error = update_mp(mp, &args)) != 0) { - (void)msdosfs_unmount(mp, 0, p); + (void)msdosfs_unmount(mp, 0, td); free(mp, M_MOUNT); return (error); } if ((error = vfs_lock(mp)) != 0) { - (void)msdosfs_unmount(mp, 0, p); + (void)msdosfs_unmount(mp, 0, td); free(mp, M_MOUNT); return (error); } @@ -208,7 +208,7 @@ msdosfs_mountroot() (void) copystr(ROOTNAME, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void)msdosfs_statfs(mp, &mp->mnt_stat, p); + (void)msdosfs_statfs(mp, &mp->mnt_stat, td); vfs_unlock(mp); return (0); } @@ -220,12 +220,12 @@ msdosfs_mountroot() * special file to treat as a filesystem. */ static int -msdosfs_mount(mp, path, data, ndp, p) +msdosfs_mount(mp, path, data, ndp, td) struct mount *mp; char *path; caddr_t data; struct nameidata *ndp; - struct proc *p; + struct thread *td; { struct vnode *devvp; /* vnode for blk device to mount */ struct msdosfs_args args; /* will hold data from mount request */ @@ -263,16 +263,16 @@ msdosfs_mount(mp, path, data, ndp, p) * If upgrade to read-write by non-root, then verify * that user has necessary permissions on the device. */ - if (p->p_ucred->cr_uid != 0) { + if (td->td_proc->p_ucred->cr_uid != 0) { devvp = pmp->pm_devvp; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); error = VOP_ACCESS(devvp, VREAD | VWRITE, - p->p_ucred, p); + td->td_proc->p_ucred, td); if (error) { - VOP_UNLOCK(devvp, 0, p); + VOP_UNLOCK(devvp, 0, td); return (error); } - VOP_UNLOCK(devvp, 0, p); + VOP_UNLOCK(devvp, 0, td); } pmp->pm_flags &= ~MSDOSFSMNT_RONLY; } @@ -295,7 +295,7 @@ msdosfs_mount(mp, path, data, ndp, p) * Not an update, or updating the name: look up the name * and verify that it refers to a sensible block device. */ - NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); + NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td); error = namei(ndp); if (error) return (error); @@ -310,20 +310,20 @@ msdosfs_mount(mp, path, data, ndp, p) * If mount by non-root, then verify that user has necessary * permissions on the device. */ - if (p->p_ucred->cr_uid != 0) { + if (td->td_proc->p_ucred->cr_uid != 0) { accessmode = VREAD; if ((mp->mnt_flag & MNT_RDONLY) == 0) accessmode |= VWRITE; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p); + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td); if (error) { vput(devvp); return (error); } - VOP_UNLOCK(devvp, 0, p); + VOP_UNLOCK(devvp, 0, td); } if ((mp->mnt_flag & MNT_UPDATE) == 0) { - error = mountmsdosfs(devvp, mp, p, &args); + error = mountmsdosfs(devvp, mp, td, &args); #ifdef MSDOSFS_DEBUG /* only needed for the printf below */ pmp = VFSTOMSDOSFS(mp); #endif @@ -340,13 +340,13 @@ msdosfs_mount(mp, path, data, ndp, p) error = update_mp(mp, &args); if (error) { - msdosfs_unmount(mp, MNT_FORCE, p); + msdosfs_unmount(mp, MNT_FORCE, td); return error; } (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void) msdosfs_statfs(mp, &mp->mnt_stat, p); + (void) msdosfs_statfs(mp, &mp->mnt_stat, td); #ifdef MSDOSFS_DEBUG printf("msdosfs_mount(): mp %p, pmp %p, inusemap %p\n", mp, pmp, pmp->pm_inusemap); #endif @@ -354,10 +354,10 @@ msdosfs_mount(mp, path, data, ndp, p) } static int -mountmsdosfs(devvp, mp, p, argp) +mountmsdosfs(devvp, mp, td, argp) struct vnode *devvp; struct mount *mp; - struct proc *p; + struct thread *td; struct msdosfs_args *argp; { struct msdosfsmount *pmp; @@ -386,16 +386,16 @@ mountmsdosfs(devvp, mp, p, argp) return (error); if (vcount(devvp) > 1 && devvp != rootvp) return (EBUSY); - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0); - VOP_UNLOCK(devvp, 0, p); + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0); + VOP_UNLOCK(devvp, 0, td); if (error) return (error); ronly = (mp->mnt_flag & MNT_RDONLY) != 0; - vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p); - VOP_UNLOCK(devvp, 0, p); + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td); + VOP_UNLOCK(devvp, 0, td); if (error) return (error); @@ -415,7 +415,7 @@ mountmsdosfs(devvp, mp, p, argp) * Let's check it... */ error = VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, - FREAD, NOCRED, p); + FREAD, NOCRED, td); if (error) goto error_exit; tmp = dpart.part->p_fstype; @@ -724,7 +724,7 @@ mountmsdosfs(devvp, mp, p, argp) error_exit: if (bp) brelse(bp); - (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD | FWRITE, NOCRED, p); + (void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD | FWRITE, NOCRED, td); if (pmp) { if (pmp->pm_inusemap) free(pmp->pm_inusemap, M_MSDOSFSFAT); @@ -738,10 +738,10 @@ error_exit: * Unmount the filesystem described by mp. */ static int -msdosfs_unmount(mp, mntflags, p) +msdosfs_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { struct msdosfsmount *pmp; int error, flags; @@ -778,7 +778,7 @@ msdosfs_unmount(mp, mntflags, p) #endif error = VOP_CLOSE(pmp->pm_devvp, (pmp->pm_flags&MSDOSFSMNT_RONLY) ? FREAD : FREAD | FWRITE, - NOCRED, p); + NOCRED, td); vrele(pmp->pm_devvp); free(pmp->pm_inusemap, M_MSDOSFSFAT); free(pmp, M_MSDOSFSMNT); @@ -807,10 +807,10 @@ msdosfs_root(mp, vpp) } static int -msdosfs_statfs(mp, sbp, p) +msdosfs_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { struct msdosfsmount *pmp; @@ -832,11 +832,11 @@ msdosfs_statfs(mp, sbp, p) } static int -msdosfs_sync(mp, waitfor, cred, p) +msdosfs_sync(mp, waitfor, cred, td) struct mount *mp; int waitfor; struct ucred *cred; - struct proc *p; + struct thread *td; { struct vnode *vp, *nvp; struct denode *dep; @@ -879,17 +879,17 @@ loop: mtx_lock(&mntvnode_mtx); continue; } - error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p); + error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, td); if (error) { mtx_lock(&mntvnode_mtx); if (error == ENOENT) goto loop; continue; } - error = VOP_FSYNC(vp, cred, waitfor, p); + error = VOP_FSYNC(vp, cred, waitfor, td); if (error) allerror = error; - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); vrele(vp); mtx_lock(&mntvnode_mtx); } @@ -899,11 +899,11 @@ loop: * Flush filesystem control info. */ if (waitfor != MNT_LAZY) { - vn_lock(pmp->pm_devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_FSYNC(pmp->pm_devvp, cred, waitfor, p); + vn_lock(pmp->pm_devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_FSYNC(pmp->pm_devvp, cred, waitfor, td); if (error) allerror = error; - VOP_UNLOCK(pmp->pm_devvp, 0, p); + VOP_UNLOCK(pmp->pm_devvp, 0, td); } return (allerror); } diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 77d2760..bbdcecb 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -211,7 +211,7 @@ msdosfs_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -233,7 +233,7 @@ msdosfs_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -273,7 +273,7 @@ msdosfs_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct denode *dep = VTODE(ap->a_vp); @@ -339,7 +339,7 @@ msdosfs_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -351,7 +351,7 @@ msdosfs_setattr(ap) #ifdef MSDOSFS_DEBUG printf("msdosfs_setattr(): vp %p, vap %p, cred %p, p %p\n", - ap->a_vp, vap, cred, ap->a_p); + ap->a_vp, vap, cred, ap->a_td); #endif /* @@ -376,7 +376,7 @@ msdosfs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != pmp->pm_uid && - (error = suser_xxx(cred, ap->a_p, PRISON_ROOT))) + (error = suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT))) return (error); /* * We are very inconsistent about handling unsupported @@ -417,7 +417,7 @@ msdosfs_setattr(ap) gid = pmp->pm_gid; if ((cred->cr_uid != pmp->pm_uid || uid != pmp->pm_uid || (gid != pmp->pm_gid && !groupmember(gid, cred))) && - (error = suser_xxx(cred, ap->a_p, PRISON_ROOT))) + (error = suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT))) return error; if (uid != pmp->pm_uid || gid != pmp->pm_gid) return EINVAL; @@ -441,7 +441,7 @@ msdosfs_setattr(ap) default: break; } - error = detrunc(dep, vap->va_size, 0, cred, ap->a_p); + error = detrunc(dep, vap->va_size, 0, cred, ap->a_td); if (error) return error; } @@ -449,9 +449,9 @@ msdosfs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != pmp->pm_uid && - (error = suser_xxx(cred, ap->a_p, PRISON_ROOT)) && + (error = suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT)) && ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || - (error = VOP_ACCESS(ap->a_vp, VWRITE, cred, ap->a_p)))) + (error = VOP_ACCESS(ap->a_vp, VWRITE, cred, ap->a_td)))) return (error); if (vp->v_type != VDIR) { if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 && @@ -472,7 +472,7 @@ msdosfs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != pmp->pm_uid && - (error = suser_xxx(cred, ap->a_p, PRISON_ROOT))) + (error = suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT))) return (error); if (vp->v_type != VDIR) { /* We ignore the read and execute bits. */ @@ -601,7 +601,7 @@ msdosfs_write(ap) struct buf *bp; int ioflag = ap->a_ioflag; 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 vnode *thisvp; struct denode *dep = VTODE(vp); @@ -636,12 +636,12 @@ msdosfs_write(ap) /* * If they've exceeded their filesize limit, tell them about it. */ - if (p && + if (td && ((uoff_t)uio->uio_offset + uio->uio_resid > - p->p_rlimit[RLIMIT_FSIZE].rlim_cur)) { - PROC_LOCK(p); - psignal(p, SIGXFSZ); - PROC_UNLOCK(p); + 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); } @@ -795,7 +795,7 @@ msdosfs_fsync(ap) struct vnode *a_vp; struct ucred *a_cred; int a_waitfor; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -931,7 +931,7 @@ msdosfs_rename(ap) struct vnode *tvp = ap->a_tvp; struct componentname *tcnp = ap->a_tcnp; struct componentname *fcnp = ap->a_fcnp; - struct proc *p = fcnp->cn_proc; + struct thread *td = fcnp->cn_thread; struct denode *ip, *xp, *dp, *zp; u_char toname[11], oldname[11]; u_long from_diroffset, to_diroffset; @@ -987,7 +987,7 @@ abortit: goto abortit; } - error = vn_lock(fvp, LK_EXCLUSIVE, p); + error = vn_lock(fvp, LK_EXCLUSIVE, td); if (error) goto abortit; dp = VTODE(fdvp); @@ -1008,7 +1008,7 @@ abortit: (fcnp->cn_flags & ISDOTDOT) || (tcnp->cn_flags & ISDOTDOT) || (ip->de_flag & DE_RENAME)) { - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp, 0, td); error = EINVAL; goto abortit; } @@ -1038,8 +1038,8 @@ abortit: * to namei, as the parent directory is unlocked by the * call to doscheckpath(). */ - error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc); - VOP_UNLOCK(fvp, 0, p); + error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread); + VOP_UNLOCK(fvp, 0, td); if (VTODE(fdvp)->de_StartCluster != VTODE(tdvp)->de_StartCluster) newparent = 1; if (doingdirectory && newparent) { @@ -1108,7 +1108,7 @@ abortit: if ((fcnp->cn_flags & SAVESTART) == 0) panic("msdosfs_rename: lost from startdir"); if (!newparent) - VOP_UNLOCK(tdvp, 0, p); + VOP_UNLOCK(tdvp, 0, td); if (relookup(fdvp, &fvp, fcnp) == 0) vrele(fdvp); if (fvp == NULL) { @@ -1119,7 +1119,7 @@ abortit: panic("rename: lost dir entry"); vrele(ap->a_fvp); if (newparent) - VOP_UNLOCK(tdvp, 0, p); + VOP_UNLOCK(tdvp, 0, td); vrele(tdvp); return 0; } @@ -1139,9 +1139,9 @@ abortit: if (doingdirectory) panic("rename: lost dir entry"); vrele(ap->a_fvp); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp, 0, td); if (newparent) - VOP_UNLOCK(fdvp, 0, p); + VOP_UNLOCK(fdvp, 0, td); xp = NULL; } else { vrele(fvp); @@ -1163,8 +1163,8 @@ abortit: if (error) { bcopy(oldname, ip->de_Name, 11); if (newparent) - VOP_UNLOCK(fdvp, 0, p); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fdvp, 0, td); + VOP_UNLOCK(fvp, 0, td); goto bad; } ip->de_refcnt++; @@ -1173,8 +1173,8 @@ abortit: if (error) { /* XXX should really panic here, fs is corrupt */ if (newparent) - VOP_UNLOCK(fdvp, 0, p); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fdvp, 0, td); + VOP_UNLOCK(fvp, 0, td); goto bad; } if (!doingdirectory) { @@ -1183,8 +1183,8 @@ abortit: if (error) { /* XXX should really panic here, fs is corrupt */ if (newparent) - VOP_UNLOCK(fdvp, 0, p); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fdvp, 0, td); + VOP_UNLOCK(fvp, 0, td); goto bad; } if (ip->de_dirclust == MSDOSFSROOT) @@ -1194,7 +1194,7 @@ abortit: } reinsert(ip); if (newparent) - VOP_UNLOCK(fdvp, 0, p); + VOP_UNLOCK(fdvp, 0, td); } /* @@ -1213,7 +1213,7 @@ abortit: if (error) { /* XXX should really panic here, fs is corrupt */ brelse(bp); - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp, 0, td); goto bad; } dotdotp = (struct direntry *)bp->b_data + 1; @@ -1223,12 +1223,12 @@ abortit: error = bwrite(bp); if (error) { /* XXX should really panic here, fs is corrupt */ - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp, 0, td); goto bad; } } - VOP_UNLOCK(fvp, 0, p); + VOP_UNLOCK(fvp, 0, td); bad: if (xp) vput(tvp); @@ -1392,7 +1392,7 @@ msdosfs_rmdir(ap) register struct vnode *dvp = ap->a_dvp; register struct componentname *cnp = ap->a_cnp; register struct denode *ip, *dp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; int error; ip = VTODE(vp); @@ -1427,14 +1427,14 @@ msdosfs_rmdir(ap) * the name cache. */ cache_purge(dvp); - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); /* * Truncate the directory that is being deleted. */ - error = detrunc(ip, (u_long)0, IO_SYNC, cnp->cn_cred, p); + error = detrunc(ip, (u_long)0, IO_SYNC, cnp->cn_cred, td); cache_purge(vp); - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); out: return (error); } diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index e1e6006..c215741 100644 --- a/sys/fs/ntfs/ntfs_subr.c +++ b/sys/fs/ntfs/ntfs_subr.c @@ -227,7 +227,7 @@ ntfs_ntvattrget( vget() */ error = ntfs_vgetex(ntmp->ntm_mountp, aalp->al_inumber, NTFS_A_DATA, NULL, LK_EXCLUSIVE, - VG_EXT, curproc, &newvp); + VG_EXT, curthread, &newvp); if (error) { printf("ntfs_ntvattrget: CAN'T VGET INO: %d\n", aalp->al_inumber); diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 26a09b8..19e6925 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -76,36 +76,36 @@ MALLOC_DEFINE(M_NTFSDIR,"NTFS dir", "NTFS dir buffer"); static int ntfs_root __P((struct mount *, struct vnode **)); static int ntfs_statfs __P((struct mount *, struct statfs *, - struct proc *)); -static int ntfs_unmount __P((struct mount *, int, struct proc *)); + struct thread *)); +static int ntfs_unmount __P((struct mount *, int, struct thread *)); static int ntfs_vget __P((struct mount *mp, ino_t ino, struct vnode **vpp)); static int ntfs_mountfs __P((register struct vnode *, struct mount *, - struct ntfs_args *, struct proc *)); + struct ntfs_args *, struct thread *)); static int ntfs_vptofh __P((struct vnode *, struct fid *)); static int ntfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); #if !defined (__FreeBSD__) static int ntfs_quotactl __P((struct mount *, int, uid_t, caddr_t, - struct proc *)); -static int ntfs_start __P((struct mount *, int, struct proc *)); + struct thread *)); +static int ntfs_start __P((struct mount *, int, struct thread *)); static int ntfs_sync __P((struct mount *, int, struct ucred *, - struct proc *)); + struct thread *)); #endif #if defined(__FreeBSD__) struct sockaddr; static int ntfs_mount __P((struct mount *, char *, caddr_t, - struct nameidata *, struct proc *)); + struct nameidata *, struct thread *)); static int ntfs_init __P((struct vfsconf *)); #elif defined(__NetBSD__) static int ntfs_mount __P((struct mount *, const char *, void *, - struct nameidata *, struct proc *)); + struct nameidata *, struct thread *)); static void ntfs_init __P((void)); static int ntfs_mountroot __P((void)); static int ntfs_sysctl __P((int *, u_int, void *, size_t *, void *, - size_t, struct proc *)); + size_t, struct thread *)); static int ntfs_checkexp __P((struct mount *, struct mbuf *, int *, struct ucred **)); #endif @@ -180,7 +180,7 @@ ntfs_mountroot() args.gid = 0; args.mode = 0777; - if ((error = ntfs_mountfs(rootvp, mp, &args, p)) != 0) { + if ((error = ntfs_mountfs(rootvp, mp, &args, td)) != 0) { mp->mnt_op->vfs_refcount--; vfs_unbusy(mp); free(mp, M_MOUNT); @@ -191,7 +191,7 @@ ntfs_mountroot() mtx_lock(&mountlist_mtx); TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); - (void)ntfs_statfs(mp, &mp->mnt_stat, p); + (void)ntfs_statfs(mp, &mp->mnt_stat, td); vfs_unbusy(mp); return (0); } @@ -236,7 +236,7 @@ ntfs_mount ( void *data, #endif struct nameidata *ndp, - struct proc *p ) + struct thread *td ) { size_t size; int err = 0; @@ -266,7 +266,7 @@ ntfs_mount ( /* * Attempt mount */ - if( ( err = ntfs_mountfs(rootvp, mp, &args, p)) != 0) { + if( ( err = ntfs_mountfs(rootvp, mp, &args, td)) != 0) { /* fs specific cleanup (if any)*/ goto error_1; } @@ -316,7 +316,7 @@ ntfs_mount ( * Not an update, or updating the name: look up the name * and verify that it refers to a sensible block device. */ - NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); + NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td); err = namei(ndp); if (err) { /* can't get devvp!*/ @@ -385,7 +385,7 @@ ntfs_mount ( &size); /* real size*/ bzero( mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - err = ntfs_mountfs(devvp, mp, &args, p); + err = ntfs_mountfs(devvp, mp, &args, td); } if (err) { goto error_2; @@ -400,7 +400,7 @@ dostatfs: * * This code is common to root and non-root mounts */ - (void)VFS_STATFS(mp, &mp->mnt_stat, p); + (void)VFS_STATFS(mp, &mp->mnt_stat, td); goto success; @@ -420,11 +420,11 @@ success: * Common code for mount and mountroot */ int -ntfs_mountfs(devvp, mp, argsp, p) +ntfs_mountfs(devvp, mp, argsp, td) register struct vnode *devvp; struct mount *mp; struct ntfs_args *argsp; - struct proc *p; + struct thread *td; { struct buf *bp; struct ntfsmount *ntmp; @@ -449,19 +449,19 @@ ntfs_mountfs(devvp, mp, argsp, p) if (ncount > 1 && devvp != rootvp) return (EBUSY); #if defined(__FreeBSD__) - VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0); - VOP__UNLOCK(devvp, 0, p); + VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0); + VOP__UNLOCK(devvp, 0, td); #else - error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0); + error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0); #endif if (error) return (error); ronly = (mp->mnt_flag & MNT_RDONLY) != 0; - VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p); - VOP__UNLOCK(devvp, 0, p); + VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td); + VOP__UNLOCK(devvp, 0, td); if (error) return (error); @@ -624,11 +624,11 @@ out: #if defined __NetBSD__ /* lock the device vnode before calling VOP_CLOSE() */ - VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p); - (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); - VOP__UNLOCK(devvp, 0, p); + VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, td); + (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, td); + VOP__UNLOCK(devvp, 0, td); #else - (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); + (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, td); #endif return (error); @@ -639,7 +639,7 @@ static int ntfs_start ( struct mount *mp, int flags, - struct proc *p ) + struct thread *td ) { return (0); } @@ -649,7 +649,7 @@ static int ntfs_unmount( struct mount *mp, int mntflags, - struct proc *p) + struct thread *td) { register struct ntfsmount *ntmp; int error, ronly = 0, flags, i; @@ -689,17 +689,17 @@ ntfs_unmount( if (ntmp->ntm_devvp->v_type != VBAD) ntmp->ntm_devvp->v_rdev->si_mountpoint = NULL; - vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, p, 0, 0); + vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, td, 0, 0); #if defined(__NetBSD__) /* lock the device vnode before calling VOP_CLOSE() */ VOP_LOCK(ntmp->ntm_devvp, LK_EXCLUSIVE | LK_RETRY); error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE, - NOCRED, p); - VOP__UNLOCK(ntmp->ntm_devvp, 0, p); + NOCRED, td); + VOP__UNLOCK(ntmp->ntm_devvp, 0, td); #else error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE, - NOCRED, p); + NOCRED, td); #endif vrele(ntmp->ntm_devvp); @@ -744,7 +744,7 @@ ntfs_quotactl ( int cmds, uid_t uid, caddr_t arg, - struct proc *p) + struct thread *td) { printf("\nntfs_quotactl():\n"); return EOPNOTSUPP; @@ -787,7 +787,7 @@ static int ntfs_statfs( struct mount *mp, struct statfs *sbp, - struct proc *p) + struct thread *td) { struct ntfsmount *ntmp = VFSTONTFS(mp); u_int64_t mftsize,mftallocated; @@ -831,7 +831,7 @@ ntfs_sync ( struct mount *mp, int waitfor, struct ucred *cred, - struct proc *p) + struct thread *td) { /*dprintf(("ntfs_sync():\n"));*/ return (0); @@ -888,7 +888,7 @@ ntfs_vgetex( char *attrname, u_long lkflags, u_long flags, - struct proc *p, + struct thread *td, struct vnode **vpp) { int error; @@ -953,7 +953,7 @@ ntfs_vgetex( } if (FTOV(fp)) { - VGET(FTOV(fp), lkflags, p); + VGET(FTOV(fp), lkflags, td); *vpp = FTOV(fp); ntfs_ntput(ip); return (0); @@ -980,7 +980,7 @@ ntfs_vgetex( ntfs_ntput(ip); if (lkflags & LK_TYPE_MASK) { - error = VN_LOCK(vp, lkflags, p); + error = VN_LOCK(vp, lkflags, td); if (error) { vput(vp); return (error); @@ -999,7 +999,7 @@ ntfs_vget( struct vnode **vpp) { return ntfs_vgetex(mp, ino, NTFS_A_DATA, NULL, - LK_EXCLUSIVE | LK_RETRY, 0, curproc, vpp); + LK_EXCLUSIVE | LK_RETRY, 0, curthread, vpp); } #if defined(__FreeBSD__) diff --git a/sys/fs/ntfs/ntfs_vfsops.h b/sys/fs/ntfs/ntfs_vfsops.h index c05686f..b82877a 100644 --- a/sys/fs/ntfs/ntfs_vfsops.h +++ b/sys/fs/ntfs/ntfs_vfsops.h @@ -36,9 +36,9 @@ struct mount; struct ntfsmount; -struct proc; +struct thread; struct vnode; int ntfs_vgetex(struct mount *, ino_t, u_int32_t, char *, u_long, u_long, - struct proc *, struct vnode **); + struct thread *, struct vnode **); int ntfs_calccfree(struct ntfsmount *, cn_t *); diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index 5c2297f..baad440 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -191,7 +191,7 @@ ntfs_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; @@ -245,7 +245,7 @@ ntfs_inactive(ap) if (ntfs_prtactive && vp->v_usecount != 0) vprint("ntfs_inactive: pushing active", vp); - VOP__UNLOCK(vp, 0, ap->a_p); + VOP__UNLOCK(vp, 0, ap->a_td); /* XXX since we don't support any filesystem changes * right now, nothing more needs to be done @@ -423,7 +423,7 @@ ntfs_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -471,7 +471,7 @@ ntfs_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { #if NTFS_DEBUG @@ -500,7 +500,7 @@ ntfs_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { #if NTFS_DEBUG @@ -674,7 +674,7 @@ ntfs_lookup(ap) (int)cnp->cn_namelen, cnp->cn_nameptr, cnp->cn_namelen, dip->i_number, lockparent, wantparent)); - error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_proc); + error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_thread); if(error) return (error); @@ -713,7 +713,7 @@ ntfs_lookup(ap) if(error) return (error); - VOP__UNLOCK(dvp,0,cnp->cn_proc); + VOP__UNLOCK(dvp,0,cnp->cn_thread); cnp->cn_flags |= PDIRUNLOCK; dprintf(("ntfs_lookup: parentdir: %d\n", @@ -722,13 +722,13 @@ ntfs_lookup(ap) vap->va_a_name->n_pnumber,ap->a_vpp); ntfs_ntvattrrele(vap); if (error) { - if (VN_LOCK(dvp,LK_EXCLUSIVE|LK_RETRY,cnp->cn_proc)==0) + if (VN_LOCK(dvp,LK_EXCLUSIVE|LK_RETRY,cnp->cn_thread)==0) cnp->cn_flags &= ~PDIRUNLOCK; return (error); } if (lockparent && (cnp->cn_flags & ISLASTCN)) { - error = VN_LOCK(dvp, LK_EXCLUSIVE, cnp->cn_proc); + error = VN_LOCK(dvp, LK_EXCLUSIVE, cnp->cn_thread); if (error) { vput( *(ap->a_vpp) ); return (error); @@ -746,7 +746,7 @@ ntfs_lookup(ap) VTONT(*ap->a_vpp)->i_number)); if(!lockparent || !(cnp->cn_flags & ISLASTCN)) - VOP__UNLOCK(dvp, 0, cnp->cn_proc); + VOP__UNLOCK(dvp, 0, cnp->cn_thread); } if (cnp->cn_flags & MAKEENTRY) @@ -768,7 +768,7 @@ ntfs_fsync(ap) struct vnode *a_vp; struct ucred *a_cred; int a_waitfor; - struct proc *a_p; + struct thread *a_td; } */ *ap; { return (0); diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index 97aa492..add959e 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -110,7 +110,7 @@ null_node_find(mp, lowervp) struct mount *mp; struct vnode *lowervp; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct null_node_hashhead *hd; struct null_node *a; struct vnode *vp; @@ -123,17 +123,17 @@ null_node_find(mp, lowervp) */ hd = NULL_NHASH(lowervp); loop: - lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, p); + lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, td); LIST_FOREACH(a, hd, null_hash) { if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) { vp = NULLTOV(a); - lockmgr(&null_hashlock, LK_RELEASE, NULL, p); + lockmgr(&null_hashlock, LK_RELEASE, NULL, td); /* * We need vget for the VXLOCK * stuff, but we don't want to lock * the lower node. */ - if (vget(vp, LK_EXCLUSIVE | LK_CANRECURSE, p)) { + if (vget(vp, LK_EXCLUSIVE | LK_CANRECURSE, td)) { printf ("null_node_find: vget failed.\n"); goto loop; }; @@ -141,11 +141,11 @@ loop: * Now we got both vnodes locked, so release the * lower one. */ - VOP_UNLOCK(lowervp, 0, p); + VOP_UNLOCK(lowervp, 0, td); return (vp); } } - lockmgr(&null_hashlock, LK_RELEASE, NULL, p); + lockmgr(&null_hashlock, LK_RELEASE, NULL, td); return NULLVP; } @@ -162,7 +162,7 @@ null_node_alloc(mp, lowervp, vpp) struct vnode *lowervp; struct vnode **vpp; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct null_node_hashhead *hd; struct null_node *xp; struct vnode *othervp, *vp; @@ -211,16 +211,16 @@ null_node_alloc(mp, lowervp, vpp) * NULL, then we copy that up and manually lock the new vnode. */ - lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, p); + lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, td); vp->v_vnlock = lowervp->v_vnlock; - error = VOP_LOCK(vp, LK_EXCLUSIVE | LK_THISLAYER, p); + error = VOP_LOCK(vp, LK_EXCLUSIVE | LK_THISLAYER, td); if (error) panic("null_node_alloc: can't lock new vnode\n"); VREF(lowervp); hd = NULL_NHASH(lowervp); LIST_INSERT_HEAD(hd, xp, null_hash); - lockmgr(&null_hashlock, LK_RELEASE, NULL, p); + lockmgr(&null_hashlock, LK_RELEASE, NULL, td); return 0; } diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index f707751..1ab0aaa 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -63,33 +63,33 @@ static int nullfs_fhtovp(struct mount *mp, struct fid *fidp, static int nullfs_checkexp(struct mount *mp, struct sockaddr *nam, int *extflagsp, struct ucred **credanonp); static int nullfs_mount(struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p); + struct nameidata *ndp, struct thread *td); static int nullfs_quotactl(struct mount *mp, int cmd, uid_t uid, - caddr_t arg, struct proc *p); + caddr_t arg, struct thread *td); static int nullfs_root(struct mount *mp, struct vnode **vpp); -static int nullfs_start(struct mount *mp, int flags, struct proc *p); +static int nullfs_start(struct mount *mp, int flags, struct thread *td); static int nullfs_statfs(struct mount *mp, struct statfs *sbp, - struct proc *p); + struct thread *td); static int nullfs_sync(struct mount *mp, int waitfor, - struct ucred *cred, struct proc *p); -static int nullfs_unmount(struct mount *mp, int mntflags, struct proc *p); + struct ucred *cred, struct thread *td); +static int nullfs_unmount(struct mount *mp, int mntflags, struct thread *td); static int nullfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp); static int nullfs_vptofh(struct vnode *vp, struct fid *fhp); static int nullfs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, int namespace, const char *attrname, - struct proc *p); + struct thread *td); /* * Mount null layer */ static int -nullfs_mount(mp, path, data, ndp, p) +nullfs_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 = 0; struct null_args args; @@ -106,7 +106,7 @@ nullfs_mount(mp, path, data, ndp, p) */ if (mp->mnt_flag & MNT_UPDATE) { return (EOPNOTSUPP); - /* return VFS_MOUNT(MOUNTTONULLMOUNT(mp)->nullm_vfs, path, data, ndp, p);*/ + /* return VFS_MOUNT(MOUNTTONULLMOUNT(mp)->nullm_vfs, path, data, ndp, td);*/ } /* @@ -122,20 +122,20 @@ nullfs_mount(mp, path, data, ndp, p) */ if ((mp->mnt_vnodecovered->v_op == null_vnodeop_p) && VOP_ISLOCKED(mp->mnt_vnodecovered, NULL)) { - VOP_UNLOCK(mp->mnt_vnodecovered, 0, p); + VOP_UNLOCK(mp->mnt_vnodecovered, 0, td); isvnunlocked = 1; } /* * Find lower node */ NDINIT(ndp, LOOKUP, FOLLOW|WANTPARENT|LOCKLEAF, - UIO_USERSPACE, args.target, p); + UIO_USERSPACE, args.target, td); error = namei(ndp); /* * Re-lock vnode. */ if (isvnunlocked && !VOP_ISLOCKED(mp->mnt_vnodecovered, NULL)) - vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY, td); if (error) return (error); @@ -174,7 +174,7 @@ nullfs_mount(mp, path, data, ndp, p) /* * Unlock the node (either the lower or the alias) */ - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); /* * Make sure the node alias worked */ @@ -199,7 +199,7 @@ nullfs_mount(mp, path, data, ndp, p) (void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void)nullfs_statfs(mp, &mp->mnt_stat, p); + (void)nullfs_statfs(mp, &mp->mnt_stat, td); NULLFSDEBUG("nullfs_mount: lower %s, alias at %s\n", mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname); return (0); @@ -211,23 +211,23 @@ nullfs_mount(mp, path, data, ndp, p) * when that filesystem was mounted. */ static int -nullfs_start(mp, flags, p) +nullfs_start(mp, flags, td) struct mount *mp; int flags; - struct proc *p; + struct thread *td; { return (0); - /* return VFS_START(MOUNTTONULLMOUNT(mp)->nullm_vfs, flags, p); */ + /* return VFS_START(MOUNTTONULLMOUNT(mp)->nullm_vfs, flags, td); */ } /* * Free reference to null layer */ static int -nullfs_unmount(mp, mntflags, p) +nullfs_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { void *mntdata; int error; @@ -257,7 +257,7 @@ nullfs_root(mp, vpp) struct mount *mp; struct vnode **vpp; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct vnode *vp; NULLFSDEBUG("nullfs_root(mp = %p, vp = %p->%p)\n", (void *)mp, @@ -277,27 +277,27 @@ nullfs_root(mp, vpp) return (EDEADLK); } #endif - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); *vpp = vp; return 0; } static int -nullfs_quotactl(mp, cmd, uid, arg, p) +nullfs_quotactl(mp, cmd, uid, arg, td) struct mount *mp; int cmd; uid_t uid; caddr_t arg; - struct proc *p; + struct thread *td; { - return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg, p); + return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg, td); } static int -nullfs_statfs(mp, sbp, p) +nullfs_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { int error; struct statfs mstat; @@ -308,7 +308,7 @@ nullfs_statfs(mp, sbp, p) bzero(&mstat, sizeof(mstat)); - error = VFS_STATFS(MOUNTTONULLMOUNT(mp)->nullm_vfs, &mstat, p); + error = VFS_STATFS(MOUNTTONULLMOUNT(mp)->nullm_vfs, &mstat, td); if (error) return (error); @@ -331,11 +331,11 @@ nullfs_statfs(mp, sbp, p) } static int -nullfs_sync(mp, waitfor, cred, p) +nullfs_sync(mp, waitfor, cred, td) struct mount *mp; int waitfor; struct ucred *cred; - struct proc *p; + struct thread *td; { /* * XXX - Assumes no data cached at null layer. @@ -392,16 +392,16 @@ nullfs_vptofh(vp, fhp) } static int -nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, p) +nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td) struct mount *mp; int cmd; struct vnode *filename_vp; int namespace; const char *attrname; - struct proc *p; + struct thread *td; { return VFS_EXTATTRCTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, filename_vp, - namespace, attrname, p); + namespace, attrname, td); } diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 0801c0b..3683ac1 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -320,7 +320,7 @@ null_bypass(ap) *(vps_p[i]) = old_vps[i]; #if 0 if (reles & VDESC_VP0_WILLUNLOCK) - VOP_UNLOCK(*(vps_p[i]), LK_THISLAYER, curproc); + VOP_UNLOCK(*(vps_p[i]), LK_THISLAYER, curthread); #endif if (reles & VDESC_VP0_WILLRELE) vrele(*(vps_p[i])); @@ -368,7 +368,7 @@ null_lookup(ap) { struct componentname *cnp = ap->a_cnp; struct vnode *dvp = ap->a_dvp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; int flags = cnp->cn_flags; struct vnode *vp, *ldvp, *lvp; int error; @@ -393,7 +393,7 @@ null_lookup(ap) * tracked by underlying filesystem. */ if (cnp->cn_flags & PDIRUNLOCK) - VOP_UNLOCK(dvp, LK_THISLAYER, p); + VOP_UNLOCK(dvp, LK_THISLAYER, td); if ((error == 0 || error == EJUSTRETURN) && lvp != NULL) { if (ldvp == lvp) { *ap->a_vpp = dvp; @@ -418,7 +418,7 @@ null_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -464,7 +464,7 @@ null_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { int error; @@ -485,7 +485,7 @@ null_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -520,7 +520,7 @@ null_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -581,12 +581,12 @@ null_lock(ap) struct vop_lock_args /* { struct vnode *a_vp; int a_flags; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; int flags = ap->a_flags; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct vnode *lvp; int error; @@ -594,7 +594,7 @@ null_lock(ap) if (vp->v_vnlock != NULL) return 0; /* lock is shared across layers */ error = lockmgr(&vp->v_lock, flags & ~LK_THISLAYER, - &vp->v_interlock, p); + &vp->v_interlock, td); return (error); } @@ -611,9 +611,9 @@ null_lock(ap) NULLFSDEBUG("null_lock: avoiding LK_DRAIN\n"); return(lockmgr(vp->v_vnlock, (flags & ~LK_TYPE_MASK) | LK_EXCLUSIVE, - &vp->v_interlock, p)); + &vp->v_interlock, td)); } - return(lockmgr(vp->v_vnlock, flags, &vp->v_interlock, p)); + return(lockmgr(vp->v_vnlock, flags, &vp->v_interlock, td)); } else { /* * To prevent race conditions involving doing a lookup @@ -625,21 +625,21 @@ null_lock(ap) */ lvp = NULLVPTOLOWERVP(vp); if (lvp == NULL) - return (lockmgr(&vp->v_lock, flags, &vp->v_interlock, p)); + return (lockmgr(&vp->v_lock, flags, &vp->v_interlock, td)); if (flags & LK_INTERLOCK) { mtx_unlock(&vp->v_interlock); flags &= ~LK_INTERLOCK; } if ((flags & LK_TYPE_MASK) == LK_DRAIN) { error = VOP_LOCK(lvp, - (flags & ~LK_TYPE_MASK) | LK_EXCLUSIVE, p); + (flags & ~LK_TYPE_MASK) | LK_EXCLUSIVE, td); } else - error = VOP_LOCK(lvp, flags, p); + error = VOP_LOCK(lvp, flags, td); if (error) return (error); - error = lockmgr(&vp->v_lock, flags, &vp->v_interlock, p); + error = lockmgr(&vp->v_lock, flags, &vp->v_interlock, td); if (error) - VOP_UNLOCK(lvp, 0, p); + VOP_UNLOCK(lvp, 0, td); return (error); } } @@ -654,12 +654,12 @@ null_unlock(ap) struct vop_unlock_args /* { struct vnode *a_vp; int a_flags; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; int flags = ap->a_flags; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct vnode *lvp; if (vp->v_vnlock != NULL) { @@ -667,35 +667,35 @@ null_unlock(ap) return 0; /* the lock is shared across layers */ flags &= ~LK_THISLAYER; return (lockmgr(vp->v_vnlock, flags | LK_RELEASE, - &vp->v_interlock, p)); + &vp->v_interlock, td)); } lvp = NULLVPTOLOWERVP(vp); if (lvp == NULL) - return (lockmgr(&vp->v_lock, flags | LK_RELEASE, &vp->v_interlock, p)); + return (lockmgr(&vp->v_lock, flags | LK_RELEASE, &vp->v_interlock, td)); if ((flags & LK_THISLAYER) == 0) { if (flags & LK_INTERLOCK) { mtx_unlock(&vp->v_interlock); flags &= ~LK_INTERLOCK; } - VOP_UNLOCK(lvp, flags & ~LK_INTERLOCK, p); + VOP_UNLOCK(lvp, flags & ~LK_INTERLOCK, td); } else flags &= ~LK_THISLAYER; - return (lockmgr(&vp->v_lock, flags | LK_RELEASE, &vp->v_interlock, p)); + return (lockmgr(&vp->v_lock, flags | LK_RELEASE, &vp->v_interlock, td)); } static int null_islocked(ap) struct vop_islocked_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; if (vp->v_vnlock != NULL) - return (lockstatus(vp->v_vnlock, p)); - return (lockstatus(&vp->v_lock, p)); + return (lockstatus(vp->v_vnlock, td)); + return (lockstatus(&vp->v_lock, td)); } /* @@ -707,23 +707,23 @@ static int null_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct null_node *xp = VTONULL(vp); struct vnode *lowervp = xp->null_lowervp; - lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, p); + lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, td); LIST_REMOVE(xp, null_hash); - lockmgr(&null_hashlock, LK_RELEASE, NULL, p); + lockmgr(&null_hashlock, LK_RELEASE, NULL, td); xp->null_lowervp = NULLVP; if (vp->v_vnlock != NULL) { vp->v_vnlock = &vp->v_lock; /* we no longer share the lock */ } else - VOP_UNLOCK(vp, LK_THISLAYER, p); + VOP_UNLOCK(vp, LK_THISLAYER, td); vput(lowervp); /* @@ -743,7 +743,7 @@ static int null_reclaim(ap) struct vop_reclaim_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -774,7 +774,7 @@ null_createvobject(ap) struct vop_createvobject_args /* { struct vnode *vp; struct ucred *cred; - struct proc *p; + struct thread *td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -783,7 +783,7 @@ null_createvobject(ap) if (vp->v_type == VNON || lowervp == NULL) return 0; - error = VOP_CREATEVOBJECT(lowervp, ap->a_cred, ap->a_p); + error = VOP_CREATEVOBJECT(lowervp, ap->a_cred, ap->a_td); if (error) return (error); vp->v_flag |= VOBJBUF; 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; diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index 5c47e72..80356e4 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -62,23 +62,23 @@ static MALLOC_DEFINE(M_PORTALFSMNT, "PORTAL mount", "PORTAL mount structure"); static int portal_mount __P((struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p)); + struct nameidata *ndp, struct thread *td)); static int portal_unmount __P((struct mount *mp, int mntflags, - struct proc *p)); + struct thread *td)); static int portal_root __P((struct mount *mp, struct vnode **vpp)); static int portal_statfs __P((struct mount *mp, struct statfs *sbp, - struct proc *p)); + struct thread *td)); /* * Mount the per-process file descriptors (/dev/fd) */ static int -portal_mount(mp, path, data, ndp, p) +portal_mount(mp, path, data, ndp, td) struct mount *mp; char *path; caddr_t data; struct nameidata *ndp; - struct proc *p; + struct thread *td; { struct file *fp; struct portal_args args; @@ -99,12 +99,12 @@ portal_mount(mp, path, data, ndp, p) if (error) return (error); - error = holdsock(p->p_fd, args.pa_socket, &fp); + error = holdsock(td->td_proc->p_fd, args.pa_socket, &fp); if (error) return (error); so = (struct socket *) fp->f_data; if (so->so_proto->pr_domain->dom_family != AF_UNIX) { - fdrop(fp, p); + fdrop(fp, td); return (ESOCKTNOSUPPORT); } @@ -118,7 +118,7 @@ portal_mount(mp, path, data, ndp, p) if (error) { FREE(fmp, M_PORTALFSMNT); FREE(pn, M_TEMP); - fdrop(fp, p); + fdrop(fp, td); return (error); } @@ -144,16 +144,16 @@ portal_mount(mp, path, data, ndp, p) bcopy("portal", mp->mnt_stat.f_mntfromname, sizeof("portal")); #endif - (void)portal_statfs(mp, &mp->mnt_stat, p); - fdrop(fp, p); + (void)portal_statfs(mp, &mp->mnt_stat, td); + fdrop(fp, td); return (0); } static int -portal_unmount(mp, mntflags, p) +portal_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { int error, flags = 0; @@ -186,7 +186,7 @@ portal_unmount(mp, mntflags, p) * Discard reference to underlying file. Must call closef because * this may be the last reference. */ - closef(VFSTOPORTAL(mp)->pm_server, (struct proc *) 0); + closef(VFSTOPORTAL(mp)->pm_server, (struct thread *) 0); /* * Finally, throw away the portalmount structure */ @@ -200,7 +200,7 @@ portal_root(mp, vpp) struct mount *mp; struct vnode **vpp; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct vnode *vp; /* @@ -208,16 +208,16 @@ portal_root(mp, vpp) */ vp = VFSTOPORTAL(mp)->pm_root; VREF(vp); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); *vpp = vp; return (0); } static int -portal_statfs(mp, sbp, p) +portal_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { sbp->f_flags = 0; diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c index 03deb34..0e20d13 100644 --- a/sys/fs/portalfs/portal_vnops.c +++ b/sys/fs/portalfs/portal_vnops.c @@ -65,7 +65,7 @@ static int portal_fileid = PORTAL_ROOTFILEID+1; -static void portal_closefd __P((struct proc *p, int fd)); +static void portal_closefd __P((struct thread *td, int fd)); static int portal_connect __P((struct socket *so, struct socket *so2)); static int portal_getattr __P((struct vop_getattr_args *ap)); static int portal_lookup __P((struct vop_lookup_args *ap)); @@ -76,15 +76,15 @@ static int portal_reclaim __P((struct vop_reclaim_args *ap)); static int portal_setattr __P((struct vop_setattr_args *ap)); static void -portal_closefd(p, fd) - struct proc *p; +portal_closefd(td, fd) + struct thread *td; int fd; { int error; struct close_args ua; ua.fd = fd; - error = close(p, &ua); + error = close(td, &ua); /* * We should never get an error, and there isn't anything * we could do if we got one, so just print a message. @@ -204,12 +204,12 @@ portal_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct socket *so = 0; struct portalnode *pt; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct vnode *vp = ap->a_vp; int s; struct uio auio; @@ -237,7 +237,7 @@ portal_open(ap) * to deal with the side effects. Check for this * by testing whether the p_dupfd has been set. */ - if (p->p_dupfd >= 0) + if (td->td_dupfd >= 0) return (ENODEV); pt = VTOPORTAL(vp); @@ -246,7 +246,7 @@ portal_open(ap) /* * Create a new socket. */ - error = socreate(AF_UNIX, &so, SOCK_STREAM, 0, ap->a_p); + error = socreate(AF_UNIX, &so, SOCK_STREAM, 0, ap->a_td); if (error) goto bad; @@ -315,12 +315,12 @@ portal_open(ap) auio.uio_iovcnt = 2; auio.uio_rw = UIO_WRITE; auio.uio_segflg = UIO_SYSSPACE; - auio.uio_procp = p; + auio.uio_td = td; auio.uio_offset = 0; auio.uio_resid = aiov[0].iov_len + aiov[1].iov_len; error = sosend(so, (struct sockaddr *) 0, &auio, - (struct mbuf *) 0, (struct mbuf *) 0, 0, p); + (struct mbuf *) 0, (struct mbuf *) 0, 0 , td); if (error) goto bad; @@ -392,7 +392,7 @@ portal_open(ap) int i; printf("portal_open: %d extra fds\n", newfds - 1); for (i = 1; i < newfds; i++) { - portal_closefd(p, *ip); + portal_closefd(td, *ip); ip++; } } @@ -401,9 +401,9 @@ portal_open(ap) * Check that the mode the file is being opened for is a subset * of the mode of the existing descriptor. */ - fp = p->p_fd->fd_ofiles[fd]; + fp = td->td_proc->p_fd->fd_ofiles[fd]; if (((ap->a_mode & (FREAD|FWRITE)) | fp->f_flag) != fp->f_flag) { - portal_closefd(p, fd); + portal_closefd(td, fd); error = EACCES; goto bad; } @@ -413,7 +413,7 @@ portal_open(ap) * special error code (ENXIO) which causes magic things to * happen in vn_open. The whole concept is, well, hmmm. */ - p->p_dupfd = fd; + td->td_dupfd = fd; error = ENXIO; bad:; @@ -437,7 +437,7 @@ portal_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -482,7 +482,7 @@ portal_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { diff --git a/sys/fs/procfs/procfs.h b/sys/fs/procfs/procfs.h index b46b9c0..d97f825 100644 --- a/sys/fs/procfs/procfs.h +++ b/sys/fs/procfs/procfs.h @@ -119,14 +119,14 @@ void procfs_exit __P((struct proc *)); int procfs_freevp __P((struct vnode *)); int procfs_allocvp __P((struct mount *, struct vnode **, long, pfstype)); struct vnode *procfs_findtextvp __P((struct proc *)); -int procfs_sstep __P((struct proc *)); -void procfs_fix_sstep __P((struct proc *)); -int procfs_read_regs __P((struct proc *, struct reg *)); -int procfs_write_regs __P((struct proc *, struct reg *)); -int procfs_read_fpregs __P((struct proc *, struct fpreg *)); -int procfs_write_fpregs __P((struct proc *, struct fpreg *)); -int procfs_read_dbregs __P((struct proc *, struct dbreg *)); -int procfs_write_dbregs __P((struct proc *, struct dbreg *)); +int procfs_sstep __P((struct thread *)); +void procfs_fix_sstep __P((struct thread *)); +int procfs_read_regs __P((struct thread *, struct reg *)); +int procfs_write_regs __P((struct thread *, struct reg *)); +int procfs_read_fpregs __P((struct thread *, struct fpreg *)); +int procfs_write_fpregs __P((struct thread *, struct fpreg *)); +int procfs_read_dbregs __P((struct thread *, struct dbreg *)); +int procfs_write_dbregs __P((struct thread *, struct dbreg *)); int procfs_donote __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); int procfs_doregs __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); int procfs_dofpregs __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); @@ -140,12 +140,12 @@ int procfs_docmdline __P((struct proc *, struct proc *, struct pfsnode *pfsp, st int procfs_dorlimit __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); /* functions to check whether or not files should be displayed */ -int procfs_validfile __P((struct proc *)); -int procfs_validfpregs __P((struct proc *)); -int procfs_validregs __P((struct proc *)); -int procfs_validdbregs __P((struct proc *)); -int procfs_validmap __P((struct proc *)); -int procfs_validtype __P((struct proc *)); +int procfs_validfile __P((struct thread *)); +int procfs_validfpregs __P((struct thread *)); +int procfs_validregs __P((struct thread *)); +int procfs_validdbregs __P((struct thread *)); +int procfs_validmap __P((struct thread *)); +int procfs_validtype __P((struct thread *)); #define PROCFS_LOCKED 0x01 #define PROCFS_WANT 0x02 diff --git a/sys/fs/procfs/procfs_ctl.c b/sys/fs/procfs/procfs_ctl.c index 30b61f2..eacf32a 100644 --- a/sys/fs/procfs/procfs_ctl.c +++ b/sys/fs/procfs/procfs_ctl.c @@ -190,7 +190,7 @@ out: /* * do single-step fixup if needed */ - FIX_SSTEP(p); + FIX_SSTEP(&p->p_thread); /* XXXKSE */ #endif /* @@ -246,7 +246,7 @@ out: case PROCFS_CTL_STEP: _PHOLD(p); PROC_UNLOCK(p); - error = procfs_sstep(p); + error = procfs_sstep(&p->p_thread); /* XXXKSE */ PRELE(p); if (error) return (error); @@ -300,7 +300,7 @@ out: mtx_lock_spin(&sched_lock); if (p->p_stat == SSTOP) - setrunnable(p); + setrunnable(&p->p_thread); /* XXXKSE */ mtx_unlock_spin(&sched_lock); return (0); } @@ -347,9 +347,9 @@ procfs_doctl(curp, p, pfs, uio) if (TRACE_WAIT_P(curp, p)) { p->p_xstat = nm->nm_val; #ifdef FIX_SSTEP - FIX_SSTEP(p); + FIX_SSTEP(&p->p_thread); /* XXXKSE */ #endif - setrunnable(p); + setrunnable(&p->p_thread); /* XXXKSE */ mtx_unlock_spin(&sched_lock); } else { mtx_unlock_spin(&sched_lock); diff --git a/sys/fs/procfs/procfs_dbregs.c b/sys/fs/procfs/procfs_dbregs.c index d61b8c9..5de041a 100644 --- a/sys/fs/procfs/procfs_dbregs.c +++ b/sys/fs/procfs/procfs_dbregs.c @@ -83,14 +83,14 @@ procfs_dodbregs(curp, p, pfs, uio) if (kl < 0) error = EINVAL; else - error = procfs_read_dbregs(p, &r); + error = procfs_read_dbregs(&p->p_thread, &r); /* XXXKSE */ if (error == 0) error = uiomove(kv, kl, uio); if (error == 0 && uio->uio_rw == UIO_WRITE) { if (p->p_stat != SSTOP) error = EBUSY; else - error = procfs_write_dbregs(p, &r); + error = procfs_write_dbregs(&p->p_thread, &r); /* XXXKSE */ } PRELE(p); @@ -99,9 +99,8 @@ procfs_dodbregs(curp, p, pfs, uio) } int -procfs_validdbregs(p) - struct proc *p; +procfs_validdbregs(struct thread *td) { - return ((p->p_flag & P_SYSTEM) == 0); + return ((td->td_proc->p_flag & P_SYSTEM) == 0); } diff --git a/sys/fs/procfs/procfs_fpregs.c b/sys/fs/procfs/procfs_fpregs.c index 9b6cd3a..2b68693 100644 --- a/sys/fs/procfs/procfs_fpregs.c +++ b/sys/fs/procfs/procfs_fpregs.c @@ -80,14 +80,14 @@ procfs_dofpregs(curp, p, pfs, uio) if (kl < 0) error = EINVAL; else - error = procfs_read_fpregs(p, &r); + error = procfs_read_fpregs(&p->p_thread, &r); if (error == 0) error = uiomove(kv, kl, uio); if (error == 0 && uio->uio_rw == UIO_WRITE) { if (p->p_stat != SSTOP) error = EBUSY; else - error = procfs_write_fpregs(p, &r); + error = procfs_write_fpregs(&p->p_thread, &r); } PRELE(p); @@ -96,9 +96,8 @@ procfs_dofpregs(curp, p, pfs, uio) } int -procfs_validfpregs(p) - struct proc *p; +procfs_validfpregs(struct thread *td) { - return ((p->p_flag & P_SYSTEM) == 0); + return (( td->td_proc->p_flag & P_SYSTEM) == 0); } diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c index 692594d..945639a 100644 --- a/sys/fs/procfs/procfs_map.c +++ b/sys/fs/procfs/procfs_map.c @@ -182,8 +182,7 @@ case OBJT_DEVICE: } int -procfs_validmap(p) - struct proc *p; +procfs_validmap(struct thread *td) { - return ((p->p_flag & P_SYSTEM) == 0); + return ((td->td_proc->p_flag & P_SYSTEM) == 0); } diff --git a/sys/fs/procfs/procfs_regs.c b/sys/fs/procfs/procfs_regs.c index 6a00ecd..f590075 100644 --- a/sys/fs/procfs/procfs_regs.c +++ b/sys/fs/procfs/procfs_regs.c @@ -81,14 +81,14 @@ procfs_doregs(curp, p, pfs, uio) if (kl < 0) error = EINVAL; else - error = procfs_read_regs(p, &r); + error = procfs_read_regs(&p->p_thread, &r); /* XXXKSE */ if (error == 0) error = uiomove(kv, kl, uio); if (error == 0 && uio->uio_rw == UIO_WRITE) { if (p->p_stat != SSTOP) error = EBUSY; else - error = procfs_write_regs(p, &r); + error = procfs_write_regs(&p->p_thread, &r); /* XXXKSE */ } PRELE(p); @@ -97,9 +97,8 @@ procfs_doregs(curp, p, pfs, uio) } int -procfs_validregs(p) - struct proc *p; +procfs_validregs(struct thread *td) { - return ((p->p_flag & P_SYSTEM) == 0); + return ((td->td_proc->p_flag & P_SYSTEM) == 0); } diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index 3a2a814..c75294b 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -145,8 +145,14 @@ procfs_dostatus(curp, p, pfs, uio) } DOCHECK(); - ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %s", - (p->p_wchan && p->p_wmesg) ? p->p_wmesg : "nochan"); + if (p->p_flag & P_KSES) { + ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %s", + "-kse- "); + } else { + ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %s", + (p->p_thread.td_wchan && p->p_thread.td_wmesg) ? + p->p_thread.td_wmesg : "nochan"); + } DOCHECK(); cr = p->p_ucred; diff --git a/sys/fs/procfs/procfs_subr.c b/sys/fs/procfs/procfs_subr.c index 8575058..a411546 100644 --- a/sys/fs/procfs/procfs_subr.c +++ b/sys/fs/procfs/procfs_subr.c @@ -88,7 +88,7 @@ procfs_allocvp(mp, vpp, pid, pfs_type) long pid; pfstype pfs_type; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct pfsnode *pfs; struct vnode *vp; struct pfsnode **pp; @@ -100,7 +100,7 @@ loop: if (pfs->pfs_pid == pid && pfs->pfs_type == pfs_type && vp->v_mount == mp) { - if (vget(vp, 0, p)) + if (vget(vp, 0, td)) goto loop; *vpp = vp; return (0); @@ -246,7 +246,7 @@ procfs_rw(ap) { struct vnode *vp = ap->a_vp; struct uio *uio = ap->a_uio; - struct proc *curp = uio->uio_procp; + struct proc *curp = uio->uio_td->td_proc; struct pfsnode *pfs = VTOPFS(vp); struct proc *p; int rtval; diff --git a/sys/fs/procfs/procfs_type.c b/sys/fs/procfs/procfs_type.c index 3919c88..31cbcf0 100644 --- a/sys/fs/procfs/procfs_type.c +++ b/sys/fs/procfs/procfs_type.c @@ -78,8 +78,7 @@ procfs_dotype(curp, p, pfs, uio) } int -procfs_validtype(p) - struct proc *p; +procfs_validtype(struct thread *td) { - return ((p->p_flag & P_SYSTEM) == 0); + return ((td->td_proc->p_flag & P_SYSTEM) == 0); } diff --git a/sys/fs/procfs/procfs_vfsops.c b/sys/fs/procfs/procfs_vfsops.c index c0d7add..2442022 100644 --- a/sys/fs/procfs/procfs_vfsops.c +++ b/sys/fs/procfs/procfs_vfsops.c @@ -52,11 +52,11 @@ #include <fs/procfs/procfs.h> static int procfs_mount __P((struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p)); + struct nameidata *ndp, struct thread *td)); static int procfs_statfs __P((struct mount *mp, struct statfs *sbp, - struct proc *p)); + struct thread *td)); static int procfs_unmount __P((struct mount *mp, int mntflags, - struct proc *p)); + struct thread *td)); /* * VFS Operations. @@ -65,12 +65,12 @@ static int procfs_unmount __P((struct mount *mp, int mntflags, */ /* ARGSUSED */ static int -procfs_mount(mp, path, data, ndp, p) +procfs_mount(mp, path, data, ndp, td) struct mount *mp; char *path; caddr_t data; struct nameidata *ndp; - struct proc *p; + struct thread *td; { size_t size; int error; @@ -90,7 +90,7 @@ procfs_mount(mp, path, data, ndp, p) size = sizeof("procfs") - 1; bcopy("procfs", mp->mnt_stat.f_mntfromname, size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void)procfs_statfs(mp, &mp->mnt_stat, p); + (void)procfs_statfs(mp, &mp->mnt_stat, td); return (0); } @@ -99,10 +99,10 @@ procfs_mount(mp, path, data, ndp, p) * unmount system call */ static int -procfs_unmount(mp, mntflags, p) +procfs_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { int error; int flags = 0; @@ -133,10 +133,10 @@ procfs_root(mp, vpp) * Get file system statistics. */ static int -procfs_statfs(mp, sbp, p) +procfs_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { sbp->f_bsize = PAGE_SIZE; sbp->f_iosize = PAGE_SIZE; diff --git a/sys/fs/procfs/procfs_vnops.c b/sys/fs/procfs/procfs_vnops.c index 206f3e5..5367078 100644 --- a/sys/fs/procfs/procfs_vnops.c +++ b/sys/fs/procfs/procfs_vnops.c @@ -91,7 +91,7 @@ static struct proc_target { u_char pt_namlen; char *pt_name; pfstype pt_pfstype; - int (*pt_valid) __P((struct proc *p)); + int (*pt_valid) __P((struct thread *p)); } proc_targets[] = { #define N(s) sizeof(s)-1, s /* name type validp */ @@ -133,7 +133,7 @@ procfs_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct pfsnode *pfs = VTOPFS(ap->a_vp); @@ -143,7 +143,7 @@ procfs_open(ap) p2 = PFIND(pfs->pfs_pid); if (p2 == NULL) return (ENOENT); - if (pfs->pfs_pid && p_cansee(ap->a_p, p2)) { + if (pfs->pfs_pid && p_cansee(ap->a_td->td_proc, p2)) { error = ENOENT; goto out; } @@ -156,7 +156,7 @@ procfs_open(ap) goto out; } - p1 = ap->a_p; + p1 = ap->a_td->td_proc; error = p_candebug(p1, p2); if (error) return (error); @@ -185,7 +185,7 @@ procfs_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct pfsnode *pfs = VTOPFS(ap->a_vp); @@ -235,7 +235,7 @@ procfs_ioctl(ap) struct procfs_status *psp; unsigned char flags; - p = ap->a_p; + p = ap->a_td->td_proc; procp = pfind(pfs->pfs_pid); if (procp == NULL) { return ENOTTY; @@ -380,7 +380,7 @@ procfs_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct pfsnode *pfs = VTOPFS(ap->a_vp); @@ -407,7 +407,7 @@ procfs_getattr(ap) return (ENOENT); } - if (p_cansee(ap->a_p, procp)) { + if (p_cansee(ap->a_td->td_proc, procp)) { PROC_UNLOCK(procp); return (ENOENT); } @@ -569,7 +569,7 @@ procfs_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { @@ -603,7 +603,7 @@ procfs_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct pfsnode *pfs = VTOPFS(ap->a_vp); @@ -621,7 +621,7 @@ procfs_access(ap) procp = PFIND(pfs->pfs_pid); if (procp == NULL) return (ENOENT); - if (p_cansee(ap->a_p, procp)) { + if (p_cansee(ap->a_td->td_proc, procp)) { PROC_UNLOCK(procp); return (ENOENT); } @@ -629,7 +629,7 @@ procfs_access(ap) } vap = &vattr; - error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p); + error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td); if (error) return (error); @@ -658,12 +658,13 @@ procfs_lookup(ap) struct vnode **vpp = ap->a_vpp; struct vnode *dvp = ap->a_dvp; char *pname = cnp->cn_nameptr; - struct proc *curp = cnp->cn_proc; + struct proc *curp = cnp->cn_thread->td_proc; struct proc_target *pt; pid_t pid; struct pfsnode *pfs; struct proc *p; int i; + struct thread *td; *vpp = NULL; @@ -708,13 +709,14 @@ procfs_lookup(ap) return (procfs_root(dvp->v_mount, vpp)); p = PFIND(pfs->pfs_pid); + td = &p->p_thread; /* XXXKSE */ if (p == NULL) break; for (pt = proc_targets, i = 0; i < nproc_targets; pt++, i++) { if (cnp->cn_namelen == pt->pt_namlen && bcmp(pt->pt_name, pname, cnp->cn_namelen) == 0 && - (pt->pt_valid == NULL || (*pt->pt_valid)(p))) + (pt->pt_valid == NULL || (*pt->pt_valid)(td))) goto found; } PROC_UNLOCK(p); @@ -735,11 +737,11 @@ procfs_lookup(ap) * Does this process have a text file? */ int -procfs_validfile(p) - struct proc *p; +procfs_validfile(td) + struct thread *td; { - return (procfs_findtextvp(p) != NULLVP); + return (procfs_findtextvp(td->td_proc) != NULLVP); } /* @@ -765,6 +767,7 @@ procfs_readdir(ap) struct pfsnode *pfs; int count, error, i, off; static u_int delen; + struct thread *td; if (!delen) { @@ -794,16 +797,17 @@ procfs_readdir(ap) struct proc_target *pt; p = PFIND(pfs->pfs_pid); + td = &p->p_thread; /* XXXKSE */ if (p == NULL) break; - if (p_cansee(curproc, p)) { + if (p_cansee(curthread->td_proc, p)) { PROC_UNLOCK(p); break; } for (pt = &proc_targets[i]; uio->uio_resid >= delen && i < nproc_targets; pt++, i++) { - if (pt->pt_valid && (*pt->pt_valid)(p) == 0) + if (pt->pt_valid && (*pt->pt_valid)(td) == 0) continue; dp->d_reclen = delen; @@ -864,11 +868,11 @@ procfs_readdir(ap) p = LIST_NEXT(p, p_list); if (p == NULL) goto done; - if (p_cansee(curproc, p)) + if (p_cansee(curthread->td_proc, p)) continue; pcnt++; } - while (p_cansee(curproc, p)) { + while (p_cansee(curthread->td_proc, p)) { p = LIST_NEXT(p, p_list); if (p == NULL) goto done; diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index e74c683..45117ac 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -51,7 +51,7 @@ SYSCTL_NODE(_vfs, OID_AUTO, pfs, CTLFLAG_RW, 0, */ int pfs_mount(struct pfs_info *pi, struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p) + struct nameidata *ndp, struct thread *td) { struct statfs *sbp; @@ -79,7 +79,7 @@ pfs_mount(struct pfs_info *pi, struct mount *mp, char *path, caddr_t data, * Unmount a pseudofs instance */ int -pfs_unmount(struct mount *mp, int mntflags, struct proc *p) +pfs_unmount(struct mount *mp, int mntflags, struct thread *td) { struct pfs_info *pi; int error; @@ -108,7 +108,7 @@ pfs_root(struct mount *mp, struct vnode **vpp) * Return filesystem stats */ int -pfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p) +pfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) { bcopy(&mp->mnt_stat, sbp, sizeof *sbp); return (0); diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h index cfe3d9e..474f442 100644 --- a/sys/fs/pseudofs/pseudofs.h +++ b/sys/fs/pseudofs/pseudofs.h @@ -56,7 +56,7 @@ struct pfs_node; struct pfs_bitmap; #define PFS_FILL_ARGS \ - struct proc *curp, struct proc *p, struct pfs_node *pn, struct sbuf *sb + struct thread *td, struct proc *p, struct pfs_node *pn, struct sbuf *sb #define PFS_FILL_PROTO(name) \ int name(PFS_FILL_ARGS); typedef int (*pfs_fill_t)(PFS_FILL_ARGS); @@ -122,12 +122,12 @@ struct pfs_node { */ int pfs_mount (struct pfs_info *pi, struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p); + struct nameidata *ndp, struct thread *td); int pfs_unmount (struct mount *mp, int mntflags, - struct proc *p); + struct thread *td); int pfs_root (struct mount *mp, struct vnode **vpp); int pfs_statfs (struct mount *mp, struct statfs *sbp, - struct proc *p); + struct thread *td); int pfs_init (struct pfs_info *pi, struct vfsconf *vfc); int pfs_uninit (struct pfs_info *pi, struct vfsconf *vfc); @@ -143,8 +143,8 @@ static struct pfs_info name##_info = { \ \ static int \ _##name##_mount(struct mount *mp, char *path, caddr_t data, \ - struct nameidata *ndp, struct proc *p) { \ - return pfs_mount(&name##_info, mp, path, data, ndp, p); \ + struct nameidata *ndp, struct thread *td) { \ + return pfs_mount(&name##_info, mp, path, data, ndp, td); \ } \ \ static int \ diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index 465bfcd..3ff33d7 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -98,7 +98,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, for (pv = pfs_vncache; pv; pv = pv->pv_next) { pvd = (struct pfs_vdata *)pv->pv_vnode->v_data; if (pvd->pvd_pn == pn && pvd->pvd_pid == pid) { - if (vget(pv->pv_vnode, 0, curproc) == 0) { + if (vget(pv->pv_vnode, 0, curthread) == 0) { ++pfs_vncache_hits; *vpp = pv->pv_vnode; mtx_unlock(&pfs_vncache_mutex); diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c index ea26435..db62cbd 100644 --- a/sys/fs/pseudofs/pseudofs_vnops.c +++ b/sys/fs/pseudofs/pseudofs_vnops.c @@ -56,7 +56,7 @@ pfs_access(struct vop_access_args *va) struct vattr vattr; int error; - error = VOP_GETATTR(vn, &vattr, va->a_cred, va->a_p); + error = VOP_GETATTR(vn, &vattr, va->a_cred, va->a_td); if (error) return (error); error = vaccess(vn->v_type, vattr.va_mode, vattr.va_uid, @@ -230,7 +230,7 @@ pfs_read(struct vop_read_args *va) return (EIO); } - error = (pn->pn_func)(curproc, proc, pn, sb); + error = (pn->pn_func)(curthread, proc, pn, sb); if (proc != NULL) PRELE(proc); @@ -392,7 +392,7 @@ pfs_readlink(struct vop_readlink_args *va) /* sbuf_new() can't fail with a static buffer */ sbuf_new(&sb, buf, sizeof buf, 0); - error = (pn->pn_func)(curproc, proc, pn, &sb); + error = (pn->pn_func)(curthread, proc, pn, &sb); if (proc != NULL) PRELE(proc); diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index f2b1c34..0cdfd26 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -131,10 +131,10 @@ spec_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct vnode *vp = ap->a_vp; dev_t dev = vp->v_rdev; int error; @@ -191,9 +191,9 @@ spec_open(ap) if (dsw->d_flags & D_TTY) vp->v_flag |= VISTTY; - VOP_UNLOCK(vp, 0, p); - error = (*dsw->d_open)(dev, ap->a_mode, S_IFCHR, p); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_UNLOCK(vp, 0, td); + error = (*dsw->d_open)(dev, ap->a_mode, S_IFCHR, td); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (error) return (error); @@ -238,7 +238,7 @@ spec_read(ap) } */ *ap; { struct vnode *vp; - struct proc *p; + struct thread *td; struct uio *uio; dev_t dev; int error, resid; @@ -246,15 +246,15 @@ spec_read(ap) vp = ap->a_vp; dev = vp->v_rdev; uio = ap->a_uio; - p = uio->uio_procp; + td = uio->uio_td; resid = uio->uio_resid; if (resid == 0) return (0); - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); error = (*devsw(dev)->d_read) (dev, uio, ap->a_ioflag); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (uio->uio_resid != resid || (error == 0 && resid != 0)) getnanotime(&dev->si_atime); return (error); @@ -274,7 +274,7 @@ spec_write(ap) } */ *ap; { struct vnode *vp; - struct proc *p; + struct thread *td; struct uio *uio; dev_t dev; int error, resid; @@ -282,12 +282,12 @@ spec_write(ap) vp = ap->a_vp; dev = vp->v_rdev; uio = ap->a_uio; - p = uio->uio_procp; + td = uio->uio_td; resid = uio->uio_resid; - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); error = (*devsw(dev)->d_write) (dev, uio, ap->a_ioflag); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (uio->uio_resid != resid || (error == 0 && resid != 0)) { getnanotime(&dev->si_ctime); dev->si_mtime = dev->si_ctime; @@ -307,14 +307,14 @@ spec_ioctl(ap) caddr_t a_data; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { dev_t dev; dev = ap->a_vp->v_rdev; return ((*devsw(dev)->d_ioctl)(dev, ap->a_command, - ap->a_data, ap->a_fflag, ap->a_p)); + ap->a_data, ap->a_fflag, ap->a_td)); } /* ARGSUSED */ @@ -324,13 +324,13 @@ spec_poll(ap) struct vnode *a_vp; int a_events; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { dev_t dev; dev = ap->a_vp->v_rdev; - return (*devsw(dev)->d_poll)(dev, ap->a_events, ap->a_p); + return (*devsw(dev)->d_poll)(dev, ap->a_events, ap->a_td); } /* ARGSUSED */ @@ -359,7 +359,7 @@ spec_fsync(ap) struct vnode *a_vp; struct ucred *a_cred; int a_waitfor; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -563,11 +563,11 @@ spec_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; dev_t dev = vp->v_rdev; /* @@ -579,10 +579,10 @@ spec_close(ap) * if the reference count is 2 (this last descriptor * plus the session), release the reference from the session. */ - if (vcount(vp) == 2 && p && (vp->v_flag & VXLOCK) == 0 && - vp == p->p_session->s_ttyvp) { + if (vcount(vp) == 2 && td && (vp->v_flag & VXLOCK) == 0 && + vp == td->td_proc->p_session->s_ttyvp) { vrele(vp); - p->p_session->s_ttyvp = NULL; + td->td_proc->p_session->s_ttyvp = NULL; } /* * We do not want to really close the device if it @@ -600,7 +600,7 @@ spec_close(ap) } else if (vcount(vp) > 1) { return (0); } - return (devsw(dev)->d_close(dev, ap->a_fflag, S_IFCHR, p)); + return (devsw(dev)->d_close(dev, ap->a_fflag, S_IFCHR, td)); } /* @@ -716,7 +716,7 @@ spec_getpages(ap) bp->b_iodone = spec_getpages_iodone; /* B_PHYS is not set, but it is nice to fill this in. */ - bp->b_rcred = bp->b_wcred = curproc->p_ucred; + bp->b_rcred = bp->b_wcred = curthread->td_proc->p_ucred; if (bp->b_rcred != NOCRED) crhold(bp->b_rcred); if (bp->b_wcred != NOCRED) diff --git a/sys/fs/umapfs/umap_subr.c b/sys/fs/umapfs/umap_subr.c index afcaceb..c61fe7c 100644 --- a/sys/fs/umapfs/umap_subr.c +++ b/sys/fs/umapfs/umap_subr.c @@ -141,7 +141,7 @@ umap_node_find(mp, targetvp) struct mount *mp; struct vnode *targetvp; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct umap_node_hashhead *hd; struct umap_node *a; struct vnode *vp; @@ -168,7 +168,7 @@ loop: * stuff, but we don't want to lock * the lower node. */ - if (vget(vp, 0, p)) { + if (vget(vp, 0, td)) { #ifdef DEBUG printf ("umap_node_find: vget failed.\n"); #endif diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c index 116ce16..a22b8df 100644 --- a/sys/fs/umapfs/umap_vfsops.c +++ b/sys/fs/umapfs/umap_vfsops.c @@ -62,35 +62,35 @@ static int umapfs_fhtovp __P((struct mount *mp, struct fid *fidp, static int umapfs_checkexp __P((struct mount *mp, struct sockaddr *nam, int *extflagsp, struct ucred **credanonp)); static int umapfs_mount __P((struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p)); + struct nameidata *ndp, struct thread *td)); static int umapfs_quotactl __P((struct mount *mp, int cmd, uid_t uid, - caddr_t arg, struct proc *p)); + caddr_t arg, struct thread *td)); static int umapfs_root __P((struct mount *mp, struct vnode **vpp)); -static int umapfs_start __P((struct mount *mp, int flags, struct proc *p)); +static int umapfs_start __P((struct mount *mp, int flags, struct thread *td)); static int umapfs_statfs __P((struct mount *mp, struct statfs *sbp, - struct proc *p)); + struct thread *td)); static int umapfs_sync __P((struct mount *mp, int waitfor, - struct ucred *cred, struct proc *p)); + struct ucred *cred, struct thread *td)); static int umapfs_unmount __P((struct mount *mp, int mntflags, - struct proc *p)); + struct thread *td)); static int umapfs_vget __P((struct mount *mp, ino_t ino, struct vnode **vpp)); static int umapfs_vptofh __P((struct vnode *vp, struct fid *fhp)); static int umapfs_extattrctl __P((struct mount *mp, int cmd, struct vnode *filename_vp, int namespace, const char *attrname, - struct proc *p)); + struct thread *td)); /* * Mount umap layer */ static int -umapfs_mount(mp, path, data, ndp, p) +umapfs_mount(mp, path, data, ndp, td) struct mount *mp; char *path; caddr_t data; struct nameidata *ndp; - struct proc *p; + struct thread *td; { struct umap_args args; struct vnode *lowerrootvp, *vp; @@ -105,7 +105,7 @@ umapfs_mount(mp, path, data, ndp, p) /* * Only for root */ - if ((error = suser(p)) != 0) + if ((error = suser_td(td)) != 0) return (error); #ifdef DEBUG @@ -117,7 +117,7 @@ umapfs_mount(mp, path, data, ndp, p) */ if (mp->mnt_flag & MNT_UPDATE) { return (EOPNOTSUPP); - /* return (VFS_MOUNT(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, path, data, ndp, p));*/ + /* return (VFS_MOUNT(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, path, data, ndp, td));*/ } /* @@ -131,7 +131,7 @@ umapfs_mount(mp, path, data, ndp, p) * Find lower node */ NDINIT(ndp, LOOKUP, FOLLOW|WANTPARENT|LOCKLEAF, - UIO_USERSPACE, args.target, p); + UIO_USERSPACE, args.target, td); error = namei(ndp); if (error) return (error); @@ -209,7 +209,7 @@ umapfs_mount(mp, path, data, ndp, p) /* * Unlock the node (either the lower or the alias) */ - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); /* * Make sure the node alias worked */ @@ -234,7 +234,7 @@ umapfs_mount(mp, path, data, ndp, p) (void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void)umapfs_statfs(mp, &mp->mnt_stat, p); + (void)umapfs_statfs(mp, &mp->mnt_stat, td); #ifdef DEBUG printf("umapfs_mount: lower %s, alias at %s\n", mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname); @@ -248,23 +248,23 @@ umapfs_mount(mp, path, data, ndp, p) * when that filesystem was mounted. */ static int -umapfs_start(mp, flags, p) +umapfs_start(mp, flags, td) struct mount *mp; int flags; - struct proc *p; + struct thread *td; { return (0); - /* return (VFS_START(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, flags, p)); */ + /* return (VFS_START(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, flags, td)); */ } /* * Free reference to umap layer */ static int -umapfs_unmount(mp, mntflags, p) +umapfs_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { int error; int flags = 0; @@ -304,7 +304,7 @@ umapfs_root(mp, vpp) struct mount *mp; struct vnode **vpp; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct vnode *vp; #ifdef DEBUG @@ -318,27 +318,27 @@ umapfs_root(mp, vpp) */ vp = MOUNTTOUMAPMOUNT(mp)->umapm_rootvp; VREF(vp); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); *vpp = vp; return (0); } static int -umapfs_quotactl(mp, cmd, uid, arg, p) +umapfs_quotactl(mp, cmd, uid, arg, td) struct mount *mp; int cmd; uid_t uid; caddr_t arg; - struct proc *p; + struct thread *td; { - return (VFS_QUOTACTL(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, cmd, uid, arg, p)); + return (VFS_QUOTACTL(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, cmd, uid, arg, td)); } static int -umapfs_statfs(mp, sbp, p) +umapfs_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { int error; struct statfs mstat; @@ -351,7 +351,7 @@ umapfs_statfs(mp, sbp, p) bzero(&mstat, sizeof(mstat)); - error = VFS_STATFS(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, &mstat, p); + error = VFS_STATFS(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, &mstat, td); if (error) return (error); @@ -374,11 +374,11 @@ umapfs_statfs(mp, sbp, p) } static int -umapfs_sync(mp, waitfor, cred, p) +umapfs_sync(mp, waitfor, cred, td) struct mount *mp; int waitfor; struct ucred *cred; - struct proc *p; + struct thread *td; { /* * XXX - Assumes no data cached at umap layer. @@ -427,16 +427,16 @@ umapfs_vptofh(vp, fhp) } static int -umapfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, p) +umapfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td) struct mount *mp; int cmd; struct vnode *filename_vp; int namespace; const char *attrname; - struct proc *p; + struct thread *td; { return (VFS_EXTATTRCTL(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, cmd, - filename_vp, namespace, attrname, p)); + filename_vp, namespace, attrname, td)); } diff --git a/sys/fs/umapfs/umap_vnops.c b/sys/fs/umapfs/umap_vnops.c index b73ff2c..77a8a14 100644 --- a/sys/fs/umapfs/umap_vnops.c +++ b/sys/fs/umapfs/umap_vnops.c @@ -283,7 +283,7 @@ umap_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { short uid, gid; @@ -359,7 +359,7 @@ umap_lock(ap) struct vop_lock_args /* { struct vnode *a_vp; int a_flags; - struct proc *a_p; + struct thread *a_td; } */ *ap; { @@ -380,7 +380,7 @@ umap_unlock(ap) struct vop_unlock_args /* { struct vnode *a_vp; int a_flags; - struct proc *a_p; + struct thread *a_td; } */ *ap; { vop_nounlock(ap); @@ -392,7 +392,7 @@ static int umap_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -405,8 +405,8 @@ umap_inactive(ap) * cache and reusable. * */ - VOP_INACTIVE(lowervp, ap->a_p); - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); + VOP_INACTIVE(lowervp, ap->a_td); + VOP_UNLOCK(ap->a_vp, 0, ap->a_td); return (0); } diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index 63a881c..0caff1a 100644 --- a/sys/fs/unionfs/union.h +++ b/sys/fs/unionfs/union.h @@ -119,22 +119,22 @@ extern int union_allocvp __P((struct vnode **, struct mount *, struct componentname *, struct vnode *, struct vnode *, int)); extern int union_freevp __P((struct vnode *)); -extern struct vnode *union_dircache __P((struct vnode *, struct proc *)); +extern struct vnode *union_dircache __P((struct vnode *, struct thread *)); extern int union_copyup __P((struct union_node *, int, struct ucred *, - struct proc *)); + struct thread *)); extern int union_dowhiteout __P((struct union_node *, struct ucred *, - struct proc *)); + struct thread *)); extern int union_mkshadow __P((struct union_mount *, struct vnode *, struct componentname *, struct vnode **)); extern int union_mkwhiteout __P((struct union_mount *, struct vnode *, struct componentname *, char *)); extern int union_cn_close __P((struct vnode *, int, struct ucred *, - struct proc *)); + struct thread *)); extern void union_removed_upper __P((struct union_node *un)); extern struct vnode *union_lowervp __P((struct vnode *)); extern void union_newsize __P((struct vnode *, off_t, off_t)); -extern int (*union_dircheckp) __P((struct proc *, struct vnode **, +extern int (*union_dircheckp) __P((struct thread *, struct vnode **, struct file *)); #define MOUNTTOUNIONMOUNT(mp) ((struct union_mount *)((mp)->mnt_data)) diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 52a5483..5919672 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -89,11 +89,11 @@ static void union_updatevp __P((struct union_node *un, static void union_newlower __P((struct union_node *, struct vnode *)); static void union_newupper __P((struct union_node *, struct vnode *)); static int union_copyfile __P((struct vnode *, struct vnode *, - struct ucred *, struct proc *)); + struct ucred *, struct thread *)); static int union_vn_create __P((struct vnode **, struct union_node *, - struct proc *)); + struct thread *)); static int union_vn_close __P((struct vnode *, int, struct ucred *, - struct proc *)); + struct thread *)); int union_init() @@ -351,7 +351,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache) int error; struct union_node *un = 0; struct union_mount *um = MOUNTTOUNIONMOUNT(mp); - struct proc *p = (cnp) ? cnp->cn_proc : curproc; + struct thread *td = (cnp) ? cnp->cn_thread : curthread; int hash = 0; int vflag; int try; @@ -410,7 +410,7 @@ loop: un->un_uppervp == NULLVP) && (UNIONTOV(un)->v_mount == mp)) { if (vget(UNIONTOV(un), 0, - cnp ? cnp->cn_proc : NULL)) { + cnp ? cnp->cn_thread : NULL)) { union_list_unlock(hash); goto loop; } @@ -450,21 +450,21 @@ loop: * while moving up the tree). */ VREF(dvp); - VOP_UNLOCK(dvp, 0, p); - error = vn_lock(un->un_vnode, LK_EXCLUSIVE, p); - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + VOP_UNLOCK(dvp, 0, td); + error = vn_lock(un->un_vnode, LK_EXCLUSIVE, td); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); vrele(dvp); } else { /* * our new un is under dvp */ - error = vn_lock(un->un_vnode, LK_EXCLUSIVE, p); + error = vn_lock(un->un_vnode, LK_EXCLUSIVE, td); } } else if (dvp == NULLVP) { /* * dvp is NULL, we need to lock un. */ - error = vn_lock(un->un_vnode, LK_EXCLUSIVE, p); + error = vn_lock(un->un_vnode, LK_EXCLUSIVE, td); } else { /* * dvp == un->un_vnode, we are already locked. @@ -573,7 +573,7 @@ loop: bzero(un, sizeof(*un)); lockinit(&un->un_lock, PVFS, "unlock", 0, 0); - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td); un->un_vnode = *vpp; un->un_uppervp = uppervp; @@ -656,11 +656,11 @@ union_freevp(vp) * haven't been bumped at all. */ static int -union_copyfile(fvp, tvp, cred, p) +union_copyfile(fvp, tvp, cred, td) struct vnode *fvp; struct vnode *tvp; struct ucred *cred; - struct proc *p; + struct thread *td; { char *buf; struct uio uio; @@ -677,12 +677,12 @@ union_copyfile(fvp, tvp, cred, p) bzero(&uio, sizeof(uio)); - uio.uio_procp = p; + uio.uio_td = td; uio.uio_segflg = UIO_SYSSPACE; uio.uio_offset = 0; - VOP_LEASE(fvp, p, cred, LEASE_READ); - VOP_LEASE(tvp, p, cred, LEASE_WRITE); + VOP_LEASE(fvp, td, cred, LEASE_READ); + VOP_LEASE(tvp, td, cred, LEASE_WRITE); buf = malloc(MAXBSIZE, M_TEMP, M_WAITOK); @@ -743,11 +743,11 @@ union_copyfile(fvp, tvp, cred, p) */ int -union_copyup(un, docopy, cred, p) +union_copyup(un, docopy, cred, td) struct union_node *un; int docopy; struct ucred *cred; - struct proc *p; + struct thread *td; { int error; struct mount *mp; @@ -757,15 +757,15 @@ union_copyup(un, docopy, cred, p) * If the user does not have read permission, the vnode should not * be copied to upper layer. */ - vn_lock(un->un_lowervp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_ACCESS(un->un_lowervp, VREAD, cred, p); - VOP_UNLOCK(un->un_lowervp, 0, p); + vn_lock(un->un_lowervp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_ACCESS(un->un_lowervp, VREAD, cred, td); + VOP_UNLOCK(un->un_lowervp, 0, td); if (error) return (error); if ((error = vn_start_write(un->un_dirvp, &mp, V_WAIT | PCATCH)) != 0) return (error); - if ((error = union_vn_create(&uvp, un, p)) != 0) { + if ((error = union_vn_create(&uvp, un, td)) != 0) { vn_finished_write(mp); return (error); } @@ -778,24 +778,24 @@ union_copyup(un, docopy, cred, p) * XX - should not ignore errors * from VOP_CLOSE */ - vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_OPEN(lvp, FREAD, cred, p); + vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, td); + error = VOP_OPEN(lvp, FREAD, cred, td); if (error == 0 && vn_canvmio(lvp) == TRUE) - error = vfs_object_create(lvp, p, cred); + error = vfs_object_create(lvp, td, cred); if (error == 0) { - error = union_copyfile(lvp, uvp, cred, p); - VOP_UNLOCK(lvp, 0, p); - (void) VOP_CLOSE(lvp, FREAD, cred, p); + error = union_copyfile(lvp, uvp, cred, td); + VOP_UNLOCK(lvp, 0, td); + (void) VOP_CLOSE(lvp, FREAD, cred, td); } if (error == 0) UDEBUG(("union: copied up %s\n", un->un_path)); } - VOP_UNLOCK(uvp, 0, p); + VOP_UNLOCK(uvp, 0, td); vn_finished_write(mp); union_newupper(un, uvp); KASSERT(uvp->v_usecount > 0, ("copy: uvp refcount 0: %d", uvp->v_usecount)); - union_vn_close(uvp, FWRITE, cred, p); + union_vn_close(uvp, FWRITE, cred, td); KASSERT(uvp->v_usecount > 0, ("copy: uvp refcount 0: %d", uvp->v_usecount)); /* * Subsequent IOs will go to the top layer, so @@ -809,12 +809,12 @@ union_copyup(un, docopy, cred, p) int i; for (i = 0; i < un->un_openl; i++) { - (void) VOP_CLOSE(lvp, FREAD, cred, p); - (void) VOP_OPEN(uvp, FREAD, cred, p); + (void) VOP_CLOSE(lvp, FREAD, cred, td); + (void) VOP_OPEN(uvp, FREAD, cred, td); } if (un->un_openl) { if (vn_canvmio(uvp) == TRUE) - error = vfs_object_create(uvp, p, cred); + error = vfs_object_create(uvp, td, cred); } un->un_openl = 0; } @@ -862,7 +862,7 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen) cn->cn_nameiop = CREATE; cn->cn_flags = (LOCKPARENT|LOCKLEAF|HASBUF|SAVENAME|ISLASTCN); - cn->cn_proc = cnp->cn_proc; + cn->cn_thread = cnp->cn_thread; if (um->um_op == UNMNT_ABOVE) cn->cn_cred = cnp->cn_cred; else @@ -871,7 +871,7 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen) cn->cn_consume = cnp->cn_consume; VREF(dvp); - VOP_UNLOCK(dvp, 0, cnp->cn_proc); + VOP_UNLOCK(dvp, 0, cnp->cn_thread); /* * Pass dvp unlocked and referenced on call to relookup(). @@ -880,7 +880,7 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen) */ if ((error = relookup(dvp, vpp, cn)) != 0) { - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, cnp->cn_proc); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, cnp->cn_thread); return(error); } @@ -916,7 +916,7 @@ union_mkshadow(um, dvp, cnp, vpp) { int error; struct vattr va; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct componentname cn; struct mount *mp; @@ -955,7 +955,7 @@ union_mkshadow(um, dvp, cnp, vpp) va.va_mode = um->um_cmode; /* VOP_LEASE: dvp is locked */ - VOP_LEASE(dvp, p, cn.cn_cred, LEASE_WRITE); + VOP_LEASE(dvp, td, cn.cn_cred, LEASE_WRITE); error = VOP_MKDIR(dvp, vpp, &cn, &va); if (cn.cn_flags & HASBUF) { @@ -984,7 +984,7 @@ union_mkwhiteout(um, dvp, cnp, path) char *path; { int error; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *wvp; struct componentname cn; struct mount *mp; @@ -1011,7 +1011,7 @@ union_mkwhiteout(um, dvp, cnp, path) } /* VOP_LEASE: dvp is locked */ - VOP_LEASE(dvp, p, p->p_ucred, LEASE_WRITE); + VOP_LEASE(dvp, td, td->td_proc->p_ucred, LEASE_WRITE); error = VOP_WHITEOUT(dvp, &cn, CREATE); if (cn.cn_flags & HASBUF) { @@ -1037,18 +1037,18 @@ union_mkwhiteout(um, dvp, cnp, path) * use. If an error occurs *vpp iis undefined. */ static int -union_vn_create(vpp, un, p) +union_vn_create(vpp, un, td) struct vnode **vpp; struct union_node *un; - struct proc *p; + struct thread *td; { struct vnode *vp; - struct ucred *cred = p->p_ucred; + struct ucred *cred = td->td_proc->p_ucred; struct vattr vat; struct vattr *vap = &vat; int fmode = FFLAGS(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL); int error; - int cmode = UN_FILEMODE & ~p->p_fd->fd_cmask; + int cmode = UN_FILEMODE & ~td->td_proc->p_fd->fd_cmask; struct componentname cn; *vpp = NULLVP; @@ -1067,8 +1067,8 @@ union_vn_create(vpp, un, p) bcopy(un->un_path, cn.cn_pnbuf, cn.cn_namelen+1); cn.cn_nameiop = CREATE; cn.cn_flags = (LOCKPARENT|LOCKLEAF|HASBUF|SAVENAME|ISLASTCN); - cn.cn_proc = p; - cn.cn_cred = p->p_ucred; + cn.cn_thread = td; + cn.cn_cred = td->td_proc->p_ucred; cn.cn_nameptr = cn.cn_pnbuf; cn.cn_consume = 0; @@ -1112,7 +1112,7 @@ union_vn_create(vpp, un, p) VATTR_NULL(vap); vap->va_type = VREG; vap->va_mode = cmode; - VOP_LEASE(un->un_dirvp, p, cred, LEASE_WRITE); + VOP_LEASE(un->un_dirvp, td, cred, LEASE_WRITE); error = VOP_CREATE(un->un_dirvp, &vp, &cn, vap); if (cn.cn_flags & HASBUF) { zfree(namei_zone, cn.cn_pnbuf); @@ -1122,9 +1122,9 @@ union_vn_create(vpp, un, p) if (error) return (error); - error = VOP_OPEN(vp, fmode, cred, p); + error = VOP_OPEN(vp, fmode, cred, td); if (error == 0 && vn_canvmio(vp) == TRUE) - error = vfs_object_create(vp, p, cred); + error = vfs_object_create(vp, td, cred); if (error) { vput(vp); return (error); @@ -1135,16 +1135,16 @@ union_vn_create(vpp, un, p) } static int -union_vn_close(vp, fmode, cred, p) +union_vn_close(vp, fmode, cred, td) struct vnode *vp; int fmode; struct ucred *cred; - struct proc *p; + struct thread *td; { if (fmode & FWRITE) --vp->v_writecount; - return (VOP_CLOSE(vp, fmode, cred, p)); + return (VOP_CLOSE(vp, fmode, cred, td)); } #if 0 @@ -1159,7 +1159,7 @@ void union_removed_upper(un) struct union_node *un; { - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct vnode **vpp; /* @@ -1188,17 +1188,17 @@ union_removed_upper(un) * during a remove/rmdir operation. */ int -union_dowhiteout(un, cred, p) +union_dowhiteout(un, cred, td) struct union_node *un; struct ucred *cred; - struct proc *p; + struct thread *td; { struct vattr va; if (un->un_lowervp != NULLVP) return (1); - if (VOP_GETATTR(un->un_uppervp, &va, cred, p) == 0 && + if (VOP_GETATTR(un->un_uppervp, &va, cred, td) == 0 && (va.va_flags & OPAQUE)) return (1); @@ -1234,9 +1234,9 @@ union_dircache_r(vp, vppp, cntp) } struct vnode * -union_dircache(vp, p) +union_dircache(vp, td) struct vnode *vp; - struct proc *p; + struct thread *td; { int cnt; struct vnode *nvp; @@ -1245,7 +1245,7 @@ union_dircache(vp, p) struct union_node *un; int error; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); dircache = VTOUNION(vp)->un_dircache; nvp = NULLVP; @@ -1271,7 +1271,7 @@ union_dircache(vp, p) if (*vpp == NULLVP) goto out; - /*vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, p);*/ + /*vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);*/ UDEBUG(("ALLOCVP-3 %p ref %d\n", *vpp, (*vpp ? (*vpp)->v_usecount : -99))); VREF(*vpp); error = union_allocvp(&nvp, vp->v_mount, NULLVP, NULLVP, NULL, *vpp, NULLVP, 0); @@ -1284,7 +1284,7 @@ union_dircache(vp, p) un->un_dircache = dircache; out: - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); return (nvp); } @@ -1292,14 +1292,14 @@ out: * Module glue to remove #ifdef UNION from vfs_syscalls.c */ static int -union_dircheck(struct proc *p, struct vnode **vp, struct file *fp) +union_dircheck(struct thread *td, struct vnode **vp, struct file *fp) { int error = 0; if ((*vp)->v_op == union_vnodeop_p) { struct vnode *lvp; - lvp = union_dircache(*vp, p); + lvp = union_dircache(*vp, td); if (lvp != NULLVP) { struct vattr va; @@ -1307,7 +1307,7 @@ union_dircheck(struct proc *p, struct vnode **vp, struct file *fp) * If the directory is opaque, * then don't show lower entries */ - error = VOP_GETATTR(*vp, &va, fp->f_cred, p); + error = VOP_GETATTR(*vp, &va, fp->f_cred, td); if (va.va_flags & OPAQUE) { vput(lvp); lvp = NULL; @@ -1315,17 +1315,17 @@ union_dircheck(struct proc *p, struct vnode **vp, struct file *fp) } if (lvp != NULLVP) { - error = VOP_OPEN(lvp, FREAD, fp->f_cred, p); + error = VOP_OPEN(lvp, FREAD, fp->f_cred, td); if (error == 0 && vn_canvmio(lvp) == TRUE) - error = vfs_object_create(lvp, p, fp->f_cred); + error = vfs_object_create(lvp, td, fp->f_cred); if (error) { vput(lvp); return (error); } - VOP_UNLOCK(lvp, 0, p); + VOP_UNLOCK(lvp, 0, td); fp->f_data = (caddr_t) lvp; fp->f_offset = 0; - error = vn_close(*vp, FREAD, fp->f_cred, p); + error = vn_close(*vp, FREAD, fp->f_cred, td); if (error) return (error); *vp = lvp; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index aa4986c..7f616cb 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -59,23 +59,23 @@ static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure"); extern int union_init __P((struct vfsconf *)); static int union_mount __P((struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct proc *p)); + struct nameidata *ndp, struct thread *td)); static int union_root __P((struct mount *mp, struct vnode **vpp)); static int union_statfs __P((struct mount *mp, struct statfs *sbp, - struct proc *p)); + struct thread *td)); static int union_unmount __P((struct mount *mp, int mntflags, - struct proc *p)); + struct thread *td)); /* * Mount union filesystem */ static int -union_mount(mp, path, data, ndp, p) +union_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 = 0; struct union_args args; @@ -127,7 +127,7 @@ union_mount(mp, path, data, ndp, p) * Unlock lower node to avoid deadlock. */ if (lowerrootvp->v_op == union_vnodeop_p) - VOP_UNLOCK(lowerrootvp, 0, p); + VOP_UNLOCK(lowerrootvp, 0, td); #endif /* @@ -135,13 +135,13 @@ union_mount(mp, path, data, ndp, p) * upperrootvp will be turned referenced but not locked. */ NDINIT(ndp, LOOKUP, FOLLOW|WANTPARENT, - UIO_USERSPACE, args.target, p); + UIO_USERSPACE, args.target, td); error = namei(ndp); #if 0 if (lowerrootvp->v_op == union_vnodeop_p) - vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY, td); #endif if (error) goto bad; @@ -223,9 +223,9 @@ union_mount(mp, path, data, ndp, p) goto bad; } - um->um_cred = p->p_ucred; + um->um_cred = td->td_proc->p_ucred; crhold(um->um_cred); - um->um_cmode = UN_DIRMODE &~ p->p_fd->fd_cmask; + um->um_cmode = UN_DIRMODE &~ td->td_proc->p_fd->fd_cmask; /* * Depending on what you think the MNT_LOCAL flag might mean, @@ -275,7 +275,7 @@ union_mount(mp, path, data, ndp, p) (void) copyinstr(args.target, cp, len - 1, &size); bzero(cp + size, len - size); - (void)union_statfs(mp, &mp->mnt_stat, p); + (void)union_statfs(mp, &mp->mnt_stat, td); UDEBUG(("union_mount: from %s, on %s\n", mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname)); @@ -303,10 +303,10 @@ bad: * Free reference to union layer */ static int -union_unmount(mp, mntflags, p) +union_unmount(mp, mntflags, td) struct mount *mp; int mntflags; - struct proc *p; + struct thread *td; { struct union_mount *um = MOUNTTOUNIONMOUNT(mp); int error; @@ -396,10 +396,10 @@ union_root(mp, vpp) } static int -union_statfs(mp, sbp, p) +union_statfs(mp, sbp, td) struct mount *mp; struct statfs *sbp; - struct proc *p; + struct thread *td; { int error; struct union_mount *um = MOUNTTOUNIONMOUNT(mp); @@ -412,7 +412,7 @@ union_statfs(mp, sbp, p) bzero(&mstat, sizeof(mstat)); if (um->um_lowervp) { - error = VFS_STATFS(um->um_lowervp->v_mount, &mstat, p); + error = VFS_STATFS(um->um_lowervp->v_mount, &mstat, td); if (error) return (error); } @@ -431,7 +431,7 @@ union_statfs(mp, sbp, p) sbp->f_files = mstat.f_files; sbp->f_ffree = mstat.f_ffree; - error = VFS_STATFS(um->um_uppervp->v_mount, &mstat, p); + error = VFS_STATFS(um->um_uppervp->v_mount, &mstat, td); if (error) return (error); diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index b5abfa7..aca606b 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -109,13 +109,13 @@ static int union_write __P((struct vop_read_args *ap)); static __inline struct vnode * -union_lock_upper(struct union_node *un, struct proc *p) +union_lock_upper(struct union_node *un, struct thread *td) { struct vnode *uppervp; if ((uppervp = un->un_uppervp) != NULL) { VREF(uppervp); - vn_lock(uppervp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, p); + vn_lock(uppervp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, td); } KASSERT((uppervp == NULL || uppervp->v_usecount > 0), ("uppervp usecount is 0")); return(uppervp); @@ -123,29 +123,29 @@ union_lock_upper(struct union_node *un, struct proc *p) static __inline void -union_unlock_upper(struct vnode *uppervp, struct proc *p) +union_unlock_upper(struct vnode *uppervp, struct thread *td) { vput(uppervp); } static __inline struct vnode * -union_lock_other(struct union_node *un, struct proc *p) +union_lock_other(struct union_node *un, struct thread *td) { struct vnode *vp; if (un->un_uppervp != NULL) { - vp = union_lock_upper(un, p); + vp = union_lock_upper(un, td); } else if ((vp = un->un_lowervp) != NULL) { VREF(vp); - vn_lock(vp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, td); } return(vp); } static __inline void -union_unlock_other(struct vnode *vp, struct proc *p) +union_unlock_other(struct vnode *vp, struct thread *td) { vput(vp); } @@ -178,7 +178,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) struct componentname *cnp; { int error; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *dvp = *pdvp; struct vnode *tdvp; struct mount *mp; @@ -201,7 +201,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) dvp = dvp->v_mount->mnt_vnodecovered; VREF(dvp); vput(tdvp); - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); } } @@ -232,7 +232,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) UDEBUG(("parentdir %p result %p flag %lx\n", dvp, tdvp, cnp->cn_flags)); if (dvp != tdvp && (cnp->cn_flags & ISLASTCN) == 0) - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); /* * Lastly check if the current node is a mount point in @@ -252,7 +252,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) ) { int relock_pdvp = 0; - if (vfs_busy(mp, 0, 0, p)) + if (vfs_busy(mp, 0, 0, td)) continue; if (dvp == *pdvp) @@ -261,10 +261,10 @@ union_lookup1(udvp, pdvp, vpp, cnp) dvp = NULL; error = VFS_ROOT(mp, &dvp); - vfs_unbusy(mp, p); + vfs_unbusy(mp, td); if (relock_pdvp) - vn_lock(*pdvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(*pdvp, LK_EXCLUSIVE | LK_RETRY, td); if (error) { *vpp = NULL; @@ -291,7 +291,7 @@ union_lookup(ap) struct vnode *dvp = ap->a_dvp; /* starting dir */ struct union_node *dun = VTOUNION(dvp); /* associated union node */ struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; int lockparent = cnp->cn_flags & LOCKPARENT; struct union_mount *um = MOUNTTOUNIONMOUNT(dvp->v_mount); struct ucred *saved_cred = NULL; @@ -329,7 +329,7 @@ union_lookup(ap) * We must lock upperdvp while holding our lock on dvp * to avoid a deadlock. */ - upperdvp = union_lock_upper(dun, p); + upperdvp = union_lock_upper(dun, td); /* * do the lookup in the upper level. @@ -403,7 +403,7 @@ union_lookup(ap) int terror; terror = VOP_GETATTR(upperdvp, &va, - cnp->cn_cred, cnp->cn_proc); + cnp->cn_cred, cnp->cn_thread); if (terror == 0 && (va.va_flags & OPAQUE)) iswhiteout = 1; } @@ -446,7 +446,7 @@ union_lookup(ap) * to us so we NULL it out. */ VREF(lowerdvp); - vn_lock(lowerdvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(lowerdvp, LK_EXCLUSIVE | LK_RETRY, td); lerror = union_lookup1(um->um_lowervp, &lowerdvp, &lowervp, cnp); if (lowerdvp == lowervp) vrele(lowerdvp); @@ -470,7 +470,7 @@ union_lookup(ap) if ((cnp->cn_flags & ISDOTDOT) && dun->un_pvp != NULLVP) { if ((lowervp = LOWERVP(dun->un_pvp)) != NULL) { VREF(lowervp); - vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY, td); lerror = 0; } } @@ -533,11 +533,11 @@ union_lookup(ap) */ if (uppervp && uppervp != upperdvp) - VOP_UNLOCK(uppervp, 0, p); + VOP_UNLOCK(uppervp, 0, td); if (lowervp) - VOP_UNLOCK(lowervp, 0, p); + VOP_UNLOCK(lowervp, 0, td); if (upperdvp) - VOP_UNLOCK(upperdvp, 0, p); + VOP_UNLOCK(upperdvp, 0, td); error = union_allocvp(ap->a_vpp, dvp->v_mount, dvp, upperdvp, cnp, uppervp, lowervp, 1); @@ -600,7 +600,7 @@ out: if (*ap->a_vpp != dvp) { if ((error == 0 || error == EJUSTRETURN) && (!lockparent || (cnp->cn_flags & ISLASTCN) == 0)) { - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); } } @@ -637,24 +637,24 @@ union_create(ap) { struct union_node *dun = VTOUNION(ap->a_dvp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *dvp; int error = EROFS; - if ((dvp = union_lock_upper(dun, p)) != NULL) { + if ((dvp = union_lock_upper(dun, td)) != NULL) { struct vnode *vp; struct mount *mp; error = VOP_CREATE(dvp, &vp, cnp, ap->a_vap); if (error == 0) { mp = ap->a_dvp->v_mount; - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); UDEBUG(("ALLOCVP-1 FROM %p REFS %d\n", vp, vp->v_usecount)); error = union_allocvp(ap->a_vpp, mp, NULLVP, NULLVP, cnp, vp, NULLVP, 1); UDEBUG(("ALLOCVP-2B FROM %p REFS %d\n", *ap->a_vpp, vp->v_usecount)); } - union_unlock_upper(dvp, p); + union_unlock_upper(dvp, td); } return (error); } @@ -672,9 +672,9 @@ union_whiteout(ap) struct vnode *uppervp; int error = EOPNOTSUPP; - if ((uppervp = union_lock_upper(un, cnp->cn_proc)) != NULLVP) { + if ((uppervp = union_lock_upper(un, cnp->cn_thread)) != NULLVP) { error = VOP_WHITEOUT(un->un_uppervp, cnp, ap->a_flags); - union_unlock_upper(uppervp, cnp->cn_proc); + union_unlock_upper(uppervp, cnp->cn_thread); } return(error); } @@ -700,9 +700,9 @@ union_mknod(ap) struct vnode *dvp; int error = EROFS; - if ((dvp = union_lock_upper(dun, cnp->cn_proc)) != NULL) { + if ((dvp = union_lock_upper(dun, cnp->cn_thread)) != NULL) { error = VOP_MKNOD(dvp, ap->a_vpp, cnp, ap->a_vap); - union_unlock_upper(dvp, cnp->cn_proc); + union_unlock_upper(dvp, cnp->cn_thread); } return (error); } @@ -723,14 +723,14 @@ union_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); struct vnode *tvp; int mode = ap->a_mode; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; int error = 0; int tvpisupper = 1; @@ -742,7 +742,7 @@ union_open(ap) * * At the end of this section tvp will be left locked. */ - if ((tvp = union_lock_upper(un, p)) == NULLVP) { + if ((tvp = union_lock_upper(un, td)) == NULLVP) { /* * If the lower vnode is being opened for writing, then * copy the file contents to the upper vnode and open that, @@ -751,12 +751,12 @@ union_open(ap) tvp = un->un_lowervp; if ((ap->a_mode & FWRITE) && (tvp->v_type == VREG)) { int docopy = !(mode & O_TRUNC); - error = union_copyup(un, docopy, cred, p); - tvp = union_lock_upper(un, p); + error = union_copyup(un, docopy, cred, td); + tvp = union_lock_upper(un, td); } else { un->un_openl++; VREF(tvp); - vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, td); tvpisupper = 0; } } @@ -766,13 +766,13 @@ union_open(ap) */ if (error == 0) - error = VOP_OPEN(tvp, mode, cred, p); + error = VOP_OPEN(tvp, mode, cred, td); /* * Absolutely necessary or UFS will blowup */ if (error == 0 && vn_canvmio(tvp) == TRUE) { - error = vfs_object_create(tvp, p, cred); + error = vfs_object_create(tvp, td, cred); } /* @@ -780,7 +780,7 @@ union_open(ap) */ if (tvpisupper) { if (tvp) - union_unlock_upper(tvp, p); + union_unlock_upper(tvp, td); } else { vput(tvp); } @@ -800,7 +800,7 @@ union_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); @@ -833,11 +833,11 @@ union_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; int error = EACCES; struct vnode *vp; @@ -856,15 +856,15 @@ union_access(ap) } } - if ((vp = union_lock_upper(un, p)) != NULLVP) { + if ((vp = union_lock_upper(un, td)) != NULLVP) { ap->a_vp = vp; error = VCALL(vp, VOFFSET(vop_access), ap); - union_unlock_upper(vp, p); + union_unlock_upper(vp, td); return(error); } if ((vp = un->un_lowervp) != NULLVP) { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); ap->a_vp = vp; /* @@ -885,7 +885,7 @@ union_access(ap) error = VCALL(vp, VOFFSET(vop_access), ap); } } - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); } return(error); } @@ -912,7 +912,7 @@ union_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { int error; @@ -933,7 +933,7 @@ union_getattr(ap) vap = ap->a_vap; if ((vp = un->un_uppervp) != NULLVP) { - error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p); + error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td); if (error) return (error); /* XXX isn't this dangerouso without a lock? */ @@ -950,7 +950,7 @@ union_getattr(ap) } if (vp != NULLVP) { - error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p); + error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td); if (error) return (error); /* XXX isn't this dangerous without a lock? */ @@ -968,11 +968,11 @@ union_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct vattr *vap = ap->a_vap; struct vnode *uppervp; int error; @@ -995,7 +995,7 @@ union_setattr(ap) */ if (un->un_uppervp == NULLVP && (un->un_lowervp->v_type == VREG)) { error = union_copyup(un, (ap->a_vap->va_size != 0), - ap->a_cred, ap->a_p); + ap->a_cred, ap->a_td); if (error) return (error); } @@ -1005,12 +1005,12 @@ union_setattr(ap) * otherwise return read-only filesystem error. */ error = EROFS; - if ((uppervp = union_lock_upper(un, p)) != NULLVP) { + if ((uppervp = union_lock_upper(un, td)) != NULLVP) { error = VOP_SETATTR(un->un_uppervp, ap->a_vap, - ap->a_cred, ap->a_p); + ap->a_cred, ap->a_td); if ((error == 0) && (ap->a_vap->va_size != VNOVAL)) union_newsize(ap->a_vp, ap->a_vap->va_size, VNOVAL); - union_unlock_upper(uppervp, p); + union_unlock_upper(uppervp, td); } return (error); } @@ -1025,15 +1025,15 @@ union_read(ap) } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; struct vnode *uvp; int error; - uvp = union_lock_other(un, p); + uvp = union_lock_other(un, td); KASSERT(uvp != NULL, ("union_read: backing vnode missing!")); error = VOP_READ(uvp, ap->a_uio, ap->a_ioflag, ap->a_cred); - union_unlock_other(uvp, p); + union_unlock_other(uvp, td); /* * XXX @@ -1066,11 +1066,11 @@ union_write(ap) } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; struct vnode *uppervp; int error; - if ((uppervp = union_lock_upper(un, p)) == NULLVP) + if ((uppervp = union_lock_upper(un, td)) == NULLVP) panic("union: missing upper layer in write"); error = VOP_WRITE(uppervp, ap->a_uio, ap->a_ioflag, ap->a_cred); @@ -1085,7 +1085,7 @@ union_write(ap) if (cur > un->un_uppersz) union_newsize(ap->a_vp, cur, VNOVAL); } - union_unlock_upper(uppervp, p); + union_unlock_upper(uppervp, td); return (error); } @@ -1093,7 +1093,7 @@ static int union_lease(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; @@ -1112,7 +1112,7 @@ union_ioctl(ap) caddr_t a_data; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *ovp = OTHERVP(ap->a_vp); @@ -1127,7 +1127,7 @@ union_poll(ap) struct vnode *a_vp; int a_events; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *ovp = OTHERVP(ap->a_vp); @@ -1141,7 +1141,7 @@ union_revoke(ap) struct vop_revoke_args /* { struct vnode *a_vp; int a_flags; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -1160,17 +1160,17 @@ union_fsync(ap) struct vnode *a_vp; struct ucred *a_cred; int a_waitfor; - struct proc *a_p; + struct thread *a_td; } */ *ap; { int error = 0; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct vnode *targetvp; struct union_node *un = VTOUNION(ap->a_vp); - if ((targetvp = union_lock_other(un, p)) != NULLVP) { - error = VOP_FSYNC(targetvp, ap->a_cred, ap->a_waitfor, p); - union_unlock_other(targetvp, p); + if ((targetvp = union_lock_other(un, td)) != NULLVP) { + error = VOP_FSYNC(targetvp, ap->a_cred, ap->a_waitfor, td); + union_unlock_other(targetvp, td); } return (error); @@ -1194,16 +1194,16 @@ union_remove(ap) struct union_node *dun = VTOUNION(ap->a_dvp); struct union_node *un = VTOUNION(ap->a_vp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *uppervp; struct vnode *upperdvp; int error; - if ((upperdvp = union_lock_upper(dun, p)) == NULLVP) + if ((upperdvp = union_lock_upper(dun, td)) == NULLVP) panic("union remove: null upper vnode"); - if ((uppervp = union_lock_upper(un, p)) != NULLVP) { - if (union_dowhiteout(un, cnp->cn_cred, p)) + if ((uppervp = union_lock_upper(un, td)) != NULLVP) { + if (union_dowhiteout(un, cnp->cn_cred, td)) cnp->cn_flags |= DOWHITEOUT; error = VOP_REMOVE(upperdvp, uppervp, cnp); #if 0 @@ -1211,13 +1211,13 @@ union_remove(ap) if (!error) union_removed_upper(un); #endif - union_unlock_upper(uppervp, p); + union_unlock_upper(uppervp, td); } else { error = union_mkwhiteout( MOUNTTOUNIONMOUNT(ap->a_dvp->v_mount), upperdvp, ap->a_cnp, un->un_path); } - union_unlock_upper(upperdvp, p); + union_unlock_upper(upperdvp, td); return (error); } @@ -1238,7 +1238,7 @@ union_link(ap) } */ *ap; { struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct union_node *dun = VTOUNION(ap->a_tdvp); struct vnode *vp; struct vnode *tdvp; @@ -1250,24 +1250,24 @@ union_link(ap) struct union_node *tun = VTOUNION(ap->a_vp); if (tun->un_uppervp == NULLVP) { - vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td); #if 0 if (dun->un_uppervp == tun->un_dirvp) { if (dun->un_flags & UN_ULOCK) { dun->un_flags &= ~UN_ULOCK; - VOP_UNLOCK(dun->un_uppervp, 0, p); + VOP_UNLOCK(dun->un_uppervp, 0, td); } } #endif - error = union_copyup(tun, 1, cnp->cn_cred, p); + error = union_copyup(tun, 1, cnp->cn_cred, td); #if 0 if (dun->un_uppervp == tun->un_dirvp) { vn_lock(dun->un_uppervp, - LK_EXCLUSIVE | LK_RETRY, p); + LK_EXCLUSIVE | LK_RETRY, td); dun->un_flags |= UN_ULOCK; } #endif - VOP_UNLOCK(ap->a_vp, 0, p); + VOP_UNLOCK(ap->a_vp, 0, td); } vp = tun->un_uppervp; } @@ -1282,18 +1282,18 @@ union_link(ap) * is expected to be locked on return. */ - if ((tdvp = union_lock_upper(dun, p)) == NULLVP) + if ((tdvp = union_lock_upper(dun, td)) == NULLVP) return (EROFS); - VOP_UNLOCK(ap->a_tdvp, 0, p); /* unlock calling node */ + VOP_UNLOCK(ap->a_tdvp, 0, td); /* unlock calling node */ error = VOP_LINK(tdvp, vp, cnp); /* call link on upper */ /* * We have to unlock tdvp prior to relocking our calling node in * order to avoid a deadlock. */ - union_unlock_upper(tdvp, p); - vn_lock(ap->a_tdvp, LK_EXCLUSIVE | LK_RETRY, p); + union_unlock_upper(tdvp, td); + vn_lock(ap->a_tdvp, LK_EXCLUSIVE | LK_RETRY, td); return (error); } @@ -1350,9 +1350,9 @@ union_rename(ap) if (un->un_uppervp == NULLVP) { switch(fvp->v_type) { case VREG: - vn_lock(un->un_vnode, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_proc); - error = union_copyup(un, 1, ap->a_fcnp->cn_cred, ap->a_fcnp->cn_proc); - VOP_UNLOCK(un->un_vnode, 0, ap->a_fcnp->cn_proc); + vn_lock(un->un_vnode, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_thread); + error = union_copyup(un, 1, ap->a_fcnp->cn_cred, ap->a_fcnp->cn_thread); + VOP_UNLOCK(un->un_vnode, 0, ap->a_fcnp->cn_thread); if (error) goto bad; break; @@ -1368,12 +1368,12 @@ union_rename(ap) #if 0 vrele(fvp); fvp = NULL; - vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_proc); + vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_thread); error = union_mkshadow(um, fdvp, ap->a_fcnp, &un->un_uppervp); - VOP_UNLOCK(fdvp, 0, ap->a_fcnp->cn_proc); + VOP_UNLOCK(fdvp, 0, ap->a_fcnp->cn_thread); if (un->un_uppervp) - VOP_UNLOCK(un->un_uppervp, 0, ap->a_fcnp->cn_proc); + VOP_UNLOCK(un->un_uppervp, 0, ap->a_fcnp->cn_thread); if (error) goto bad; break; @@ -1417,7 +1417,7 @@ union_rename(ap) * new tdvp is a lock and reference on uppervp, put away * the old tdvp. */ - tdvp = union_lock_upper(un, ap->a_tcnp->cn_proc); + tdvp = union_lock_upper(un, ap->a_tcnp->cn_thread); vput(ap->a_tdvp); } @@ -1432,7 +1432,7 @@ union_rename(ap) if (tvp != NULLVP && tvp->v_op == union_vnodeop_p) { struct union_node *un = VTOUNION(tvp); - tvp = union_lock_upper(un, ap->a_tcnp->cn_proc); + tvp = union_lock_upper(un, ap->a_tcnp->cn_thread); vput(ap->a_tvp); /* note: tvp may be NULL */ } @@ -1473,18 +1473,18 @@ union_mkdir(ap) { struct union_node *dun = VTOUNION(ap->a_dvp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *upperdvp; int error = EROFS; - if ((upperdvp = union_lock_upper(dun, p)) != NULLVP) { + if ((upperdvp = union_lock_upper(dun, td)) != NULLVP) { struct vnode *vp; error = VOP_MKDIR(upperdvp, &vp, cnp, ap->a_vap); - union_unlock_upper(upperdvp, p); + union_unlock_upper(upperdvp, td); if (error == 0) { - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); UDEBUG(("ALLOCVP-2 FROM %p REFS %d\n", vp, vp->v_usecount)); error = union_allocvp(ap->a_vpp, ap->a_dvp->v_mount, ap->a_dvp, NULLVP, cnp, vp, NULLVP, 1); @@ -1505,25 +1505,25 @@ union_rmdir(ap) struct union_node *dun = VTOUNION(ap->a_dvp); struct union_node *un = VTOUNION(ap->a_vp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *upperdvp; struct vnode *uppervp; int error; - if ((upperdvp = union_lock_upper(dun, p)) == NULLVP) + if ((upperdvp = union_lock_upper(dun, td)) == NULLVP) panic("union rmdir: null upper vnode"); - if ((uppervp = union_lock_upper(un, p)) != NULLVP) { - if (union_dowhiteout(un, cnp->cn_cred, p)) + if ((uppervp = union_lock_upper(un, td)) != NULLVP) { + if (union_dowhiteout(un, cnp->cn_cred, td)) cnp->cn_flags |= DOWHITEOUT; error = VOP_RMDIR(upperdvp, uppervp, ap->a_cnp); - union_unlock_upper(uppervp, p); + union_unlock_upper(uppervp, td); } else { error = union_mkwhiteout( MOUNTTOUNIONMOUNT(ap->a_dvp->v_mount), dun->un_uppervp, ap->a_cnp, un->un_path); } - union_unlock_upper(upperdvp, p); + union_unlock_upper(upperdvp, td); return (error); } @@ -1546,14 +1546,14 @@ union_symlink(ap) { struct union_node *dun = VTOUNION(ap->a_dvp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *dvp; int error = EROFS; - if ((dvp = union_lock_upper(dun, p)) != NULLVP) { + if ((dvp = union_lock_upper(dun, td)) != NULLVP) { error = VOP_SYMLINK(dvp, ap->a_vpp, cnp, ap->a_vap, ap->a_target); - union_unlock_upper(dvp, p); + union_unlock_upper(dvp, td); } return (error); } @@ -1577,14 +1577,14 @@ union_readdir(ap) } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; struct vnode *uvp; int error = 0; - if ((uvp = union_lock_upper(un, p)) != NULLVP) { + if ((uvp = union_lock_upper(un, td)) != NULLVP) { ap->a_vp = uvp; error = VCALL(uvp, VOFFSET(vop_readdir), ap); - union_unlock_upper(uvp, p); + union_unlock_upper(uvp, td); } return(error); } @@ -1600,15 +1600,15 @@ union_readlink(ap) int error; struct union_node *un = VTOUNION(ap->a_vp); struct uio *uio = ap->a_uio; - struct proc *p = uio->uio_procp; + struct thread *td = uio->uio_td; struct vnode *vp; - vp = union_lock_other(un, p); + vp = union_lock_other(un, td); KASSERT(vp != NULL, ("union_readlink: backing vnode missing!")); ap->a_vp = vp; error = VCALL(vp, VOFFSET(vop_readlink), ap); - union_unlock_other(vp, p); + union_unlock_other(vp, td); return (error); } @@ -1645,11 +1645,11 @@ static int union_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct union_node *un = VTOUNION(vp); struct vnode **vpp; @@ -1676,11 +1676,11 @@ union_inactive(ap) #if 0 if ((un->un_flags & UN_ULOCK) && un->un_uppervp) { un->un_flags &= ~UN_ULOCK; - VOP_UNLOCK(un->un_uppervp, 0, p); + VOP_UNLOCK(un->un_uppervp, 0, td); } #endif - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); if ((un->un_flags & UN_CACHED) == 0) vgone(vp); @@ -1705,7 +1705,7 @@ union_lock(ap) { #if 0 struct vnode *vp = ap->a_vp; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; int flags = ap->a_flags; struct union_node *un; #endif @@ -1723,12 +1723,12 @@ union_lock(ap) if (un->un_uppervp != NULLVP && (flags & LK_TYPE_MASK) == LK_EXCLUSIVE) { if ((un->un_flags & UN_ULOCK) == 0 && vp->v_usecount) { - error = vn_lock(un->un_uppervp, flags, p); + error = vn_lock(un->un_uppervp, flags, td); if (error) { struct vop_unlock_args uap = { 0 }; uap.a_vp = ap->a_vp; uap.a_flags = ap->a_flags; - uap.a_p = ap->a_p; + uap.a_td = ap->a_td; vop_stdunlock(&uap); return (error); } @@ -1750,7 +1750,7 @@ union_unlock(ap) struct vop_unlock_args /* { struct vnode *a_vp; int a_flags; - struct proc *a_p; + struct thread *a_td; } */ *ap; { #if 0 @@ -1773,7 +1773,7 @@ union_unlock(ap) if ((un->un_flags & UN_ULOCK) && lockstatus(&un->un_lock, NULL) != LK_EXCLUSIVE) { un->un_flags &= ~UN_ULOCK; - VOP_UNLOCK(un->un_uppervp, LK_EXCLUSIVE, p); + VOP_UNLOCK(un->un_uppervp, LK_EXCLUSIVE, td); } #endif return(error); @@ -1788,7 +1788,7 @@ union_createvobject(ap) struct vop_createvobject_args /* { struct vnode *vp; struct ucred *cred; - struct proc *p; + struct thread *td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -1856,16 +1856,16 @@ union_pathconf(ap) } */ *ap; { int error; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct union_node *un = VTOUNION(ap->a_vp); struct vnode *vp; - vp = union_lock_other(un, p); + vp = union_lock_other(un, td); KASSERT(vp != NULL, ("union_pathconf: backing vnode missing!")); ap->a_vp = vp; error = VCALL(vp, VOFFSET(vop_pathconf), ap); - union_unlock_other(vp, p); + union_unlock_other(vp, td); return (error); } |