aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c32
-rw-r--r--sys/ufs/ffs/ffs_balloc.c40
-rw-r--r--sys/ufs/ffs/ffs_inode.c37
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c90
-rw-r--r--sys/ufs/ffs/ffs_softdep.c124
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c4
-rw-r--r--sys/ufs/ffs/ffs_vnops.c17
-rw-r--r--sys/ufs/ffs/fs.h8
-rw-r--r--sys/ufs/ufs/dinode.h22
-rw-r--r--sys/ufs/ufs/ufs_bmap.c27
-rw-r--r--sys/ufs/ufs/ufs_lookup.c12
-rw-r--r--sys/ufs/ufs/ufs_vfsops.c2
-rw-r--r--sys/ufs/ufs/ufs_vnops.c4
13 files changed, 216 insertions, 203 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index fb719cfb20ac..e4ff2dd63d34 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -303,7 +303,7 @@ retry:
}
if (bp->b_blkno == bp->b_lblkno) {
- if (lbprev >= NDADDR)
+ if (lbprev >= UFS_NDADDR)
panic("ffs_realloccg: lbprev out of range");
bp->b_blkno = fsbtodb(fs, bprev);
}
@@ -524,7 +524,7 @@ ffs_reallocblks_ufs1(ap)
ufs_lbn_t start_lbn, end_lbn;
ufs1_daddr_t soff, newblk, blkno;
ufs2_daddr_t pref;
- struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
+ struct indir start_ap[UFS_NIADDR + 1], end_ap[UFS_NIADDR + 1], *idp;
int i, cg, len, start_lvl, end_lvl, ssize;
vp = ap->a_vp;
@@ -567,7 +567,7 @@ ffs_reallocblks_ufs1(ap)
* this for other indirect block boundaries, but it is only
* important for the first one.
*/
- if (start_lbn < NDADDR && end_lbn >= NDADDR)
+ if (start_lbn < UFS_NDADDR && end_lbn >= UFS_NDADDR)
return (ENOSPC);
/*
* If the latest allocation is in a new cylinder group, assume that
@@ -773,7 +773,7 @@ ffs_reallocblks_ufs2(ap)
struct ufsmount *ump;
ufs_lbn_t start_lbn, end_lbn;
ufs2_daddr_t soff, newblk, blkno, pref;
- struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;
+ struct indir start_ap[UFS_NIADDR + 1], end_ap[UFS_NIADDR + 1], *idp;
int i, cg, len, start_lvl, end_lvl, ssize;
vp = ap->a_vp;
@@ -816,7 +816,7 @@ ffs_reallocblks_ufs2(ap)
* this for other indirect block boundaries, but it is only
* important for the first one.
*/
- if (start_lbn < NDADDR && end_lbn >= NDADDR)
+ if (start_lbn < UFS_NDADDR && end_lbn >= UFS_NDADDR)
return (ENOSPC);
/*
* If the latest allocation is in a new cylinder group, assume that
@@ -1334,9 +1334,9 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
* If we are allocating the first indirect block, try to
* place it immediately following the last direct block.
*/
- if (indx == -1 && lbn < NDADDR + NINDIR(fs) &&
- ip->i_din1->di_db[NDADDR - 1] != 0)
- pref = ip->i_din1->di_db[NDADDR - 1] + fs->fs_frag;
+ if (indx == -1 && lbn < UFS_NDADDR + NINDIR(fs) &&
+ ip->i_din1->di_db[UFS_NDADDR - 1] != 0)
+ pref = ip->i_din1->di_db[UFS_NDADDR - 1] + fs->fs_frag;
return (pref);
}
/*
@@ -1344,7 +1344,7 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
* block and the indirect has been allocated in the data block area,
* try to place it immediately following the indirect block.
*/
- if (lbn == NDADDR) {
+ if (lbn == UFS_NDADDR) {
pref = ip->i_din1->di_ib[0];
if (pref != 0 && pref >= cgdata(fs, inocg) &&
pref < cgbase(fs, inocg + 1))
@@ -1368,7 +1368,7 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
* blocks, we try to allocate in the data area of the inode's
* cylinder group.
*/
- if (lbn < NDADDR + NINDIR(fs))
+ if (lbn < UFS_NDADDR + NINDIR(fs))
return (cgdata(fs, inocg));
/*
* Find a cylinder with greater than average number of
@@ -1439,9 +1439,9 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap)
* If we are allocating the first indirect block, try to
* place it immediately following the last direct block.
*/
- if (indx == -1 && lbn < NDADDR + NINDIR(fs) &&
- ip->i_din2->di_db[NDADDR - 1] != 0)
- pref = ip->i_din2->di_db[NDADDR - 1] + fs->fs_frag;
+ if (indx == -1 && lbn < UFS_NDADDR + NINDIR(fs) &&
+ ip->i_din2->di_db[UFS_NDADDR - 1] != 0)
+ pref = ip->i_din2->di_db[UFS_NDADDR - 1] + fs->fs_frag;
return (pref);
}
/*
@@ -1449,7 +1449,7 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap)
* block and the indirect has been allocated in the data block area,
* try to place it immediately following the indirect block.
*/
- if (lbn == NDADDR) {
+ if (lbn == UFS_NDADDR) {
pref = ip->i_din2->di_ib[0];
if (pref != 0 && pref >= cgdata(fs, inocg) &&
pref < cgbase(fs, inocg + 1))
@@ -1473,7 +1473,7 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap)
* blocks, we try to allocate in the data area of the inode's
* cylinder group.
*/
- if (lbn < NDADDR + NINDIR(fs))
+ if (lbn < UFS_NDADDR + NINDIR(fs))
return (cgdata(fs, inocg));
/*
* Find a cylinder with greater than average number of
@@ -2916,7 +2916,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
if (blksize > blkcnt)
blksize = blkcnt;
ffs_blkfree(ump, fs, ump->um_devvp, blkno,
- blksize * fs->fs_fsize, ROOTINO, VDIR, NULL);
+ blksize * fs->fs_fsize, UFS_ROOTINO, VDIR, NULL);
blkno += blksize;
blkcnt -= blksize;
blksize = fs->fs_frag;
diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c
index 0471fd6938f6..3f0bbd7ecfb3 100644
--- a/sys/ufs/ffs/ffs_balloc.c
+++ b/sys/ufs/ffs/ffs_balloc.c
@@ -97,12 +97,12 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
ufs1_daddr_t nb;
struct buf *bp, *nbp;
struct ufsmount *ump;
- struct indir indirs[NIADDR + 2];
+ struct indir indirs[UFS_NIADDR + 2];
int deallocated, osize, nsize, num, i, error;
ufs2_daddr_t newb;
ufs1_daddr_t *bap, pref;
- ufs1_daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1];
- ufs2_daddr_t *lbns_remfree, lbns[NIADDR + 1];
+ ufs1_daddr_t *allocib, *blkp, *allocblk, allociblk[UFS_NIADDR + 1];
+ ufs2_daddr_t *lbns_remfree, lbns[UFS_NIADDR + 1];
int unwindidx = -1;
int saved_inbdflush;
static struct timeval lastfail;
@@ -133,7 +133,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
* this fragment has to be extended to be a full block.
*/
lastlbn = lblkno(fs, ip->i_size);
- if (lastlbn < NDADDR && lastlbn < lbn) {
+ if (lastlbn < UFS_NDADDR && lastlbn < lbn) {
nb = lastlbn;
osize = blksize(fs, ip, nb);
if (osize < fs->fs_bsize && osize > 0) {
@@ -161,9 +161,9 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
}
}
/*
- * The first NDADDR blocks are direct blocks
+ * The first UFS_NDADDR blocks are direct blocks
*/
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
if (flags & BA_METAONLY)
panic("ffs_balloc_ufs1: BA_METAONLY for direct block");
nb = dp->di_db[lbn];
@@ -265,8 +265,9 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
bp->b_blkno = fsbtodb(fs, nb);
vfs_bio_clrbuf(bp);
if (DOINGSOFTDEP(vp)) {
- softdep_setup_allocdirect(ip, NDADDR + indirs[0].in_off,
- newb, 0, fs->fs_bsize, 0, bp);
+ softdep_setup_allocdirect(ip,
+ UFS_NDADDR + indirs[0].in_off, newb, 0,
+ fs->fs_bsize, 0, bp);
bdwrite(bp);
} else if ((flags & IO_SYNC) == 0 && DOINGASYNC(vp)) {
if (bp->b_bufsize == fs->fs_bsize)
@@ -383,7 +384,7 @@ retry:
* the file. Otherwise it has been allocated in the metadata
* area, so we want to find our own place out in the data area.
*/
- if (pref == 0 || (lbn > NDADDR && fs->fs_metaspace != 0))
+ if (pref == 0 || (lbn > UFS_NDADDR && fs->fs_metaspace != 0))
pref = ffs_blkpref_ufs1(ip, lbn, indirs[i].in_off,
&bap[0]);
error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
@@ -571,10 +572,10 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
struct fs *fs;
struct buf *bp, *nbp;
struct ufsmount *ump;
- struct indir indirs[NIADDR + 2];
+ struct indir indirs[UFS_NIADDR + 2];
ufs2_daddr_t nb, newb, *bap, pref;
- ufs2_daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1];
- ufs2_daddr_t *lbns_remfree, lbns[NIADDR + 1];
+ ufs2_daddr_t *allocib, *blkp, *allocblk, allociblk[UFS_NIADDR + 1];
+ ufs2_daddr_t *lbns_remfree, lbns[UFS_NIADDR + 1];
int deallocated, osize, nsize, num, i, error;
int unwindidx = -1;
int saved_inbdflush;
@@ -603,7 +604,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
* Check for allocating external data.
*/
if (flags & IO_EXT) {
- if (lbn >= NXADDR)
+ if (lbn >= UFS_NXADDR)
return (EFBIG);
/*
* If the next write will extend the data into a new block,
@@ -717,7 +718,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
* this fragment has to be extended to be a full block.
*/
lastlbn = lblkno(fs, ip->i_size);
- if (lastlbn < NDADDR && lastlbn < lbn) {
+ if (lastlbn < UFS_NDADDR && lastlbn < lbn) {
nb = lastlbn;
osize = blksize(fs, ip, nb);
if (osize < fs->fs_bsize && osize > 0) {
@@ -744,9 +745,9 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
}
}
/*
- * The first NDADDR blocks are direct blocks
+ * The first UFS_NDADDR blocks are direct blocks
*/
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
if (flags & BA_METAONLY)
panic("ffs_balloc_ufs2: BA_METAONLY for direct block");
nb = dp->di_db[lbn];
@@ -851,8 +852,9 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
bp->b_blkno = fsbtodb(fs, nb);
vfs_bio_clrbuf(bp);
if (DOINGSOFTDEP(vp)) {
- softdep_setup_allocdirect(ip, NDADDR + indirs[0].in_off,
- newb, 0, fs->fs_bsize, 0, bp);
+ softdep_setup_allocdirect(ip,
+ UFS_NDADDR + indirs[0].in_off, newb, 0,
+ fs->fs_bsize, 0, bp);
bdwrite(bp);
} else if ((flags & IO_SYNC) == 0 && DOINGASYNC(vp)) {
if (bp->b_bufsize == fs->fs_bsize)
@@ -970,7 +972,7 @@ retry:
* the file. Otherwise it has been allocated in the metadata
* area, so we want to find our own place out in the data area.
*/
- if (pref == 0 || (lbn > NDADDR && fs->fs_metaspace != 0))
+ if (pref == 0 || (lbn > UFS_NDADDR && fs->fs_metaspace != 0))
pref = ffs_blkpref_ufs2(ip, lbn, indirs[i].in_off,
&bap[0]);
error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 0982ddab98ac..a581742ad1dd 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -183,8 +183,9 @@ ffs_truncate(vp, length, flags, cred)
struct ucred *cred;
{
struct inode *ip;
- ufs2_daddr_t bn, lbn, lastblock, lastiblock[NIADDR], indir_lbn[NIADDR];
- ufs2_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
+ ufs2_daddr_t bn, lbn, lastblock, lastiblock[UFS_NIADDR];
+ ufs2_daddr_t indir_lbn[UFS_NIADDR], oldblks[UFS_NDADDR + UFS_NIADDR];
+ ufs2_daddr_t newblks[UFS_NDADDR + UFS_NIADDR];
ufs2_daddr_t count, blocksreleased = 0, datablocks, blkno;
struct bufobj *bo;
struct fs *fs;
@@ -260,14 +261,14 @@ ffs_truncate(vp, length, flags, cred)
osize = ip->i_din2->di_extsize;
ip->i_din2->di_blocks -= extblocks;
ip->i_din2->di_extsize = 0;
- for (i = 0; i < NXADDR; i++) {
+ for (i = 0; i < UFS_NXADDR; i++) {
oldblks[i] = ip->i_din2->di_extb[i];
ip->i_din2->di_extb[i] = 0;
}
ip->i_flag |= IN_CHANGE;
if ((error = ffs_update(vp, waitforupdate)))
return (error);
- for (i = 0; i < NXADDR; i++) {
+ for (i = 0; i < UFS_NXADDR; i++) {
if (oldblks[i] == 0)
continue;
ffs_blkfree(ump, fs, ITODEVVP(ip), oldblks[i],
@@ -338,14 +339,14 @@ ffs_truncate(vp, length, flags, cred)
lbn = lblkno(fs, length - 1);
if (length == 0) {
blkno = -1;
- } else if (lbn < NDADDR) {
+ } else if (lbn < UFS_NDADDR) {
blkno = DIP(ip, i_db[lbn]);
} else {
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn), fs->fs_bsize,
cred, BA_METAONLY, &bp);
if (error)
return (error);
- indiroff = (lbn - NDADDR) % NINDIR(fs);
+ indiroff = (lbn - UFS_NDADDR) % NINDIR(fs);
if (I_IS_UFS1(ip))
blkno = ((ufs1_daddr_t *)(bp->b_data))[indiroff];
else
@@ -428,7 +429,7 @@ ffs_truncate(vp, length, flags, cred)
* so that we do not get a soft updates inconsistency
* when we create the fragment below.
*/
- if (DOINGSOFTDEP(vp) && lbn < NDADDR &&
+ if (DOINGSOFTDEP(vp) && lbn < UFS_NDADDR &&
fragroundup(fs, blkoff(fs, length)) < fs->fs_bsize &&
(error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0)
return (error);
@@ -456,7 +457,7 @@ ffs_truncate(vp, length, flags, cred)
* the file is truncated to 0.
*/
lastblock = lblkno(fs, length + fs->fs_bsize - 1) - 1;
- lastiblock[SINGLE] = lastblock - NDADDR;
+ lastiblock[SINGLE] = lastblock - UFS_NDADDR;
lastiblock[DOUBLE] = lastiblock[SINGLE] - NINDIR(fs);
lastiblock[TRIPLE] = lastiblock[DOUBLE] - NINDIR(fs) * NINDIR(fs);
nblocks = btodb(fs->fs_bsize);
@@ -467,13 +468,13 @@ ffs_truncate(vp, length, flags, cred)
* normalized to -1 for calls to ffs_indirtrunc below.
*/
for (level = TRIPLE; level >= SINGLE; level--) {
- oldblks[NDADDR + level] = DIP(ip, i_ib[level]);
+ oldblks[UFS_NDADDR + level] = DIP(ip, i_ib[level]);
if (lastiblock[level] < 0) {
DIP_SET(ip, i_ib[level], 0);
lastiblock[level] = -1;
}
}
- for (i = 0; i < NDADDR; i++) {
+ for (i = 0; i < UFS_NDADDR; i++) {
oldblks[i] = DIP(ip, i_db[i]);
if (i > lastblock)
DIP_SET(ip, i_db[i], 0);
@@ -487,13 +488,13 @@ ffs_truncate(vp, length, flags, cred)
* Note that we save the new block configuration so we can check it
* when we are done.
*/
- for (i = 0; i < NDADDR; i++) {
+ for (i = 0; i < UFS_NDADDR; i++) {
newblks[i] = DIP(ip, i_db[i]);
DIP_SET(ip, i_db[i], oldblks[i]);
}
- for (i = 0; i < NIADDR; i++) {
- newblks[NDADDR + i] = DIP(ip, i_ib[i]);
- DIP_SET(ip, i_ib[i], oldblks[NDADDR + i]);
+ for (i = 0; i < UFS_NIADDR; i++) {
+ newblks[UFS_NDADDR + i] = DIP(ip, i_ib[i]);
+ DIP_SET(ip, i_ib[i], oldblks[UFS_NDADDR + i]);
}
ip->i_size = osize;
DIP_SET(ip, i_size, osize);
@@ -505,7 +506,7 @@ ffs_truncate(vp, length, flags, cred)
/*
* Indirect blocks first.
*/
- indir_lbn[SINGLE] = -NDADDR;
+ indir_lbn[SINGLE] = -UFS_NDADDR;
indir_lbn[DOUBLE] = indir_lbn[SINGLE] - NINDIR(fs) - 1;
indir_lbn[TRIPLE] = indir_lbn[DOUBLE] - NINDIR(fs) * NINDIR(fs) - 1;
for (level = TRIPLE; level >= SINGLE; level--) {
@@ -531,7 +532,7 @@ ffs_truncate(vp, length, flags, cred)
/*
* All whole direct blocks or frags.
*/
- for (i = NDADDR - 1; i > lastblock; i--) {
+ for (i = UFS_NDADDR - 1; i > lastblock; i--) {
long bsize;
bn = DIP(ip, i_db[i]);
@@ -579,9 +580,9 @@ ffs_truncate(vp, length, flags, cred)
done:
#ifdef INVARIANTS
for (level = SINGLE; level <= TRIPLE; level++)
- if (newblks[NDADDR + level] != DIP(ip, i_ib[level]))
+ if (newblks[UFS_NDADDR + level] != DIP(ip, i_ib[level]))
panic("ffs_truncate1");
- for (i = 0; i < NDADDR; i++)
+ for (i = 0; i < UFS_NDADDR; i++)
if (newblks[i] != DIP(ip, i_db[i]))
panic("ffs_truncate2");
BO_LOCK(bo);
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 549c44e34735..09f972c097d8 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -330,7 +330,7 @@ restart:
* Allocate all indirect blocks and mark all of them as not
* needing to be copied.
*/
- for (blkno = NDADDR; blkno < numblks; blkno += NINDIR(fs)) {
+ for (blkno = UFS_NDADDR; blkno < numblks; blkno += NINDIR(fs)) {
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno),
fs->fs_bsize, td->td_ucred, BA_METAONLY, &ibp);
if (error)
@@ -576,7 +576,7 @@ loop:
*/
blkno = 0;
loc = howmany(xp->i_size, fs->fs_bsize) - 1;
- if (loc < NDADDR) {
+ if (loc < UFS_NDADDR) {
len = fragroundup(fs, blkoff(fs, xp->i_size));
if (len != 0 && len < fs->fs_bsize) {
ffs_blkfree(ump, copy_fs, vp,
@@ -816,7 +816,7 @@ out1:
* update the non-integrity-critical time fields and
* allocated-block count.
*/
- for (blockno = 0; blockno < NDADDR; blockno++) {
+ for (blockno = 0; blockno < UFS_NDADDR; blockno++) {
if (DIP(ip, i_db[blockno]) != 0)
continue;
error = UFS_BALLOC(vp, lblktosize(fs, blockno),
@@ -923,8 +923,8 @@ cgaccount(cg, vp, nbp, passno)
if (base + len >= numblks)
len = numblks - base - 1;
loc = 0;
- if (base < NDADDR) {
- for ( ; loc < NDADDR; loc++) {
+ if (base < UFS_NDADDR) {
+ for ( ; loc < UFS_NDADDR; loc++) {
if (ffs_isblock(fs, cg_blksfree(cgp), loc))
DIP_SET(ip, i_db[loc], BLK_NOCOPY);
else if (passno == 2 && DIP(ip, i_db[loc])== BLK_NOCOPY)
@@ -938,7 +938,7 @@ cgaccount(cg, vp, nbp, passno)
if (error) {
return (error);
}
- indiroff = (base + loc - NDADDR) % NINDIR(fs);
+ indiroff = (base + loc - UFS_NDADDR) % NINDIR(fs);
for ( ; loc < len; loc++, indiroff++) {
if (indiroff >= NINDIR(fs)) {
if (passno == 2)
@@ -1010,7 +1010,7 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype, clearmode)
*/
lbn = fragstoblks(fs, ino_to_fsba(fs, cancelip->i_number));
blkno = 0;
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
blkno = VTOI(snapvp)->i_din1->di_db[lbn];
} else {
if (DOINGSOFTDEP(snapvp))
@@ -1021,7 +1021,7 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype, clearmode)
td->td_pflags &= ~TDP_COWINPROGRESS;
if (error)
return (error);
- indiroff = (lbn - NDADDR) % NINDIR(fs);
+ indiroff = (lbn - UFS_NDADDR) % NINDIR(fs);
blkno = ((ufs1_daddr_t *)(bp->b_data))[indiroff];
bqrelse(bp);
}
@@ -1047,7 +1047,7 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype, clearmode)
dip->di_size = 0;
dip->di_blocks = 0;
dip->di_flags &= ~SF_SNAPSHOT;
- bzero(&dip->di_db[0], (NDADDR + NIADDR) * sizeof(ufs1_daddr_t));
+ bzero(&dip->di_db[0], (UFS_NDADDR + UFS_NIADDR) * sizeof(ufs1_daddr_t));
bdwrite(bp);
/*
* Now go through and expunge all the blocks in the file
@@ -1055,16 +1055,16 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype, clearmode)
*/
numblks = howmany(cancelip->i_size, fs->fs_bsize);
if ((error = (*acctfunc)(snapvp, &cancelip->i_din1->di_db[0],
- &cancelip->i_din1->di_db[NDADDR], fs, 0, expungetype)))
+ &cancelip->i_din1->di_db[UFS_NDADDR], fs, 0, expungetype)))
return (error);
if ((error = (*acctfunc)(snapvp, &cancelip->i_din1->di_ib[0],
- &cancelip->i_din1->di_ib[NIADDR], fs, -1, expungetype)))
+ &cancelip->i_din1->di_ib[UFS_NIADDR], fs, -1, expungetype)))
return (error);
blksperindir = 1;
- lbn = -NDADDR;
- len = numblks - NDADDR;
- rlbn = NDADDR;
- for (i = 0; len > 0 && i < NIADDR; i++) {
+ lbn = -UFS_NDADDR;
+ len = numblks - UFS_NDADDR;
+ rlbn = UFS_NDADDR;
+ for (i = 0; len > 0 && i < UFS_NIADDR; i++) {
error = indiracct_ufs1(snapvp, ITOV(cancelip), i,
cancelip->i_din1->di_ib[i], lbn, rlbn, len,
blksperindir, fs, acctfunc, expungetype);
@@ -1100,7 +1100,7 @@ indiracct_ufs1(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks,
{
int error, num, i;
ufs_lbn_t subblksperindir;
- struct indir indirs[NIADDR + 2];
+ struct indir indirs[UFS_NIADDR + 2];
ufs1_daddr_t last, *bap;
struct buf *bp;
@@ -1196,7 +1196,7 @@ snapacct_ufs1(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
if (blkno == 0 || blkno == BLK_NOCOPY || blkno == BLK_SNAP)
continue;
lbn = fragstoblks(fs, blkno);
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
blkp = &ip->i_din1->di_db[lbn];
ip->i_flag |= IN_CHANGE | IN_UPDATE;
} else {
@@ -1205,7 +1205,7 @@ snapacct_ufs1(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
if (error)
return (error);
blkp = &((ufs1_daddr_t *)(ibp->b_data))
- [(lbn - NDADDR) % NINDIR(fs)];
+ [(lbn - UFS_NDADDR) % NINDIR(fs)];
}
/*
* If we are expunging a snapshot vnode and we
@@ -1214,13 +1214,13 @@ snapacct_ufs1(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
* we took our current snapshot and can be ignored.
*/
if (expungetype == BLK_SNAP && *blkp == BLK_NOCOPY) {
- if (lbn >= NDADDR)
+ if (lbn >= UFS_NDADDR)
brelse(ibp);
} else {
if (*blkp != 0)
panic("snapacct_ufs1: bad block");
*blkp = expungetype;
- if (lbn >= NDADDR)
+ if (lbn >= UFS_NDADDR)
bdwrite(ibp);
}
}
@@ -1294,7 +1294,7 @@ expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype, clearmode)
*/
lbn = fragstoblks(fs, ino_to_fsba(fs, cancelip->i_number));
blkno = 0;
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
blkno = VTOI(snapvp)->i_din2->di_db[lbn];
} else {
if (DOINGSOFTDEP(snapvp))
@@ -1305,7 +1305,7 @@ expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype, clearmode)
td->td_pflags &= ~TDP_COWINPROGRESS;
if (error)
return (error);
- indiroff = (lbn - NDADDR) % NINDIR(fs);
+ indiroff = (lbn - UFS_NDADDR) % NINDIR(fs);
blkno = ((ufs2_daddr_t *)(bp->b_data))[indiroff];
bqrelse(bp);
}
@@ -1331,7 +1331,7 @@ expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype, clearmode)
dip->di_size = 0;
dip->di_blocks = 0;
dip->di_flags &= ~SF_SNAPSHOT;
- bzero(&dip->di_db[0], (NDADDR + NIADDR) * sizeof(ufs2_daddr_t));
+ bzero(&dip->di_db[0], (UFS_NDADDR + UFS_NIADDR) * sizeof(ufs2_daddr_t));
bdwrite(bp);
/*
* Now go through and expunge all the blocks in the file
@@ -1339,16 +1339,16 @@ expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype, clearmode)
*/
numblks = howmany(cancelip->i_size, fs->fs_bsize);
if ((error = (*acctfunc)(snapvp, &cancelip->i_din2->di_db[0],
- &cancelip->i_din2->di_db[NDADDR], fs, 0, expungetype)))
+ &cancelip->i_din2->di_db[UFS_NDADDR], fs, 0, expungetype)))
return (error);
if ((error = (*acctfunc)(snapvp, &cancelip->i_din2->di_ib[0],
- &cancelip->i_din2->di_ib[NIADDR], fs, -1, expungetype)))
+ &cancelip->i_din2->di_ib[UFS_NIADDR], fs, -1, expungetype)))
return (error);
blksperindir = 1;
- lbn = -NDADDR;
- len = numblks - NDADDR;
- rlbn = NDADDR;
- for (i = 0; len > 0 && i < NIADDR; i++) {
+ lbn = -UFS_NDADDR;
+ len = numblks - UFS_NDADDR;
+ rlbn = UFS_NDADDR;
+ for (i = 0; len > 0 && i < UFS_NIADDR; i++) {
error = indiracct_ufs2(snapvp, ITOV(cancelip), i,
cancelip->i_din2->di_ib[i], lbn, rlbn, len,
blksperindir, fs, acctfunc, expungetype);
@@ -1384,7 +1384,7 @@ indiracct_ufs2(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks,
{
int error, num, i;
ufs_lbn_t subblksperindir;
- struct indir indirs[NIADDR + 2];
+ struct indir indirs[UFS_NIADDR + 2];
ufs2_daddr_t last, *bap;
struct buf *bp;
@@ -1480,7 +1480,7 @@ snapacct_ufs2(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
if (blkno == 0 || blkno == BLK_NOCOPY || blkno == BLK_SNAP)
continue;
lbn = fragstoblks(fs, blkno);
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
blkp = &ip->i_din2->di_db[lbn];
ip->i_flag |= IN_CHANGE | IN_UPDATE;
} else {
@@ -1489,7 +1489,7 @@ snapacct_ufs2(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
if (error)
return (error);
blkp = &((ufs2_daddr_t *)(ibp->b_data))
- [(lbn - NDADDR) % NINDIR(fs)];
+ [(lbn - UFS_NDADDR) % NINDIR(fs)];
}
/*
* If we are expunging a snapshot vnode and we
@@ -1498,13 +1498,13 @@ snapacct_ufs2(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
* we took our current snapshot and can be ignored.
*/
if (expungetype == BLK_SNAP && *blkp == BLK_NOCOPY) {
- if (lbn >= NDADDR)
+ if (lbn >= UFS_NDADDR)
brelse(ibp);
} else {
if (*blkp != 0)
panic("snapacct_ufs2: bad block");
*blkp = expungetype;
- if (lbn >= NDADDR)
+ if (lbn >= UFS_NDADDR)
bdwrite(ibp);
}
}
@@ -1639,7 +1639,7 @@ ffs_snapremove(vp)
* Clear all BLK_NOCOPY fields. Pass any block claims to other
* snapshots that want them (see ffs_snapblkfree below).
*/
- for (blkno = 1; blkno < NDADDR; blkno++) {
+ for (blkno = 1; blkno < UFS_NDADDR; blkno++) {
dblk = DIP(ip, i_db[blkno]);
if (dblk == 0)
continue;
@@ -1654,7 +1654,7 @@ ffs_snapremove(vp)
}
}
numblks = howmany(ip->i_size, fs->fs_bsize);
- for (blkno = NDADDR; blkno < numblks; blkno += NINDIR(fs)) {
+ for (blkno = UFS_NDADDR; blkno < numblks; blkno += NINDIR(fs)) {
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno),
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
if (error)
@@ -1771,7 +1771,7 @@ retry:
/*
* Lookup block being written.
*/
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
blkno = DIP(ip, i_db[lbn]);
} else {
td->td_pflags |= TDP_COWINPROGRESS;
@@ -1780,7 +1780,7 @@ retry:
td->td_pflags &= ~TDP_COWINPROGRESS;
if (error)
break;
- indiroff = (lbn - NDADDR) % NINDIR(fs);
+ indiroff = (lbn - UFS_NDADDR) % NINDIR(fs);
if (I_IS_UFS1(ip))
blkno=((ufs1_daddr_t *)(ibp->b_data))[indiroff];
else
@@ -1803,7 +1803,7 @@ retry:
*/
if (claimedblk)
panic("snapblkfree: inconsistent block type");
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
DIP_SET(ip, i_db[lbn], BLK_NOCOPY);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
} else if (I_IS_UFS1(ip)) {
@@ -1822,7 +1822,7 @@ retry:
* (default), or does not care about the block,
* it is not needed.
*/
- if (lbn >= NDADDR)
+ if (lbn >= UFS_NDADDR)
bqrelse(ibp);
continue;
}
@@ -1846,13 +1846,13 @@ retry:
* the work to the inode or indirect being written.
*/
if (wkhd != NULL) {
- if (lbn < NDADDR)
+ if (lbn < UFS_NDADDR)
softdep_inode_append(ip,
curthread->td_ucred, wkhd);
else
softdep_buf_append(ibp, wkhd);
}
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
DIP_SET(ip, i_db[lbn], bno);
} else if (I_IS_UFS1(ip)) {
((ufs1_daddr_t *)(ibp->b_data))[indiroff] = bno;
@@ -1866,7 +1866,7 @@ retry:
lockmgr(vp->v_vnlock, LK_RELEASE, NULL);
return (1);
}
- if (lbn >= NDADDR)
+ if (lbn >= UFS_NDADDR)
bqrelse(ibp);
/*
* Allocate the block into which to do the copy. Note that this
@@ -2327,7 +2327,7 @@ ffs_copyonwrite(devvp, bp)
* will never require any additional allocations for the
* snapshot inode.
*/
- if (lbn < NDADDR) {
+ if (lbn < UFS_NDADDR) {
blkno = DIP(ip, i_db[lbn]);
} else {
td->td_pflags |= TDP_COWINPROGRESS | TDP_NORUNNINGBUF;
@@ -2336,7 +2336,7 @@ ffs_copyonwrite(devvp, bp)
td->td_pflags &= ~TDP_COWINPROGRESS;
if (error)
break;
- indiroff = (lbn - NDADDR) % NINDIR(fs);
+ indiroff = (lbn - UFS_NDADDR) % NINDIR(fs);
if (I_IS_UFS1(ip))
blkno=((ufs1_daddr_t *)(ibp->b_data))[indiroff];
else
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 94ac101094e3..ea0242d03e80 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -2732,7 +2732,7 @@ softdep_journal_lookup(mp, vpp)
ino_t sujournal;
int error;
- error = VFS_VGET(mp, ROOTINO, LK_EXCLUSIVE, &dvp);
+ error = VFS_VGET(mp, UFS_ROOTINO, LK_EXCLUSIVE, &dvp);
if (error)
return (error);
bzero(&cnp, sizeof(cnp));
@@ -4133,8 +4133,8 @@ newfreework(ump, freeblks, parent, lbn, nb, frags, off, journal)
freework->fw_blkno = nb;
freework->fw_frags = frags;
freework->fw_indir = NULL;
- freework->fw_ref = (MOUNTEDSUJ(UFSTOVFS(ump)) == 0 || lbn >= -NXADDR)
- ? 0 : NINDIR(ump->um_fs) + 1;
+ freework->fw_ref = (MOUNTEDSUJ(UFSTOVFS(ump)) == 0 ||
+ lbn >= -UFS_NXADDR) ? 0 : NINDIR(ump->um_fs) + 1;
freework->fw_start = freework->fw_off = off;
if (journal)
newjfreeblk(freeblks, lbn, nb, frags);
@@ -5296,7 +5296,7 @@ softdep_setup_allocdirect(ip, off, newblkno, oldblkno, newsize, oldsize, bp)
"off %jd newsize %ld oldsize %d",
ip->i_number, newblkno, oldblkno, off, newsize, oldsize);
ACQUIRE_LOCK(ITOUMP(ip));
- if (off >= NDADDR) {
+ if (off >= UFS_NDADDR) {
if (lbn > 0)
panic("softdep_setup_allocdirect: bad lbn %jd, off %jd",
lbn, off);
@@ -5464,7 +5464,7 @@ allocdirect_merge(adphead, newadp, oldadp)
LOCK_OWNED(VFSTOUFS(newadp->ad_list.wk_mp));
if (newadp->ad_oldblkno != oldadp->ad_newblkno ||
newadp->ad_oldsize != oldadp->ad_newsize ||
- newadp->ad_offset >= NDADDR)
+ newadp->ad_offset >= UFS_NDADDR)
panic("%s %jd != new %jd || old size %ld != new %ld",
"allocdirect_merge: old blkno",
(intmax_t)newadp->ad_oldblkno,
@@ -5669,8 +5669,8 @@ softdep_setup_allocext(ip, off, newblkno, oldblkno, newsize, oldsize, bp)
ump = VFSTOUFS(mp);
KASSERT(MOUNTEDSOFTDEP(mp) != 0,
("softdep_setup_allocext called on non-softdep filesystem"));
- KASSERT(off < NXADDR, ("softdep_setup_allocext: lbn %lld > NXADDR",
- (long long)off));
+ KASSERT(off < UFS_NXADDR,
+ ("softdep_setup_allocext: lbn %lld > UFS_NXADDR", (long long)off));
lbn = bp->b_lblkno;
if (oldblkno && oldblkno != newblkno)
@@ -6430,12 +6430,12 @@ blkcount(fs, datablocks, length)
totblks = 0;
numblks = howmany(length, fs->fs_bsize);
- if (numblks <= NDADDR) {
+ if (numblks <= UFS_NDADDR) {
totblks = howmany(length, fs->fs_fsize);
goto out;
}
totblks = blkstofrags(fs, numblks);
- numblks -= NDADDR;
+ numblks -= UFS_NDADDR;
/*
* Count all single, then double, then triple indirects required.
* Subtracting one indirects worth of blocks for each pass
@@ -6553,12 +6553,12 @@ softdep_journal_freeblocks(ip, cred, length, flags)
/*
* Compute frags we are keeping in lastlbn. 0 means all.
*/
- if (lastlbn >= 0 && lastlbn < NDADDR) {
+ if (lastlbn >= 0 && lastlbn < UFS_NDADDR) {
frags = fragroundup(fs, lastoff);
/* adp offset of last valid allocdirect. */
iboff = lastlbn;
} else if (lastlbn > 0)
- iboff = NDADDR;
+ iboff = UFS_NDADDR;
if (fs->fs_magic == FS_UFS2_MAGIC)
extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize));
/*
@@ -6570,9 +6570,10 @@ softdep_journal_freeblocks(ip, cred, length, flags)
/*
* Handle truncation of whole direct and indirect blocks.
*/
- for (i = iboff + 1; i < NDADDR; i++)
+ for (i = iboff + 1; i < UFS_NDADDR; i++)
setup_freedirect(freeblks, ip, i, needj);
- for (i = 0, tmpval = NINDIR(fs), lbn = NDADDR; i < NIADDR;
+ for (i = 0, tmpval = NINDIR(fs), lbn = UFS_NDADDR;
+ i < UFS_NIADDR;
i++, lbn += tmpval, tmpval *= NINDIR(fs)) {
/* Release a whole indirect tree. */
if (lbn > lastlbn) {
@@ -6580,7 +6581,7 @@ softdep_journal_freeblocks(ip, cred, length, flags)
needj);
continue;
}
- iboff = i + NDADDR;
+ iboff = i + UFS_NDADDR;
/*
* Traverse partially truncated indirect tree.
*/
@@ -6614,7 +6615,7 @@ softdep_journal_freeblocks(ip, cred, length, flags)
* handling indirect blocks. Non-indirects need no extra
* journaling.
*/
- if (length != 0 && lastlbn >= NDADDR) {
+ if (length != 0 && lastlbn >= UFS_NDADDR) {
ip->i_flag |= IN_TRUNCATED;
newjtrunc(freeblks, length, 0);
}
@@ -6626,7 +6627,7 @@ softdep_journal_freeblocks(ip, cred, length, flags)
freeblks->fb_len = length;
}
if ((flags & IO_EXT) != 0) {
- for (i = 0; i < NXADDR; i++)
+ for (i = 0; i < UFS_NXADDR; i++)
setup_freeext(freeblks, ip, i, needj);
ip->i_din2->di_extsize = 0;
datablocks += extblocks;
@@ -6877,9 +6878,10 @@ softdep_setup_freeblocks(ip, length, flags)
if (fs->fs_magic == FS_UFS2_MAGIC)
extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize));
if ((flags & IO_NORMAL) != 0) {
- for (i = 0; i < NDADDR; i++)
+ for (i = 0; i < UFS_NDADDR; i++)
setup_freedirect(freeblks, ip, i, 0);
- for (i = 0, tmpval = NINDIR(fs), lbn = NDADDR; i < NIADDR;
+ for (i = 0, tmpval = NINDIR(fs), lbn = UFS_NDADDR;
+ i < UFS_NIADDR;
i++, lbn += tmpval, tmpval *= NINDIR(fs))
setup_freeindir(freeblks, ip, i, -lbn -i, 0);
ip->i_size = 0;
@@ -6887,7 +6889,7 @@ softdep_setup_freeblocks(ip, length, flags)
datablocks = DIP(ip, i_blocks) - extblocks;
}
if ((flags & IO_EXT) != 0) {
- for (i = 0; i < NXADDR; i++)
+ for (i = 0; i < UFS_NXADDR; i++)
setup_freeext(freeblks, ip, i, 0);
ip->i_din2->di_extsize = 0;
datablocks += extblocks;
@@ -7022,9 +7024,9 @@ trunc_pages(ip, length, extblocks, flags)
* to verify how many levels are required.
*/
lbn = lblkno(fs, length);
- if (lbn >= NDADDR) {
+ if (lbn >= UFS_NDADDR) {
/* Calculate the virtual lbn of the triple indirect. */
- lbn = -lbn - (NIADDR - 1);
+ lbn = -lbn - (UFS_NIADDR - 1);
end = OFF_TO_IDX(lblktosize(fs, lbn));
} else
end = extend;
@@ -7753,7 +7755,7 @@ freework_freeblock(freework)
* blocks to expire so that we know the checker will not confuse
* a re-allocated indirect block with its old contents.
*/
- if (needj && freework->fw_lbn <= -NDADDR)
+ if (needj && freework->fw_lbn <= -UFS_NDADDR)
indirblk_insert(freework);
/*
* If we are canceling an existing jnewblk pass it to the free
@@ -7926,7 +7928,7 @@ handle_workitem_freeblocks(freeblks, flags)
case D_FREEWORK:
freework = WK_FREEWORK(wk);
- if (freework->fw_lbn <= -NDADDR)
+ if (freework->fw_lbn <= -UFS_NDADDR)
handle_workitem_indirblk(freework);
else
freework_freeblock(freework);
@@ -8476,7 +8478,7 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp, isnewblk)
/*
* Whiteouts have no dependencies.
*/
- if (newinum == WINO) {
+ if (newinum == UFS_WINO) {
if (newdirbp != NULL)
bdwrite(newdirbp);
return (0);
@@ -8493,7 +8495,7 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp, isnewblk)
dap->da_newinum = newinum;
dap->da_state = ATTACHED;
LIST_INIT(&dap->da_jwork);
- isindir = bp->b_lblkno >= NDADDR;
+ isindir = bp->b_lblkno >= UFS_NDADDR;
newdirblk = NULL;
if (isnewblk &&
(isindir ? blkoff(fs, diroffset) : fragoff(fs, diroffset)) == 0) {
@@ -9306,7 +9308,7 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir)
/*
* Whiteouts do not need diradd dependencies.
*/
- if (newinum != WINO) {
+ if (newinum != UFS_WINO) {
dap = malloc(sizeof(struct diradd),
M_DIRADD, M_SOFTDEP_FLAGS|M_ZERO);
workitem_alloc(&dap->da_list, D_DIRADD, mp);
@@ -9340,7 +9342,7 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir)
* Whiteouts have no additional dependencies,
* so just put the dirrem on the correct list.
*/
- if (newinum == WINO) {
+ if (newinum == UFS_WINO) {
if ((dirrem->dm_state & COMPLETE) == 0) {
LIST_INSERT_HEAD(&pagedep->pd_dirremhd, dirrem,
dm_next);
@@ -10217,19 +10219,19 @@ initiate_write_inodeblock_ufs1(inodedep, bp)
if (deplist != 0 && prevlbn >= adp->ad_offset)
panic("softdep_write_inodeblock: lbn order");
prevlbn = adp->ad_offset;
- if (adp->ad_offset < NDADDR &&
+ if (adp->ad_offset < UFS_NDADDR &&
dp->di_db[adp->ad_offset] != adp->ad_newblkno)
panic("%s: direct pointer #%jd mismatch %d != %jd",
"softdep_write_inodeblock",
(intmax_t)adp->ad_offset,
dp->di_db[adp->ad_offset],
(intmax_t)adp->ad_newblkno);
- if (adp->ad_offset >= NDADDR &&
- dp->di_ib[adp->ad_offset - NDADDR] != adp->ad_newblkno)
+ if (adp->ad_offset >= UFS_NDADDR &&
+ dp->di_ib[adp->ad_offset - UFS_NDADDR] != adp->ad_newblkno)
panic("%s: indirect pointer #%jd mismatch %d != %jd",
"softdep_write_inodeblock",
- (intmax_t)adp->ad_offset - NDADDR,
- dp->di_ib[adp->ad_offset - NDADDR],
+ (intmax_t)adp->ad_offset - UFS_NDADDR,
+ dp->di_ib[adp->ad_offset - UFS_NDADDR],
(intmax_t)adp->ad_newblkno);
deplist |= 1 << adp->ad_offset;
if ((adp->ad_state & ATTACHED) == 0)
@@ -10247,24 +10249,24 @@ initiate_write_inodeblock_ufs1(inodedep, bp)
*/
for (lastadp = NULL, adp = TAILQ_FIRST(&inodedep->id_inoupdt); adp;
lastadp = adp, adp = TAILQ_NEXT(adp, ad_next)) {
- if (adp->ad_offset >= NDADDR)
+ if (adp->ad_offset >= UFS_NDADDR)
break;
dp->di_db[adp->ad_offset] = adp->ad_oldblkno;
/* keep going until hitting a rollback to a frag */
if (adp->ad_oldsize == 0 || adp->ad_oldsize == fs->fs_bsize)
continue;
dp->di_size = fs->fs_bsize * adp->ad_offset + adp->ad_oldsize;
- for (i = adp->ad_offset + 1; i < NDADDR; i++) {
+ for (i = adp->ad_offset + 1; i < UFS_NDADDR; i++) {
#ifdef INVARIANTS
if (dp->di_db[i] != 0 && (deplist & (1 << i)) == 0)
panic("softdep_write_inodeblock: lost dep1");
#endif /* INVARIANTS */
dp->di_db[i] = 0;
}
- for (i = 0; i < NIADDR; i++) {
+ for (i = 0; i < UFS_NIADDR; i++) {
#ifdef INVARIANTS
if (dp->di_ib[i] != 0 &&
- (deplist & ((1 << NDADDR) << i)) == 0)
+ (deplist & ((1 << UFS_NDADDR) << i)) == 0)
panic("softdep_write_inodeblock: lost dep2");
#endif /* INVARIANTS */
dp->di_ib[i] = 0;
@@ -10296,7 +10298,7 @@ initiate_write_inodeblock_ufs1(inodedep, bp)
* postpone fsck, we are stuck with this argument.
*/
for (; adp; adp = TAILQ_NEXT(adp, ad_next))
- dp->di_ib[adp->ad_offset - NDADDR] = 0;
+ dp->di_ib[adp->ad_offset - UFS_NDADDR] = 0;
}
/*
@@ -10416,7 +10418,7 @@ initiate_write_inodeblock_ufs2(inodedep, bp)
if (adp->ad_oldsize == 0 || adp->ad_oldsize == fs->fs_bsize)
continue;
dp->di_extsize = fs->fs_bsize * adp->ad_offset + adp->ad_oldsize;
- for (i = adp->ad_offset + 1; i < NXADDR; i++) {
+ for (i = adp->ad_offset + 1; i < UFS_NXADDR; i++) {
#ifdef INVARIANTS
if (dp->di_extb[i] != 0 && (deplist & (1 << i)) == 0)
panic("softdep_write_inodeblock: lost dep1");
@@ -10450,19 +10452,19 @@ initiate_write_inodeblock_ufs2(inodedep, bp)
if ((adp->ad_state & ATTACHED) == 0)
panic("inodedep %p and adp %p not attached", inodedep, adp);
prevlbn = adp->ad_offset;
- if (adp->ad_offset < NDADDR &&
+ if (adp->ad_offset < UFS_NDADDR &&
dp->di_db[adp->ad_offset] != adp->ad_newblkno)
panic("%s: direct pointer #%jd mismatch %jd != %jd",
"softdep_write_inodeblock",
(intmax_t)adp->ad_offset,
(intmax_t)dp->di_db[adp->ad_offset],
(intmax_t)adp->ad_newblkno);
- if (adp->ad_offset >= NDADDR &&
- dp->di_ib[adp->ad_offset - NDADDR] != adp->ad_newblkno)
+ if (adp->ad_offset >= UFS_NDADDR &&
+ dp->di_ib[adp->ad_offset - UFS_NDADDR] != adp->ad_newblkno)
panic("%s indirect pointer #%jd mismatch %jd != %jd",
"softdep_write_inodeblock:",
- (intmax_t)adp->ad_offset - NDADDR,
- (intmax_t)dp->di_ib[adp->ad_offset - NDADDR],
+ (intmax_t)adp->ad_offset - UFS_NDADDR,
+ (intmax_t)dp->di_ib[adp->ad_offset - UFS_NDADDR],
(intmax_t)adp->ad_newblkno);
deplist |= 1 << adp->ad_offset;
if ((adp->ad_state & ATTACHED) == 0)
@@ -10480,24 +10482,24 @@ initiate_write_inodeblock_ufs2(inodedep, bp)
*/
for (lastadp = NULL, adp = TAILQ_FIRST(&inodedep->id_inoupdt); adp;
lastadp = adp, adp = TAILQ_NEXT(adp, ad_next)) {
- if (adp->ad_offset >= NDADDR)
+ if (adp->ad_offset >= UFS_NDADDR)
break;
dp->di_db[adp->ad_offset] = adp->ad_oldblkno;
/* keep going until hitting a rollback to a frag */
if (adp->ad_oldsize == 0 || adp->ad_oldsize == fs->fs_bsize)
continue;
dp->di_size = fs->fs_bsize * adp->ad_offset + adp->ad_oldsize;
- for (i = adp->ad_offset + 1; i < NDADDR; i++) {
+ for (i = adp->ad_offset + 1; i < UFS_NDADDR; i++) {
#ifdef INVARIANTS
if (dp->di_db[i] != 0 && (deplist & (1 << i)) == 0)
panic("softdep_write_inodeblock: lost dep2");
#endif /* INVARIANTS */
dp->di_db[i] = 0;
}
- for (i = 0; i < NIADDR; i++) {
+ for (i = 0; i < UFS_NIADDR; i++) {
#ifdef INVARIANTS
if (dp->di_ib[i] != 0 &&
- (deplist & ((1 << NDADDR) << i)) == 0)
+ (deplist & ((1 << UFS_NDADDR) << i)) == 0)
panic("softdep_write_inodeblock: lost dep3");
#endif /* INVARIANTS */
dp->di_ib[i] = 0;
@@ -10529,7 +10531,7 @@ initiate_write_inodeblock_ufs2(inodedep, bp)
* postpone fsck, we are stuck with this argument.
*/
for (; adp; adp = TAILQ_NEXT(adp, ad_next))
- dp->di_ib[adp->ad_offset - NDADDR] = 0;
+ dp->di_ib[adp->ad_offset - UFS_NDADDR] = 0;
}
/*
@@ -11456,7 +11458,7 @@ handle_written_inodeblock(inodedep, bp, flags)
if (adp->ad_state & ATTACHED)
panic("handle_written_inodeblock: new entry");
if (fstype == UFS1) {
- if (adp->ad_offset < NDADDR) {
+ if (adp->ad_offset < UFS_NDADDR) {
if (dp1->di_db[adp->ad_offset]!=adp->ad_oldblkno)
panic("%s %s #%jd mismatch %d != %jd",
"handle_written_inodeblock:",
@@ -11466,17 +11468,20 @@ handle_written_inodeblock(inodedep, bp, flags)
(intmax_t)adp->ad_oldblkno);
dp1->di_db[adp->ad_offset] = adp->ad_newblkno;
} else {
- if (dp1->di_ib[adp->ad_offset - NDADDR] != 0)
+ if (dp1->di_ib[adp->ad_offset - UFS_NDADDR] !=
+ 0)
panic("%s: %s #%jd allocated as %d",
"handle_written_inodeblock",
"indirect pointer",
- (intmax_t)adp->ad_offset - NDADDR,
- dp1->di_ib[adp->ad_offset - NDADDR]);
- dp1->di_ib[adp->ad_offset - NDADDR] =
+ (intmax_t)adp->ad_offset -
+ UFS_NDADDR,
+ dp1->di_ib[adp->ad_offset -
+ UFS_NDADDR]);
+ dp1->di_ib[adp->ad_offset - UFS_NDADDR] =
adp->ad_newblkno;
}
} else {
- if (adp->ad_offset < NDADDR) {
+ if (adp->ad_offset < UFS_NDADDR) {
if (dp2->di_db[adp->ad_offset]!=adp->ad_oldblkno)
panic("%s: %s #%jd %s %jd != %jd",
"handle_written_inodeblock",
@@ -11486,14 +11491,17 @@ handle_written_inodeblock(inodedep, bp, flags)
(intmax_t)adp->ad_oldblkno);
dp2->di_db[adp->ad_offset] = adp->ad_newblkno;
} else {
- if (dp2->di_ib[adp->ad_offset - NDADDR] != 0)
+ if (dp2->di_ib[adp->ad_offset - UFS_NDADDR] !=
+ 0)
panic("%s: %s #%jd allocated as %jd",
"handle_written_inodeblock",
"indirect pointer",
- (intmax_t)adp->ad_offset - NDADDR,
+ (intmax_t)adp->ad_offset -
+ UFS_NDADDR,
(intmax_t)
- dp2->di_ib[adp->ad_offset - NDADDR]);
- dp2->di_ib[adp->ad_offset - NDADDR] =
+ dp2->di_ib[adp->ad_offset -
+ UFS_NDADDR]);
+ dp2->di_ib[adp->ad_offset - UFS_NDADDR] =
adp->ad_newblkno;
}
}
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index c258a202920d..0ff44efcbd5b 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1431,7 +1431,7 @@ ffs_statfs(mp, sbp)
fs->fs_cstotal.cs_nffree + dbtofsb(fs, fs->fs_pendingblocks);
sbp->f_bavail = freespace(fs, fs->fs_minfree) +
dbtofsb(fs, fs->fs_pendingblocks);
- sbp->f_files = fs->fs_ncg * fs->fs_ipg - ROOTINO;
+ sbp->f_files = fs->fs_ncg * fs->fs_ipg - UFS_ROOTINO;
sbp->f_ffree = fs->fs_cstotal.cs_nifree + fs->fs_pendinginodes;
UFS_UNLOCK(ump);
sbp->f_namemax = NAME_MAX;
@@ -1848,7 +1848,7 @@ ffs_fhtovp(mp, fhp, flags, vpp)
ino = ufhp->ufid_ino;
ump = VFSTOUFS(mp);
fs = ump->um_fs;
- if (ino < ROOTINO || ino >= fs->fs_ncg * fs->fs_ipg)
+ if (ino < UFS_ROOTINO || ino >= fs->fs_ncg * fs->fs_ipg)
return (ESTALE);
/*
* Need to check if inode is initialized because UFS2 does lazy
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 0b5c61765d7a..13ed69694f17 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -271,7 +271,7 @@ loop:
* active. Otherwise we must flush them with data,
* since dependencies prevent data block writes.
*/
- if (waitfor == MNT_WAIT && bp->b_lblkno <= -NDADDR &&
+ if (waitfor == MNT_WAIT && bp->b_lblkno <= -UFS_NDADDR &&
(lbn_level(bp->b_lblkno) >= passes ||
((flags & DATA_ONLY) != 0 && !DOINGSOFTDEP(vp))))
continue;
@@ -356,7 +356,7 @@ next:
*/
still_dirty = false;
TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs) {
- if (bp->b_lblkno > -NDADDR) {
+ if (bp->b_lblkno > -UFS_NDADDR) {
still_dirty = true;
break;
}
@@ -373,7 +373,7 @@ next:
}
/* switch between sync/async. */
wait = !wait;
- if (wait || ++passes < NIADDR + 2)
+ if (wait || ++passes < UFS_NIADDR + 2)
goto loop;
#ifdef INVARIANTS
if (!vn_isdisk(vp, NULL))
@@ -1002,7 +1002,8 @@ ffs_extwrite(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *ucred)
uio->uio_offset = dp->di_extsize;
KASSERT(uio->uio_offset >= 0, ("ffs_extwrite: uio->uio_offset < 0"));
KASSERT(uio->uio_resid >= 0, ("ffs_extwrite: uio->uio_resid < 0"));
- if ((uoff_t)uio->uio_offset + uio->uio_resid > NXADDR * fs->fs_bsize)
+ if ((uoff_t)uio->uio_offset + uio->uio_resid >
+ UFS_NXADDR * fs->fs_bsize)
return (EFBIG);
resid = uio->uio_resid;
@@ -1145,7 +1146,7 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra)
fs = ITOFS(ip);
dp = ip->i_din2;
easize = dp->di_extsize;
- if ((uoff_t)easize + extra > NXADDR * fs->fs_bsize)
+ if ((uoff_t)easize + extra > UFS_NXADDR * fs->fs_bsize)
return (EFBIG);
eae = malloc(easize + extra, M_TEMP, M_WAITOK);
@@ -1296,7 +1297,7 @@ struct vop_strategy_args {
vp = ap->a_vp;
lbn = ap->a_bp->b_lblkno;
- if (I_IS_UFS2(VTOI(vp)) && lbn < 0 && lbn >= -NXADDR)
+ if (I_IS_UFS2(VTOI(vp)) && lbn < 0 && lbn >= -UFS_NXADDR)
return (VOP_STRATEGY_APV(&ufs_vnodeops, ap));
if (vp->v_type == VFIFO)
return (VOP_STRATEGY_APV(&ufs_fifoops, ap));
@@ -1584,7 +1585,7 @@ vop_setextattr {
return (EROFS);
ealen = ap->a_uio->uio_resid;
- if (ealen < 0 || ealen > lblktosize(fs, NXADDR))
+ if (ealen < 0 || ealen > lblktosize(fs, UFS_NXADDR))
return (EINVAL);
error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace,
@@ -1635,7 +1636,7 @@ vop_setextattr {
easize += (ealength - ul);
}
}
- if (easize > lblktosize(fs, NXADDR)) {
+ if (easize > lblktosize(fs, UFS_NXADDR)) {
free(eae, M_TEMP);
ffs_close_ea(ap->a_vp, 0, ap->a_cred, ap->a_td);
if (ip->i_ea_area != NULL && ip->i_ea_error == 0)
diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h
index c2f77a585561..c87c2b8f436e 100644
--- a/sys/ufs/ffs/fs.h
+++ b/sys/ufs/ffs/fs.h
@@ -575,7 +575,7 @@ struct cg {
(((off_t)(frag)) << (fs)->fs_fshift)
#define lblktosize(fs, blk) /* calculates ((off_t)blk * fs->fs_bsize) */ \
(((off_t)(blk)) << (fs)->fs_bshift)
-/* Use this only when `blk' is known to be small, e.g., < NDADDR. */
+/* Use this only when `blk' is known to be small, e.g., < UFS_NDADDR. */
#define smalllblktosize(fs, blk) /* calculates (blk * fs->fs_bsize) */ \
((blk) << (fs)->fs_bshift)
#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
@@ -608,11 +608,11 @@ struct cg {
* Determining the size of a file block in the filesystem.
*/
#define blksize(fs, ip, lbn) \
- (((lbn) >= NDADDR || (ip)->i_size >= smalllblktosize(fs, (lbn) + 1)) \
+ (((lbn) >= UFS_NDADDR || (ip)->i_size >= smalllblktosize(fs, (lbn) + 1)) \
? (fs)->fs_bsize \
: (fragroundup(fs, blkoff(fs, (ip)->i_size))))
#define sblksize(fs, size, lbn) \
- (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
+ (((lbn) >= UFS_NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
? (fs)->fs_bsize \
: (fragroundup(fs, blkoff(fs, (size)))))
@@ -622,7 +622,7 @@ struct cg {
#define NINDIR(fs) ((fs)->fs_nindir)
/*
- * Indirect lbns are aligned on NDADDR addresses where single indirects
+ * Indirect lbns are aligned on UFS_NDADDR addresses where single indirects
* are the negated address of the lowest lbn reachable, double indirects
* are this lbn - 1 and triple indirects are this lbn - 2. This yields
* an unusual bit order to determine level.
diff --git a/sys/ufs/ufs/dinode.h b/sys/ufs/ufs/dinode.h
index 36a7c0da11ab..0e90ac24ab0a 100644
--- a/sys/ufs/ufs/dinode.h
+++ b/sys/ufs/ufs/dinode.h
@@ -74,15 +74,15 @@
* the root inode is 2. (Inode 1 is no longer used for this purpose, however
* numerous dump tapes make this assumption, so we are stuck with it).
*/
-#define ROOTINO ((ino_t)2)
+#define UFS_ROOTINO ((ino_t)2)
/*
* The Whiteout inode# is a dummy non-zero inode number which will
* never be allocated to a real file. It is used as a place holder
* in the directory entry which has been tagged as a DT_WHT entry.
- * See the comments about ROOTINO above.
+ * See the comments about UFS_ROOTINO above.
*/
-#define WINO ((ino_t)1)
+#define UFS_WINO ((ino_t)1)
/*
* The size of physical and logical block numbers and time fields in UFS.
@@ -118,9 +118,9 @@ typedef int64_t ufs_time_t;
* are defined by types with precise widths.
*/
-#define NXADDR 2 /* External addresses in inode. */
-#define NDADDR 12 /* Direct addresses in inode. */
-#define NIADDR 3 /* Indirect addresses in inode. */
+#define UFS_NXADDR 2 /* External addresses in inode. */
+#define UFS_NDADDR 12 /* Direct addresses in inode. */
+#define UFS_NIADDR 3 /* Indirect addresses in inode. */
struct ufs2_dinode {
u_int16_t di_mode; /* 0: IFMT, permissions; see below. */
@@ -142,9 +142,9 @@ struct ufs2_dinode {
u_int32_t di_kernflags; /* 84: Kernel flags. */
u_int32_t di_flags; /* 88: Status flags (chflags). */
u_int32_t di_extsize; /* 92: External attributes size. */
- ufs2_daddr_t di_extb[NXADDR];/* 96: External attributes block. */
- ufs2_daddr_t di_db[NDADDR]; /* 112: Direct disk blocks. */
- ufs2_daddr_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */
+ ufs2_daddr_t di_extb[UFS_NXADDR];/* 96: External attributes block. */
+ ufs2_daddr_t di_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
+ ufs2_daddr_t di_ib[UFS_NIADDR]; /* 208: Indirect disk blocks. */
u_int64_t di_modrev; /* 232: i_modrev for NFSv4 */
uint32_t di_freelink; /* 240: SUJ: Next unlinked inode. */
uint32_t di_spare[3]; /* 244: Reserved; currently unused */
@@ -176,8 +176,8 @@ struct ufs1_dinode {
int32_t di_mtimensec; /* 28: Last modified time. */
int32_t di_ctime; /* 32: Last inode change time. */
int32_t di_ctimensec; /* 36: Last inode change time. */
- ufs1_daddr_t di_db[NDADDR]; /* 40: Direct disk blocks. */
- ufs1_daddr_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */
+ ufs1_daddr_t di_db[UFS_NDADDR]; /* 40: Direct disk blocks. */
+ ufs1_daddr_t di_ib[UFS_NIADDR]; /* 88: Indirect disk blocks. */
u_int32_t di_flags; /* 100: Status flags (chflags). */
u_int32_t di_blocks; /* 104: Blocks actually held. */
u_int32_t di_gen; /* 108: Generation number. */
diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c
index f6a774a89fc4..cf369363ae28 100644
--- a/sys/ufs/ufs/ufs_bmap.c
+++ b/sys/ufs/ufs/ufs_bmap.c
@@ -115,7 +115,7 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb)
struct buf *bp;
struct ufsmount *ump;
struct mount *mp;
- struct indir a[NIADDR+1], *ap;
+ struct indir a[UFS_NIADDR+1], *ap;
ufs2_daddr_t daddr;
ufs_lbn_t metalbn;
int error, num, maxrun = 0;
@@ -144,9 +144,9 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb)
num = *nump;
if (num == 0) {
- if (bn >= 0 && bn < NDADDR) {
+ if (bn >= 0 && bn < UFS_NDADDR) {
*bnp = blkptrtodb(ump, DIP(ip, i_db[bn]));
- } else if (bn < 0 && bn >= -NXADDR) {
+ } else if (bn < 0 && bn >= -UFS_NXADDR) {
*bnp = blkptrtodb(ump, ip->i_din2->di_extb[-1 - bn]);
if (*bnp == 0)
*bnp = -1;
@@ -175,7 +175,7 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb)
*bnp = -1;
} else if (runp) {
ufs2_daddr_t bnb = bn;
- for (++bn; bn < NDADDR && *runp < maxrun &&
+ for (++bn; bn < UFS_NDADDR && *runp < maxrun &&
is_sequential(ump, DIP(ip, i_db[bn - 1]),
DIP(ip, i_db[bn]));
++bn, ++*runp);
@@ -330,17 +330,18 @@ ufs_getlbns(vp, bn, ap, nump)
if (bn < 0)
bn = -bn;
- /* The first NDADDR blocks are direct blocks. */
- if (bn < NDADDR)
+ /* The first UFS_NDADDR blocks are direct blocks. */
+ if (bn < UFS_NDADDR)
return (0);
/*
* Determine the number of levels of indirection. After this loop
* is done, blockcnt indicates the number of data blocks possible
- * at the previous level of indirection, and NIADDR - i is the number
- * of levels of indirection needed to locate the requested block.
+ * at the previous level of indirection, and UFS_NIADDR - i is the
+ * number of levels of indirection needed to locate the requested block.
*/
- for (blockcnt = 1, i = NIADDR, bn -= NDADDR;; i--, bn -= blockcnt) {
+ for (blockcnt = 1, i = UFS_NIADDR, bn -= UFS_NDADDR; ;
+ i--, bn -= blockcnt) {
if (i == 0)
return (EFBIG);
blockcnt *= MNINDIR(ump);
@@ -350,9 +351,9 @@ ufs_getlbns(vp, bn, ap, nump)
/* Calculate the address of the first meta-block. */
if (realbn >= 0)
- metalbn = -(realbn - bn + NIADDR - i);
+ metalbn = -(realbn - bn + UFS_NIADDR - i);
else
- metalbn = -(-realbn - bn + NIADDR - i);
+ metalbn = -(-realbn - bn + UFS_NIADDR - i);
/*
* At each iteration, off is the offset into the bap array which is
@@ -361,9 +362,9 @@ ufs_getlbns(vp, bn, ap, nump)
* into the argument array.
*/
ap->in_lbn = metalbn;
- ap->in_off = off = NIADDR - i;
+ ap->in_off = off = UFS_NIADDR - i;
ap++;
- for (++numlevels; i <= NIADDR; i++) {
+ for (++numlevels; i <= UFS_NIADDR; i++) {
/* If searching for a meta-data block, quit when found. */
if (metalbn == realbn)
break;
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index 2f883c4f8a01..5be38cdb72dd 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -1069,7 +1069,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename)
namlen = ep->d_namlen;
# endif
if (ep->d_ino == 0 ||
- (ep->d_ino == WINO && namlen == dirp->d_namlen &&
+ (ep->d_ino == UFS_WINO && namlen == dirp->d_namlen &&
bcmp(ep->d_name, dirp->d_name, dirp->d_namlen) == 0)) {
if (spacefree + dsize < newentrysize)
panic("ufs_direnter: compact1");
@@ -1178,12 +1178,12 @@ ufs_dirremove(dvp, ip, flags, isrmdir)
}
if (flags & DOWHITEOUT) {
/*
- * Whiteout entry: set d_ino to WINO.
+ * Whiteout entry: set d_ino to UFS_WINO.
*/
if ((error =
UFS_BLKATOFF(dvp, (off_t)dp->i_offset, (char **)&ep, &bp)) != 0)
return (error);
- ep->d_ino = WINO;
+ ep->d_ino = UFS_WINO;
ep->d_type = DT_WHT;
goto out;
}
@@ -1353,7 +1353,7 @@ ufs_dirempty(ip, parentino, cred)
if (dp->d_reclen == 0)
return (0);
/* skip empty entries */
- if (dp->d_ino == 0 || dp->d_ino == WINO)
+ if (dp->d_ino == 0 || dp->d_ino == UFS_WINO)
continue;
/* accept only "." and ".." */
# if (BYTE_ORDER == LITTLE_ENDIAN)
@@ -1445,7 +1445,7 @@ ufs_checkpath(ino_t source_ino, ino_t parent_ino, struct inode *target, struct u
return (EEXIST);
if (target->i_number == parent_ino)
return (0);
- if (target->i_number == ROOTINO)
+ if (target->i_number == UFS_ROOTINO)
return (0);
for (;;) {
error = ufs_dir_dd_ino(vp, cred, &dd_ino, &vp1);
@@ -1455,7 +1455,7 @@ ufs_checkpath(ino_t source_ino, ino_t parent_ino, struct inode *target, struct u
error = EINVAL;
break;
}
- if (dd_ino == ROOTINO)
+ if (dd_ino == UFS_ROOTINO)
break;
if (dd_ino == parent_ino)
break;
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index 5bb73ea0c81d..5135f2228a8c 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -74,7 +74,7 @@ ufs_root(mp, flags, vpp)
struct vnode *nvp;
int error;
- error = VFS_VGET(mp, (ino_t)ROOTINO, flags, &nvp);
+ error = VFS_VGET(mp, (ino_t)UFS_ROOTINO, flags, &nvp);
if (error)
return (error);
*vpp = nvp;
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index d100454f6810..6119de14df65 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1053,7 +1053,7 @@ ufs_whiteout(ap)
panic("ufs_whiteout: old format filesystem");
#endif
- newdir.d_ino = WINO;
+ newdir.d_ino = UFS_WINO;
newdir.d_namlen = cnp->cn_namelen;
bcopy(cnp->cn_nameptr, newdir.d_name, (unsigned)cnp->cn_namelen + 1);
newdir.d_type = DT_WHT;
@@ -2564,7 +2564,7 @@ ufs_vinit(mntp, fifoops, vpp)
if (vp->v_type == VFIFO)
vp->v_op = fifoops;
ASSERT_VOP_LOCKED(vp, "ufs_vinit");
- if (ip->i_number == ROOTINO)
+ if (ip->i_number == UFS_ROOTINO)
vp->v_vflag |= VV_ROOT;
*vpp = vp;
return (0);