summaryrefslogtreecommitdiffstats
path: root/sys/fs/unionfs
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
committerjulian <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
commit5596676e6c6c1e81e899cd0531f9b1c28a292669 (patch)
treeb1a19fcdf05759281fab0d89efb13f0fdf42102e /sys/fs/unionfs
parent83e00d4274950d2b531c24692cd123538ffbddb9 (diff)
downloadFreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.zip
FreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.tar.gz
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
Diffstat (limited to 'sys/fs/unionfs')
-rw-r--r--sys/fs/unionfs/union.h10
-rw-r--r--sys/fs/unionfs/union_subr.c136
-rw-r--r--sys/fs/unionfs/union_vfsops.c34
-rw-r--r--sys/fs/unionfs/union_vnops.c252
4 files changed, 216 insertions, 216 deletions
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);
}
OpenPOWER on IntegriCloud