Stick LFS_ in front of IFMT, IFIFO, IFREG, etc. so as not to conflict

with the UFS copies of these symbols. (Which themselves ought to have
UFS_ stuck on.)
This commit is contained in:
dholland 2013-06-08 02:11:11 +00:00
parent 5fce92dbf7
commit b6eb36b1f1
13 changed files with 78 additions and 78 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.27 2013/06/06 00:52:50 dholland Exp $ */
/* $NetBSD: dir.c,v 1.28 2013/06/08 02:11:11 dholland Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -317,7 +317,7 @@ fileerror(ino_t cwd, ino_t ino, const char *errmesg)
else {
if (ftypeok(VTOD(vp)))
pfatal("%s=%s\n",
(VTOI(vp)->i_ffs1_mode & IFMT) == IFDIR ?
(VTOI(vp)->i_ffs1_mode & LFS_IFMT) == LFS_IFDIR ?
"DIR" : "FILE", pathbuf);
else
pfatal("NAME=%s\n", pathbuf);
@ -337,7 +337,7 @@ adjust(struct inodesc *idesc, short lcnt)
clri(idesc, "UNREF", 0);
} else {
pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
((dp->di_mode & IFMT) == IFDIR ? "DIR" : "FILE"));
((dp->di_mode & LFS_IFMT) == LFS_IFDIR ? "DIR" : "FILE"));
pinode(idesc->id_number);
printf(" COUNT %d SHOULD BE %d",
dp->di_nlink, dp->di_nlink - lcnt);
@ -406,7 +406,7 @@ linkup(ino_t orphan, ino_t parentdir)
memset(&idesc, 0, sizeof(struct inodesc));
vp = vget(fs, orphan);
dp = VTOD(vp);
lostdir = (dp->di_mode & IFMT) == IFDIR;
lostdir = (dp->di_mode & LFS_IFMT) == LFS_IFDIR;
pwarn("UNREF %s ", lostdir ? "DIR" : "FILE");
pinode(orphan);
if (preen && dp->di_size == 0)
@ -448,7 +448,7 @@ linkup(ino_t orphan, ino_t parentdir)
}
vp = vget(fs, lfdir);
dp = VTOD(vp);
if ((dp->di_mode & IFMT) != IFDIR) {
if ((dp->di_mode & LFS_IFMT) != LFS_IFDIR) {
pfatal("lost+found IS NOT A DIRECTORY");
if (reply("REALLOCATE") == 0)
return (0);
@ -622,7 +622,7 @@ allocdir(ino_t parent, ino_t request, int mode)
struct dirtemplate *dirp;
struct uvnode *vp;
ino = allocino(request, IFDIR | mode);
ino = allocino(request, LFS_IFDIR | mode);
dirp = &dirhead;
dirp->dot_ino = ino;
dirp->dotdot_ino = parent;

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.46 2013/06/08 02:09:35 dholland Exp $ */
/* $NetBSD: inode.c,v 1.47 2013/06/08 02:11:11 dholland Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -137,9 +137,9 @@ ckinode(struct ulfs1_dinode *dp, struct inodesc *idesc)
idesc->id_fix = DONTKNOW;
idesc->id_entryno = 0;
idesc->id_filesize = dp->di_size;
mode = dp->di_mode & IFMT;
if (mode == IFBLK || mode == IFCHR ||
(mode == IFLNK && (dp->di_size < fs->lfs_maxsymlinklen ||
mode = dp->di_mode & LFS_IFMT;
if (mode == LFS_IFBLK || mode == LFS_IFCHR ||
(mode == LFS_IFLNK && (dp->di_size < fs->lfs_maxsymlinklen ||
(fs->lfs_maxsymlinklen == 0 &&
dp->di_blocks == 0))))
return (KEEPON);
@ -432,7 +432,7 @@ clri(struct inodesc * idesc, const char *type, int flag)
vp = vget(fs, idesc->id_number);
if (flag & 0x1) {
pwarn("%s %s", type,
(VTOI(vp)->i_ffs1_mode & IFMT) == IFDIR ? "DIR" : "FILE");
(VTOI(vp)->i_ffs1_mode & LFS_IFMT) == LFS_IFDIR ? "DIR" : "FILE");
pinode(idesc->id_number);
}
if ((flag & 0x2) || preen || reply("CLEAR") == 1) {
@ -594,12 +594,12 @@ allocino(ino_t request, int type)
if (ino == maxino)
extend_ifile(fs);
switch (type & IFMT) {
case IFDIR:
switch (type & LFS_IFMT) {
case LFS_IFDIR:
statemap[ino] = DSTATE;
break;
case IFREG:
case IFLNK:
case LFS_IFREG:
case LFS_IFLNK:
statemap[ino] = FSTATE;
break;
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass1.c,v 1.33 2013/06/06 00:54:49 dholland Exp $ */
/* $NetBSD: pass1.c,v 1.34 2013/06/08 02:11:11 dholland Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -132,7 +132,7 @@ pass1(void)
if (inumber == 0 || dins[i]->daddr == 0)
continue;
tinode = ginode(inumber);
if (tinode && (tinode->di_mode & IFMT) == IFDIR)
if (tinode && (tinode->di_mode & LFS_IFMT) == LFS_IFDIR)
numdirs++;
}
@ -181,7 +181,7 @@ checkinode(ino_t inumber, struct inodesc * idesc)
statemap[inumber] = USTATE;
return;
}
mode = dp->di_mode & IFMT;
mode = dp->di_mode & LFS_IFMT;
/* XXX - LFS doesn't have this particular problem (?) */
if (mode == 0) {
@ -208,11 +208,11 @@ checkinode(ino_t inumber, struct inodesc * idesc)
(unsigned long long) dp->di_size);
goto unknown;
}
if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
if (!preen && mode == LFS_IFMT && reply("HOLD BAD BLOCK") == 1) {
vp = vget(fs, inumber);
dp = VTOD(vp);
dp->di_size = fs->lfs_fsize;
dp->di_mode = IFREG | 0600;
dp->di_mode = LFS_IFREG | 0600;
inodirty(VTOI(vp));
}
ndb = howmany(dp->di_size, fs->lfs_bsize);
@ -222,9 +222,9 @@ checkinode(ino_t inumber, struct inodesc * idesc)
(unsigned long long) dp->di_size, ndb);
goto unknown;
}
if (mode == IFBLK || mode == IFCHR)
if (mode == LFS_IFBLK || mode == LFS_IFCHR)
ndb++;
if (mode == IFLNK) {
if (mode == LFS_IFLNK) {
/*
* Fake ndb value so direct/indirect block checks below
* will detect any garbage after symlink string.
@ -266,7 +266,7 @@ checkinode(ino_t inumber, struct inodesc * idesc)
zlnp->next = zlnhead;
zlnhead = zlnp;
}
if (mode == IFDIR) {
if (mode == LFS_IFDIR) {
if (dp->di_size == 0)
statemap[inumber] = DCLEAR;
else
@ -283,7 +283,7 @@ checkinode(ino_t inumber, struct inodesc * idesc)
if (dp->di_nlink <= 0) {
LFS_IENTRY(ifp, fs, inumber, bp);
if (ifp->if_nextfree == LFS_ORPHAN_NEXTFREE) {
statemap[inumber] = (mode == IFDIR ? DCLEAR : FCLEAR);
statemap[inumber] = (mode == LFS_IFDIR ? DCLEAR : FCLEAR);
/* Add this to our list of orphans */
zlnp = emalloc(sizeof *zlnp);
zlnp->zlncnt = inumber;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass2.c,v 1.19 2013/06/06 00:52:50 dholland Exp $ */
/* $NetBSD: pass2.c,v 1.20 2013/06/08 02:11:11 dholland Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -103,8 +103,8 @@ pass2(void)
errx(EEXIT, "%s", "");
vp = vget(fs, ULFS_ROOTINO);
dp = VTOD(vp);
dp->di_mode &= ~IFMT;
dp->di_mode |= IFDIR;
dp->di_mode &= ~LFS_IFMT;
dp->di_mode |= LFS_IFDIR;
inodirty(VTOI(vp));
break;
@ -156,7 +156,7 @@ pass2(void)
}
}
memset(&dino, 0, sizeof(struct ulfs1_dinode));
dino.di_mode = IFDIR;
dino.di_mode = LFS_IFDIR;
dino.di_size = inp->i_isize;
memcpy(&dino.di_db[0], &inp->i_blks[0], (size_t) inp->i_numblks);
curino.id_number = inp->i_number;
@ -382,7 +382,7 @@ again:
break;
dp = ginode(dirp->d_ino);
statemap[dirp->d_ino] =
(dp->di_mode & IFMT) == IFDIR ? DSTATE : FSTATE;
(dp->di_mode & LFS_IFMT) == LFS_IFDIR ? DSTATE : FSTATE;
lncntp[dirp->d_ino] = dp->di_nlink;
goto again;

View File

@ -1,4 +1,4 @@
/* $NetBSD: utilities.c,v 1.33 2013/06/06 00:52:50 dholland Exp $ */
/* $NetBSD: utilities.c,v 1.34 2013/06/08 02:11:11 dholland Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -66,15 +66,15 @@ extern off_t locked_queue_bytes;
int
ftypeok(struct ulfs1_dinode * dp)
{
switch (dp->di_mode & IFMT) {
switch (dp->di_mode & LFS_IFMT) {
case IFDIR:
case IFREG:
case IFBLK:
case IFCHR:
case IFLNK:
case IFSOCK:
case IFIFO:
case LFS_IFDIR:
case LFS_IFREG:
case LFS_IFBLK:
case LFS_IFCHR:
case LFS_IFLNK:
case LFS_IFSOCK:
case LFS_IFIFO:
return (1);
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: make_lfs.c,v 1.23 2013/06/08 02:09:35 dholland Exp $ */
/* $NetBSD: make_lfs.c,v 1.24 2013/06/08 02:11:11 dholland Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
#if 0
static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95";
#else
__RCSID("$NetBSD: make_lfs.c,v 1.23 2013/06/08 02:09:35 dholland Exp $");
__RCSID("$NetBSD: make_lfs.c,v 1.24 2013/06/08 02:11:11 dholland Exp $");
#endif
#endif /* not lint */
@ -615,7 +615,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
if (dip == NULL)
err(1, NULL);
memset(dip, 0, sizeof(*dip));
dip->di_mode = IFREG|IREAD|IWRITE;
dip->di_mode = LFS_IFREG|IREAD|IWRITE;
dip->di_flags = SF_IMMUTABLE;
make_dinode(LFS_IFILE_INUM, dip,
blkstofrags(fs, fs->lfs_cleansz + fs->lfs_segtabsz + 1), fs);
@ -680,7 +680,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
vp = lfs_raw_vget(fs, ULFS_ROOTINO, devfd, 0x0);
dip = VTOI(vp)->i_din.ffs1_din;
make_dinode(ULFS_ROOTINO, dip, howmany(DIRBLKSIZ,fs->lfs_fsize), fs);
dip->di_mode = IFDIR | UMASK;
dip->di_mode = LFS_IFDIR | UMASK;
VTOI(vp)->i_lfs_osize = dip->di_size = DIRBLKSIZ;
#ifdef MAKE_LF_DIR
VTOI(vp)->i_nlink = dip->di_nlink = 3;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_rfw.c,v 1.15 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: lfs_rfw.c,v 1.16 2013/06/08 02:11:11 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.15 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.16 2013/06/08 02:11:11 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -180,7 +180,7 @@ lfs_rf_valloc(struct lfs *fs, ino_t ino, int vers, struct lwp *l,
* this later if it turns out to be some other kind of file.
*/
ip = VTOI(vp);
ip->i_mode = ip->i_ffs1_mode = IFREG;
ip->i_mode = ip->i_ffs1_mode = LFS_IFREG;
ip->i_nlink = ip->i_ffs1_nlink = 1;
ulfs_vinit(vp->v_mount, lfs_specop_p, lfs_fifoop_p, &vp);
ip = VTOI(vp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.227 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: lfs_segment.c,v 1.228 2013/06/08 02:11:11 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.227 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.228 2013/06/08 02:11:11 dholland Exp $");
#ifdef DEBUG
# define vndebug(vp, str) do { \
@ -1208,8 +1208,8 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip)
*/
/* Check file size based on highest allocated block */
if (((ip->i_ffs1_mode & IFMT) == IFREG ||
(ip->i_ffs1_mode & IFMT) == IFDIR) &&
if (((ip->i_ffs1_mode & LFS_IFMT) == LFS_IFREG ||
(ip->i_ffs1_mode & LFS_IFMT) == LFS_IFDIR) &&
ip->i_size > ((ip->i_lfs_hiblk + 1) << fs->lfs_bshift)) {
cdp->di_size = (ip->i_lfs_hiblk + 1) << fs->lfs_bshift;
DLOG((DLOG_SEG, "lfs_writeinode: ino %d size %" PRId64 " -> %"
@ -1236,10 +1236,10 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip)
for (i = (cdp->di_size + fs->lfs_bsize - 1) >> fs->lfs_bshift;
i < ULFS_NDADDR; i++) {
KASSERT(i >= 0);
if ((cdp->di_mode & IFMT) == IFLNK)
if ((cdp->di_mode & LFS_IFMT) == LFS_IFLNK)
continue;
if (((cdp->di_mode & IFMT) == IFBLK ||
(cdp->di_mode & IFMT) == IFCHR) && i == 0)
if (((cdp->di_mode & LFS_IFMT) == LFS_IFBLK ||
(cdp->di_mode & LFS_IFMT) == LFS_IFCHR) && i == 0)
continue;
if (cdp->di_db[i] != 0) {
# ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.302 2013/06/06 00:49:28 dholland Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.303 2013/06/08 02:11:11 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.302 2013/06/06 00:49:28 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.303 2013/06/08 02:11:11 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -1999,7 +1999,7 @@ lfs_vinit(struct mount *mp, struct vnode **vpp)
# endif
panic("lfs_vinit: ino %llu is type VNON! (ifmt=%o)\n",
(unsigned long long)ip->i_number,
(ip->i_mode & IFMT) >> 12);
(ip->i_mode & LFS_IFMT) >> 12);
}
#endif /* DIAGNOSTIC */

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.245 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.246 2013/06/08 02:11:11 dholland Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.245 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.246 2013/06/08 02:11:11 dholland Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -953,7 +953,7 @@ lfs_getattr(void *v)
*/
vap->va_fsid = ip->i_dev;
vap->va_fileid = ip->i_number;
vap->va_mode = ip->i_mode & ~IFMT;
vap->va_mode = ip->i_mode & ~LFS_IFMT;
vap->va_nlink = ip->i_nlink;
vap->va_uid = ip->i_uid;
vap->va_gid = ip->i_gid;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_dinode.h,v 1.5 2013/06/08 02:09:35 dholland Exp $ */
/* $NetBSD: ulfs_dinode.h,v 1.6 2013/06/08 02:11:11 dholland Exp $ */
/* from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp */
/*
@ -90,14 +90,14 @@
#define ISUID 0004000 /* Set-uid. */
/* File types. */
#define IFMT 0170000 /* Mask of file type. */
#define IFIFO 0010000 /* Named pipe (fifo). */
#define IFCHR 0020000 /* Character device. */
#define IFDIR 0040000 /* Directory file. */
#define IFBLK 0060000 /* Block device. */
#define IFREG 0100000 /* Regular file. */
#define IFLNK 0120000 /* Symbolic link. */
#define IFSOCK 0140000 /* UNIX domain socket. */
#define IFWHT 0160000 /* Whiteout. */
#define LFS_IFMT 0170000 /* Mask of file type. */
#define LFS_IFIFO 0010000 /* Named pipe (fifo). */
#define LFS_IFCHR 0020000 /* Character device. */
#define LFS_IFDIR 0040000 /* Directory file. */
#define LFS_IFBLK 0060000 /* Block device. */
#define LFS_IFREG 0100000 /* Regular file. */
#define LFS_IFLNK 0120000 /* Symbolic link. */
#define LFS_IFSOCK 0140000 /* UNIX domain socket. */
#define LFS_IFWHT 0160000 /* Whiteout. */
#endif /* !_UFS_LFS_ULFS_DINODE_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_rename.c,v 1.3 2013/06/06 00:48:04 dholland Exp $ */
/* $NetBSD: ulfs_rename.c,v 1.4 2013/06/08 02:11:11 dholland Exp $ */
/* from NetBSD: ufs_rename.c,v 1.6 2013/01/22 09:39:18 dholland Exp */
/*-
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_rename.c,v 1.3 2013/06/06 00:48:04 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_rename.c,v 1.4 2013/06/08 02:11:11 dholland Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -323,10 +323,10 @@ ulfs_gro_rename(struct mount *mp, kauth_cred_t cred,
return EMLINK;
directory_p = (fvp->v_type == VDIR);
KASSERT(directory_p == ((VTOI(fvp)->i_mode & IFMT) == IFDIR));
KASSERT(directory_p == ((VTOI(fvp)->i_mode & LFS_IFMT) == LFS_IFDIR));
KASSERT((tvp == NULL) || (directory_p == (tvp->v_type == VDIR)));
KASSERT((tvp == NULL) || (directory_p ==
((VTOI(tvp)->i_mode & IFMT) == IFDIR)));
((VTOI(tvp)->i_mode & LFS_IFMT) == LFS_IFDIR)));
reparent_p = (fdvp != tdvp);
KASSERT(reparent_p == (VTOI(fdvp)->i_number != VTOI(tdvp)->i_number));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_vnops.c,v 1.6 2013/06/06 00:51:25 dholland Exp $ */
/* $NetBSD: ulfs_vnops.c,v 1.7 2013/06/08 02:11:11 dholland Exp $ */
/* from NetBSD: ufs_vnops.c,v 1.212 2013/03/18 19:35:48 plunky Exp */
/*-
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.6 2013/06/06 00:51:25 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.7 2013/06/08 02:11:11 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -994,7 +994,7 @@ ulfs_mkdir(void *v)
goto out;
}
dmode = vap->va_mode & ACCESSPERMS;
dmode |= IFDIR;
dmode |= LFS_IFDIR;
/*
* Must simulate part of ulfs_makeinode here to acquire the inode,
* but not have it entered in the parent directory. The entry is
@ -1253,7 +1253,7 @@ ulfs_symlink(void *v)
* ulfs_makeinode
*/
fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED);
error = ulfs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp, ulr,
error = ulfs_makeinode(LFS_IFLNK | ap->a_vap->va_mode, ap->a_dvp, ulr,
vpp, ap->a_cnp);
if (error)
goto out;
@ -1814,8 +1814,8 @@ ulfs_makeinode(int mode, struct vnode *dvp, const struct ulfs_lookup_results *ul
pdir = VTOI(dvp);
if ((mode & IFMT) == 0)
mode |= IFREG;
if ((mode & LFS_IFMT) == 0)
mode |= LFS_IFREG;
if ((error = ULFS_VALLOC(dvp, mode, cnp->cn_cred, vpp)) != 0) {
vput(dvp);