aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dump/main.c4
-rw-r--r--sbin/dump/traverse.c20
-rw-r--r--sbin/fsck_ffs/dir.c11
-rw-r--r--sbin/fsck_ffs/fsutil.c18
-rw-r--r--sbin/fsck_ffs/inode.c20
-rw-r--r--sbin/fsck_ffs/pass1.c20
-rw-r--r--sbin/fsck_ffs/pass2.c9
-rw-r--r--sbin/fsck_ffs/suj.c42
-rw-r--r--sbin/fsdb/fsdb.c22
-rw-r--r--sbin/fsdb/fsdbutil.c36
-rw-r--r--sbin/newfs/mkfs.c6
-rw-r--r--sbin/quotacheck/quotacheck.c10
-rw-r--r--sbin/restore/dirs.c4
-rw-r--r--sbin/restore/interactive.c4
-rw-r--r--sbin/restore/tape.c18
-rw-r--r--sbin/tunefs/tunefs.c4
16 files changed, 123 insertions, 125 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index 1f30a7a61609..127b5ca33f97 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -550,7 +550,7 @@ main(int argc, char *argv[])
* Skip directory inodes deleted and maybe reallocated
*/
dp = getinode(ino, &mode);
- if (mode != UFS_IFDIR)
+ if (mode != IFDIR)
continue;
(void)dumpino(dp, ino);
}
@@ -569,7 +569,7 @@ main(int argc, char *argv[])
* Skip inodes deleted and reallocated as directories.
*/
dp = getinode(ino, &mode);
- if (mode == UFS_IFDIR)
+ if (mode == IFDIR)
continue;
(void)dumpino(dp, ino);
}
diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c
index feb3dd4f644f..5538133e3813 100644
--- a/sbin/dump/traverse.c
+++ b/sbin/dump/traverse.c
@@ -195,7 +195,7 @@ mapfiles(ino_t maxino, long *tapesize)
for (i = 0; i < inosused; i++, ino++) {
if (ino < UFS_ROOTINO ||
(dp = getinode(ino, &mode)) == NULL ||
- (mode & UFS_IFMT) == 0)
+ (mode & IFMT) == 0)
continue;
if (ino >= maxino) {
msg("Skipping inode %ju >= maxino %ju\n",
@@ -209,19 +209,19 @@ mapfiles(ino_t maxino, long *tapesize)
* (this is used in mapdirs()).
*/
SETINO(ino, usedinomap);
- if (mode == UFS_IFDIR)
+ if (mode == IFDIR)
SETINO(ino, dumpdirmap);
if (WANTTODUMP(dp)) {
SETINO(ino, dumpinomap);
- if (mode != UFS_IFREG &&
- mode != UFS_IFDIR &&
- mode != UFS_IFLNK)
+ if (mode != IFREG &&
+ mode != IFDIR &&
+ mode != IFLNK)
*tapesize += 1;
else
*tapesize += blockest(dp);
continue;
}
- if (mode == UFS_IFDIR) {
+ if (mode == IFDIR) {
if (!nonodump &&
(DIP(dp, di_flags) & UF_NODUMP))
CLRINO(ino, usedinomap);
@@ -429,7 +429,7 @@ searchdir(
* Add back to dumpdirmap and remove from usedinomap
* to propagate nodump.
*/
- if (mode == UFS_IFDIR) {
+ if (mode == IFDIR) {
SETINO(dp->d_ino, dumpdirmap);
CLRINO(dp->d_ino, usedinomap);
ret |= HASSUBDIRS;
@@ -554,7 +554,7 @@ dumpino(union dinode *dp, ino_t ino)
default:
msg("Warning: undefined file type 0%o\n",
- DIP(dp, di_mode) & UFS_IFMT);
+ DIP(dp, di_mode) & IFMT);
return;
}
if (DIP(dp, di_size) > UFS_NDADDR * sblock->fs_bsize) {
@@ -890,11 +890,11 @@ getinode(ino_t inum, int *modep)
gotit:
if (sblock->fs_magic == FS_UFS1_MAGIC) {
dp1 = &((struct ufs1_dinode *)inoblock)[inum - minino];
- *modep = (dp1->di_mode & UFS_IFMT);
+ *modep = (dp1->di_mode & IFMT);
return ((union dinode *)dp1);
}
dp2 = &((struct ufs2_dinode *)inoblock)[inum - minino];
- *modep = (dp2->di_mode & UFS_IFMT);
+ *modep = (dp2->di_mode & IFMT);
return ((union dinode *)dp2);
}
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c
index 503dc2ed79df..212833cb1f42 100644
--- a/sbin/fsck_ffs/dir.c
+++ b/sbin/fsck_ffs/dir.c
@@ -264,7 +264,7 @@ fileerror(ino_t cwd, ino_t ino, const char *errmesg)
dp = ginode(ino);
if (ftypeok(dp))
pfatal("%s=%s\n",
- (DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR ? "DIR" : "FILE",
+ (DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE",
pathbuf);
else
pfatal("NAME=%s\n", pathbuf);
@@ -308,8 +308,7 @@ adjust(struct inodesc *idesc, int lcnt)
}
if (lcnt != 0) {
pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
- ((DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR ?
- "DIR" : "FILE"));
+ ((DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE"));
pinode(idesc->id_number);
printf(" COUNT %d SHOULD BE %d",
DIP(dp, di_nlink), DIP(dp, di_nlink) - lcnt);
@@ -389,7 +388,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
memset(&idesc, 0, sizeof(struct inodesc));
dp = ginode(orphan);
- lostdir = (DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR;
+ lostdir = (DIP(dp, di_mode) & IFMT) == IFDIR;
pwarn("UNREF %s ", lostdir ? "DIR" : "FILE");
pinode(orphan);
if (preen && DIP(dp, di_size) == 0)
@@ -437,7 +436,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
}
}
dp = ginode(lfdir);
- if ((DIP(dp, di_mode) & UFS_IFMT) != UFS_IFDIR) {
+ if ((DIP(dp, di_mode) & IFMT) != IFDIR) {
pfatal("lost+found IS NOT A DIRECTORY");
if (reply("REALLOCATE") == 0)
return (0);
@@ -616,7 +615,7 @@ allocdir(ino_t parent, ino_t request, int mode)
struct inoinfo *inp;
struct dirtemplate *dirp;
- ino = allocino(request, UFS_IFDIR|mode);
+ ino = allocino(request, IFDIR|mode);
dirp = &dirhead;
dirp->dot_ino = ino;
dirp->dotdot_ino = parent;
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index 8bcaffd73858..d4a5f81bbfa7 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -100,15 +100,15 @@ fsutilinit(void)
int
ftypeok(union dinode *dp)
{
- switch (DIP(dp, di_mode) & UFS_IFMT) {
-
- case UFS_IFDIR:
- case UFS_IFREG:
- case UFS_IFBLK:
- case UFS_IFCHR:
- case UFS_IFLNK:
- case UFS_IFSOCK:
- case UFS_IFIFO:
+ switch (DIP(dp, di_mode) & IFMT) {
+
+ case IFDIR:
+ case IFREG:
+ case IFBLK:
+ case IFCHR:
+ case IFLNK:
+ case IFSOCK:
+ case IFIFO:
return (1);
default:
diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index 2e4651ed0f89..e40527770a69 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -71,8 +71,8 @@ ckinode(union dinode *dp, struct inodesc *idesc)
idesc->id_lbn = -1;
idesc->id_entryno = 0;
idesc->id_filesize = DIP(dp, di_size);
- mode = DIP(dp, di_mode) & UFS_IFMT;
- if (mode == UFS_IFBLK || mode == UFS_IFCHR || (mode == UFS_IFLNK &&
+ mode = DIP(dp, di_mode) & IFMT;
+ if (mode == IFBLK || mode == IFCHR || (mode == IFLNK &&
DIP(dp, di_size) < (unsigned)sblock.fs_maxsymlinklen))
return (KEEPON);
if (sblock.fs_magic == FS_UFS1_MAGIC)
@@ -347,7 +347,7 @@ getnextinode(ino_t inumber, int rebuildcg)
* Try to determine if we have reached the end of the
* allocated inodes.
*/
- mode = DIP(dp, di_mode) & UFS_IFMT;
+ mode = DIP(dp, di_mode) & IFMT;
if (mode == 0) {
if (memcmp(dp->dp2.di_db, ufs2_zino.di_db,
UFS_NDADDR * sizeof(ufs2_daddr_t)) ||
@@ -362,9 +362,9 @@ getnextinode(ino_t inumber, int rebuildcg)
ndb = howmany(DIP(dp, di_size), sblock.fs_bsize);
if (ndb < 0)
return (NULL);
- if (mode == UFS_IFBLK || mode == UFS_IFCHR)
+ if (mode == IFBLK || mode == IFCHR)
ndb++;
- if (mode == UFS_IFLNK) {
+ if (mode == IFLNK) {
/*
* Fake ndb value so direct/indirect block checks below
* will detect any garbage after symlink string.
@@ -533,7 +533,7 @@ clri(struct inodesc *idesc, const char *type, int flag)
dp = ginode(idesc->id_number);
if (flag == 1) {
pwarn("%s %s", type,
- (DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR ? "DIR":"FILE");
+ (DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE");
pinode(idesc->id_number);
}
if (preen || reply("CLEAR") == 1) {
@@ -681,13 +681,13 @@ allocino(ino_t request, int type)
return (0);
setbit(cg_inosused(cgp), ino % sblock.fs_ipg);
cgp->cg_cs.cs_nifree--;
- switch (type & UFS_IFMT) {
- case UFS_IFDIR:
+ switch (type & IFMT) {
+ case IFDIR:
inoinfo(ino)->ino_state = DSTATE;
cgp->cg_cs.cs_ndir++;
break;
- case UFS_IFREG:
- case UFS_IFLNK:
+ case IFREG:
+ case IFLNK:
inoinfo(ino)->ino_state = FSTATE;
break;
default:
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c
index 023853a96ec1..aa4fc4915399 100644
--- a/sbin/fsck_ffs/pass1.c
+++ b/sbin/fsck_ffs/pass1.c
@@ -251,7 +251,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
if ((dp = getnextinode(inumber, rebuildcg)) == NULL)
return (0);
- mode = DIP(dp, di_mode) & UFS_IFMT;
+ mode = DIP(dp, di_mode) & IFMT;
if (mode == 0) {
if ((sblock.fs_magic == FS_UFS1_MAGIC &&
(memcmp(dp->dp1.di_db, ufs1_zino.di_db,
@@ -284,25 +284,25 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
kernmaxfilesize = sblock.fs_maxfilesize;
if (DIP(dp, di_size) > kernmaxfilesize ||
DIP(dp, di_size) > sblock.fs_maxfilesize ||
- (mode == UFS_IFDIR && DIP(dp, di_size) > MAXDIRSIZE)) {
+ (mode == IFDIR && DIP(dp, di_size) > MAXDIRSIZE)) {
if (debug)
printf("bad size %ju:", (uintmax_t)DIP(dp, di_size));
goto unknown;
}
- if (!preen && mode == UFS_IFMT && reply("HOLD BAD BLOCK") == 1) {
+ if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
dp = ginode(inumber);
DIP_SET(dp, di_size, sblock.fs_fsize);
- DIP_SET(dp, di_mode, UFS_IFREG|0600);
+ DIP_SET(dp, di_mode, IFREG|0600);
inodirty();
}
- if ((mode == UFS_IFBLK || mode == UFS_IFCHR || mode == UFS_IFIFO ||
- mode == UFS_IFSOCK) && DIP(dp, di_size) != 0) {
+ if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
+ mode == IFSOCK) && DIP(dp, di_size) != 0) {
if (debug)
printf("bad special-file size %ju:",
(uintmax_t)DIP(dp, di_size));
goto unknown;
}
- if ((mode == UFS_IFBLK || mode == UFS_IFCHR) &&
+ if ((mode == IFBLK || mode == IFCHR) &&
(dev_t)DIP(dp, di_rdev) == NODEV) {
if (debug)
printf("bad special-file rdev NODEV:");
@@ -315,9 +315,9 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
(uintmax_t)DIP(dp, di_size), (uintmax_t)ndb);
goto unknown;
}
- if (mode == UFS_IFBLK || mode == UFS_IFCHR)
+ if (mode == IFBLK || mode == IFCHR)
ndb++;
- if (mode == UFS_IFLNK) {
+ if (mode == IFLNK) {
/*
* Fake ndb value so direct/indirect block checks below
* will detect any garbage after symlink string.
@@ -357,7 +357,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int rebuildcg)
goto unknown;
n_files++;
inoinfo(inumber)->ino_linkcnt = DIP(dp, di_nlink);
- if (mode == UFS_IFDIR) {
+ if (mode == IFDIR) {
if (DIP(dp, di_size) == 0)
inoinfo(inumber)->ino_state = DCLEAR;
else if (DIP(dp, di_nlink) <= 0)
diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c
index 956395e1ae9b..c543cc0e561d 100644
--- a/sbin/fsck_ffs/pass2.c
+++ b/sbin/fsck_ffs/pass2.c
@@ -112,8 +112,8 @@ pass2(void)
exit(EEXIT);
}
dp = ginode(UFS_ROOTINO);
- DIP_SET(dp, di_mode, DIP(dp, di_mode) & ~UFS_IFMT);
- DIP_SET(dp, di_mode, DIP(dp, di_mode) | UFS_IFDIR);
+ DIP_SET(dp, di_mode, DIP(dp, di_mode) & ~IFMT);
+ DIP_SET(dp, di_mode, DIP(dp, di_mode) | IFDIR);
inodirty();
break;
@@ -184,7 +184,7 @@ pass2(void)
}
dp = &dino;
memset(dp, 0, sizeof(struct ufs2_dinode));
- DIP_SET(dp, di_mode, UFS_IFDIR);
+ DIP_SET(dp, di_mode, IFDIR);
DIP_SET(dp, di_size, inp->i_isize);
for (i = 0; i < MIN(inp->i_numblks, UFS_NDADDR); i++)
DIP_SET(dp, di_db[i], inp->i_blks[i]);
@@ -478,8 +478,7 @@ again:
break;
dp = ginode(dirp->d_ino);
inoinfo(dirp->d_ino)->ino_state =
- (DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR ?
- DSTATE : FSTATE;
+ (DIP(dp, di_mode) & IFMT) == IFDIR ? DSTATE : FSTATE;
inoinfo(dirp->d_ino)->ino_linkcnt = DIP(dp, di_nlink);
goto again;
diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c
index b43824b231ea..fcd27d7c8e3e 100644
--- a/sbin/fsck_ffs/suj.c
+++ b/sbin/fsck_ffs/suj.c
@@ -605,7 +605,7 @@ ino_free(ino_t ino, int mode)
if (ino < cgp->cg_irotor)
cgp->cg_irotor = ino;
cgp->cg_cs.cs_nifree++;
- if ((mode & UFS_IFMT) == UFS_IFDIR) {
+ if ((mode & IFMT) == IFDIR) {
freedir++;
cgp->cg_cs.cs_ndir--;
}
@@ -748,7 +748,7 @@ ino_blkatoff(union dinode *ip, ino_t ino, ufs_lbn_t lbn, int *frags)
/*
* Now direct and indirect.
*/
- if (DIP(ip, di_mode) == UFS_IFLNK &&
+ if (DIP(ip, di_mode) == IFLNK &&
DIP(ip, di_size) < fs->fs_maxsymlinklen)
return (0);
if (lbn >= 0 && lbn < UFS_NDADDR) {
@@ -853,7 +853,7 @@ ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
*isdot = 0;
dip = ino_read(parent);
*mode = DIP(dip, di_mode);
- if ((*mode & UFS_IFMT) != UFS_IFDIR) {
+ if ((*mode & IFMT) != IFDIR) {
if (debug) {
/*
* This can happen if the parent inode
@@ -1013,7 +1013,7 @@ ino_visit(union dinode *ip, ino_t ino, ino_visitor visitor, int flags)
int i;
size = DIP(ip, di_size);
- mode = DIP(ip, di_mode) & UFS_IFMT;
+ mode = DIP(ip, di_mode) & IFMT;
fragcnt = 0;
if ((flags & VISIT_EXT) &&
fs->fs_magic == FS_UFS2_MAGIC && ip->dp2.di_extsize) {
@@ -1027,8 +1027,8 @@ ino_visit(union dinode *ip, ino_t ino, ino_visitor visitor, int flags)
}
}
/* Skip datablocks for short links and devices. */
- if (mode == UFS_IFBLK || mode == UFS_IFCHR ||
- (mode == UFS_IFLNK && size < fs->fs_maxsymlinklen))
+ if (mode == IFBLK || mode == IFCHR ||
+ (mode == IFLNK && size < fs->fs_maxsymlinklen))
return (fragcnt);
for (i = 0; i < UFS_NDADDR; i++) {
if (DIP(ip, di_db[i]) == 0)
@@ -1265,7 +1265,7 @@ ino_reclaim(union dinode *ip, ino_t ino, int mode)
(uintmax_t)ino, DIP(ip, di_nlink), DIP(ip, di_mode));
/* We are freeing an inode or directory. */
- if ((DIP(ip, di_mode) & UFS_IFMT) == UFS_IFDIR)
+ if ((DIP(ip, di_mode) & IFMT) == IFDIR)
ino_visit(ip, ino, ino_free_children, 0);
DIP_SET(ip, di_nlink, 0);
ino_visit(ip, ino, blk_free_visit, VISIT_EXT | VISIT_INDIR);
@@ -1300,7 +1300,7 @@ ino_decr(ino_t ino)
if (mode == 0)
err_suj("Inode %d has a link of %d with 0 mode\n", ino, nlink);
nlink--;
- if ((mode & UFS_IFMT) == UFS_IFDIR)
+ if ((mode & IFMT) == IFDIR)
reqlink = 2;
else
reqlink = 1;
@@ -1335,13 +1335,13 @@ ino_adjust(struct suj_ino *sino)
nlink = sino->si_nlink;
ino = sino->si_ino;
- mode = sino->si_mode & UFS_IFMT;
+ mode = sino->si_mode & IFMT;
/*
* If it's a directory with no dot links, it was truncated before
* the name was cleared. We need to clear the dirent that
* points at it.
*/
- if (mode == UFS_IFDIR && nlink == 1 && sino->si_dotlinks == 0) {
+ if (mode == IFDIR && nlink == 1 && sino->si_dotlinks == 0) {
sino->si_nlink = nlink = 0;
TAILQ_FOREACH(srec, &sino->si_recs, sr_next) {
rrec = (struct jrefrec *)srec->sr_rec;
@@ -1358,7 +1358,7 @@ ino_adjust(struct suj_ino *sino)
* If it's a directory with no real names pointing to it go ahead
* and truncate it. This will free any children.
*/
- if (mode == UFS_IFDIR && nlink - sino->si_dotlinks == 0) {
+ if (mode == IFDIR && nlink - sino->si_dotlinks == 0) {
sino->si_nlink = nlink = 0;
/*
* Mark any .. links so they know not to free this inode
@@ -1374,7 +1374,7 @@ ino_adjust(struct suj_ino *sino)
}
}
ip = ino_read(ino);
- mode = DIP(ip, di_mode) & UFS_IFMT;
+ mode = DIP(ip, di_mode) & IFMT;
if (nlink > UFS_LINK_MAX)
err_suj("ino %ju nlink manipulation error, new %ju, old %d\n",
(uintmax_t)ino, (uintmax_t)nlink, DIP(ip, di_nlink));
@@ -1393,7 +1393,7 @@ ino_adjust(struct suj_ino *sino)
if (mode != sino->si_mode && debug)
printf("ino %ju, mode %o != %o\n",
(uintmax_t)ino, mode, sino->si_mode);
- if ((mode & UFS_IFMT) == UFS_IFDIR)
+ if ((mode & IFMT) == IFDIR)
reqlink = 2;
else
reqlink = 1;
@@ -1506,15 +1506,15 @@ ino_trunc(ino_t ino, off_t size)
int mode;
ip = ino_read(ino);
- mode = DIP(ip, di_mode) & UFS_IFMT;
+ mode = DIP(ip, di_mode) & IFMT;
cursize = DIP(ip, di_size);
if (debug)
printf("Truncating ino %ju, mode %o to size %jd from size %jd\n",
(uintmax_t)ino, mode, size, cursize);
/* Skip datablocks for short links and devices. */
- if (mode == 0 || mode == UFS_IFBLK || mode == UFS_IFCHR ||
- (mode == UFS_IFLNK && cursize < fs->fs_maxsymlinklen))
+ if (mode == 0 || mode == IFBLK || mode == IFCHR ||
+ (mode == IFLNK && cursize < fs->fs_maxsymlinklen))
return;
/* Don't extend. */
if (size > cursize)
@@ -1587,7 +1587,7 @@ ino_trunc(ino_t ino, off_t size)
* uninitialized space later.
*/
off = blkoff(fs, size);
- if (off && DIP(ip, di_mode) != UFS_IFDIR) {
+ if (off && DIP(ip, di_mode) != IFDIR) {
uint8_t *buf;
long clrsize;
@@ -1635,7 +1635,7 @@ ino_check(struct suj_ino *sino)
rrec = (struct jrefrec *)srec->sr_rec;
isat = ino_isat(rrec->jr_parent, rrec->jr_diroff,
rrec->jr_ino, &mode, &isdot);
- if (isat && (mode & UFS_IFMT) != (rrec->jr_mode & UFS_IFMT))
+ if (isat && (mode & IFMT) != (rrec->jr_mode & IFMT))
err_suj("Inode mode/directory type mismatch %o != %o\n",
mode, rrec->jr_mode);
if (debug)
@@ -1646,7 +1646,7 @@ ino_check(struct suj_ino *sino)
(uintmax_t)rrec->jr_parent,
(uintmax_t)rrec->jr_diroff,
rrec->jr_mode, isat, isdot);
- mode = rrec->jr_mode & UFS_IFMT;
+ mode = rrec->jr_mode & IFMT;
if (rrec->jr_op == JOP_REMREF)
removes++;
newlinks += isat;
@@ -1915,7 +1915,7 @@ ino_unlinked(void)
fs->fs_sujfree = 0;
while (ino != 0) {
ip = ino_read(ino);
- mode = DIP(ip, di_mode) & UFS_IFMT;
+ mode = DIP(ip, di_mode) & IFMT;
inon = DIP(ip, di_freelink);
DIP_SET(ip, di_freelink, 0);
/*
@@ -2371,7 +2371,7 @@ suj_verifyino(union dinode *ip)
return (-1);
}
- if (DIP(ip, di_mode) != (UFS_IFREG | UFS_IREAD)) {
+ if (DIP(ip, di_mode) != (IFREG | IREAD)) {
printf("Invalid mode %o for journal inode %ju\n",
DIP(ip, di_mode), (uintmax_t)sujino);
return (-1);
diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c
index 8f1598c1e8ab..1c6f78302fce 100644
--- a/sbin/fsdb/fsdb.c
+++ b/sbin/fsdb/fsdb.c
@@ -512,14 +512,14 @@ CMDFUNCSTART(findblk)
/* Get on-disk inode aka dinode. */
curinum = inum;
curinode = ginode(inum);
- /* Find UFS_IFLNK dinode with allocated data blocks. */
- switch (DIP(curinode, di_mode) & UFS_IFMT) {
- case UFS_IFDIR:
- case UFS_IFREG:
+ /* Find IFLNK dinode with allocated data blocks. */
+ switch (DIP(curinode, di_mode) & IFMT) {
+ case IFDIR:
+ case IFREG:
if (DIP(curinode, di_blocks) == 0)
continue;
break;
- case UFS_IFLNK:
+ case IFLNK:
{
uint64_t size = DIP(curinode, di_size);
if (size > 0 && size < sblock.fs_maxsymlinklen &&
@@ -889,10 +889,10 @@ struct typemap {
const char *typename;
int typebits;
} typenamemap[] = {
- {"file", UFS_IFREG},
- {"dir", UFS_IFDIR},
- {"socket", UFS_IFSOCK},
- {"fifo", UFS_IFIFO},
+ {"file", IFREG},
+ {"dir", IFDIR},
+ {"socket", IFSOCK},
+ {"fifo", IFIFO},
};
CMDFUNCSTART(newtype)
@@ -902,7 +902,7 @@ CMDFUNCSTART(newtype)
if (!checkactive())
return 1;
- type = DIP(curinode, di_mode) & UFS_IFMT;
+ type = DIP(curinode, di_mode) & IFMT;
for (tp = typenamemap;
tp < &typenamemap[nitems(typenamemap)];
tp++) {
@@ -917,7 +917,7 @@ CMDFUNCSTART(newtype)
warnx("try one of `file', `dir', `socket', `fifo'");
return 1;
}
- DIP_SET(curinode, di_mode, DIP(curinode, di_mode) & ~UFS_IFMT);
+ DIP_SET(curinode, di_mode, DIP(curinode, di_mode) & ~IFMT);
DIP_SET(curinode, di_mode, DIP(curinode, di_mode) | type);
inodirty();
printactive(0);
diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c
index afb0d20fd74f..6ad315df8eb6 100644
--- a/sbin/fsdb/fsdbutil.c
+++ b/sbin/fsdb/fsdbutil.c
@@ -120,20 +120,20 @@ printstat(const char *cp, ino_t inum, union dinode *dp)
time_t t;
printf("%s: ", cp);
- switch (DIP(dp, di_mode) & UFS_IFMT) {
- case UFS_IFDIR:
+ switch (DIP(dp, di_mode) & IFMT) {
+ case IFDIR:
puts("directory");
break;
- case UFS_IFREG:
+ case IFREG:
puts("regular file");
break;
- case UFS_IFBLK:
+ case IFBLK:
printf("block special (%#jx)", (uintmax_t)DIP(dp, di_rdev));
break;
- case UFS_IFCHR:
+ case IFCHR:
printf("character special (%#jx)", DIP(dp, di_rdev));
break;
- case UFS_IFLNK:
+ case IFLNK:
fputs("symlink",stdout);
if (DIP(dp, di_size) > 0 &&
DIP(dp, di_size) < sblock.fs_maxsymlinklen &&
@@ -147,10 +147,10 @@ printstat(const char *cp, ino_t inum, union dinode *dp)
putchar('\n');
}
break;
- case UFS_IFSOCK:
+ case IFSOCK:
puts("socket");
break;
- case UFS_IFIFO:
+ case IFIFO:
puts("fifo");
break;
}
@@ -338,7 +338,7 @@ checkactivedir(void)
warnx("no current inode\n");
return 0;
}
- if ((DIP(curinode, di_mode) & UFS_IFMT) != UFS_IFDIR) {
+ if ((DIP(curinode, di_mode) & IFMT) != IFDIR) {
warnx("inode %ju not a directory", (uintmax_t)curinum);
return 0;
}
@@ -350,14 +350,14 @@ printactive(int doblocks)
{
if (!checkactive())
return 1;
- switch (DIP(curinode, di_mode) & UFS_IFMT) {
- case UFS_IFDIR:
- case UFS_IFREG:
- case UFS_IFBLK:
- case UFS_IFCHR:
- case UFS_IFLNK:
- case UFS_IFSOCK:
- case UFS_IFIFO:
+ switch (DIP(curinode, di_mode) & IFMT) {
+ case IFDIR:
+ case IFREG:
+ case IFBLK:
+ case IFCHR:
+ case IFLNK:
+ case IFSOCK:
+ case IFIFO:
if (doblocks)
printblocks(curinum, curinode);
else
@@ -368,7 +368,7 @@ printactive(int doblocks)
break;
default:
printf("current inode %ju: screwy itype 0%o (mode 0%o)?\n",
- (uintmax_t)curinum, DIP(curinode, di_mode) & UFS_IFMT,
+ (uintmax_t)curinum, DIP(curinode, di_mode) & IFMT,
DIP(curinode, di_mode));
break;
}
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index b4e49c29b8b5..79fc627e5f7a 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -883,7 +883,7 @@ fsinit(time_t utime)
/*
* create the root directory
*/
- node.dp1.di_mode = UFS_IFDIR | UMASK;
+ node.dp1.di_mode = IFDIR | UMASK;
node.dp1.di_nlink = entries;
node.dp1.di_size = makedir(root_dir, entries);
node.dp1.di_db[0] = alloc(sblock.fs_fsize, node.dp1.di_mode);
@@ -919,7 +919,7 @@ fsinit(time_t utime)
/*
* create the root directory
*/
- node.dp2.di_mode = UFS_IFDIR | UMASK;
+ node.dp2.di_mode = IFDIR | UMASK;
node.dp2.di_nlink = entries;
node.dp2.di_size = makedir(root_dir, entries);
node.dp2.di_db[0] = alloc(sblock.fs_fsize, node.dp2.di_mode);
@@ -1002,7 +1002,7 @@ goth:
acg.cg_cs.cs_nbfree--;
sblock.fs_cstotal.cs_nbfree--;
fscs[0].cs_nbfree--;
- if (mode & UFS_IFDIR) {
+ if (mode & IFDIR) {
acg.cg_cs.cs_ndir++;
sblock.fs_cstotal.cs_ndir++;
fscs[0].cs_ndir++;
diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c
index fb485e7475f9..7071aaf9dea5 100644
--- a/sbin/quotacheck/quotacheck.c
+++ b/sbin/quotacheck/quotacheck.c
@@ -370,7 +370,7 @@ chkquota(char *specname, struct quotafile *qfu, struct quotafile *qfg)
for (i = 0; i < inosused; i++, ino++) {
if ((dp = getnextinode(ino)) == NULL ||
ino < UFS_ROOTINO ||
- (mode = DIP(dp, di_mode) & UFS_IFMT) == 0)
+ (mode = DIP(dp, di_mode) & IFMT) == 0)
continue;
/*
* XXX: Do not account for UIDs or GIDs that appear
@@ -405,16 +405,16 @@ chkquota(char *specname, struct quotafile *qfu, struct quotafile *qfg)
fup = addid((u_long)DIP(dp, di_gid), GRPQUOTA,
(char *)0, mntpt);
fup->fu_curinodes++;
- if (mode == UFS_IFREG || mode == UFS_IFDIR ||
- mode == UFS_IFLNK)
+ if (mode == IFREG || mode == IFDIR ||
+ mode == IFLNK)
fup->fu_curblocks += DIP(dp, di_blocks);
}
if (qfu) {
fup = addid((u_long)DIP(dp, di_uid), USRQUOTA,
(char *)0, mntpt);
fup->fu_curinodes++;
- if (mode == UFS_IFREG || mode == UFS_IFDIR ||
- mode == UFS_IFLNK)
+ if (mode == IFREG || mode == IFDIR ||
+ mode == IFLNK)
fup->fu_curblocks += DIP(dp, di_blocks);
}
}
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index 519a11f673bb..a8120fda8b6e 100644
--- a/sbin/restore/dirs.c
+++ b/sbin/restore/dirs.c
@@ -178,7 +178,7 @@ extractdirs(int genmode)
for (;;) {
curfile.name = "<directory file - name unknown>";
curfile.action = USING;
- if (curfile.mode == 0 || (curfile.mode & UFS_IFMT) != UFS_IFDIR)
+ if (curfile.mode == 0 || (curfile.mode & IFMT) != IFDIR)
break;
itp = allocinotab(&curfile, seekpt);
getfile(putdir, putdirattrs, xtrnull);
@@ -205,7 +205,7 @@ void
skipdirs(void)
{
- while (curfile.ino && (curfile.mode & UFS_IFMT) == UFS_IFDIR) {
+ while (curfile.ino && (curfile.mode & IFMT) == IFDIR) {
skipfile();
}
}
diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c
index 911c95a550e7..15b1fb45bb04 100644
--- a/sbin/restore/interactive.c
+++ b/sbin/restore/interactive.c
@@ -741,9 +741,9 @@ glob_stat(const char *name, struct stat *stp)
(!vflag && dp->d_ino == UFS_WINO))
return (-1);
if (inodetype(dp->d_ino) == NODE)
- stp->st_mode = UFS_IFDIR;
+ stp->st_mode = IFDIR;
else
- stp->st_mode = UFS_IFREG;
+ stp->st_mode = IFREG;
return (0);
}
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index c1a85c964517..04cda7ebd636 100644
--- a/sbin/restore/tape.c
+++ b/sbin/restore/tape.c
@@ -592,19 +592,19 @@ extractfile(char *name)
gid = curfile.gid;
mode = curfile.mode;
flags = curfile.file_flags;
- switch (mode & UFS_IFMT) {
+ switch (mode & IFMT) {
default:
fprintf(stderr, "%s: unknown file mode 0%o\n", name, mode);
skipfile();
return (FAIL);
- case UFS_IFSOCK:
+ case IFSOCK:
vprintf(stdout, "skipped socket %s\n", name);
skipfile();
return (GOOD);
- case UFS_IFDIR:
+ case IFDIR:
if (mflag) {
ep = lookupname(name);
if (ep == NULL || ep->e_flags & EXTRACT)
@@ -615,7 +615,7 @@ extractfile(char *name)
vprintf(stdout, "extract file %s\n", name);
return (genliteraldir(name, curfile.ino));
- case UFS_IFLNK:
+ case IFLNK:
lnkbuf[0] = '\0';
pathlen = 0;
buf = setupextattr(extsize);
@@ -639,7 +639,7 @@ extractfile(char *name)
}
return (FAIL);
- case UFS_IFIFO:
+ case IFIFO:
vprintf(stdout, "extract fifo %s\n", name);
if (Nflag) {
skipfile();
@@ -667,8 +667,8 @@ extractfile(char *name)
(void) chflags(name, flags);
return (GOOD);
- case UFS_IFCHR:
- case UFS_IFBLK:
+ case IFCHR:
+ case IFBLK:
vprintf(stdout, "extract special file %s\n", name);
if (Nflag) {
skipfile();
@@ -676,7 +676,7 @@ extractfile(char *name)
}
if (uflag)
(void) unlink(name);
- if (mknod(name, (mode & (UFS_IFCHR | UFS_IFBLK)) | 0600,
+ if (mknod(name, (mode & (IFCHR | IFBLK)) | 0600,
(int)curfile.rdev) < 0) {
fprintf(stderr, "%s: cannot create special file: %s\n",
name, strerror(errno));
@@ -697,7 +697,7 @@ extractfile(char *name)
(void) chflags(name, flags);
return (GOOD);
- case UFS_IFREG:
+ case IFREG:
vprintf(stdout, "extract file %s\n", name);
if (Nflag) {
skipfile();
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c
index de6be992cfae..e3d972bceb57 100644
--- a/sbin/tunefs/tunefs.c
+++ b/sbin/tunefs/tunefs.c
@@ -1021,7 +1021,7 @@ journal_alloc(int64_t size)
if (sblock.fs_magic == FS_UFS1_MAGIC) {
bzero(dp1, sizeof(*dp1));
dp1->di_size = size;
- dp1->di_mode = UFS_IFREG | UFS_IREAD;
+ dp1->di_mode = IFREG | IREAD;
dp1->di_nlink = 1;
dp1->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
dp1->di_atime = utime;
@@ -1030,7 +1030,7 @@ journal_alloc(int64_t size)
} else {
bzero(dp2, sizeof(*dp2));
dp2->di_size = size;
- dp2->di_mode = UFS_IFREG | UFS_IREAD;
+ dp2->di_mode = IFREG | IREAD;
dp2->di_nlink = 1;
dp2->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
dp2->di_atime = utime;