aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_rawread.c2
-rw-r--r--sys/ufs/ffs/ffs_softdep.c2
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c2
-rw-r--r--sys/ufs/ffs/ffs_vnops.c12
-rw-r--r--sys/ufs/ufs/ufs_lookup.c4
-rw-r--r--sys/ufs/ufs/ufs_quota.c38
-rw-r--r--sys/ufs/ufs/ufs_vnops.c34
7 files changed, 49 insertions, 45 deletions
diff --git a/sys/ufs/ffs/ffs_rawread.c b/sys/ufs/ffs/ffs_rawread.c
index 9db0bee0d66d..ef0b2ff4f788 100644
--- a/sys/ufs/ffs/ffs_rawread.c
+++ b/sys/ufs/ffs/ffs_rawread.c
@@ -281,7 +281,7 @@ ffs_rawread_main(struct vnode *vp,
if (error != 0)
break;
- if (resid > bp->b_bufsize) { /* Setup fist readahead */
+ if (resid > bp->b_bufsize) { /* Setup first readahead */
if (rawreadahead != 0)
nbp = uma_zalloc(ffsraw_pbuf_zone,
M_NOWAIT);
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index b5212ce5875f..297c8257bd22 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -2148,7 +2148,7 @@ retry_flush:
#ifdef QUOTA
UFS_LOCK(ump);
for (i = 0; i < MAXQUOTAS; i++) {
- if (ump->um_quotas[i] != NULLVP)
+ if (ump->um_quotas[i] != NULL)
morework = 1;
}
UFS_UNLOCK(ump);
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 75f5fe716c31..de6b32795698 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1112,7 +1112,7 @@ ffs_mountfs(struct vnode *odevvp, struct mount *mp, struct thread *td)
ump->um_bptrtodb = fs->fs_fsbtodb;
ump->um_seqinc = fs->fs_frag;
for (i = 0; i < MAXQUOTAS; i++)
- ump->um_quotas[i] = NULLVP;
+ ump->um_quotas[i] = NULL;
#ifdef UFS_EXTATTR
ufs_extattr_uepm_init(&ump->um_extattr);
#endif
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 897a21032907..c7e2b3f4b8e6 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1550,7 +1550,7 @@ ffs_openextattr(
} */ *ap)
{
- if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK)
+ if (VN_ISDEV(ap->a_vp))
return (EOPNOTSUPP);
return (ffs_open_ea(ap->a_vp, ap->a_cred, ap->a_td));
@@ -1572,7 +1572,7 @@ ffs_closeextattr(
struct vnode *vp;
vp = ap->a_vp;
- if (vp->v_type == VCHR || vp->v_type == VBLK)
+ if (VN_ISDEV(vp))
return (EOPNOTSUPP);
if (ap->a_commit && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0)
return (EROFS);
@@ -1610,7 +1610,7 @@ ffs_deleteextattr(
vp = ap->a_vp;
ip = VTOI(vp);
- if (vp->v_type == VCHR || vp->v_type == VBLK)
+ if (VN_ISDEV(vp))
return (EOPNOTSUPP);
if (strlen(ap->a_name) == 0)
return (EINVAL);
@@ -1688,7 +1688,7 @@ ffs_getextattr(
ip = VTOI(ap->a_vp);
- if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK)
+ if (VN_ISDEV(ap->a_vp))
return (EOPNOTSUPP);
error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace,
@@ -1738,7 +1738,7 @@ ffs_listextattr(
ip = VTOI(ap->a_vp);
- if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK)
+ if (VN_ISDEV(ap->a_vp))
return (EOPNOTSUPP);
error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace,
@@ -1803,7 +1803,7 @@ ffs_setextattr(
ip = VTOI(vp);
fs = ITOFS(ip);
- if (vp->v_type == VCHR || vp->v_type == VBLK)
+ if (VN_ISDEV(vp))
return (EOPNOTSUPP);
if (strlen(ap->a_name) == 0)
return (EINVAL);
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index 9221aa63184d..419ec3de8572 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -597,7 +597,7 @@ found:
return (error);
}
if (dp->i_number == ino) {
- VREF(vdp);
+ vref(vdp);
*vpp = vdp;
vput(tdp);
return (0);
@@ -707,7 +707,7 @@ found:
*vpp = tdp;
} else if (dp->i_number == ino) {
- VREF(vdp); /* we want ourself, ie "." */
+ vref(vdp); /* we want ourself, ie "." */
/*
* When we lookup "." we still can be asked to lock it
* differently.
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index ac125902b74b..55c4bf98e502 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -467,7 +467,7 @@ chkdquot(struct inode *ip)
UFS_LOCK(ump);
for (i = 0; i < MAXQUOTAS; i++) {
- if (ump->um_quotas[i] == NULLVP ||
+ if (ump->um_quotas[i] == NULL ||
(ump->um_qflags[i] & (QTF_OPENING|QTF_CLOSING)))
continue;
if (ip->i_dquot[i] == NODQUOT) {
@@ -594,12 +594,12 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname,
ump->um_cred[type] = crhold(td->td_ucred);
ump->um_btime[type] = MAX_DQ_TIME;
ump->um_itime[type] = MAX_IQ_TIME;
- if (dqget(NULLVP, 0, ump, type, &dq) == 0) {
+ if (dqget(NULL, 0, ump, type, &dq) == 0) {
if (dq->dq_btime > 0)
ump->um_btime[type] = dq->dq_btime;
if (dq->dq_itime > 0)
ump->um_itime[type] = dq->dq_itime;
- dqrele(NULLVP, dq);
+ dqrele(NULL, dq);
}
/*
* Search vnodes associated with this mount point,
@@ -655,7 +655,7 @@ quotaoff1(struct thread *td, struct mount *mp, int type)
UFS_LOCK(ump);
KASSERT((ump->um_qflags[type] & QTF_CLOSING) != 0,
("quotaoff1: flags are invalid"));
- if ((qvp = ump->um_quotas[type]) == NULLVP) {
+ if ((qvp = ump->um_quotas[type]) == NULL) {
UFS_UNLOCK(ump);
return (0);
}
@@ -692,7 +692,7 @@ again:
* access to the closed vnode from dqget/dqsync
*/
UFS_LOCK(ump);
- ump->um_quotas[type] = NULLVP;
+ ump->um_quotas[type] = NULL;
ump->um_cred[type] = NOCRED;
UFS_UNLOCK(ump);
@@ -750,7 +750,7 @@ quotaoff_inchange(struct thread *td, struct mount *mp, int type)
UFS_LOCK(ump);
ump->um_qflags[type] &= ~QTF_CLOSING;
for (i = 0; i < MAXQUOTAS; i++)
- if (ump->um_quotas[i] != NULLVP)
+ if (ump->um_quotas[i] != NULL)
break;
if (i == MAXQUOTAS) {
MNT_ILOCK(mp);
@@ -820,11 +820,11 @@ _getquota(struct thread *td, struct mount *mp, uint64_t id, int type,
}
dq = NODQUOT;
- error = dqget(NULLVP, id, VFSTOUFS(mp), type, &dq);
+ error = dqget(NULL, id, VFSTOUFS(mp), type, &dq);
if (error)
return (error);
*dqb = dq->dq_dqb;
- dqrele(NULLVP, dq);
+ dqrele(NULL, dq);
return (error);
}
@@ -850,7 +850,7 @@ _setquota(struct thread *td, struct mount *mp, uint64_t id, int type,
ndq = NODQUOT;
ump = VFSTOUFS(mp);
- error = dqget(NULLVP, id, ump, type, &ndq);
+ error = dqget(NULL, id, ump, type, &ndq);
if (error)
return (error);
dq = ndq;
@@ -887,7 +887,7 @@ _setquota(struct thread *td, struct mount *mp, uint64_t id, int type,
dq->dq_flags &= ~DQ_FAKE;
dq->dq_flags |= DQ_MOD;
DQI_UNLOCK(dq);
- dqrele(NULLVP, dq);
+ dqrele(NULL, dq);
return (0);
}
@@ -913,7 +913,7 @@ _setuse(struct thread *td, struct mount *mp, uint64_t id, int type,
ump = VFSTOUFS(mp);
ndq = NODQUOT;
- error = dqget(NULLVP, id, ump, type, &ndq);
+ error = dqget(NULL, id, ump, type, &ndq);
if (error)
return (error);
dq = ndq;
@@ -937,7 +937,7 @@ _setuse(struct thread *td, struct mount *mp, uint64_t id, int type,
dq->dq_flags &= ~DQ_INODS;
dq->dq_flags |= DQ_MOD;
DQI_UNLOCK(dq);
- dqrele(NULLVP, dq);
+ dqrele(NULL, dq);
return (0);
}
@@ -1038,7 +1038,7 @@ getquotasize(struct thread *td, struct mount *mp, uint64_t id, int type,
int bitsize;
UFS_LOCK(ump);
- if (ump->um_quotas[type] == NULLVP ||
+ if (ump->um_quotas[type] == NULL ||
(ump->um_qflags[type] & QTF_CLOSING)) {
UFS_UNLOCK(ump);
return (EINVAL);
@@ -1067,7 +1067,7 @@ qsync(struct mount *mp)
* If not, simply return.
*/
for (i = 0; i < MAXQUOTAS; i++)
- if (ump->um_quotas[i] != NULLVP)
+ if (ump->um_quotas[i] != NULL)
break;
if (i == MAXQUOTAS)
return (0);
@@ -1114,7 +1114,7 @@ qsyncvp(struct vnode *vp)
* If not, simply return.
*/
for (i = 0; i < MAXQUOTAS; i++)
- if (ump->um_quotas[i] != NULLVP)
+ if (ump->um_quotas[i] != NULL)
break;
if (i == MAXQUOTAS)
return (0);
@@ -1278,10 +1278,10 @@ dqget(struct vnode *vp, uint64_t id, struct ufsmount *ump, int type,
struct uio auio;
int dqvplocked, error;
- if (vp != NULLVP)
+ if (vp != NULL)
ASSERT_VOP_ELOCKED(vp, "dqget");
- if (vp != NULLVP && *dqp != NODQUOT) {
+ if (vp != NULL && *dqp != NODQUOT) {
return (0);
}
@@ -1293,7 +1293,7 @@ dqget(struct vnode *vp, uint64_t id, struct ufsmount *ump, int type,
UFS_LOCK(ump);
dqvp = ump->um_quotas[type];
- if (dqvp == NULLVP || (ump->um_qflags[type] & QTF_CLOSING)) {
+ if (dqvp == NULL || (ump->um_qflags[type] & QTF_CLOSING)) {
*dqp = NODQUOT;
UFS_UNLOCK(ump);
return (EINVAL);
@@ -1561,7 +1561,7 @@ dqsync(struct vnode *vp, struct dquot *dq)
if ((ump = dq->dq_ump) == NULL)
return (0);
UFS_LOCK(ump);
- if ((dqvp = ump->um_quotas[dq->dq_type]) == NULLVP) {
+ if ((dqvp = ump->um_quotas[dq->dq_type]) == NULL) {
if (vp == NULL) {
UFS_UNLOCK(ump);
return (0);
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index ffc993aef9fc..736c5a66267e 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -156,30 +156,30 @@ ufs_itimes_locked(struct vnode *vp)
if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) == 0)
return;
- if ((vp->v_type == VBLK || vp->v_type == VCHR) && !DOINGSOFTDEP(vp))
+ if (VN_ISDEV(vp) && !DOINGSOFTDEP(vp))
UFS_INODE_SET_FLAG(ip, IN_LAZYMOD);
else if (((vp->v_mount->mnt_kern_flag &
- (MNTK_SUSPENDED | MNTK_SUSPEND)) == 0) ||
- (ip->i_flag & (IN_CHANGE | IN_UPDATE)))
+ (MNTK_SUSPENDED | MNTK_SUSPEND)) == 0) ||
+ (ip->i_flag & (IN_CHANGE | IN_UPDATE)) != 0)
UFS_INODE_SET_FLAG(ip, IN_MODIFIED);
- else if (ip->i_flag & IN_ACCESS)
+ else if ((ip->i_flag & IN_ACCESS) != 0)
UFS_INODE_SET_FLAG(ip, IN_LAZYACCESS);
vfs_timestamp(&ts);
- if (ip->i_flag & IN_ACCESS) {
+ if ((ip->i_flag & IN_ACCESS) != 0) {
DIP_SET(ip, i_atime, ts.tv_sec);
DIP_SET(ip, i_atimensec, ts.tv_nsec);
}
- if (ip->i_flag & IN_UPDATE) {
+ if ((ip->i_flag & IN_UPDATE) != 0) {
DIP_SET(ip, i_mtime, ts.tv_sec);
DIP_SET(ip, i_mtimensec, ts.tv_nsec);
}
- if (ip->i_flag & IN_CHANGE) {
+ if ((ip->i_flag & IN_CHANGE) != 0) {
DIP_SET(ip, i_ctime, ts.tv_sec);
DIP_SET(ip, i_ctimensec, ts.tv_nsec);
DIP_SET(ip, i_modrev, DIP(ip, i_modrev) + 1);
}
- out:
+out:
ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE);
}
@@ -319,7 +319,7 @@ ufs_open(struct vop_open_args *ap)
struct vnode *vp = ap->a_vp;
struct inode *ip;
- if (vp->v_type == VCHR || vp->v_type == VBLK)
+ if (VN_ISDEV(vp))
return (EOPNOTSUPP);
ip = VTOI(vp);
@@ -540,7 +540,7 @@ ufs_stat(struct vop_stat_args *ap)
sb->st_uid = ip->i_uid;
sb->st_gid = ip->i_gid;
if (I_IS_UFS1(ip)) {
- sb->st_rdev = ip->i_din1->di_rdev;
+ sb->st_rdev = VN_ISDEV(vp) ? ip->i_din1->di_rdev : NODEV;
sb->st_size = ip->i_din1->di_size;
sb->st_mtim.tv_sec = ip->i_din1->di_mtime;
sb->st_mtim.tv_nsec = ip->i_din1->di_mtimensec;
@@ -551,7 +551,7 @@ ufs_stat(struct vop_stat_args *ap)
sb->st_blocks = dbtob((uint64_t)ip->i_din1->di_blocks) / S_BLKSIZE;
sb->st_filerev = ip->i_din1->di_modrev;
} else {
- sb->st_rdev = ip->i_din2->di_rdev;
+ sb->st_rdev = VN_ISDEV(vp) ? ip->i_din2->di_rdev : NODEV;
sb->st_size = ip->i_din2->di_size;
sb->st_mtim.tv_sec = ip->i_din2->di_mtime;
sb->st_mtim.tv_nsec = ip->i_din2->di_mtimensec;
@@ -603,7 +603,7 @@ ufs_getattr(
vap->va_uid = ip->i_uid;
vap->va_gid = ip->i_gid;
if (I_IS_UFS1(ip)) {
- vap->va_rdev = ip->i_din1->di_rdev;
+ vap->va_rdev = VN_ISDEV(vp) ? ip->i_din1->di_rdev : NODEV;
vap->va_size = ip->i_din1->di_size;
vap->va_mtime.tv_sec = ip->i_din1->di_mtime;
vap->va_mtime.tv_nsec = ip->i_din1->di_mtimensec;
@@ -612,7 +612,7 @@ ufs_getattr(
vap->va_bytes = dbtob((uint64_t)ip->i_din1->di_blocks);
vap->va_filerev = ip->i_din1->di_modrev;
} else {
- vap->va_rdev = ip->i_din2->di_rdev;
+ vap->va_rdev = VN_ISDEV(vp) ? ip->i_din2->di_rdev : NODEV;
vap->va_size = ip->i_din2->di_size;
vap->va_mtime.tv_sec = ip->i_din2->di_mtime;
vap->va_mtime.tv_nsec = ip->i_din2->di_mtimensec;
@@ -2592,8 +2592,12 @@ ufs_print(
printf("\tnlink=%d, effnlink=%d, size=%jd", ip->i_nlink,
ip->i_effnlink, (intmax_t)ip->i_size);
- if (I_IS_UFS2(ip))
- printf(", extsize %d", ip->i_din2->di_extsize);
+ if (I_IS_UFS2(ip)) {
+ if (ip->i_din2 == NULL)
+ printf(", dinode=NULL (fields omitted)");
+ else
+ printf(", extsize=%d", ip->i_din2->di_extsize);
+ }
printf("\n\tgeneration=%jx, uid=%d, gid=%d, flags=0x%b\n",
(uintmax_t)ip->i_gen, ip->i_uid, ip->i_gid,
(uint32_t)ip->i_flags, PRINT_INODE_FLAGS);