summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_balloc.c6
-rw-r--r--sys/ufs/ffs/ffs_extern.h20
-rw-r--r--sys/ufs/ffs/ffs_inode.c10
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c106
-rw-r--r--sys/ufs/ffs/ffs_softdep.c194
-rw-r--r--sys/ufs/ffs/ffs_softdep_stub.c10
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c144
-rw-r--r--sys/ufs/ffs/ffs_vnops.c6
-rw-r--r--sys/ufs/ifs/ifs_extern.h1
-rw-r--r--sys/ufs/ifs/ifs_lookup.c12
-rw-r--r--sys/ufs/ifs/ifs_vfsops.c8
-rw-r--r--sys/ufs/ufs/extattr.h10
-rw-r--r--sys/ufs/ufs/quota.h8
-rw-r--r--sys/ufs/ufs/ufs_acl.c18
-rw-r--r--sys/ufs/ufs/ufs_extattr.c206
-rw-r--r--sys/ufs/ufs/ufs_extern.h4
-rw-r--r--sys/ufs/ufs/ufs_ihash.c9
-rw-r--r--sys/ufs/ufs/ufs_inode.c14
-rw-r--r--sys/ufs/ufs/ufs_lookup.c56
-rw-r--r--sys/ufs/ufs/ufs_quota.c50
-rw-r--r--sys/ufs/ufs/ufs_readwrite.c16
-rw-r--r--sys/ufs/ufs/ufs_vfsops.c22
-rw-r--r--sys/ufs/ufs/ufs_vnops.c92
-rw-r--r--sys/ufs/ufs/ufsmount.h2
24 files changed, 513 insertions, 511 deletions
diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c
index cf57bc7..26747fc 100644
--- a/sys/ufs/ffs/ffs_balloc.c
+++ b/sys/ufs/ffs/ffs_balloc.c
@@ -72,7 +72,7 @@ ffs_balloc(struct vnode *a_vp, off_t a_startoffset, int a_size,
int deallocated, osize, nsize, num, i, error;
ufs_daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1];
int unwindidx = -1;
- struct proc *p = curproc; /* XXX */
+ struct thread *td = curthread; /* XXX */
vp = a_vp;
ip = VTOI(vp);
@@ -350,7 +350,7 @@ fail:
* occurence. The error return from fsync is ignored as we already
* have an error to return to the user.
*/
- (void) VOP_FSYNC(vp, cred, MNT_WAIT, p);
+ (void) VOP_FSYNC(vp, cred, MNT_WAIT, td);
for (deallocated = 0, blkp = allociblk; blkp < allocblk; blkp++) {
ffs_blkfree(ip, *blkp, fs->fs_bsize);
deallocated += fs->fs_bsize;
@@ -387,6 +387,6 @@ fail:
ip->i_blocks -= btodb(deallocated);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
}
- (void) VOP_FSYNC(vp, cred, MNT_WAIT, p);
+ (void) VOP_FSYNC(vp, cred, MNT_WAIT, td);
return (error);
}
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index e7cdc17..49f0279 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -44,7 +44,7 @@ struct fs;
struct inode;
struct malloc_type;
struct mount;
-struct proc;
+struct thread;
struct sockaddr;
struct statfs;
struct ucred;
@@ -64,16 +64,16 @@ ufs_daddr_t ffs_blkpref __P((struct inode *, ufs_daddr_t, int, ufs_daddr_t *));
void ffs_clrblock __P((struct fs *, u_char *, ufs_daddr_t));
void ffs_clusteracct __P((struct fs *, struct cg *, ufs_daddr_t, int));
int ffs_fhtovp __P((struct mount *, struct fid *, struct vnode **));
-int ffs_flushfiles __P((struct mount *, int, struct proc *));
+int ffs_flushfiles __P((struct mount *, int, struct thread *));
void ffs_fragacct __P((struct fs *, int, int32_t [], int));
int ffs_freefile __P((struct inode *, ino_t, int ));
int ffs_isblock __P((struct fs *, u_char *, ufs_daddr_t));
int ffs_isfreeblock __P((struct fs *, unsigned char *, ufs_daddr_t));
-int ffs_mountfs __P((struct vnode *, struct mount *, struct proc *,
+int ffs_mountfs __P((struct vnode *, struct mount *, struct thread *,
struct malloc_type *));
int ffs_mountroot __P((void));
int ffs_mount __P((struct mount *, char *, caddr_t, struct nameidata *,
- struct proc *));
+ struct thread *));
int ffs_reallocblks __P((struct vop_reallocblks_args *));
int ffs_realloccg __P((struct inode *,
ufs_daddr_t, ufs_daddr_t, int, int, struct ucred *, struct buf **));
@@ -83,10 +83,10 @@ void ffs_snapremove __P((struct vnode *vp));
int ffs_snapshot __P((struct mount *mp, char *snapfile));
void ffs_snapshot_mount __P((struct mount *mp));
void ffs_snapshot_unmount __P((struct mount *mp));
-int ffs_statfs __P((struct mount *, struct statfs *, struct proc *));
-int ffs_sync __P((struct mount *, int, struct ucred *, struct proc *));
-int ffs_truncate __P((struct vnode *, off_t, int, struct ucred *, struct proc *));
-int ffs_unmount __P((struct mount *, int, struct proc *));
+int ffs_statfs __P((struct mount *, struct statfs *, struct thread *));
+int ffs_sync __P((struct mount *, int, struct ucred *, struct thread *));
+int ffs_truncate __P((struct vnode *, off_t, int, struct ucred *, struct thread *));
+int ffs_unmount __P((struct mount *, int, struct thread *));
int ffs_update __P((struct vnode *, int));
int ffs_valloc __P((struct vnode *, int, struct ucred *, struct vnode **));
@@ -104,8 +104,8 @@ extern vop_t **ffs_fifoop_p;
void softdep_initialize __P((void));
int softdep_mount __P((struct vnode *, struct mount *, struct fs *,
struct ucred *));
-int softdep_flushworklist __P((struct mount *, int *, struct proc *));
-int softdep_flushfiles __P((struct mount *, int, struct proc *));
+int softdep_flushworklist __P((struct mount *, int *, struct thread *));
+int softdep_flushfiles __P((struct mount *, int, struct thread *));
void softdep_update_inodeblock __P((struct inode *, struct buf *, int));
void softdep_load_inodeblock __P((struct inode *));
void softdep_freefile __P((struct vnode *, ino_t, int));
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 3af19b5..d0cd063 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -130,12 +130,12 @@ ffs_update(vp, waitfor)
* disk blocks.
*/
int
-ffs_truncate(vp, length, flags, cred, p)
+ffs_truncate(vp, length, flags, cred, td)
struct vnode *vp;
off_t length;
int flags;
struct ucred *cred;
- struct proc *p;
+ struct thread *td;
{
register struct vnode *ovp = vp;
ufs_daddr_t lastblock;
@@ -191,7 +191,7 @@ ffs_truncate(vp, length, flags, cred, p)
* so that it will have no data structures left.
*/
if ((error = VOP_FSYNC(ovp, cred, MNT_WAIT,
- p)) != 0)
+ td)) != 0)
return (error);
if (oip->i_flag & IN_SPACECOUNTED)
fs->fs_pendingblocks -= oip->i_blocks;
@@ -200,7 +200,7 @@ ffs_truncate(vp, length, flags, cred, p)
(void) chkdq(oip, -oip->i_blocks, NOCRED, 0);
#endif
softdep_setup_freeblocks(oip, length);
- vinvalbuf(ovp, 0, cred, p, 0, 0);
+ vinvalbuf(ovp, 0, cred, td, 0, 0);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
return (ffs_update(ovp, 0));
}
@@ -302,7 +302,7 @@ ffs_truncate(vp, length, flags, cred, p)
bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof oldblks);
oip->i_size = osize;
- error = vtruncbuf(ovp, cred, p, length, fs->fs_bsize);
+ error = vtruncbuf(ovp, cred, td, length, fs->fs_bsize);
if (error && (allerror == 0))
allerror = error;
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 1cbfe28..8085103 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -105,7 +105,7 @@ ffs_snapshot(mp, snapfile)
void *space;
struct fs *copy_fs = NULL, *fs = VFSTOUFS(mp)->um_fs;
struct snaphead *snaphead;
- struct proc *p = CURPROC;
+ struct thread *td = curthread;
struct inode *ip, *xp;
struct buf *bp, *nbp, *ibp, *sbp = NULL;
struct nameidata nd;
@@ -129,7 +129,7 @@ ffs_snapshot(mp, snapfile)
* Create the snapshot file.
*/
restart:
- NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF, UIO_USERSPACE, snapfile, p);
+ NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF, UIO_USERSPACE, snapfile, td);
if ((error = namei(&nd)) != 0)
return (error);
if (nd.ni_vp != NULL) {
@@ -162,7 +162,7 @@ restart:
return (error);
goto restart;
}
- VOP_LEASE(nd.ni_dvp, p, KERNCRED, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, KERNCRED, LEASE_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vat);
vput(nd.ni_dvp);
if (error) {
@@ -199,7 +199,7 @@ restart:
*/
for (blkno = NDADDR; blkno < numblks; blkno += NINDIR(fs)) {
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno),
- fs->fs_bsize, p->p_ucred, B_METAONLY, &ibp);
+ fs->fs_bsize, td->td_proc->p_ucred, B_METAONLY, &ibp);
if (error)
goto out;
bdwrite(ibp);
@@ -260,7 +260,7 @@ restart:
/*
* Ensure that the snapshot is completely on disk.
*/
- if ((error = VOP_FSYNC(vp, KERNCRED, MNT_WAIT, p)) != 0)
+ if ((error = VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td)) != 0)
goto out;
/*
* All allocations are done, so we can now snapshot the system.
@@ -464,12 +464,12 @@ out1:
out:
mp->mnt_flag = flag;
if (error)
- (void) UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, p);
- (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, p);
+ (void) UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, td);
+ (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
if (error)
vput(vp);
else
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
vn_finished_write(wrtmp);
return (error);
}
@@ -840,7 +840,7 @@ ffs_snapblkfree(freeip, bno, size)
{
struct buf *ibp, *cbp, *savedcbp = 0;
struct fs *fs = freeip->i_fs;
- struct proc *p = CURPROC;
+ struct thread *td = curthread;
struct inode *ip;
struct vnode *vp;
ufs_daddr_t lbn, blkno;
@@ -857,12 +857,12 @@ ffs_snapblkfree(freeip, bno, size)
if (lbn < NDADDR) {
blkno = ip->i_db[lbn];
} else {
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- p->p_flag |= P_COWINPROGRESS;
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ td->td_proc->p_flag |= P_COWINPROGRESS;
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, B_METAONLY, &ibp);
- p->p_flag &= ~P_COWINPROGRESS;
- VOP_UNLOCK(vp, 0, p);
+ td->td_proc->p_flag &= ~P_COWINPROGRESS;
+ VOP_UNLOCK(vp, 0, td);
if (error)
break;
indiroff = (lbn - NDADDR) % NINDIR(fs);
@@ -888,7 +888,7 @@ ffs_snapblkfree(freeip, bno, size)
case BLK_SNAP:
if (claimedblk)
panic("snapblkfree: inconsistent block type");
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (lbn < NDADDR) {
ip->i_db[lbn] = BLK_NOCOPY;
ip->i_flag |= IN_CHANGE | IN_UPDATE;
@@ -897,7 +897,7 @@ ffs_snapblkfree(freeip, bno, size)
BLK_NOCOPY;
bdwrite(ibp);
}
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
continue;
/*
* A block that we map is being freed. If it has not been
@@ -921,7 +921,7 @@ ffs_snapblkfree(freeip, bno, size)
"Grabonremove: snapino", ip->i_number, lbn,
freeip->i_number);
#endif
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (lbn < NDADDR) {
ip->i_db[lbn] = bno;
} else {
@@ -930,7 +930,7 @@ ffs_snapblkfree(freeip, bno, size)
}
ip->i_blocks += btodb(size);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
return (1);
}
if (lbn >= NDADDR)
@@ -940,13 +940,13 @@ ffs_snapblkfree(freeip, bno, size)
* allocation will never require any additional allocations for
* the snapshot inode.
*/
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- p->p_flag |= P_COWINPROGRESS;
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ td->td_proc->p_flag |= P_COWINPROGRESS;
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, 0, &cbp);
- p->p_flag &= ~P_COWINPROGRESS;
+ td->td_proc->p_flag &= ~P_COWINPROGRESS;
if (error) {
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
break;
}
#ifdef DEBUG
@@ -966,8 +966,8 @@ ffs_snapblkfree(freeip, bno, size)
bcopy(savedcbp->b_data, cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if (dopersistence && ip->i_effnlink > 0)
- (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, p);
- VOP_UNLOCK(vp, 0, p);
+ (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
+ VOP_UNLOCK(vp, 0, td);
continue;
}
/*
@@ -977,11 +977,11 @@ ffs_snapblkfree(freeip, bno, size)
bzero(cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if (dopersistence && ip->i_effnlink > 0)
- (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, p);
- VOP_UNLOCK(vp, 0, p);
+ (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
+ VOP_UNLOCK(vp, 0, td);
break;
}
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
savedcbp = cbp;
}
/*
@@ -993,9 +993,9 @@ ffs_snapblkfree(freeip, bno, size)
vp = savedcbp->b_vp;
bawrite(savedcbp);
if (dopersistence && VTOI(vp)->i_effnlink > 0) {
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, p);
- VOP_UNLOCK(vp, 0, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
+ VOP_UNLOCK(vp, 0, td);
}
}
/*
@@ -1016,7 +1016,7 @@ ffs_snapshot_mount(mp)
{
struct ufsmount *ump = VFSTOUFS(mp);
struct fs *fs = ump->um_fs;
- struct proc *p = CURPROC;
+ struct thread *td = curthread;
struct snaphead *snaphead;
struct vnode *vp;
struct inode *ip;
@@ -1052,7 +1052,7 @@ ffs_snapshot_mount(mp)
vp->v_flag |= VSYSTEM;
ump->um_devvp->v_rdev->si_copyonwrite = ffs_copyonwrite;
ump->um_devvp->v_flag |= VCOPYONWRITE;
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
}
}
@@ -1087,7 +1087,7 @@ ffs_copyonwrite(devvp, bp)
struct buf *bp;
{
struct buf *ibp, *cbp, *savedcbp = 0;
- struct proc *p = CURPROC;
+ struct thread *td = curthread;
struct fs *fs;
struct inode *ip;
struct vnode *vp;
@@ -1096,7 +1096,7 @@ ffs_copyonwrite(devvp, bp)
fs = TAILQ_FIRST(&devvp->v_rdev->si_snapshots)->i_fs;
lbn = fragstoblks(fs, dbtofsb(fs, bp->b_blkno));
- if (p->p_flag & P_COWINPROGRESS)
+ if (td->td_proc->p_flag & P_COWINPROGRESS)
panic("ffs_copyonwrite: recursive call");
TAILQ_FOREACH(ip, &devvp->v_rdev->si_snapshots, i_nextsnap) {
vp = ITOV(ip);
@@ -1117,19 +1117,19 @@ ffs_copyonwrite(devvp, bp)
* sleep briefly, and try again.
*/
retry:
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (lbn < NDADDR) {
blkno = ip->i_db[lbn];
} else {
- p->p_flag |= P_COWINPROGRESS;
+ td->td_proc->p_flag |= P_COWINPROGRESS;
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, B_METAONLY | B_NOWAIT, &ibp);
- p->p_flag &= ~P_COWINPROGRESS;
+ td->td_proc->p_flag &= ~P_COWINPROGRESS;
if (error) {
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
if (error != EWOULDBLOCK)
break;
- tsleep(vp, p->p_pri.pri_user, "nap", 1);
+ tsleep(vp, td->td_ksegrp->kg_pri.pri_user, "nap", 1);
goto retry;
}
indiroff = (lbn - NDADDR) % NINDIR(fs);
@@ -1141,7 +1141,7 @@ retry:
panic("ffs_copyonwrite: bad copy block");
#endif
if (blkno != 0) {
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
continue;
}
/*
@@ -1149,15 +1149,15 @@ retry:
* allocation will never require any additional allocations for
* the snapshot inode.
*/
- p->p_flag |= P_COWINPROGRESS;
+ td->td_proc->p_flag |= P_COWINPROGRESS;
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, B_NOWAIT, &cbp);
- p->p_flag &= ~P_COWINPROGRESS;
+ td->td_proc->p_flag &= ~P_COWINPROGRESS;
if (error) {
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
if (error != EWOULDBLOCK)
break;
- tsleep(vp, p->p_pri.pri_user, "nap", 1);
+ tsleep(vp, td->td_ksegrp->kg_pri.pri_user, "nap", 1);
goto retry;
}
#ifdef DEBUG
@@ -1183,8 +1183,8 @@ retry:
bcopy(savedcbp->b_data, cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if (dopersistence && ip->i_effnlink > 0)
- (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, p);
- VOP_UNLOCK(vp, 0, p);
+ (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
+ VOP_UNLOCK(vp, 0, td);
continue;
}
/*
@@ -1194,12 +1194,12 @@ retry:
bzero(cbp->b_data, fs->fs_bsize);
bawrite(cbp);
if (dopersistence && ip->i_effnlink > 0)
- (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, p);
- VOP_UNLOCK(vp, 0, p);
+ (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
+ VOP_UNLOCK(vp, 0, td);
break;
}
savedcbp = cbp;
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
}
/*
* Note that we need to synchronously write snapshots that
@@ -1210,9 +1210,9 @@ retry:
vp = savedcbp->b_vp;
bawrite(savedcbp);
if (dopersistence && VTOI(vp)->i_effnlink > 0) {
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, p);
- VOP_UNLOCK(vp, 0, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ (void) VOP_FSYNC(vp, KERNCRED, MNT_WAIT, td);
+ VOP_UNLOCK(vp, 0, td);
}
}
return (error);
@@ -1229,7 +1229,7 @@ readblock(bp, lbn)
{
struct uio auio;
struct iovec aiov;
- struct proc *p = CURPROC;
+ struct thread *td = curthread;
struct inode *ip = VTOI(bp->b_vp);
aiov.iov_base = bp->b_data;
@@ -1240,6 +1240,6 @@ readblock(bp, lbn)
auio.uio_resid = bp->b_bcount;
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = p;
+ auio.uio_td = td;
return (physio(ip->i_devvp->v_rdev, &auio, 0));
}
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 86f9111..a4a35bc 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -149,8 +149,8 @@ static struct malloc_type *memtype[] = {
static void softdep_error __P((char *, int));
static void drain_output __P((struct vnode *, int));
static int getdirtybuf __P((struct buf **, int));
-static void clear_remove __P((struct proc *));
-static void clear_inodedeps __P((struct proc *));
+static void clear_remove __P((struct thread *));
+static void clear_inodedeps __P((struct thread *));
static int flush_pagedep_deps __P((struct vnode *, struct mount *,
struct diraddhd *));
static int flush_inodedep_deps __P((struct fs *, ino_t));
@@ -239,10 +239,11 @@ static struct lockit {
#define FREE_LOCK_INTERLOCKED(lk)
#else /* DEBUG */
+#define NOHOLDER ((struct thread *)-1)
static struct lockit {
int lkt_spl;
- pid_t lkt_held;
-} lk = { 0, -1 };
+ struct thread * lkt_held;
+} lk = { 0, NOHOLDER };
static int lockcnt;
static void acquire_lock __P((struct lockit *));
@@ -259,18 +260,18 @@ static void
acquire_lock(lk)
struct lockit *lk;
{
- pid_t holder;
+ struct thread *holder;
- if (lk->lkt_held != -1) {
+ if (lk->lkt_held != NOHOLDER) {
holder = lk->lkt_held;
FREE_LOCK(lk);
- if (holder == CURPROC->p_pid)
+ if (holder == curthread)
panic("softdep_lock: locking against myself");
else
- panic("softdep_lock: lock held by %d", holder);
+ panic("softdep_lock: lock held by %p", holder);
}
lk->lkt_spl = splbio();
- lk->lkt_held = CURPROC->p_pid;
+ lk->lkt_held = curthread;
lockcnt++;
}
@@ -279,9 +280,9 @@ free_lock(lk)
struct lockit *lk;
{
- if (lk->lkt_held == -1)
+ if (lk->lkt_held == NOHOLDER)
panic("softdep_unlock: lock not held");
- lk->lkt_held = -1;
+ lk->lkt_held = NOHOLDER;
splx(lk->lkt_spl);
}
@@ -289,18 +290,18 @@ static void
acquire_lock_interlocked(lk)
struct lockit *lk;
{
- pid_t holder;
+ struct thread *holder;
- if (lk->lkt_held != -1) {
+ if (lk->lkt_held != NOHOLDER) {
holder = lk->lkt_held;
FREE_LOCK(lk);
- if (holder == CURPROC->p_pid)
+ if (holder == curthread)
panic("softdep_lock_interlocked: locking against self");
else
- panic("softdep_lock_interlocked: lock held by %d",
+ panic("softdep_lock_interlocked: lock held by %p",
holder);
}
- lk->lkt_held = CURPROC->p_pid;
+ lk->lkt_held = curthread;
lockcnt++;
}
@@ -309,9 +310,9 @@ free_lock_interlocked(lk)
struct lockit *lk;
{
- if (lk->lkt_held == -1)
+ if (lk->lkt_held == NOHOLDER)
panic("softdep_unlock_interlocked: lock not held");
- lk->lkt_held = -1;
+ lk->lkt_held = NOHOLDER;
}
#endif /* DEBUG */
@@ -320,7 +321,7 @@ free_lock_interlocked(lk)
*/
struct sema {
int value;
- pid_t holder;
+ struct thread *holder;
char *name;
int prio;
int timo;
@@ -336,7 +337,7 @@ sema_init(semap, name, prio, timo)
int prio, timo;
{
- semap->holder = -1;
+ semap->holder = NOHOLDER;
semap->value = 0;
semap->name = name;
semap->prio = prio;
@@ -359,7 +360,7 @@ sema_get(semap, interlock)
}
return (0);
}
- semap->holder = CURPROC->p_pid;
+ semap->holder = curthread;
if (interlock != NULL)
FREE_LOCK(interlock);
return (1);
@@ -370,8 +371,8 @@ sema_release(semap)
struct sema *semap;
{
- if (semap->value <= 0 || semap->holder != CURPROC->p_pid) {
- if (lk.lkt_held != -1)
+ if (semap->value <= 0 || semap->holder != curthread) {
+ if (lk.lkt_held != NOHOLDER)
FREE_LOCK(&lk);
panic("sema_release: not held");
}
@@ -379,7 +380,7 @@ sema_release(semap)
semap->value = 0;
wakeup(semap);
}
- semap->holder = -1;
+ semap->holder = NOHOLDER;
}
/*
@@ -412,7 +413,7 @@ worklist_insert(head, item)
struct worklist *item;
{
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("worklist_insert: lock not held");
if (item->wk_state & ONWORKLIST) {
FREE_LOCK(&lk);
@@ -427,7 +428,7 @@ worklist_remove(item)
struct worklist *item;
{
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("worklist_remove: lock not held");
if ((item->wk_state & ONWORKLIST) == 0) {
FREE_LOCK(&lk);
@@ -444,12 +445,12 @@ workitem_free(item, type)
{
if (item->wk_state & ONWORKLIST) {
- if (lk.lkt_held != -1)
+ if (lk.lkt_held != NOHOLDER)
FREE_LOCK(&lk);
panic("workitem_free: still on list");
}
if (item->wk_type != type) {
- if (lk.lkt_held != -1)
+ if (lk.lkt_held != NOHOLDER)
FREE_LOCK(&lk);
panic("workitem_free: type mismatch");
}
@@ -469,7 +470,7 @@ static int tickdelay = 2; /* number of ticks to pause during slowdown */
static int proc_waiting; /* tracks whether we have a timeout posted */
static int *stat_countp; /* statistic to count in proc_waiting timeout */
static struct callout_handle handle; /* handle on posted proc_waiting timeout */
-static struct proc *filesys_syncer; /* proc of filesystem syncer process */
+static struct thread *filesys_syncer; /* proc of filesystem syncer process */
static int req_clear_inodedeps; /* syncer process flush some inodedeps */
#define FLUSH_INODES 1
static int req_clear_remove; /* syncer process flush some freeblks */
@@ -518,7 +519,7 @@ add_to_worklist(wk)
static struct worklist *worklist_tail;
if (wk->wk_state & ONWORKLIST) {
- if (lk.lkt_held != -1)
+ if (lk.lkt_held != NOHOLDER)
FREE_LOCK(&lk);
panic("add_to_worklist: already on list");
}
@@ -544,7 +545,7 @@ int
softdep_process_worklist(matchmnt)
struct mount *matchmnt;
{
- struct proc *p = CURPROC;
+ struct thread *td = curthread;
int matchcnt, loopcount;
long starttime;
@@ -552,7 +553,7 @@ softdep_process_worklist(matchmnt)
* Record the process identifier of our caller so that we can give
* this process preferential treatment in request_cleanup below.
*/
- filesys_syncer = p;
+ filesys_syncer = td;
matchcnt = 0;
/*
@@ -571,12 +572,12 @@ softdep_process_worklist(matchmnt)
* If requested, try removing inode or removal dependencies.
*/
if (req_clear_inodedeps) {
- clear_inodedeps(p);
+ clear_inodedeps(td);
req_clear_inodedeps -= 1;
wakeup_one(&proc_waiting);
}
if (req_clear_remove) {
- clear_remove(p);
+ clear_remove(td);
req_clear_remove -= 1;
wakeup_one(&proc_waiting);
}
@@ -598,12 +599,12 @@ softdep_process_worklist(matchmnt)
* If requested, try removing inode or removal dependencies.
*/
if (req_clear_inodedeps) {
- clear_inodedeps(p);
+ clear_inodedeps(td);
req_clear_inodedeps -= 1;
wakeup_one(&proc_waiting);
}
if (req_clear_remove) {
- clear_remove(p);
+ clear_remove(td);
req_clear_remove -= 1;
wakeup_one(&proc_waiting);
}
@@ -658,7 +659,7 @@ process_worklist_item(matchmnt, flags)
dirrem = WK_DIRREM(wk);
vp = ufs_ihashlookup(VFSTOUFS(dirrem->dm_mnt)->um_dev,
dirrem->dm_oldinum);
- if (vp == NULL || !VOP_ISLOCKED(vp, CURPROC))
+ if (vp == NULL || !VOP_ISLOCKED(vp, curthread))
break;
}
if (wk == 0) {
@@ -751,10 +752,10 @@ softdep_move_dependencies(oldbp, newbp)
* Purge the work list of all items associated with a particular mount point.
*/
int
-softdep_flushworklist(oldmnt, countp, p)
+softdep_flushworklist(oldmnt, countp, td)
struct mount *oldmnt;
int *countp;
- struct proc *p;
+ struct thread *td;
{
struct vnode *devvp;
int count, error = 0;
@@ -778,9 +779,9 @@ softdep_flushworklist(oldmnt, countp, p)
devvp = VFSTOUFS(oldmnt)->um_devvp;
while ((count = softdep_process_worklist(oldmnt)) > 0) {
*countp += count;
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
- error = VOP_FSYNC(devvp, p->p_ucred, MNT_WAIT, p);
- VOP_UNLOCK(devvp, 0, p);
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = VOP_FSYNC(devvp, td->td_proc->p_ucred, MNT_WAIT, td);
+ VOP_UNLOCK(devvp, 0, td);
if (error)
break;
}
@@ -794,10 +795,10 @@ softdep_flushworklist(oldmnt, countp, p)
* Flush all vnodes and worklist items associated with a specified mount point.
*/
int
-softdep_flushfiles(oldmnt, flags, p)
+softdep_flushfiles(oldmnt, flags, td)
struct mount *oldmnt;
int flags;
- struct proc *p;
+ struct thread *td;
{
int error, count, loopcnt;
@@ -812,9 +813,9 @@ softdep_flushfiles(oldmnt, flags, p)
* Do another flush in case any vnodes were brought in
* as part of the cleanup operations.
*/
- if ((error = ffs_flushfiles(oldmnt, flags, p)) != 0)
+ if ((error = ffs_flushfiles(oldmnt, flags, td)) != 0)
break;
- if ((error = softdep_flushworklist(oldmnt, &count, p)) != 0 ||
+ if ((error = softdep_flushworklist(oldmnt, &count, td)) != 0 ||
count == 0)
break;
}
@@ -885,7 +886,7 @@ pagedep_lookup(ip, lbn, flags, pagedeppp)
int i;
#ifdef DEBUG
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("pagedep_lookup: lock not held");
#endif
mp = ITOV(ip)->v_mount;
@@ -953,7 +954,7 @@ inodedep_lookup(fs, inum, flags, inodedeppp)
int firsttry;
#ifdef DEBUG
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("inodedep_lookup: lock not held");
#endif
firsttry = 1;
@@ -1226,7 +1227,7 @@ bmsafemap_lookup(bp)
struct worklist *wk;
#ifdef DEBUG
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("bmsafemap_lookup: lock not held");
#endif
LIST_FOREACH(wk, &bp->b_dep, wk_list)
@@ -1398,7 +1399,7 @@ allocdirect_merge(adphead, newadp, oldadp)
struct newdirblk *newdirblk;
#ifdef DEBUG
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("allocdirect_merge: lock not held");
#endif
if (newadp->ad_oldblkno != oldadp->ad_newblkno ||
@@ -1986,7 +1987,7 @@ free_allocdirect(adphead, adp, delay)
struct worklist *wk;
#ifdef DEBUG
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("free_allocdirect: lock not held");
#endif
if ((adp->ad_state & DEPCOMPLETE) == 0)
@@ -2028,7 +2029,7 @@ free_newdirblk(newdirblk)
int i;
#ifdef DEBUG
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("free_newdirblk: lock not held");
#endif
/*
@@ -2351,7 +2352,7 @@ free_allocindir(aip, inodedep)
struct freefrag *freefrag;
#ifdef DEBUG
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("free_allocindir: lock not held");
#endif
if ((aip->ai_state & DEPCOMPLETE) == 0)
@@ -2609,7 +2610,7 @@ free_diradd(dap)
struct mkdir *mkdir, *nextmd;
#ifdef DEBUG
- if (lk.lkt_held == -1)
+ if (lk.lkt_held == NOHOLDER)
panic("free_diradd: lock not held");
#endif
WORKLIST_REMOVE(&dap->da_list);
@@ -2989,7 +2990,7 @@ static void
handle_workitem_remove(dirrem)
struct dirrem *dirrem;
{
- struct proc *p = CURPROC; /* XXX */
+ struct thread *td = curthread;
struct inodedep *inodedep;
struct vnode *vp;
struct inode *ip;
@@ -3038,7 +3039,7 @@ handle_workitem_remove(dirrem)
}
inodedep->id_nlinkdelta = ip->i_nlink - ip->i_effnlink;
FREE_LOCK(&lk);
- if ((error = UFS_TRUNCATE(vp, (off_t)0, 0, p->p_ucred, p)) != 0)
+ if ((error = UFS_TRUNCATE(vp, (off_t)0, 0, td->td_proc->p_ucred, td)) != 0)
softdep_error("handle_workitem_remove: truncate", error);
/*
* Rename a directory to a new parent. Since, we are both deleting
@@ -3422,9 +3423,10 @@ softdep_disk_write_complete(bp)
struct bmsafemap *bmsafemap;
#ifdef DEBUG
- if (lk.lkt_held != -1)
+#define SPECIAL_FLAG NOHOLDER-1
+ if (lk.lkt_held != NOHOLDER)
panic("softdep_disk_write_complete: lock is held");
- lk.lkt_held = -2;
+ lk.lkt_held = SPECIAL_FLAG;
#endif
LIST_INIT(&reattach);
while ((wk = LIST_FIRST(&bp->b_dep)) != NULL) {
@@ -3490,7 +3492,7 @@ softdep_disk_write_complete(bp)
case D_INDIRDEP:
indirdep = WK_INDIRDEP(wk);
if (indirdep->ir_state & GOINGAWAY) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("disk_write_complete: indirdep gone");
}
bcopy(indirdep->ir_saveddata, bp->b_data, bp->b_bcount);
@@ -3501,7 +3503,7 @@ softdep_disk_write_complete(bp)
while ((aip = LIST_FIRST(&indirdep->ir_donehd)) != 0) {
handle_allocindir_partdone(aip);
if (aip == LIST_FIRST(&indirdep->ir_donehd)) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("disk_write_complete: not gone");
}
}
@@ -3512,7 +3514,7 @@ softdep_disk_write_complete(bp)
continue;
default:
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_disk_write_complete: Unknown type %s",
TYPENAME(wk->wk_type));
/* NOTREACHED */
@@ -3526,9 +3528,9 @@ softdep_disk_write_complete(bp)
WORKLIST_INSERT(&bp->b_dep, wk);
}
#ifdef DEBUG
- if (lk.lkt_held != -2)
+ if (lk.lkt_held != SPECIAL_FLAG)
panic("softdep_disk_write_complete: lock lost");
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
#endif
}
@@ -3548,7 +3550,7 @@ handle_allocdirect_partdone(adp)
if ((adp->ad_state & ALLCOMPLETE) != ALLCOMPLETE)
return;
if (adp->ad_buf != NULL) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_allocdirect_partdone: dangling dep");
}
/*
@@ -3586,7 +3588,7 @@ handle_allocdirect_partdone(adp)
if (listadp == adp)
break;
if (listadp == NULL) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_allocdirect_partdone: lost dep");
}
#endif /* DEBUG */
@@ -3622,7 +3624,7 @@ handle_allocindir_partdone(aip)
if ((aip->ai_state & ALLCOMPLETE) != ALLCOMPLETE)
return;
if (aip->ai_buf != NULL) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_allocindir_partdone: dangling dependency");
}
indirdep = aip->ai_indirdep;
@@ -3656,7 +3658,7 @@ handle_written_inodeblock(inodedep, bp)
int hadchanges;
if ((inodedep->id_state & IOSTARTED) == 0) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_inodeblock: not started");
}
inodedep->id_state &= ~IOSTARTED;
@@ -3687,12 +3689,12 @@ handle_written_inodeblock(inodedep, bp)
for (adp = TAILQ_FIRST(&inodedep->id_inoupdt); adp; adp = nextadp) {
nextadp = TAILQ_NEXT(adp, ad_next);
if (adp->ad_state & ATTACHED) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_inodeblock: new entry");
}
if (adp->ad_lbn < NDADDR) {
if (dp->di_db[adp->ad_lbn] != adp->ad_oldblkno) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("%s: %s #%ld mismatch %d != %d",
"handle_written_inodeblock",
"direct pointer", adp->ad_lbn,
@@ -3701,7 +3703,7 @@ handle_written_inodeblock(inodedep, bp)
dp->di_db[adp->ad_lbn] = adp->ad_newblkno;
} else {
if (dp->di_ib[adp->ad_lbn - NDADDR] != 0) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("%s: %s #%ld allocated as %d",
"handle_written_inodeblock",
"indirect pointer", adp->ad_lbn - NDADDR,
@@ -3719,7 +3721,7 @@ handle_written_inodeblock(inodedep, bp)
* Reset the file size to its most up-to-date value.
*/
if (inodedep->id_savedsize == -1) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_inodeblock: bad size");
}
if (dp->di_size != inodedep->id_savedsize) {
@@ -3759,7 +3761,7 @@ handle_written_inodeblock(inodedep, bp)
* have been freed.
*/
if (filefree != NULL) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_inodeblock: filefree");
}
filefree = wk;
@@ -3784,7 +3786,7 @@ handle_written_inodeblock(inodedep, bp)
continue;
default:
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_inodeblock: Unknown type %s",
TYPENAME(wk->wk_type));
/* NOTREACHED */
@@ -3792,7 +3794,7 @@ handle_written_inodeblock(inodedep, bp)
}
if (filefree != NULL) {
if (free_inodedep(inodedep) == 0) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_inodeblock: live inodedep");
}
add_to_worklist(filefree);
@@ -3842,7 +3844,7 @@ handle_written_mkdir(mkdir, type)
struct pagedep *pagedep;
if (mkdir->md_state != type) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_mkdir: bad type");
}
dap = mkdir->md_diradd;
@@ -3879,7 +3881,7 @@ handle_written_filepage(pagedep, bp)
int i, chgs;
if ((pagedep->pd_state & IOSTARTED) == 0) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_filepage: not started");
}
pagedep->pd_state &= ~IOSTARTED;
@@ -3907,7 +3909,7 @@ handle_written_filepage(pagedep, bp)
dap = nextdap) {
nextdap = LIST_NEXT(dap, da_pdlist);
if (dap->da_state & ATTACHED) {
- lk.lkt_held = -1;
+ lk.lkt_held = NOHOLDER;
panic("handle_written_filepage: attached");
}
ep = (struct direct *)
@@ -4124,7 +4126,7 @@ softdep_fsync(vp)
struct inode *ip;
struct buf *bp;
struct fs *fs;
- struct proc *p = CURPROC; /* XXX */
+ struct thread *td = curthread;
int error, flushparent;
ino_t parentino;
ufs_lbn_t lbn;
@@ -4190,9 +4192,9 @@ softdep_fsync(vp)
* ufs_lookup for details on possible races.
*/
FREE_LOCK(&lk);
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
error = VFS_VGET(mnt, parentino, &pvp);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (error != 0)
return (error);
/*
@@ -4209,7 +4211,7 @@ softdep_fsync(vp)
return (error);
}
if ((pagedep->pd_state & NEWBLOCK) &&
- (error = VOP_FSYNC(pvp, p->p_ucred, MNT_WAIT, p))) {
+ (error = VOP_FSYNC(pvp, td->td_proc->p_ucred, MNT_WAIT, td))) {
vput(pvp);
return (error);
}
@@ -4217,7 +4219,7 @@ softdep_fsync(vp)
/*
* Flush directory page containing the inode's name.
*/
- error = bread(pvp, lbn, blksize(fs, VTOI(pvp), lbn), p->p_ucred,
+ error = bread(pvp, lbn, blksize(fs, VTOI(pvp), lbn), td->td_proc->p_ucred,
&bp);
if (error == 0)
error = BUF_WRITE(bp);
@@ -4294,7 +4296,7 @@ softdep_sync_metadata(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;
@@ -4539,7 +4541,7 @@ loop:
if (vn_isdisk(vp, NULL) &&
vp->v_rdev->si_mountpoint && !VOP_ISLOCKED(vp, NULL) &&
(error = VFS_SYNC(vp->v_rdev->si_mountpoint, MNT_WAIT, ap->a_cred,
- ap->a_p)) != 0)
+ ap->a_td)) != 0)
return (error);
return (0);
}
@@ -4643,7 +4645,7 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
struct mount *mp;
struct diraddhd *diraddhdp;
{
- struct proc *p = CURPROC; /* XXX */
+ struct thread *td = curthread;
struct inodedep *inodedep;
struct ufsmount *ump;
struct diradd *dap;
@@ -4690,8 +4692,8 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
FREE_LOCK(&lk);
if ((error = VFS_VGET(mp, inum, &vp)) != 0)
break;
- if ((error=VOP_FSYNC(vp, p->p_ucred, MNT_NOWAIT, p)) ||
- (error=VOP_FSYNC(vp, p->p_ucred, MNT_NOWAIT, p))) {
+ if ((error=VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_NOWAIT, td)) ||
+ (error=VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_NOWAIT, td))) {
vput(vp);
break;
}
@@ -4792,12 +4794,12 @@ request_cleanup(resource, islocked)
int resource;
int islocked;
{
- struct proc *p = CURPROC;
+ struct thread *td = curthread;
/*
* We never hold up the filesystem syncer process.
*/
- if (p == filesys_syncer)
+ if (td == filesys_syncer)
return (0);
/*
* First check to see if the work list has gotten backlogged.
@@ -4891,8 +4893,8 @@ pause_timer(arg)
* reduce the number of dirrem, freefile, and freeblks dependency structures.
*/
static void
-clear_remove(p)
- struct proc *p;
+clear_remove(td)
+ struct thread *td;
{
struct pagedep_hashhead *pagedephd;
struct pagedep *pagedep;
@@ -4920,7 +4922,7 @@ clear_remove(p)
vn_finished_write(mp);
return;
}
- if ((error = VOP_FSYNC(vp, p->p_ucred, MNT_NOWAIT, p)))
+ if ((error = VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_NOWAIT, td)))
softdep_error("clear_remove: fsync", error);
drain_output(vp, 0);
vput(vp);
@@ -4936,8 +4938,8 @@ clear_remove(p)
* the number of inodedep dependency structures.
*/
static void
-clear_inodedeps(p)
- struct proc *p;
+clear_inodedeps(td)
+ struct thread *td;
{
struct inodedep_hashhead *inodedephd;
struct inodedep *inodedep;
@@ -4994,10 +4996,10 @@ clear_inodedeps(p)
return;
}
if (ino == lastino) {
- if ((error = VOP_FSYNC(vp, p->p_ucred, MNT_WAIT, p)))
+ if ((error = VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_WAIT, td)))
softdep_error("clear_inodedeps: fsync1", error);
} else {
- if ((error = VOP_FSYNC(vp, p->p_ucred, MNT_NOWAIT, p)))
+ if ((error = VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_NOWAIT, td)))
softdep_error("clear_inodedeps: fsync2", error);
drain_output(vp, 0);
}
diff --git a/sys/ufs/ffs/ffs_softdep_stub.c b/sys/ufs/ffs/ffs_softdep_stub.c
index 7511533..c47fdb5 100644
--- a/sys/ufs/ffs/ffs_softdep_stub.c
+++ b/sys/ufs/ffs/ffs_softdep_stub.c
@@ -55,10 +55,10 @@
#include <ufs/ufs/ufs_extern.h>
int
-softdep_flushfiles(oldmnt, flags, p)
+softdep_flushfiles(oldmnt, flags, td)
struct mount *oldmnt;
int flags;
- struct proc *p;
+ struct thread *td;
{
panic("softdep_flushfiles called");
@@ -244,10 +244,10 @@ softdep_fsync_mountdev(vp)
}
int
-softdep_flushworklist(oldmnt, countp, p)
+softdep_flushworklist(oldmnt, countp, td)
struct mount *oldmnt;
int *countp;
- struct proc *p;
+ struct thread *td;
{
*countp = 0;
@@ -260,7 +260,7 @@ softdep_sync_metadata(ap)
struct vnode *a_vp;
struct ucred *a_cred;
int a_waitfor;
- struct proc *a_p;
+ struct thread *a_td;
} */ *ap;
{
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index f741036..48a8ba97 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -67,7 +67,7 @@
static MALLOC_DEFINE(M_FFSNODE, "FFS node", "FFS vnode private part");
static int ffs_sbupdate __P((struct ufsmount *, int));
-int ffs_reload __P((struct mount *,struct ucred *,struct proc *));
+int ffs_reload __P((struct mount *,struct ucred *,struct thread *));
static int ffs_oldfscompat __P((struct fs *));
static int ffs_init __P((struct vfsconf *));
@@ -132,12 +132,12 @@ VFS_SET(ufs_vfsops, ufs, 0);
* namei() if it is a genuine NULL from the user.
*/
int
-ffs_mount(mp, path, data, ndp, p)
+ffs_mount(mp, path, data, ndp, td)
struct mount *mp; /* mount struct pointer*/
char *path; /* path to mount point*/
caddr_t data; /* arguments to FS specific mount*/
struct nameidata *ndp; /* mount point credentials*/
- struct proc *p; /* process requesting mount*/
+ struct thread *td; /* process requesting mount*/
{
size_t size;
struct vnode *devvp;
@@ -156,10 +156,10 @@ ffs_mount(mp, path, data, ndp, p)
return (error);
}
- if ((error = ffs_mountfs(rootvp, mp, p, M_FFSNODE)) != 0)
+ if ((error = ffs_mountfs(rootvp, mp, td, M_FFSNODE)) != 0)
return (error);
- (void)VFS_STATFS(mp, &mp->mnt_stat, p);
+ (void)VFS_STATFS(mp, &mp->mnt_stat, td);
return (0);
}
@@ -184,9 +184,9 @@ ffs_mount(mp, path, data, ndp, p)
if (mp->mnt_flag & MNT_FORCE)
flags |= FORCECLOSE;
if (mp->mnt_flag & MNT_SOFTDEP) {
- error = softdep_flushfiles(mp, flags, p);
+ error = softdep_flushfiles(mp, flags, td);
} else {
- error = ffs_flushfiles(mp, flags, p);
+ error = ffs_flushfiles(mp, flags, td);
}
if (error) {
vn_finished_write(mp);
@@ -212,21 +212,21 @@ ffs_mount(mp, path, data, ndp, p)
vn_finished_write(mp);
}
if ((mp->mnt_flag & MNT_RELOAD) &&
- (error = ffs_reload(mp, ndp->ni_cnd.cn_cred, p)) != 0)
+ (error = ffs_reload(mp, ndp->ni_cnd.cn_cred, td)) != 0)
return (error);
if (fs->fs_ronly && (mp->mnt_kern_flag & MNTK_WANTRDWR)) {
/*
* 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) {
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
+ if (td->td_proc->p_ucred->cr_uid != 0) {
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
if ((error = VOP_ACCESS(devvp, VREAD | VWRITE,
- p->p_ucred, p)) != 0) {
- VOP_UNLOCK(devvp, 0, p);
+ td->td_proc->p_ucred, td)) != 0) {
+ VOP_UNLOCK(devvp, 0, td);
return (error);
}
- VOP_UNLOCK(devvp, 0, p);
+ VOP_UNLOCK(devvp, 0, td);
}
fs->fs_flags &= ~FS_UNCLEAN;
if (fs->fs_clean == 0) {
@@ -253,7 +253,7 @@ ffs_mount(mp, path, data, ndp, p)
}
/* check to see if we need to start softdep */
if ((fs->fs_flags & FS_DOSOFTDEP) &&
- (error = softdep_mount(devvp, mp, fs, p->p_ucred))){
+ (error = softdep_mount(devvp, mp, fs, td->td_proc->p_ucred))){
vn_finished_write(mp);
return (error);
}
@@ -286,7 +286,7 @@ ffs_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)) != 0)
return (error);
NDFREE(ndp, NDF_ONLY_PNBUF);
@@ -300,16 +300,16 @@ ffs_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);
- if ((error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p))!= 0){
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ if ((error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td))!= 0){
vput(devvp);
return (error);
}
- VOP_UNLOCK(devvp, 0, p);
+ VOP_UNLOCK(devvp, 0, td);
}
if (mp->mnt_flag & MNT_UPDATE) {
@@ -335,7 +335,7 @@ ffs_mount(mp, path, data, ndp, p)
* the mount point is discarded by the upper level code.
* Note that vfs_mount() populates f_mntonname for us.
*/
- if ((error = ffs_mountfs(devvp, mp, p, M_FFSNODE)) != 0) {
+ if ((error = ffs_mountfs(devvp, mp, td, M_FFSNODE)) != 0) {
vrele(devvp);
return (error);
}
@@ -348,7 +348,7 @@ ffs_mount(mp, path, data, ndp, p)
/*
* Initialize filesystem stat information in mount struct.
*/
- (void)VFS_STATFS(mp, &mp->mnt_stat, p);
+ (void)VFS_STATFS(mp, &mp->mnt_stat, td);
return (0);
}
@@ -366,10 +366,10 @@ ffs_mount(mp, path, data, ndp, p)
* 6) re-read inode data for all active vnodes.
*/
int
-ffs_reload(mp, cred, p)
+ffs_reload(mp, cred, td)
register struct mount *mp;
struct ucred *cred;
- struct proc *p;
+ struct thread *td;
{
register struct vnode *vp, *nvp, *devvp;
struct inode *ip;
@@ -387,9 +387,9 @@ ffs_reload(mp, cred, p)
* Step 1: invalidate all cached meta-data.
*/
devvp = VFSTOUFS(mp)->um_devvp;
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
- error = vinvalbuf(devvp, 0, cred, p, 0, 0);
- VOP_UNLOCK(devvp, 0, p);
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = vinvalbuf(devvp, 0, cred, td, 0, 0);
+ VOP_UNLOCK(devvp, 0, td);
if (error)
panic("ffs_reload: dirty1");
@@ -400,16 +400,16 @@ ffs_reload(mp, cred, p)
* block device.
*/
if (vn_isdisk(devvp, NULL)) {
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
- vfs_object_create(devvp, p, p->p_ucred);
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ vfs_object_create(devvp, td, td->td_proc->p_ucred);
mtx_lock(&devvp->v_interlock);
- VOP_UNLOCK(devvp, LK_INTERLOCK, p);
+ VOP_UNLOCK(devvp, LK_INTERLOCK, td);
}
/*
* Step 2: re-read superblock from disk.
*/
- if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, NOCRED, p) != 0)
+ if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, NOCRED, td) != 0)
size = DEV_BSIZE;
else
size = dpart.disklab->d_secsize;
@@ -486,16 +486,16 @@ loop:
/*
* Step 4: invalidate all inactive vnodes.
*/
- if (vrecycle(vp, NULL, p))
+ if (vrecycle(vp, NULL, td))
goto loop;
/*
* Step 5: invalidate all cached file data.
*/
mtx_lock(&vp->v_interlock);
- if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) {
+ if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td)) {
goto loop;
}
- if (vinvalbuf(vp, 0, cred, p, 0, 0))
+ if (vinvalbuf(vp, 0, cred, td, 0, 0))
panic("ffs_reload: dirty2");
/*
* Step 6: re-read inode data for all active vnodes.
@@ -527,10 +527,10 @@ SYSCTL_INT(_debug, OID_AUTO, bigcgs, CTLFLAG_RW, &bigcgs, 0, "");
* Common code for mount and mountroot
*/
int
-ffs_mountfs(devvp, mp, p, malloctype)
+ffs_mountfs(devvp, mp, td, malloctype)
register struct vnode *devvp;
struct mount *mp;
- struct proc *p;
+ struct thread *td;
struct malloc_type *malloctype;
{
register struct ufsmount *ump;
@@ -547,7 +547,7 @@ ffs_mountfs(devvp, mp, p, malloctype)
int ncount;
dev = devvp->v_rdev;
- cred = p ? p->p_ucred : NOCRED;
+ cred = td ? td->td_proc->p_ucred : NOCRED;
/*
* Disallow multiple mounts of the same device.
* Disallow mounting of a device that is currently in use
@@ -561,9 +561,9 @@ ffs_mountfs(devvp, mp, p, malloctype)
if (ncount > 1 && devvp != rootvp)
return (EBUSY);
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
- error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0);
- VOP_UNLOCK(devvp, 0, p);
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = vinvalbuf(devvp, V_SAVE, cred, td, 0, 0);
+ VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
@@ -574,16 +574,16 @@ ffs_mountfs(devvp, mp, p, malloctype)
* increases the opportunity for metadata caching.
*/
if (vn_isdisk(devvp, NULL)) {
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
- vfs_object_create(devvp, p, cred);
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ vfs_object_create(devvp, td, cred);
mtx_lock(&devvp->v_interlock);
- VOP_UNLOCK(devvp, LK_INTERLOCK, p);
+ VOP_UNLOCK(devvp, LK_INTERLOCK, td);
}
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);
if (devvp->v_rdev->si_iosize_max > mp->mnt_iosize_max)
@@ -591,7 +591,7 @@ ffs_mountfs(devvp, mp, p, malloctype)
if (mp->mnt_iosize_max > MAXPHYS)
mp->mnt_iosize_max = MAXPHYS;
- if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, cred, p) != 0)
+ if (VOP_IOCTL(devvp, DIOCGPART, (caddr_t)&dpart, FREAD, cred, td) != 0)
size = DEV_BSIZE;
else
size = dpart.disklab->d_secsize;
@@ -767,7 +767,7 @@ ffs_mountfs(devvp, mp, p, malloctype)
* This would all happen while the file system was busy/not
* available, so would effectively be "atomic".
*/
- (void) ufs_extattr_autostart(mp, p);
+ (void) ufs_extattr_autostart(mp, td);
#endif /* !UFS_EXTATTR_AUTOSTART */
#endif /* !UFS_EXTATTR */
return (0);
@@ -775,7 +775,7 @@ out:
devvp->v_rdev->si_mountpoint = NULL;
if (bp)
brelse(bp);
- (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, cred, p);
+ (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, cred, td);
if (ump) {
free(ump->um_fs, M_UFSMNT);
free(ump, M_UFSMNT);
@@ -820,10 +820,10 @@ ffs_oldfscompat(fs)
* unmount system call
*/
int
-ffs_unmount(mp, mntflags, p)
+ffs_unmount(mp, mntflags, td)
struct mount *mp;
int mntflags;
- struct proc *p;
+ struct thread *td;
{
register struct ufsmount *ump = VFSTOUFS(mp);
register struct fs *fs;
@@ -834,7 +834,7 @@ ffs_unmount(mp, mntflags, p)
flags |= FORCECLOSE;
}
#ifdef UFS_EXTATTR
- if ((error = ufs_extattr_stop(mp, p))) {
+ if ((error = ufs_extattr_stop(mp, td))) {
if (error != EOPNOTSUPP)
printf("ffs_unmount: ufs_extattr_stop returned %d\n",
error);
@@ -843,10 +843,10 @@ ffs_unmount(mp, mntflags, p)
}
#endif
if (mp->mnt_flag & MNT_SOFTDEP) {
- if ((error = softdep_flushfiles(mp, flags, p)) != 0)
+ if ((error = softdep_flushfiles(mp, flags, td)) != 0)
return (error);
} else {
- if ((error = ffs_flushfiles(mp, flags, p)) != 0)
+ if ((error = ffs_flushfiles(mp, flags, td)) != 0)
return (error);
}
fs = ump->um_fs;
@@ -870,9 +870,9 @@ ffs_unmount(mp, mntflags, p)
}
ump->um_devvp->v_rdev->si_mountpoint = NULL;
- vinvalbuf(ump->um_devvp, V_SAVE, NOCRED, p, 0, 0);
+ vinvalbuf(ump->um_devvp, V_SAVE, NOCRED, td, 0, 0);
error = VOP_CLOSE(ump->um_devvp, fs->fs_ronly ? FREAD : FREAD|FWRITE,
- NOCRED, p);
+ NOCRED, td);
vrele(ump->um_devvp);
@@ -888,10 +888,10 @@ ffs_unmount(mp, mntflags, p)
* Flush out all the files in a filesystem.
*/
int
-ffs_flushfiles(mp, flags, p)
+ffs_flushfiles(mp, flags, td)
register struct mount *mp;
int flags;
- struct proc *p;
+ struct thread *td;
{
register struct ufsmount *ump;
int error;
@@ -906,7 +906,7 @@ ffs_flushfiles(mp, flags, p)
for (i = 0; i < MAXQUOTAS; i++) {
if (ump->um_quotas[i] == NULLVP)
continue;
- quotaoff(p, mp, i);
+ quotaoff(td, mp, i);
}
/*
* Here we fall through to vflush again to ensure
@@ -931,9 +931,9 @@ ffs_flushfiles(mp, flags, p)
/*
* Flush filesystem metadata.
*/
- vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY, p);
- error = VOP_FSYNC(ump->um_devvp, p->p_ucred, MNT_WAIT, p);
- VOP_UNLOCK(ump->um_devvp, 0, p);
+ vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = VOP_FSYNC(ump->um_devvp, td->td_proc->p_ucred, MNT_WAIT, td);
+ VOP_UNLOCK(ump->um_devvp, 0, td);
return (error);
}
@@ -941,10 +941,10 @@ ffs_flushfiles(mp, flags, p)
* Get file system statistics.
*/
int
-ffs_statfs(mp, sbp, p)
+ffs_statfs(mp, sbp, td)
struct mount *mp;
register struct statfs *sbp;
- struct proc *p;
+ struct thread *td;
{
register struct ufsmount *ump;
register struct fs *fs;
@@ -980,11 +980,11 @@ ffs_statfs(mp, sbp, p)
* Note: we are always called with the filesystem marked `MPBUSY'.
*/
int
-ffs_sync(mp, waitfor, cred, p)
+ffs_sync(mp, waitfor, cred, td)
struct mount *mp;
int waitfor;
struct ucred *cred;
- struct proc *p;
+ struct thread *td;
{
struct vnode *nvp, *vp, *devvp;
struct inode *ip;
@@ -1028,15 +1028,15 @@ loop:
continue;
}
if (vp->v_type != VCHR) {
- if ((error = vget(vp, lockreq, p)) != 0) {
+ if ((error = vget(vp, lockreq, td)) != 0) {
mtx_lock(&mntvnode_mtx);
if (error == ENOENT)
goto loop;
continue;
}
- if ((error = VOP_FSYNC(vp, cred, waitfor, p)) != 0)
+ if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
allerror = error;
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
vrele(vp);
} else {
mtx_unlock(&vp->v_interlock);
@@ -1049,7 +1049,7 @@ loop:
* Force stale file system control information to be flushed.
*/
if (waitfor == MNT_WAIT) {
- if ((error = softdep_flushworklist(ump->um_mountp, &count, p)))
+ if ((error = softdep_flushworklist(ump->um_mountp, &count, td)))
allerror = error;
/* Flushed work items may create new vnodes to clean */
if (count) {
@@ -1065,10 +1065,10 @@ loop:
if (waitfor != MNT_LAZY &&
(devvp->v_numoutput > 0 || TAILQ_FIRST(&devvp->v_dirtyblkhd))) {
mtx_unlock(&devvp->v_interlock);
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
- if ((error = VOP_FSYNC(devvp, cred, waitfor, p)) != 0)
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ if ((error = VOP_FSYNC(devvp, cred, waitfor, td)) != 0)
allerror = error;
- VOP_UNLOCK(devvp, 0, p);
+ VOP_UNLOCK(devvp, 0, td);
if (waitfor == MNT_WAIT) {
mtx_lock(&mntvnode_mtx);
goto loop;
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index c50fe0f..78c32ea 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -130,7 +130,7 @@ ffs_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;
@@ -147,7 +147,7 @@ ffs_fsync(ap)
* out from underneath us.
*/
if (ip->i_flags & SF_SNAPSHOT)
- VOP_UNLOCK(vp, 0, ap->a_p);
+ VOP_UNLOCK(vp, 0, ap->a_td);
wait = (ap->a_waitfor == MNT_WAIT);
if (vn_isdisk(vp, NULL)) {
lbn = INT_MAX;
@@ -291,6 +291,6 @@ loop:
splx(s);
error = UFS_UPDATE(vp, wait);
if (ip->i_flags & SF_SNAPSHOT)
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, ap->a_p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td);
return (error);
}
diff --git a/sys/ufs/ifs/ifs_extern.h b/sys/ufs/ifs/ifs_extern.h
index 62d3581..df3af4a 100644
--- a/sys/ufs/ifs/ifs_extern.h
+++ b/sys/ufs/ifs/ifs_extern.h
@@ -64,7 +64,6 @@ struct fs;
struct inode;
struct malloc_type;
struct mount;
-struct proc;
struct sockaddr;
struct statfs;
struct ucred;
diff --git a/sys/ufs/ifs/ifs_lookup.c b/sys/ufs/ifs/ifs_lookup.c
index 7f65967..c6e5873 100644
--- a/sys/ufs/ifs/ifs_lookup.c
+++ b/sys/ufs/ifs/ifs_lookup.c
@@ -119,7 +119,7 @@ ifs_lookup(ap)
int flags = cnp->cn_flags;
int nameiop = cnp->cn_nameiop;
int error, lockparent, wantparent;
- struct proc *p = cnp->cn_proc;
+ struct thread *td = cnp->cn_thread;
ufs_daddr_t inodenum;
char *endp;
@@ -140,12 +140,12 @@ ifs_lookup(ap)
return (EPERM);
}
/* Deal with the '.' directory */
- /* VOP_UNLOCK(vdp, 0, p); */
+ /* VOP_UNLOCK(vdp, 0, td); */
if (cnp->cn_namelen == 1 && *(cnp->cn_nameptr) == '.') {
/* We don't unlock the parent dir since the're the same */
*vpp = vdp;
VREF(vdp);
- /* vn_lock(vdp, LK_SHARED | LK_RETRY, p); */
+ /* vn_lock(vdp, LK_SHARED | LK_RETRY, td); */
return (0);
}
/*
@@ -155,12 +155,12 @@ ifs_lookup(ap)
if ((cnp->cn_namelen) == 7 && (strncmp(cnp->cn_nameptr, "newfile", 7) == 0)) {
if (nameiop == CREATE) {
/* Check for write permissions in . */
- error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
+ error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
if (error)
return (error);
*vpp = NULL;
if (!lockparent || !(flags & ISLASTCN))
- VOP_UNLOCK(pdp, 0, p);
+ VOP_UNLOCK(pdp, 0, td);
cnp->cn_flags |= SAVENAME;
return (EJUSTRETURN);
} else {
@@ -246,7 +246,7 @@ ifs_lookup(ap)
if (error)
return (error);
if (!lockparent || !(flags & ISLASTCN))
- VOP_UNLOCK(pdp, 0, p);
+ VOP_UNLOCK(pdp, 0, td);
*vpp = tdp;
return (0);
}
diff --git a/sys/ufs/ifs/ifs_vfsops.c b/sys/ufs/ifs/ifs_vfsops.c
index 41b1d5f..0cbf5d0 100644
--- a/sys/ufs/ifs/ifs_vfsops.c
+++ b/sys/ufs/ifs/ifs_vfsops.c
@@ -70,7 +70,7 @@ static MALLOC_DEFINE(M_IFSNODE, "IFS node", "IFS vnode private part");
static int ifs_init (struct vfsconf *);
static int ifs_mount (struct mount *, char *, caddr_t,
- struct nameidata *, struct proc *);
+ struct nameidata *, struct thread *);
extern int ifs_vget (struct mount *, ino_t, struct vnode **);
@@ -101,16 +101,16 @@ VFS_SET(ifs_vfsops, ifs, 0);
* deal with softupdates so we make sure the user isn't trying to use it.
*/
static int
-ifs_mount(mp, path, data, ndp, p)
+ifs_mount(mp, path, data, ndp, td)
struct mount *mp;
char *path;
caddr_t data;
struct nameidata *ndp;
- struct proc *p;
+ struct thread *td;
{
/* Clear the softdep flag */
mp->mnt_flag &= ~MNT_SOFTDEP;
- return (ffs_mount(mp, path, data, ndp, p));
+ return (ffs_mount(mp, path, data, ndp, td));
}
diff --git a/sys/ufs/ufs/extattr.h b/sys/ufs/ufs/extattr.h
index b609ded..0eca43f 100644
--- a/sys/ufs/ufs/extattr.h
+++ b/sys/ufs/ufs/extattr.h
@@ -93,14 +93,14 @@ struct ufs_extattr_per_mount {
void ufs_extattr_uepm_init(struct ufs_extattr_per_mount *uepm);
void ufs_extattr_uepm_destroy(struct ufs_extattr_per_mount *uepm);
-int ufs_extattr_start(struct mount *mp, struct proc *p);
-int ufs_extattr_autostart(struct mount *mp, struct proc *p);
-int ufs_extattr_stop(struct mount *mp, struct proc *p);
+int ufs_extattr_start(struct mount *mp, struct thread *td);
+int ufs_extattr_autostart(struct mount *mp, struct thread *td);
+int ufs_extattr_stop(struct mount *mp, struct thread *td);
int ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename,
- int attrnamespace, const char *attrname, struct proc *p);
+ int attrnamespace, const char *attrname, struct thread *td);
int ufs_vop_getextattr(struct vop_getextattr_args *ap);
int ufs_vop_setextattr(struct vop_setextattr_args *ap);
-void ufs_extattr_vnode_inactive(struct vnode *vp, struct proc *p);
+void ufs_extattr_vnode_inactive(struct vnode *vp, struct thread *td);
#endif /* !_KERNEL */
diff --git a/sys/ufs/ufs/quota.h b/sys/ufs/ufs/quota.h
index efa714e..080569c 100644
--- a/sys/ufs/ufs/quota.h
+++ b/sys/ufs/ufs/quota.h
@@ -174,7 +174,7 @@ struct dquot {
struct inode;
struct mount;
-struct proc;
+struct thread;
struct ucred;
struct vnode;
@@ -185,11 +185,11 @@ void dqrele __P((struct vnode *, struct dquot *));
int getinoquota __P((struct inode *));
int getquota __P((struct mount *, u_long, int, caddr_t));
int qsync __P((struct mount *mp));
-int quotaoff __P((struct proc *, struct mount *, int));
-int quotaon __P((struct proc *, struct mount *, int, caddr_t));
+int quotaoff __P((struct thread *td, struct mount *, int));
+int quotaon __P((struct thread *td, struct mount *, int, caddr_t));
int setquota __P((struct mount *, u_long, int, caddr_t));
int setuse __P((struct mount *, u_long, int, caddr_t));
-int ufs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
+int ufs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct thread *td));
#else /* !_KERNEL */
diff --git a/sys/ufs/ufs/ufs_acl.c b/sys/ufs/ufs/ufs_acl.c
index d5ab20b..56e4828 100644
--- a/sys/ufs/ufs/ufs_acl.c
+++ b/sys/ufs/ufs/ufs_acl.c
@@ -217,7 +217,7 @@ ufs_getacl(ap)
struct acl_type_t type;
struct acl *aclp;
struct ucred *cred;
- struct proc *p;
+ struct thread *td;
} */ *ap;
{
struct inode *ip = VTOI(ap->a_vp);
@@ -241,7 +241,7 @@ ufs_getacl(ap)
error = vn_extattr_get(ap->a_vp, IO_NODELOCKED,
POSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE,
POSIX1E_ACL_ACCESS_EXTATTR_NAME, &len, (char *) ap->a_aclp,
- ap->a_p);
+ ap->a_td);
switch (error) {
/* XXX: Will be ENOATTR. */
/* XXX: If ufs_getacl() should work on file systems without
@@ -294,7 +294,7 @@ ufs_getacl(ap)
error = vn_extattr_get(ap->a_vp, IO_NODELOCKED,
POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE,
POSIX1E_ACL_DEFAULT_EXTATTR_NAME, &len,
- (char *) ap->a_aclp, ap->a_p);
+ (char *) ap->a_aclp, ap->a_td);
/*
* Unlike ACL_TYPE_ACCESS, there is no relationship between
* the inode contents and the ACL, and it is therefore
@@ -370,7 +370,7 @@ ufs_setacl(ap)
* Set operation.
*/
error = VOP_ACLCHECK(ap->a_vp, ap->a_type, ap->a_aclp,
- ap->a_cred, ap->a_p);
+ ap->a_cred, ap->a_td);
if (error != 0)
return (error);
} else {
@@ -397,7 +397,7 @@ ufs_setacl(ap)
/*
* Must hold VADMIN (be file owner) or have appropriate privilege.
*/
- if ((error = VOP_ACCESS(ap->a_vp, VADMIN, ap->a_cred, ap->a_p)))
+ if ((error = VOP_ACCESS(ap->a_vp, VADMIN, ap->a_cred, ap->a_td)))
return (error);
switch(ap->a_type) {
@@ -405,14 +405,14 @@ ufs_setacl(ap)
error = vn_extattr_set(ap->a_vp, IO_NODELOCKED,
POSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE,
POSIX1E_ACL_ACCESS_EXTATTR_NAME, sizeof(*ap->a_aclp),
- (char *) ap->a_aclp, ap->a_p);
+ (char *) ap->a_aclp, ap->a_td);
break;
case ACL_TYPE_DEFAULT:
if (ap->a_aclp == NULL) {
error = vn_extattr_rm(ap->a_vp, IO_NODELOCKED,
POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE,
- POSIX1E_ACL_DEFAULT_EXTATTR_NAME, ap->a_p);
+ POSIX1E_ACL_DEFAULT_EXTATTR_NAME, ap->a_td);
/*
* Attempting to delete a non-present default ACL
* will return success for portability purposes.
@@ -425,7 +425,7 @@ ufs_setacl(ap)
error = vn_extattr_set(ap->a_vp, IO_NODELOCKED,
POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE,
POSIX1E_ACL_DEFAULT_EXTATTR_NAME,
- sizeof(*ap->a_aclp), (char *) ap->a_aclp, ap->a_p);
+ sizeof(*ap->a_aclp), (char *) ap->a_aclp, ap->a_td);
break;
default:
@@ -466,7 +466,7 @@ ufs_aclcheck(ap)
acl_type_t type;
struct acl *aclp;
struct ucred *cred;
- struct proc *p;
+ struct thread *td;
} */ *ap;
{
diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c
index b713267..60dc574 100644
--- a/sys/ufs/ufs/ufs_extattr.c
+++ b/sys/ufs/ufs/ufs_extattr.c
@@ -66,20 +66,20 @@ SYSCTL_INT(_debug, OID_AUTO, ufs_extattr_sync, CTLFLAG_RW, &ufs_extattr_sync,
static int ufs_extattr_valid_attrname(const char *attrname);
static int ufs_extattr_credcheck(struct vnode *vp,
- struct ufs_extattr_list_entry *uele, struct ucred *cred, struct proc *p,
+ struct ufs_extattr_list_entry *uele, struct ucred *cred, struct thread *td,
int access);
static int ufs_extattr_enable_with_open(struct ufsmount *ump,
- struct vnode *vp, int attrnamespace, const char *attrname, struct proc *p);
+ struct vnode *vp, int attrnamespace, const char *attrname, struct thread *td);
static int ufs_extattr_enable(struct ufsmount *ump, int attrnamespace,
- const char *attrname, struct vnode *backing_vnode, struct proc *p);
+ const char *attrname, struct vnode *backing_vnode, struct thread *td);
static int ufs_extattr_disable(struct ufsmount *ump, int attrnamespace,
- const char *attrname, struct proc *p);
+ const char *attrname, struct thread *td);
static int ufs_extattr_get(struct vnode *vp, int attrnamespace,
- const char *name, struct uio *uio, struct ucred *cred, struct proc *p);
+ const char *name, struct uio *uio, struct ucred *cred, struct thread *td);
static int ufs_extattr_set(struct vnode *vp, int attrnamespace,
- const char *name, struct uio *uio, struct ucred *cred, struct proc *p);
+ const char *name, struct uio *uio, struct ucred *cred, struct thread *td);
static int ufs_extattr_rm(struct vnode *vp, int attrnamespace,
- const char *name, struct ucred *cred, struct proc *p);
+ const char *name, struct ucred *cred, struct thread *td);
/*
* Per-FS attribute lock protecting attribute operations.
@@ -87,19 +87,19 @@ static int ufs_extattr_rm(struct vnode *vp, int attrnamespace,
* lock per-FS; really, this should be far more fine-grained.
*/
static void
-ufs_extattr_uepm_lock(struct ufsmount *ump, struct proc *p)
+ufs_extattr_uepm_lock(struct ufsmount *ump, struct thread *td)
{
/* Ideally, LK_CANRECURSE would not be used, here. */
lockmgr(&ump->um_extattr.uepm_lock, LK_EXCLUSIVE | LK_RETRY |
- LK_CANRECURSE, 0, p);
+ LK_CANRECURSE, 0, td);
}
static void
-ufs_extattr_uepm_unlock(struct ufsmount *ump, struct proc *p)
+ufs_extattr_uepm_unlock(struct ufsmount *ump, struct thread *td)
{
- lockmgr(&ump->um_extattr.uepm_lock, LK_RELEASE, 0, p);
+ lockmgr(&ump->um_extattr.uepm_lock, LK_RELEASE, 0, td);
}
/*
@@ -190,14 +190,14 @@ ufs_extattr_uepm_destroy(struct ufs_extattr_per_mount *uepm)
* Start extended attribute support on an FS.
*/
int
-ufs_extattr_start(struct mount *mp, struct proc *p)
+ufs_extattr_start(struct mount *mp, struct thread *td)
{
struct ufsmount *ump;
int error = 0;
ump = VFSTOUFS(mp);
- ufs_extattr_uepm_lock(ump, p);
+ ufs_extattr_uepm_lock(ump, td);
if (!(ump->um_extattr.uepm_flags & UFS_EXTATTR_UEPM_INITIALIZED)) {
error = EOPNOTSUPP;
@@ -210,11 +210,11 @@ ufs_extattr_start(struct mount *mp, struct proc *p)
ump->um_extattr.uepm_flags |= UFS_EXTATTR_UEPM_STARTED;
- crhold(p->p_ucred);
- ump->um_extattr.uepm_ucred = p->p_ucred;
+ crhold(td->td_proc->p_ucred);
+ ump->um_extattr.uepm_ucred = td->td_proc->p_ucred;
unlock:
- ufs_extattr_uepm_unlock(ump, p);
+ ufs_extattr_uepm_unlock(ump, td);
return (error);
}
@@ -232,7 +232,7 @@ unlock:
#define UE_GETDIR_LOCKPARENT_DONT 2
static int
ufs_extattr_lookup(struct vnode *start_dvp, int lockparent, char *dirname,
- struct vnode **vp, struct proc *p)
+ struct vnode **vp, struct thread *td)
{
struct vop_cachedlookup_args vargs;
struct componentname cnp;
@@ -244,15 +244,15 @@ ufs_extattr_lookup(struct vnode *start_dvp, int lockparent, char *dirname,
cnp.cn_flags = ISLASTCN;
if (lockparent == UE_GETDIR_LOCKPARENT)
cnp.cn_flags |= LOCKPARENT;
- cnp.cn_proc = p;
- cnp.cn_cred = p->p_ucred;
+ cnp.cn_thread = td;
+ cnp.cn_cred = td->td_proc->p_ucred;
cnp.cn_pnbuf = zalloc(namei_zone);
cnp.cn_nameptr = cnp.cn_pnbuf;
error = copystr(dirname, cnp.cn_pnbuf, MAXPATHLEN,
(size_t *) &cnp.cn_namelen);
if (error) {
if (lockparent == UE_GETDIR_LOCKPARENT_DONT) {
- VOP_UNLOCK(start_dvp, 0, p);
+ VOP_UNLOCK(start_dvp, 0, td);
}
zfree(namei_zone, cnp.cn_pnbuf);
printf("ufs_extattr_lookup: copystr failed\n");
@@ -272,7 +272,7 @@ ufs_extattr_lookup(struct vnode *start_dvp, int lockparent, char *dirname,
*/
if (!(cnp.cn_flags & PDIRUNLOCK) &&
(lockparent == UE_GETDIR_LOCKPARENT_DONT))
- VOP_UNLOCK(start_dvp, 0, p);
+ VOP_UNLOCK(start_dvp, 0, td);
/*
* Check that ufs_lookup() didn't release the lock when we
@@ -313,15 +313,15 @@ ufs_extattr_lookup(struct vnode *start_dvp, int lockparent, char *dirname,
*/
static int
ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
- int attrnamespace, const char *attrname, struct proc *p)
+ int attrnamespace, const char *attrname, struct thread *td)
{
int error;
- error = VOP_OPEN(vp, FREAD|FWRITE, p->p_ucred, p);
+ error = VOP_OPEN(vp, FREAD|FWRITE, td->td_proc->p_ucred, td);
if (error) {
printf("ufs_extattr_enable_with_open.VOP_OPEN(): failed "
"with %d\n", error);
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
return (error);
}
@@ -330,12 +330,12 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
* to a similar piece of code in vn_open(), we don't.
*/
if (vn_canvmio(vp) == TRUE)
- if ((error = vfs_object_create(vp, p, p->p_ucred)) != 0) {
+ if ((error = vfs_object_create(vp, td, td->td_proc->p_ucred)) != 0) {
/*
* XXX: bug replicated from vn_open(): should
* VOP_CLOSE() here.
*/
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
return (error);
}
@@ -343,11 +343,11 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
vref(vp);
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
- error = ufs_extattr_enable(ump, attrnamespace, attrname, vp, p);
+ error = ufs_extattr_enable(ump, attrnamespace, attrname, vp, td);
if (error != 0)
- vn_close(vp, FREAD|FWRITE, p->p_ucred, p);
+ vn_close(vp, FREAD|FWRITE, td->td_proc->p_ucred, td);
return (error);
}
@@ -361,7 +361,7 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
*/
static int
ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp,
- int attrnamespace, struct proc *p)
+ int attrnamespace, struct thread *td)
{
struct vop_readdir_args vargs;
struct dirent *dp, *edp;
@@ -380,13 +380,13 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp,
auio.uio_iovcnt = 1;
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = p;
+ auio.uio_td = td;
auio.uio_offset = 0;
vargs.a_desc = NULL;
vargs.a_vp = dvp;
vargs.a_uio = &auio;
- vargs.a_cred = p->p_ucred;
+ vargs.a_cred = td->td_proc->p_ucred;
vargs.a_eofflag = &eofflag;
vargs.a_ncookies = NULL;
vargs.a_cookies = NULL;
@@ -413,7 +413,7 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp,
if (dp->d_reclen == 0)
break;
error = ufs_extattr_lookup(dvp, UE_GETDIR_LOCKPARENT,
- dp->d_name, &attr_vp, p);
+ dp->d_name, &attr_vp, td);
if (error) {
printf("ufs_extattr_iterate_directory: lookup "
"%s %d\n", dp->d_name, error);
@@ -429,7 +429,7 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp,
vput(attr_vp);
} else {
error = ufs_extattr_enable_with_open(ump,
- attr_vp, attrnamespace, dp->d_name, p);
+ attr_vp, attrnamespace, dp->d_name, td);
vrele(attr_vp);
if (error) {
printf("ufs_extattr_iterate_directory: "
@@ -458,7 +458,7 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp,
* mount-time.
*/
int
-ufs_extattr_autostart(struct mount *mp, struct proc *p)
+ufs_extattr_autostart(struct mount *mp, struct thread *td)
{
struct vnode *rvp, *attr_dvp, *attr_system_dvp, *attr_user_dvp;
int error;
@@ -474,7 +474,7 @@ ufs_extattr_autostart(struct mount *mp, struct proc *p)
}
error = ufs_extattr_lookup(rvp, UE_GETDIR_LOCKPARENT_DONT,
- UFS_EXTATTR_FSROOTSUBDIR, &attr_dvp, p);
+ UFS_EXTATTR_FSROOTSUBDIR, &attr_dvp, td);
if (error) {
/* rvp ref'd but now unlocked */
vrele(rvp);
@@ -494,7 +494,7 @@ ufs_extattr_autostart(struct mount *mp, struct proc *p)
goto return_vput_attr_dvp;
}
- error = ufs_extattr_start(mp, p);
+ error = ufs_extattr_start(mp, td);
if (error) {
printf("ufs_extattr_autostart: ufs_extattr_start failed (%d)\n",
error);
@@ -509,10 +509,10 @@ ufs_extattr_autostart(struct mount *mp, struct proc *p)
* be cleaned up on exit.
*/
error = ufs_extattr_lookup(attr_dvp, UE_GETDIR_LOCKPARENT,
- UFS_EXTATTR_SUBDIR_SYSTEM, &attr_system_dvp, p);
+ UFS_EXTATTR_SUBDIR_SYSTEM, &attr_system_dvp, td);
if (!error) {
error = ufs_extattr_iterate_directory(VFSTOUFS(mp),
- attr_system_dvp, EXTATTR_NAMESPACE_SYSTEM, p);
+ attr_system_dvp, EXTATTR_NAMESPACE_SYSTEM, td);
if (error)
printf("ufs_extattr_iterate_directory returned %d\n",
error);
@@ -520,10 +520,10 @@ ufs_extattr_autostart(struct mount *mp, struct proc *p)
}
error = ufs_extattr_lookup(attr_dvp, UE_GETDIR_LOCKPARENT,
- UFS_EXTATTR_SUBDIR_USER, &attr_user_dvp, p);
+ UFS_EXTATTR_SUBDIR_USER, &attr_user_dvp, td);
if (!error) {
error = ufs_extattr_iterate_directory(VFSTOUFS(mp),
- attr_user_dvp, EXTATTR_NAMESPACE_USER, p);
+ attr_user_dvp, EXTATTR_NAMESPACE_USER, td);
if (error)
printf("ufs_extattr_iterate_directory returned %d\n",
error);
@@ -544,13 +544,13 @@ return_vput_attr_dvp:
* Stop extended attribute support on an FS.
*/
int
-ufs_extattr_stop(struct mount *mp, struct proc *p)
+ufs_extattr_stop(struct mount *mp, struct thread *td)
{
struct ufs_extattr_list_entry *uele;
struct ufsmount *ump = VFSTOUFS(mp);
int error = 0;
- ufs_extattr_uepm_lock(ump, p);
+ ufs_extattr_uepm_lock(ump, td);
if (!(ump->um_extattr.uepm_flags & UFS_EXTATTR_UEPM_STARTED)) {
error = EOPNOTSUPP;
@@ -560,7 +560,7 @@ ufs_extattr_stop(struct mount *mp, struct proc *p)
while (LIST_FIRST(&ump->um_extattr.uepm_list) != NULL) {
uele = LIST_FIRST(&ump->um_extattr.uepm_list);
ufs_extattr_disable(ump, uele->uele_attrnamespace,
- uele->uele_attrname, p);
+ uele->uele_attrname, td);
}
ump->um_extattr.uepm_flags &= ~UFS_EXTATTR_UEPM_STARTED;
@@ -569,7 +569,7 @@ ufs_extattr_stop(struct mount *mp, struct proc *p)
ump->um_extattr.uepm_ucred = NULL;
unlock:
- ufs_extattr_uepm_unlock(ump, p);
+ ufs_extattr_uepm_unlock(ump, td);
return (error);
}
@@ -580,7 +580,7 @@ unlock:
*/
static int
ufs_extattr_enable(struct ufsmount *ump, int attrnamespace,
- const char *attrname, struct vnode *backing_vnode, struct proc *p)
+ const char *attrname, struct vnode *backing_vnode, struct thread *td)
{
struct ufs_extattr_list_entry *attribute;
struct iovec aiov;
@@ -622,13 +622,13 @@ ufs_extattr_enable(struct ufsmount *ump, int attrnamespace,
auio.uio_offset = (off_t) 0;
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_rw = UIO_READ;
- auio.uio_procp = (struct proc *) p;
+ auio.uio_td = td;
- VOP_LEASE(backing_vnode, p, p->p_ucred, LEASE_WRITE);
- vn_lock(backing_vnode, LK_SHARED | LK_NOPAUSE | LK_RETRY, p);
+ VOP_LEASE(backing_vnode, td, td->td_proc->p_ucred, LEASE_WRITE);
+ vn_lock(backing_vnode, LK_SHARED | LK_NOPAUSE | LK_RETRY, td);
error = VOP_READ(backing_vnode, &auio, IO_NODELOCKED,
ump->um_extattr.uepm_ucred);
- VOP_UNLOCK(backing_vnode, 0, p);
+ VOP_UNLOCK(backing_vnode, 0, td);
if (error)
goto free_exit;
@@ -667,7 +667,7 @@ free_exit:
*/
static int
ufs_extattr_disable(struct ufsmount *ump, int attrnamespace,
- const char *attrname, struct proc *p)
+ const char *attrname, struct thread *td)
{
struct ufs_extattr_list_entry *uele;
int error = 0;
@@ -682,7 +682,7 @@ ufs_extattr_disable(struct ufsmount *ump, int attrnamespace,
LIST_REMOVE(uele, uele_entries);
uele->uele_backing_vnode->v_flag &= ~VSYSTEM;
- error = vn_close(uele->uele_backing_vnode, FREAD|FWRITE, p->p_ucred, p);
+ error = vn_close(uele->uele_backing_vnode, FREAD|FWRITE, td->td_proc->p_ucred, td);
FREE(uele, M_UFS_EXTATTR);
@@ -696,7 +696,7 @@ ufs_extattr_disable(struct ufsmount *ump, int attrnamespace,
*/
int
ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
- int attrnamespace, const char *attrname, struct proc *p)
+ int attrnamespace, const char *attrname, struct thread *td)
{
struct ufsmount *ump = VFSTOUFS(mp);
int error;
@@ -705,34 +705,34 @@ ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
* Processes with privilege, but in jail, are not allowed to
* configure extended attributes.
*/
- if ((error = suser_xxx(p->p_ucred, p, 0))) {
+ if ((error = suser_xxx(td->td_proc->p_ucred, td->td_proc, 0))) {
if (filename_vp != NULL)
- VOP_UNLOCK(filename_vp, 0, p);
+ VOP_UNLOCK(filename_vp, 0, td);
return (error);
}
switch(cmd) {
case UFS_EXTATTR_CMD_START:
if (filename_vp != NULL) {
- VOP_UNLOCK(filename_vp, 0, p);
+ VOP_UNLOCK(filename_vp, 0, td);
return (EINVAL);
}
if (attrname != NULL)
return (EINVAL);
- error = ufs_extattr_start(mp, p);
+ error = ufs_extattr_start(mp, td);
return (error);
case UFS_EXTATTR_CMD_STOP:
if (filename_vp != NULL) {
- VOP_UNLOCK(filename_vp, 0, p);
+ VOP_UNLOCK(filename_vp, 0, td);
return (EINVAL);
}
if (attrname != NULL)
return (EINVAL);
- error = ufs_extattr_stop(mp, p);
+ error = ufs_extattr_stop(mp, td);
return (error);
@@ -741,7 +741,7 @@ ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
if (filename_vp == NULL)
return (EINVAL);
if (attrname == NULL) {
- VOP_UNLOCK(filename_vp, 0, p);
+ VOP_UNLOCK(filename_vp, 0, td);
return (EINVAL);
}
@@ -749,25 +749,25 @@ ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
* ufs_extattr_enable_with_open() will always unlock the
* vnode, regardless of failure.
*/
- ufs_extattr_uepm_lock(ump, p);
+ ufs_extattr_uepm_lock(ump, td);
error = ufs_extattr_enable_with_open(ump, filename_vp,
- attrnamespace, attrname, p);
- ufs_extattr_uepm_unlock(ump, p);
+ attrnamespace, attrname, td);
+ ufs_extattr_uepm_unlock(ump, td);
return (error);
case UFS_EXTATTR_CMD_DISABLE:
if (filename_vp != NULL) {
- VOP_UNLOCK(filename_vp, 0, p);
+ VOP_UNLOCK(filename_vp, 0, td);
return (EINVAL);
}
if (attrname == NULL)
return (EINVAL);
- ufs_extattr_uepm_lock(ump, p);
- error = ufs_extattr_disable(ump, attrnamespace, attrname, p);
- ufs_extattr_uepm_unlock(ump, p);
+ ufs_extattr_uepm_lock(ump, td);
+ error = ufs_extattr_disable(ump, attrnamespace, attrname, td);
+ ufs_extattr_uepm_unlock(ump, td);
return (error);
@@ -782,7 +782,7 @@ ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
*/
static int
ufs_extattr_credcheck(struct vnode *vp, struct ufs_extattr_list_entry *uele,
- struct ucred *cred, struct proc *p, int access)
+ struct ucred *cred, struct thread *td, int access)
{
/*
@@ -800,9 +800,9 @@ ufs_extattr_credcheck(struct vnode *vp, struct ufs_extattr_list_entry *uele,
*/
switch (uele->uele_attrnamespace) {
case EXTATTR_NAMESPACE_SYSTEM:
- return (suser_xxx(cred, p, 0));
+ return (suser_xxx(cred, td->td_proc, 0));
case EXTATTR_NAMESPACE_USER:
- return (VOP_ACCESS(vp, access, cred, p));
+ return (VOP_ACCESS(vp, access, cred, td));
default:
return (EPERM);
}
@@ -820,7 +820,7 @@ vop_getextattr {
IN const char *a_name;
INOUT struct uio *a_uio;
IN struct ucred *a_cred;
- IN struct proc *a_p;
+ IN struct thread *a_td;
};
*/
{
@@ -828,12 +828,12 @@ vop_getextattr {
struct ufsmount *ump = VFSTOUFS(mp);
int error;
- ufs_extattr_uepm_lock(ump, ap->a_p);
+ ufs_extattr_uepm_lock(ump, ap->a_td);
error = ufs_extattr_get(ap->a_vp, ap->a_attrnamespace, ap->a_name,
- ap->a_uio, ap->a_cred, ap->a_p);
+ ap->a_uio, ap->a_cred, ap->a_td);
- ufs_extattr_uepm_unlock(ump, ap->a_p);
+ ufs_extattr_uepm_unlock(ump, ap->a_td);
return (error);
}
@@ -844,7 +844,7 @@ vop_getextattr {
*/
static int
ufs_extattr_get(struct vnode *vp, int attrnamespace, const char *name,
- struct uio *uio, struct ucred *cred, struct proc *p)
+ struct uio *uio, struct ucred *cred, struct thread *td)
{
struct ufs_extattr_list_entry *attribute;
struct ufs_extattr_header ueh;
@@ -870,7 +870,7 @@ ufs_extattr_get(struct vnode *vp, int attrnamespace, const char *name,
if (!attribute)
return (ENOENT);
- if ((error = ufs_extattr_credcheck(vp, attribute, cred, p, IREAD)))
+ if ((error = ufs_extattr_credcheck(vp, attribute, cred, td, IREAD)))
return (error);
/*
@@ -900,21 +900,21 @@ ufs_extattr_get(struct vnode *vp, int attrnamespace, const char *name,
local_aio.uio_iovcnt = 1;
local_aio.uio_rw = UIO_READ;
local_aio.uio_segflg = UIO_SYSSPACE;
- local_aio.uio_procp = p;
+ local_aio.uio_td = td;
local_aio.uio_offset = base_offset;
local_aio.uio_resid = sizeof(struct ufs_extattr_header);
/*
* Acquire locks.
*/
- VOP_LEASE(attribute->uele_backing_vnode, p, cred, LEASE_READ);
+ VOP_LEASE(attribute->uele_backing_vnode, td, cred, LEASE_READ);
/*
* Don't need to get a lock on the backing file if the getattr is
* being applied to the backing file, as the lock is already held.
*/
if (attribute->uele_backing_vnode != vp)
vn_lock(attribute->uele_backing_vnode, LK_SHARED |
- LK_NOPAUSE | LK_RETRY, p);
+ LK_NOPAUSE | LK_RETRY, td);
error = VOP_READ(attribute->uele_backing_vnode, &local_aio,
IO_NODELOCKED, ump->um_extattr.uepm_ucred);
@@ -970,7 +970,7 @@ vopunlock_exit:
uio->uio_offset = 0;
if (attribute->uele_backing_vnode != vp)
- VOP_UNLOCK(attribute->uele_backing_vnode, 0, p);
+ VOP_UNLOCK(attribute->uele_backing_vnode, 0, td);
return (error);
}
@@ -987,7 +987,7 @@ vop_setextattr {
IN const char *a_name;
INOUT struct uio *a_uio;
IN struct ucred *a_cred;
- IN struct proc *a_p;
+ IN struct thread *a_td;
};
*/
{
@@ -996,16 +996,16 @@ vop_setextattr {
int error;
- ufs_extattr_uepm_lock(ump, ap->a_p);
+ ufs_extattr_uepm_lock(ump, ap->a_td);
if (ap->a_uio != NULL)
error = ufs_extattr_set(ap->a_vp, ap->a_attrnamespace,
- ap->a_name, ap->a_uio, ap->a_cred, ap->a_p);
+ ap->a_name, ap->a_uio, ap->a_cred, ap->a_td);
else
error = ufs_extattr_rm(ap->a_vp, ap->a_attrnamespace,
- ap->a_name, ap->a_cred, ap->a_p);
+ ap->a_name, ap->a_cred, ap->a_td);
- ufs_extattr_uepm_unlock(ump, ap->a_p);
+ ufs_extattr_uepm_unlock(ump, ap->a_td);
return (error);
}
@@ -1016,7 +1016,7 @@ vop_setextattr {
*/
static int
ufs_extattr_set(struct vnode *vp, int attrnamespace, const char *name,
- struct uio *uio, struct ucred *cred, struct proc *p)
+ struct uio *uio, struct ucred *cred, struct thread *td)
{
struct ufs_extattr_list_entry *attribute;
struct ufs_extattr_header ueh;
@@ -1039,7 +1039,7 @@ ufs_extattr_set(struct vnode *vp, int attrnamespace, const char *name,
if (!attribute)
return (ENOENT);
- if ((error = ufs_extattr_credcheck(vp, attribute, cred, p, IWRITE)))
+ if ((error = ufs_extattr_credcheck(vp, attribute, cred, td, IWRITE)))
return (error);
/*
@@ -1071,14 +1071,14 @@ ufs_extattr_set(struct vnode *vp, int attrnamespace, const char *name,
local_aio.uio_iovcnt = 1;
local_aio.uio_rw = UIO_WRITE;
local_aio.uio_segflg = UIO_SYSSPACE;
- local_aio.uio_procp = p;
+ local_aio.uio_td = td;
local_aio.uio_offset = base_offset;
local_aio.uio_resid = sizeof(struct ufs_extattr_header);
/*
* Acquire locks.
*/
- VOP_LEASE(attribute->uele_backing_vnode, p, cred, LEASE_WRITE);
+ VOP_LEASE(attribute->uele_backing_vnode, td, cred, LEASE_WRITE);
/*
* Don't need to get a lock on the backing file if the setattr is
@@ -1086,7 +1086,7 @@ ufs_extattr_set(struct vnode *vp, int attrnamespace, const char *name,
*/
if (attribute->uele_backing_vnode != vp)
vn_lock(attribute->uele_backing_vnode,
- LK_EXCLUSIVE | LK_NOPAUSE | LK_RETRY, p);
+ LK_EXCLUSIVE | LK_NOPAUSE | LK_RETRY, td);
ioflag = IO_NODELOCKED;
if (ufs_extattr_sync)
@@ -1116,7 +1116,7 @@ vopunlock_exit:
uio->uio_offset = 0;
if (attribute->uele_backing_vnode != vp)
- VOP_UNLOCK(attribute->uele_backing_vnode, 0, p);
+ VOP_UNLOCK(attribute->uele_backing_vnode, 0, td);
return (error);
}
@@ -1127,7 +1127,7 @@ vopunlock_exit:
*/
static int
ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
- struct ucred *cred, struct proc *p)
+ struct ucred *cred, struct thread *td)
{
struct ufs_extattr_list_entry *attribute;
struct ufs_extattr_header ueh;
@@ -1150,7 +1150,7 @@ ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
if (!attribute)
return (ENOENT);
- if ((error = ufs_extattr_credcheck(vp, attribute, cred, p, IWRITE)))
+ if ((error = ufs_extattr_credcheck(vp, attribute, cred, td, IWRITE)))
return (error);
/*
@@ -1172,11 +1172,11 @@ ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
local_aio.uio_iovcnt = 1;
local_aio.uio_rw = UIO_READ;
local_aio.uio_segflg = UIO_SYSSPACE;
- local_aio.uio_procp = p;
+ local_aio.uio_td = td;
local_aio.uio_offset = base_offset;
local_aio.uio_resid = sizeof(struct ufs_extattr_header);
- VOP_LEASE(attribute->uele_backing_vnode, p, cred, LEASE_WRITE);
+ VOP_LEASE(attribute->uele_backing_vnode, td, cred, LEASE_WRITE);
/*
* Don't need to get the lock on the backing vnode if the vnode we're
@@ -1184,7 +1184,7 @@ ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
*/
if (attribute->uele_backing_vnode != vp)
vn_lock(attribute->uele_backing_vnode,
- LK_EXCLUSIVE | LK_NOPAUSE | LK_RETRY, p);
+ LK_EXCLUSIVE | LK_NOPAUSE | LK_RETRY, td);
error = VOP_READ(attribute->uele_backing_vnode, &local_aio,
IO_NODELOCKED, ump->um_extattr.uepm_ucred);
@@ -1221,7 +1221,7 @@ ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
local_aio.uio_iovcnt = 1;
local_aio.uio_rw = UIO_WRITE;
local_aio.uio_segflg = UIO_SYSSPACE;
- local_aio.uio_procp = p;
+ local_aio.uio_td = td;
local_aio.uio_offset = base_offset;
local_aio.uio_resid = sizeof(struct ufs_extattr_header);
@@ -1237,7 +1237,7 @@ ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name,
error = ENXIO;
vopunlock_exit:
- VOP_UNLOCK(attribute->uele_backing_vnode, 0, p);
+ VOP_UNLOCK(attribute->uele_backing_vnode, 0, td);
return (error);
}
@@ -1247,7 +1247,7 @@ vopunlock_exit:
* attributes stripped.
*/
void
-ufs_extattr_vnode_inactive(struct vnode *vp, struct proc *p)
+ufs_extattr_vnode_inactive(struct vnode *vp, struct thread *td)
{
struct ufs_extattr_list_entry *uele;
struct mount *mp = vp->v_mount;
@@ -1261,18 +1261,18 @@ ufs_extattr_vnode_inactive(struct vnode *vp, struct proc *p)
if (!(ump->um_extattr.uepm_flags & UFS_EXTATTR_UEPM_INITIALIZED))
return;
- ufs_extattr_uepm_lock(ump, p);
+ ufs_extattr_uepm_lock(ump, td);
if (!(ump->um_extattr.uepm_flags & UFS_EXTATTR_UEPM_STARTED)) {
- ufs_extattr_uepm_unlock(ump, p);
+ ufs_extattr_uepm_unlock(ump, td);
return;
}
LIST_FOREACH(uele, &ump->um_extattr.uepm_list, uele_entries)
ufs_extattr_rm(vp, uele->uele_attrnamespace,
- uele->uele_attrname, NULL, p);
+ uele->uele_attrname, NULL, td);
- ufs_extattr_uepm_unlock(ump, p);
+ ufs_extattr_uepm_unlock(ump, td);
}
#endif /* !UFS_EXTATTR */
diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h
index d95013b..c4e2795 100644
--- a/sys/ufs/ufs/ufs_extern.h
+++ b/sys/ufs/ufs/ufs_extern.h
@@ -43,7 +43,7 @@ struct indir;
struct inode;
struct mount;
struct netcred;
-struct proc;
+struct thread;
struct sockaddr;
struct ucred;
struct ufid;
@@ -89,7 +89,7 @@ int ufs_readdir __P((struct vop_readdir_args *));
int ufs_reclaim __P((struct vop_reclaim_args *));
void ffs_snapgone __P((struct inode *));
int ufs_root __P((struct mount *, struct vnode **));
-int ufs_start __P((struct mount *, int, struct proc *));
+int ufs_start __P((struct mount *, int, struct thread *));
int ufs_vinit __P((struct mount *, vop_t **, vop_t **, struct vnode **));
/*
diff --git a/sys/ufs/ufs/ufs_ihash.c b/sys/ufs/ufs/ufs_ihash.c
index 1fd39e9..d1537af 100644
--- a/sys/ufs/ufs/ufs_ihash.c
+++ b/sys/ufs/ufs/ufs_ihash.c
@@ -40,6 +40,7 @@
#include <sys/lock.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
#include <sys/mutex.h>
#include <ufs/ufs/quota.h>
@@ -97,7 +98,7 @@ ufs_ihashget(dev, inum)
dev_t dev;
ino_t inum;
{
- struct proc *p = curproc; /* XXX */
+ struct thread *td = curthread; /* XXX */
struct inode *ip;
struct vnode *vp;
@@ -108,7 +109,7 @@ loop:
vp = ITOV(ip);
mtx_lock(&vp->v_interlock);
mtx_unlock(&ufs_ihash_mtx);
- if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p))
+ if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td))
goto loop;
return (vp);
}
@@ -124,11 +125,11 @@ void
ufs_ihashins(ip)
struct inode *ip;
{
- struct proc *p = curproc; /* XXX */
+ struct thread *td = curthread; /* XXX */
struct ihashhead *ipp;
/* lock the inode, then put it on the appropriate hash list */
- lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, p);
+ lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, td);
mtx_lock(&ufs_ihash_mtx);
ipp = INOHASH(ip->i_dev, ip->i_number);
diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c
index 028e3b9..9858297 100644
--- a/sys/ufs/ufs/ufs_inode.c
+++ b/sys/ufs/ufs/ufs_inode.c
@@ -65,12 +65,12 @@ int
ufs_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 inode *ip = VTOI(vp);
- struct proc *p = ap->a_p;
+ struct thread *td = ap->a_td;
int mode, error = 0;
if (prtactive && vp->v_usecount != 0)
@@ -90,9 +90,9 @@ ufs_inactive(ap)
(void)chkiq(ip, -1, NOCRED, 0);
#endif
#ifdef UFS_EXTATTR
- ufs_extattr_vnode_inactive(ap->a_vp, ap->a_p);
+ ufs_extattr_vnode_inactive(ap->a_vp, ap->a_td);
#endif
- error = UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, p);
+ error = UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, td);
/*
* Setting the mode to zero needs to wait for the inode
* to be written just as does a change to the link count.
@@ -117,13 +117,13 @@ ufs_inactive(ap)
}
}
out:
- 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->i_mode == 0)
- vrecycle(vp, NULL, p);
+ vrecycle(vp, NULL, td);
return (error);
}
@@ -134,7 +134,7 @@ int
ufs_reclaim(ap)
struct vop_reclaim_args /* {
struct vnode *a_vp;
- struct proc *a_p;
+ struct thread *a_td;
} */ *ap;
{
register struct inode *ip;
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index a062330..da1c0e9 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -156,7 +156,7 @@ ufs_lookup(ap)
struct ucred *cred = cnp->cn_cred;
int flags = cnp->cn_flags;
int nameiop = cnp->cn_nameiop;
- struct proc *p = cnp->cn_proc;
+ struct thread *td = cnp->cn_thread;
bp = NULL;
slotoffset = -1;
@@ -400,7 +400,7 @@ notfound:
* Access for write is interpreted as allowing
* creation of files in the directory.
*/
- error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
+ error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
if (error)
return (error);
/*
@@ -445,7 +445,7 @@ notfound:
*/
cnp->cn_flags |= SAVENAME;
if (!lockparent) {
- VOP_UNLOCK(vdp, 0, p);
+ VOP_UNLOCK(vdp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
return (EJUSTRETURN);
@@ -490,7 +490,7 @@ found:
/*
* Write access to directory required to delete files.
*/
- error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc);
+ error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread);
if (error)
return (error);
/*
@@ -509,10 +509,10 @@ found:
return (0);
}
if (flags & ISDOTDOT)
- VOP_UNLOCK(vdp, 0, p); /* race to get the inode */
+ VOP_UNLOCK(vdp, 0, td); /* race to get the inode */
error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
if (flags & ISDOTDOT) {
- if (vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY, p) != 0)
+ if (vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY, td) != 0)
cnp->cn_flags |= PDIRUNLOCK;
}
if (error)
@@ -524,14 +524,14 @@ found:
* implements append-only directories.
*/
if ((dp->i_mode & ISVTX) &&
- VOP_ACCESS(vdp, VADMIN, cred, cnp->cn_proc) &&
- VOP_ACCESS(tdp, VADMIN, cred, cnp->cn_proc)) {
+ VOP_ACCESS(vdp, VADMIN, cred, cnp->cn_thread) &&
+ VOP_ACCESS(tdp, VADMIN, cred, cnp->cn_thread)) {
vput(tdp);
return (EPERM);
}
*vpp = tdp;
if (!lockparent) {
- VOP_UNLOCK(vdp, 0, p);
+ VOP_UNLOCK(vdp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
return (0);
@@ -544,7 +544,7 @@ found:
* regular file, or empty directory.
*/
if (nameiop == RENAME && wantparent && (flags & ISLASTCN)) {
- if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc)) != 0)
+ if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread)) != 0)
return (error);
/*
* Careful about locking second inode.
@@ -553,10 +553,10 @@ found:
if (dp->i_number == dp->i_ino)
return (EISDIR);
if (flags & ISDOTDOT)
- VOP_UNLOCK(vdp, 0, p); /* race to get the inode */
+ VOP_UNLOCK(vdp, 0, td); /* race to get the inode */
error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp);
if (flags & ISDOTDOT) {
- if (vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY, p) != 0)
+ if (vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY, td) != 0)
cnp->cn_flags |= PDIRUNLOCK;
}
if (error)
@@ -564,7 +564,7 @@ found:
*vpp = tdp;
cnp->cn_flags |= SAVENAME;
if (!lockparent) {
- VOP_UNLOCK(vdp, 0, p);
+ VOP_UNLOCK(vdp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
return (0);
@@ -591,15 +591,15 @@ found:
*/
pdp = vdp;
if (flags & ISDOTDOT) {
- VOP_UNLOCK(pdp, 0, p); /* race to get the inode */
+ VOP_UNLOCK(pdp, 0, td); /* race to get the inode */
cnp->cn_flags |= PDIRUNLOCK;
if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) {
- if (vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, p) == 0)
+ if (vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td) == 0)
cnp->cn_flags &= ~PDIRUNLOCK;
return (error);
}
if (lockparent && (flags & ISLASTCN)) {
- if ((error = vn_lock(pdp, LK_EXCLUSIVE, p)) != 0) {
+ if ((error = vn_lock(pdp, LK_EXCLUSIVE, td)) != 0) {
vput(tdp);
return (error);
}
@@ -614,7 +614,7 @@ found:
if (error)
return (error);
if (!lockparent || !(flags & ISLASTCN)) {
- VOP_UNLOCK(pdp, 0, p);
+ VOP_UNLOCK(pdp, 0, td);
cnp->cn_flags |= PDIRUNLOCK;
}
*vpp = tdp;
@@ -739,7 +739,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
struct buf *newdirbp;
{
struct ucred *cr;
- struct proc *p;
+ struct thread *td;
int newentrysize;
struct inode *dp;
struct buf *bp;
@@ -748,8 +748,8 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
int error, ret, blkoff, loc, spacefree, flags;
char *dirbuf;
- p = curproc; /* XXX */
- cr = p->p_ucred;
+ td = curthread; /* XXX */
+ cr = td->td_proc->p_ucred;
dp = VTOI(dvp);
newentrysize = DIRSIZ(OFSFMT(dvp), dirp);
@@ -818,10 +818,10 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
if ((error = BUF_WRITE(bp)))
return (error);
if (tvp != NULL)
- VOP_UNLOCK(tvp, 0, p);
- error = VOP_FSYNC(dvp, p->p_ucred, MNT_WAIT, p);
+ VOP_UNLOCK(tvp, 0, td);
+ error = VOP_FSYNC(dvp, td->td_proc->p_ucred, MNT_WAIT, td);
if (tvp != NULL)
- vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, td);
return (error);
}
if (DOINGASYNC(dvp)) {
@@ -966,14 +966,14 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
*/
if (error == 0 && dp->i_endoff && dp->i_endoff < dp->i_size) {
if (tvp != NULL)
- VOP_UNLOCK(tvp, 0, p);
+ VOP_UNLOCK(tvp, 0, td);
#ifdef UFS_DIRHASH
if (dp->i_dirhash != NULL)
ufsdirhash_dirtrunc(dp, dp->i_endoff);
#endif
- (void) UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC, cr, p);
+ (void) UFS_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC, cr, td);
if (tvp != NULL)
- vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, td);
}
return (error);
}
@@ -1159,7 +1159,7 @@ ufs_dirempty(ip, parentino, cred)
for (off = 0; off < ip->i_size; off += dp->d_reclen) {
error = vn_rdwr(UIO_READ, ITOV(ip), (caddr_t)dp, MINDIRSIZ, off,
- UIO_SYSSPACE, IO_NODELOCKED, cred, &count, (struct proc *)0);
+ UIO_SYSSPACE, IO_NODELOCKED, cred, &count, (struct thread *)0);
/*
* Since we read MINDIRSIZ, residual must
* be 0 unless we're at end of file.
@@ -1230,7 +1230,7 @@ ufs_checkpath(source, target, cred)
}
error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf,
sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE,
- IO_NODELOCKED, cred, (int *)0, (struct proc *)0);
+ IO_NODELOCKED, cred, (int *)0, (struct thread *)0);
if (error != 0)
break;
# if (BYTE_ORDER == LITTLE_ENDIAN)
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index 6992160..4c10d88 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -386,8 +386,8 @@ chkdquot(ip)
* Q_QUOTAON - set up a quota file for a particular file system.
*/
int
-quotaon(p, mp, type, fname)
- struct proc *p;
+quotaon(td, mp, type, fname)
+ struct thread *td;
struct mount *mp;
register int type;
caddr_t fname;
@@ -400,20 +400,20 @@ quotaon(p, mp, type, fname)
struct nameidata nd;
vpp = &ump->um_quotas[type];
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, p);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, td);
flags = FREAD | FWRITE;
error = vn_open(&nd, &flags, 0);
if (error)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
if (vp->v_type != VREG) {
- (void) vn_close(vp, FREAD|FWRITE, p->p_ucred, p);
+ (void) vn_close(vp, FREAD|FWRITE, td->td_proc->p_ucred, td);
return (EACCES);
}
if (*vpp != vp)
- quotaoff(p, mp, type);
+ quotaoff(td, mp, type);
ump->um_qflags[type] |= QTF_OPENING;
mp->mnt_flag |= MNT_QUOTA;
vp->v_flag |= VSYSTEM;
@@ -422,8 +422,8 @@ quotaon(p, mp, type, fname)
* Save the credential of the process that turned on quotas.
* Set up the time limits for this quota.
*/
- crhold(p->p_ucred);
- ump->um_cred[type] = p->p_ucred;
+ crhold(td->td_proc->p_ucred);
+ ump->um_cred[type] = td->td_proc->p_ucred;
ump->um_btime[type] = MAX_DQ_TIME;
ump->um_itime[type] = MAX_IQ_TIME;
if (dqget(NULLVP, 0, ump, type, &dq) == 0) {
@@ -452,7 +452,7 @@ again:
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 again;
}
@@ -467,7 +467,7 @@ again:
mtx_unlock(&mntvnode_mtx);
ump->um_qflags[type] &= ~QTF_OPENING;
if (error)
- quotaoff(p, mp, type);
+ quotaoff(td, mp, type);
return (error);
}
@@ -475,8 +475,8 @@ again:
* Q_QUOTAOFF - turn off disk quotas for a filesystem.
*/
int
-quotaoff(p, mp, type)
- struct proc *p;
+quotaoff(td, mp, type)
+ struct thread *td;
struct mount *mp;
register int type;
{
@@ -508,7 +508,7 @@ again:
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 again;
}
@@ -524,7 +524,7 @@ again:
mtx_unlock(&mntvnode_mtx);
dqflush(qvp);
qvp->v_flag &= ~VSYSTEM;
- error = vn_close(qvp, FREAD|FWRITE, p->p_ucred, p);
+ error = vn_close(qvp, FREAD|FWRITE, td->td_proc->p_ucred, td);
ump->um_quotas[type] = NULLVP;
crfree(ump->um_cred[type]);
ump->um_cred[type] = NOCRED;
@@ -675,7 +675,7 @@ qsync(mp)
struct mount *mp;
{
struct ufsmount *ump = VFSTOUFS(mp);
- struct proc *p = curproc; /* XXX */
+ struct thread *td = curthread; /* XXX */
struct vnode *vp, *nextvp;
struct dquot *dq;
int i, error;
@@ -706,7 +706,7 @@ again:
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)
@@ -765,7 +765,7 @@ dqget(vp, id, ump, type, dqp)
register int type;
struct dquot **dqp;
{
- struct proc *p = curproc; /* XXX */
+ struct thread *td = curthread; /* XXX */
struct dquot *dq;
struct dqhash *dqh;
struct vnode *dqvp;
@@ -821,7 +821,7 @@ dqget(vp, id, ump, type, dqp)
* Initialize the contents of the dquot structure.
*/
if (vp != dqvp)
- vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY, td);
LIST_INSERT_HEAD(dqh, dq, dq_hash);
DQREF(dq);
dq->dq_flags = DQ_LOCK;
@@ -836,12 +836,12 @@ dqget(vp, id, ump, type, dqp)
auio.uio_offset = (off_t)(id * sizeof (struct dqblk));
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_rw = UIO_READ;
- auio.uio_procp = (struct proc *)0;
+ auio.uio_td = (struct thread *)0;
error = VOP_READ(dqvp, &auio, 0, ump->um_cred[type]);
if (auio.uio_resid == sizeof(struct dqblk) && error == 0)
bzero((caddr_t)&dq->dq_dqb, sizeof(struct dqblk));
if (vp != dqvp)
- VOP_UNLOCK(dqvp, 0, p);
+ VOP_UNLOCK(dqvp, 0, td);
if (dq->dq_flags & DQ_WANT)
wakeup((caddr_t)dq);
dq->dq_flags = 0;
@@ -915,7 +915,7 @@ dqsync(vp, dq)
struct vnode *vp;
struct dquot *dq;
{
- struct proc *p = curproc; /* XXX */
+ struct thread *td = curthread; /* XXX */
struct vnode *dqvp;
struct iovec aiov;
struct uio auio;
@@ -929,13 +929,13 @@ dqsync(vp, dq)
panic("dqsync: file");
(void) vn_write_suspend_wait(dqvp, NULL, V_WAIT);
if (vp != dqvp)
- vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY, td);
while (dq->dq_flags & DQ_LOCK) {
dq->dq_flags |= DQ_WANT;
(void) tsleep((caddr_t)dq, PINOD+2, "dqsync", 0);
if ((dq->dq_flags & DQ_MOD) == 0) {
if (vp != dqvp)
- VOP_UNLOCK(dqvp, 0, p);
+ VOP_UNLOCK(dqvp, 0, td);
return (0);
}
}
@@ -948,7 +948,7 @@ dqsync(vp, dq)
auio.uio_offset = (off_t)(dq->dq_id * sizeof (struct dqblk));
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_rw = UIO_WRITE;
- auio.uio_procp = (struct proc *)0;
+ auio.uio_td = (struct thread *)0;
error = VOP_WRITE(dqvp, &auio, 0, dq->dq_ump->um_cred[dq->dq_type]);
if (auio.uio_resid && error == 0)
error = EIO;
@@ -956,7 +956,7 @@ dqsync(vp, dq)
wakeup((caddr_t)dq);
dq->dq_flags &= ~(DQ_MOD|DQ_LOCK|DQ_WANT);
if (vp != dqvp)
- VOP_UNLOCK(dqvp, 0, p);
+ VOP_UNLOCK(dqvp, 0, td);
return (error);
}
diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c
index 0308895..83673eb 100644
--- a/sys/ufs/ufs/ufs_readwrite.c
+++ b/sys/ufs/ufs/ufs_readwrite.c
@@ -395,7 +395,7 @@ WRITE(ap)
register struct inode *ip;
register FS *fs;
struct buf *bp;
- struct proc *p;
+ struct thread *td;
ufs_daddr_t lbn;
off_t osize;
int seqcount;
@@ -456,13 +456,13 @@ WRITE(ap)
* Maybe this should be above the vnode op call, but so long as
* file servers have no limits, I don't think it matters.
*/
- p = uio->uio_procp;
- if (vp->v_type == VREG && p &&
+ td = uio->uio_td;
+ if (vp->v_type == VREG && td &&
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);
if (object) {
vm_object_vndeallocate(object);
}
@@ -573,7 +573,7 @@ WRITE(ap)
if (error) {
if (ioflag & IO_UNIT) {
(void)UFS_TRUNCATE(vp, osize,
- ioflag & IO_SYNC, ap->a_cred, uio->uio_procp);
+ ioflag & IO_SYNC, ap->a_cred, uio->uio_td);
uio->uio_offset -= resid - uio->uio_resid;
uio->uio_resid = resid;
}
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index 1fcd530..7b42452 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -64,10 +64,10 @@ MALLOC_DEFINE(M_UFSMNT, "UFS mount", "UFS mount structure");
*/
/* ARGSUSED */
int
-ufs_start(mp, flags, p)
+ufs_start(mp, flags, td)
struct mount *mp;
int flags;
- struct proc *p;
+ struct thread *td;
{
return (0);
@@ -95,12 +95,12 @@ ufs_root(mp, vpp)
* Do operations associated with quotas
*/
int
-ufs_quotactl(mp, cmds, uid, arg, p)
+ufs_quotactl(mp, cmds, uid, arg, td)
struct mount *mp;
int cmds;
uid_t uid;
caddr_t arg;
- struct proc *p;
+ struct thread *td;
{
#ifndef QUOTA
return (EOPNOTSUPP);
@@ -108,35 +108,35 @@ ufs_quotactl(mp, cmds, uid, arg, p)
int cmd, type, error;
if (uid == -1)
- uid = p->p_ucred->cr_ruid;
+ uid = td->td_proc->p_ucred->cr_ruid;
cmd = cmds >> SUBCMDSHIFT;
switch (cmd) {
case Q_SYNC:
break;
case Q_GETQUOTA:
- if (uid == p->p_ucred->cr_ruid)
+ if (uid == td->td_proc->p_ucred->cr_ruid)
break;
/* fall through */
default:
- if ((error = suser_xxx(0, p, PRISON_ROOT)) != 0)
+ if ((error = suser_xxx(0, td->td_proc, PRISON_ROOT)) != 0)
return (error);
}
type = cmds & SUBCMDMASK;
if ((u_int)type >= MAXQUOTAS)
return (EINVAL);
- if (vfs_busy(mp, LK_NOWAIT, 0, p))
+ if (vfs_busy(mp, LK_NOWAIT, 0, td))
return (0);
switch (cmd) {
case Q_QUOTAON:
- error = quotaon(p, mp, type, arg);
+ error = quotaon(td, mp, type, arg);
break;
case Q_QUOTAOFF:
- error = quotaoff(p, mp, type);
+ error = quotaoff(td, mp, type);
break;
case Q_SETQUOTA:
@@ -159,7 +159,7 @@ ufs_quotactl(mp, cmds, uid, arg, p)
error = EINVAL;
break;
}
- vfs_unbusy(mp, p);
+ vfs_unbusy(mp, td);
return (error);
#endif
}
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index e52bf93..c108c90 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -83,8 +83,8 @@
static int ufs_access __P((struct vop_access_args *));
static int ufs_advlock __P((struct vop_advlock_args *));
-static int ufs_chmod __P((struct vnode *, int, struct ucred *, struct proc *));
-static int ufs_chown __P((struct vnode *, uid_t, gid_t, struct ucred *, struct proc *));
+static int ufs_chmod __P((struct vnode *, int, struct ucred *, struct thread *));
+static int ufs_chown __P((struct vnode *, uid_t, gid_t, struct ucred *, struct thread *));
static int ufs_close __P((struct vop_close_args *));
static int ufs_create __P((struct vop_create_args *));
static int ufs_getattr __P((struct vop_getattr_args *));
@@ -267,7 +267,7 @@ ufs_open(ap)
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
- struct proc *a_p;
+ struct thread *a_td;
} */ *ap;
{
@@ -292,7 +292,7 @@ ufs_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;
@@ -332,7 +332,7 @@ ufs_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;
@@ -373,7 +373,7 @@ ufs_access(ap)
#ifdef UFS_ACL
MALLOC(acl, struct acl *, sizeof(*acl), M_ACL, M_WAITOK);
len = sizeof(*acl);
- error = VOP_GETACL(vp, ACL_TYPE_ACCESS, acl, ap->a_cred, ap->a_p);
+ error = VOP_GETACL(vp, ACL_TYPE_ACCESS, acl, ap->a_cred, ap->a_td);
switch (error) {
case EOPNOTSUPP:
error = vaccess(vp->v_type, ip->i_mode, ip->i_uid, ip->i_gid,
@@ -408,7 +408,7 @@ ufs_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;
@@ -452,14 +452,14 @@ ufs_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;
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
struct ucred *cred = ap->a_cred;
- struct proc *p = ap->a_p;
+ struct thread *td = ap->a_td;
int error;
/*
@@ -478,7 +478,7 @@ ufs_setattr(ap)
* Callers may only modify the file flags on objects they
* have VADMIN rights for.
*/
- if ((error = VOP_ACCESS(vp, VADMIN, cred, p)))
+ if ((error = VOP_ACCESS(vp, VADMIN, cred, td)))
return (error);
/*
* Unprivileged processes and privileged processes in
@@ -519,7 +519,7 @@ ufs_setattr(ap)
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
if ((error = ufs_chown(vp, vap->va_uid, vap->va_gid, cred,
- p)) != 0)
+ td)) != 0)
return (error);
}
if (vap->va_size != VNOVAL) {
@@ -541,7 +541,7 @@ ufs_setattr(ap)
default:
break;
}
- if ((error = UFS_TRUNCATE(vp, vap->va_size, 0, cred, p)) != 0)
+ if ((error = UFS_TRUNCATE(vp, vap->va_size, 0, cred, td)) != 0)
return (error);
}
if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
@@ -557,9 +557,9 @@ ufs_setattr(ap)
* If times is non-NULL, ... The caller must be the owner of
* the file or be the super-user.
*/
- if ((error = VOP_ACCESS(vp, VADMIN, cred, p)) &&
+ if ((error = VOP_ACCESS(vp, VADMIN, cred, td)) &&
((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)
ip->i_flag |= IN_ACCESS;
@@ -585,7 +585,7 @@ ufs_setattr(ap)
if ((ip->i_flags & SF_SNAPSHOT) != 0 && (vap->va_mode &
(S_IXUSR | S_IWUSR | S_IXGRP | S_IWGRP | S_IXOTH | S_IWOTH)))
return (EPERM);
- error = ufs_chmod(vp, (int)vap->va_mode, cred, p);
+ error = ufs_chmod(vp, (int)vap->va_mode, cred, td);
}
VN_KNOTE(vp, NOTE_ATTRIB);
return (error);
@@ -596,11 +596,11 @@ ufs_setattr(ap)
* Inode must be locked before calling.
*/
static int
-ufs_chmod(vp, mode, cred, p)
+ufs_chmod(vp, mode, cred, td)
register struct vnode *vp;
register int mode;
register struct ucred *cred;
- struct proc *p;
+ struct thread *td;
{
register struct inode *ip = VTOI(vp);
int error;
@@ -609,7 +609,7 @@ ufs_chmod(vp, mode, cred, p)
* To modify the permissions on a file, must possess VADMIN
* for that file.
*/
- if ((error = VOP_ACCESS(vp, VADMIN, cred, p)))
+ if ((error = VOP_ACCESS(vp, VADMIN, cred, td)))
return (error);
/*
* Privileged processes may set the sticky bit on non-directories,
@@ -633,12 +633,12 @@ ufs_chmod(vp, mode, cred, p)
* inode must be locked prior to call.
*/
static int
-ufs_chown(vp, uid, gid, cred, p)
+ufs_chown(vp, uid, gid, cred, td)
register struct vnode *vp;
uid_t uid;
gid_t gid;
struct ucred *cred;
- struct proc *p;
+ struct thread *td;
{
register struct inode *ip = VTOI(vp);
uid_t ouid;
@@ -657,7 +657,7 @@ ufs_chown(vp, uid, gid, cred, p)
* To modify the ownership of a file, must possess VADMIN
* for that file.
*/
- if ((error = VOP_ACCESS(vp, VADMIN, cred, p)))
+ if ((error = VOP_ACCESS(vp, VADMIN, cred, td)))
return (error);
/*
* To change the owner of a file, or change the group of a file
@@ -666,7 +666,7 @@ ufs_chown(vp, uid, gid, cred, p)
*/
if ((uid != ip->i_uid ||
(gid != ip->i_gid && !groupmember(gid, cred))) &&
- (error = suser_xxx(cred, p, PRISON_ROOT)))
+ (error = suser_xxx(cred, td->td_proc, PRISON_ROOT)))
return (error);
ogid = ip->i_gid;
ouid = ip->i_uid;
@@ -780,7 +780,7 @@ ufs_link(ap)
struct vnode *vp = ap->a_vp;
struct vnode *tdvp = ap->a_tdvp;
struct componentname *cnp = ap->a_cnp;
- struct proc *p = cnp->cn_proc;
+ struct thread *td = cnp->cn_thread;
struct inode *ip;
struct direct newdir;
int error;
@@ -793,7 +793,7 @@ ufs_link(ap)
error = EXDEV;
goto out2;
}
- if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, p))) {
+ if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, td))) {
goto out2;
}
ip = VTOI(vp);
@@ -825,7 +825,7 @@ ufs_link(ap)
}
out1:
if (tdvp != vp)
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
out2:
VN_KNOTE(vp, NOTE_LINK);
VN_KNOTE(tdvp, NOTE_WRITE);
@@ -928,7 +928,7 @@ ufs_rename(ap)
struct vnode *fdvp = ap->a_fdvp;
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 inode *ip, *xp, *dp;
struct direct newdir;
int doingdirectory = 0, oldparent = 0, newparent = 0;
@@ -1019,18 +1019,18 @@ abortit:
vput(fvp);
return (error);
}
- if ((error = vn_lock(fvp, LK_EXCLUSIVE, p)) != 0)
+ if ((error = vn_lock(fvp, LK_EXCLUSIVE, td)) != 0)
goto abortit;
dp = VTOI(fdvp);
ip = VTOI(fvp);
if (ip->i_nlink >= LINK_MAX) {
- VOP_UNLOCK(fvp, 0, p);
+ VOP_UNLOCK(fvp, 0, td);
error = EMLINK;
goto abortit;
}
if ((ip->i_flags & (NOUNLINK | IMMUTABLE | APPEND))
|| (dp->i_flags & APPEND)) {
- VOP_UNLOCK(fvp, 0, p);
+ VOP_UNLOCK(fvp, 0, td);
error = EPERM;
goto abortit;
}
@@ -1041,7 +1041,7 @@ abortit:
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
dp == ip || (fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT ||
(ip->i_flag & IN_RENAME)) {
- VOP_UNLOCK(fvp, 0, p);
+ VOP_UNLOCK(fvp, 0, td);
error = EINVAL;
goto abortit;
}
@@ -1074,7 +1074,7 @@ abortit:
softdep_change_linkcnt(ip);
if ((error = UFS_UPDATE(fvp, !(DOINGSOFTDEP(fvp) |
DOINGASYNC(fvp)))) != 0) {
- VOP_UNLOCK(fvp, 0, p);
+ VOP_UNLOCK(fvp, 0, td);
goto bad;
}
@@ -1088,8 +1088,8 @@ abortit:
* to namei, as the parent directory is unlocked by the
* call to checkpath().
*/
- 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 (oldparent != dp->i_number)
newparent = dp->i_number;
if (doingdirectory && newparent) {
@@ -1172,8 +1172,8 @@ abortit:
* directories.
*/
if ((dp->i_mode & S_ISTXT) &&
- VOP_ACCESS(tdvp, VADMIN, tcnp->cn_cred, p) &&
- VOP_ACCESS(tvp, VADMIN, tcnp->cn_cred, p)) {
+ VOP_ACCESS(tdvp, VADMIN, tcnp->cn_cred, td) &&
+ VOP_ACCESS(tvp, VADMIN, tcnp->cn_cred, td)) {
error = EPERM;
goto bad;
}
@@ -1232,7 +1232,7 @@ abortit:
xp->i_flag |= IN_CHANGE;
ioflag = DOINGASYNC(tvp) ? 0 : IO_SYNC;
if ((error = UFS_TRUNCATE(tvp, (off_t)0, ioflag,
- tcnp->cn_cred, tcnp->cn_proc)) != 0)
+ tcnp->cn_cred, tcnp->cn_thread)) != 0)
goto bad;
}
VN_KNOTE(tdvp, NOTE_WRITE);
@@ -1307,7 +1307,7 @@ bad:
out:
if (doingdirectory)
ip->i_flag &= ~IN_RENAME;
- if (vn_lock(fvp, LK_EXCLUSIVE, p) == 0) {
+ if (vn_lock(fvp, LK_EXCLUSIVE, td) == 0) {
ip->i_effnlink--;
ip->i_nlink--;
ip->i_flag |= IN_CHANGE;
@@ -1432,7 +1432,7 @@ ufs_mkdir(ap)
* Retrieve default ACL from parent, if any.
*/
error = VOP_GETACL(dvp, ACL_TYPE_DEFAULT, acl, cnp->cn_cred,
- cnp->cn_proc);
+ cnp->cn_thread);
switch (error) {
case 0:
/*
@@ -1500,10 +1500,10 @@ ufs_mkdir(ap)
* code that the EAs for the file need to be released?
*/
error = VOP_SETACL(tvp, ACL_TYPE_ACCESS, acl, cnp->cn_cred,
- cnp->cn_proc);
+ cnp->cn_thread);
if (error == 0)
error = VOP_SETACL(tvp, ACL_TYPE_DEFAULT, dacl,
- cnp->cn_cred, cnp->cn_proc);
+ cnp->cn_cred, cnp->cn_thread);
switch (error) {
case 0:
break;
@@ -1693,7 +1693,7 @@ ufs_rmdir(ap)
ip->i_flag |= IN_CHANGE;
ioflag = DOINGASYNC(vp) ? 0 : IO_SYNC;
error = UFS_TRUNCATE(vp, (off_t)0, ioflag, cnp->cn_cred,
- cnp->cn_proc);
+ cnp->cn_thread);
}
cache_purge(vp);
#ifdef UFS_DIRHASH
@@ -1738,7 +1738,7 @@ ufs_symlink(ap)
} else
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int *)0,
- (struct proc *)0);
+ (struct thread *)0);
if (error)
vput(vp);
return (error);
@@ -2014,7 +2014,7 @@ ufsspec_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;
@@ -2088,7 +2088,7 @@ ufsfifo_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;
@@ -2310,7 +2310,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
* Retrieve default ACL for parent, if any.
*/
error = VOP_GETACL(dvp, ACL_TYPE_DEFAULT, acl, cnp->cn_cred,
- cnp->cn_proc);
+ cnp->cn_thread);
switch (error) {
case 0:
/*
@@ -2372,7 +2372,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
* code that the EAs for the file need to be released?
*/
error = VOP_SETACL(tvp, ACL_TYPE_ACCESS, acl, cnp->cn_cred,
- cnp->cn_proc);
+ cnp->cn_thread);
switch (error) {
case 0:
break;
diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h
index 4c73aa3..85c9866 100644
--- a/sys/ufs/ufs/ufsmount.h
+++ b/sys/ufs/ufs/ufsmount.h
@@ -88,7 +88,7 @@ struct ufsmount {
int um_i_effnlink_valid; /* i_effnlink valid? */
int (*um_balloc) __P((struct vnode *, off_t, int, struct ucred *, int, struct buf **));
int (*um_blkatoff) __P((struct vnode *, off_t, char **, struct buf **));
- int (*um_truncate) __P((struct vnode *, off_t, int, struct ucred *, struct proc *));
+ int (*um_truncate) __P((struct vnode *, off_t, int, struct ucred *, struct thread *));
int (*um_update) __P((struct vnode *, int));
int (*um_valloc) __P((struct vnode *, int, struct ucred *, struct vnode **));
int (*um_vfree) __P((struct vnode *, ino_t, int));
OpenPOWER on IntegriCloud