Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically: ROOTINO -> UFS_ROOTINO WINO -> UFS_WINO NXADDR -> UFS_NXADDR NDADDR -> UFS_NDADDR NIADDR -> UFS_NIADDR MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency) Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have the same values in ext2fs and ffs. No functional change intended.
This commit is contained in:
parent
cb9b8472f6
commit
dcd34a91c5
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: coalesce.c,v 1.19 2012/01/02 21:35:17 perseant Exp $ */
|
||||
/* $NetBSD: coalesce.c,v 1.20 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
|
||||
@ -164,7 +164,7 @@ clean_inode(struct clfs *fs, ino_t ino)
|
||||
onb = nb = lblkno(fs, dip->di_size);
|
||||
|
||||
/* XXX for now, don't do any file small enough to have fragments */
|
||||
if (nb < NDADDR) {
|
||||
if (nb < UFS_NDADDR) {
|
||||
free(dip);
|
||||
return COALESCE_TOOSMALL;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_cleanerd.c,v 1.31 2012/04/16 10:48:27 joerg Exp $ */
|
||||
/* $NetBSD: lfs_cleanerd.c,v 1.32 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
@ -342,9 +342,9 @@ lfs_ientry(IFILE **ifpp, struct clfs *fs, ino_t ino, struct ubuf **bpp)
|
||||
|
||||
#ifdef TEST_PATTERN
|
||||
/*
|
||||
* Check ROOTINO for file data. The assumption is that we are running
|
||||
* Check UFS_ROOTINO for file data. The assumption is that we are running
|
||||
* the "twofiles" test with the rest of the filesystem empty. Files
|
||||
* created by "twofiles" match the test pattern, but ROOTINO and the
|
||||
* created by "twofiles" match the test pattern, but UFS_ROOTINO and the
|
||||
* executable itself (assumed to be inode 3) should not match.
|
||||
*/
|
||||
static void
|
||||
@ -950,7 +950,7 @@ static off_t
|
||||
check_hidden_cost(struct clfs *fs, BLOCK_INFO *bip, int bic, off_t *ifc)
|
||||
{
|
||||
int start;
|
||||
struct indir in[NIADDR + 1];
|
||||
struct indir in[UFS_NIADDR + 1];
|
||||
int num;
|
||||
int i, j, ebic;
|
||||
BLOCK_INFO *ebip;
|
||||
@ -974,7 +974,7 @@ check_hidden_cost(struct clfs *fs, BLOCK_INFO *bip, int bic, off_t *ifc)
|
||||
}
|
||||
if (bip[i].bi_lbn == LFS_UNUSED_LBN)
|
||||
continue;
|
||||
if (bip[i].bi_lbn < NDADDR)
|
||||
if (bip[i].bi_lbn < UFS_NDADDR)
|
||||
continue;
|
||||
|
||||
ufs_getlbns((struct lfs *)fs, NULL, (daddr_t)bip[i].bi_lbn, in, &num);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dump.h,v 1.49 2013/01/13 23:45:35 dholland Exp $ */
|
||||
/* $NetBSD: dump.h,v 1.50 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@ -72,7 +72,7 @@ struct ufsi {
|
||||
#define ufs_blkoff(u,loc) /* calculates (loc % u->ufs_bsize) */ \
|
||||
((loc) & (u)->ufs_qbmask)
|
||||
#define ufs_dblksize(u,d,b) \
|
||||
((((b) >= NDADDR || DIP((d), size) >= ((b)+1) << (u)->ufs_bshift \
|
||||
((((b) >= UFS_NDADDR || DIP((d), size) >= ((b)+1) << (u)->ufs_bshift \
|
||||
? (u)->ufs_bsize \
|
||||
: (ufs_fragroundup((u), ufs_blkoff(u, DIP((d), size)))))))
|
||||
struct ufsi *ufsib;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_inode.c,v 1.19 2013/01/13 22:59:31 dholland Exp $ */
|
||||
/* $NetBSD: ffs_inode.c,v 1.20 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993, 1994
|
||||
@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: ffs_inode.c,v 1.19 2013/01/13 22:59:31 dholland Exp $");
|
||||
__RCSID("$NetBSD: ffs_inode.c,v 1.20 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -206,7 +206,7 @@ fs_mapinodes(ino_t maxino __unused, u_int64_t *tape_size, int *anydirskipped)
|
||||
continue;
|
||||
}
|
||||
for (i = 0; i < inosused; i++, ino++) {
|
||||
if (ino < ROOTINO)
|
||||
if (ino < UFS_ROOTINO)
|
||||
continue;
|
||||
mapfileino(ino, tape_size, anydirskipped);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: traverse.c,v 1.48 2008/08/12 13:28:35 simonb Exp $ */
|
||||
/* $NetBSD: traverse.c,v 1.49 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1988, 1991, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)traverse.c 8.7 (Berkeley) 6/15/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: traverse.c,v 1.48 2008/08/12 13:28:35 simonb Exp $");
|
||||
__RCSID("$NetBSD: traverse.c,v 1.49 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -98,10 +98,10 @@ blockest(union dinode *dp)
|
||||
sizeest = howmany(ufs_fragroundup(ufsib, DIP(dp, size)), TP_BSIZE);
|
||||
if (blkest > sizeest)
|
||||
blkest = sizeest;
|
||||
if (DIP(dp, size) > ufsib->ufs_bsize * NDADDR) {
|
||||
if (DIP(dp, size) > ufsib->ufs_bsize * UFS_NDADDR) {
|
||||
/* calculate the number of indirect blocks on the dump tape */
|
||||
blkest +=
|
||||
howmany(sizeest - NDADDR * ufsib->ufs_bsize / TP_BSIZE,
|
||||
howmany(sizeest - UFS_NDADDR * ufsib->ufs_bsize / TP_BSIZE,
|
||||
TP_NINDIR);
|
||||
}
|
||||
return (blkest + 1);
|
||||
@ -246,7 +246,7 @@ mapfiles(ino_t maxino, u_int64_t *tape_size, char *diskname, char * const *dirv)
|
||||
* Ensure that the root inode actually appears in the
|
||||
* file list for a subdir
|
||||
*/
|
||||
mapfileino(ROOTINO, tape_size, &anydirskipped);
|
||||
mapfileino(UFS_ROOTINO, tape_size, &anydirskipped);
|
||||
} else {
|
||||
fs_mapinodes(maxino, tape_size, &anydirskipped);
|
||||
}
|
||||
@ -254,7 +254,7 @@ mapfiles(ino_t maxino, u_int64_t *tape_size, char *diskname, char * const *dirv)
|
||||
* Restore gets very upset if the root is not dumped,
|
||||
* so ensure that it always is dumped.
|
||||
*/
|
||||
SETINO(ROOTINO, dumpinomap);
|
||||
SETINO(UFS_ROOTINO, dumpinomap);
|
||||
return (anydirskipped);
|
||||
}
|
||||
|
||||
@ -308,7 +308,7 @@ mapdirs(ino_t maxino, u_int64_t *tape_size)
|
||||
else
|
||||
di.dp1 = dp->dp1;
|
||||
filesize = DIP(&di, size);
|
||||
for (ret = 0, i = 0; filesize > 0 && i < NDADDR; i++) {
|
||||
for (ret = 0, i = 0; filesize > 0 && i < UFS_NDADDR; i++) {
|
||||
if (is_ufs2)
|
||||
blk = iswap64(di.dp2.di_db[i]);
|
||||
else
|
||||
@ -322,7 +322,7 @@ mapdirs(ino_t maxino, u_int64_t *tape_size)
|
||||
else
|
||||
filesize -= ufsib->ufs_bsize;
|
||||
}
|
||||
for (i = 0; filesize > 0 && i < NIADDR; i++) {
|
||||
for (i = 0; filesize > 0 && i < UFS_NIADDR; i++) {
|
||||
if (is_ufs2)
|
||||
blk = iswap64(di.dp2.di_ib[i]);
|
||||
else
|
||||
@ -570,8 +570,8 @@ dumpino(union dinode *dp, ino_t ino)
|
||||
msg("Warning: undefined file type 0%o\n", DIP(dp, mode) & IFMT);
|
||||
return;
|
||||
}
|
||||
if (DIP(dp, size) > NDADDR * ufsib->ufs_bsize)
|
||||
cnt = NDADDR * ufsib->ufs_frag;
|
||||
if (DIP(dp, size) > UFS_NDADDR * ufsib->ufs_bsize)
|
||||
cnt = UFS_NDADDR * ufsib->ufs_frag;
|
||||
else
|
||||
cnt = howmany(DIP(dp, size), ufsib->ufs_fsize);
|
||||
if (is_ufs2)
|
||||
@ -579,9 +579,9 @@ dumpino(union dinode *dp, ino_t ino)
|
||||
else
|
||||
blksout32(&dp->dp1.di_db[0], cnt, ino);
|
||||
|
||||
if ((size = DIP(dp, size) - NDADDR * ufsib->ufs_bsize) <= 0)
|
||||
if ((size = DIP(dp, size) - UFS_NDADDR * ufsib->ufs_bsize) <= 0)
|
||||
return;
|
||||
for (ind_level = 0; ind_level < NIADDR; ind_level++) {
|
||||
for (ind_level = 0; ind_level < UFS_NIADDR; ind_level++) {
|
||||
if (is_ufs2)
|
||||
blk = iswap64(dp->dp2.di_ib[ind_level]);
|
||||
else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_inode.c,v 1.15 2011/08/14 12:13:24 christos Exp $ */
|
||||
/* $NetBSD: lfs_inode.c,v 1.16 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991, 1993, 1994
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: lfs_inode.c,v 1.15 2011/08/14 12:13:24 christos Exp $");
|
||||
__RCSID("$NetBSD: lfs_inode.c,v 1.16 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -187,16 +187,16 @@ fs_mapinodes(ino_t maxino, u_int64_t *tapesz, int *anydirskipped)
|
||||
{
|
||||
ino_t ino;
|
||||
|
||||
for (ino = ROOTINO; ino < maxino; ino++)
|
||||
for (ino = UFS_ROOTINO; ino < maxino; ino++)
|
||||
mapfileino(ino, tapesz, anydirskipped);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX KS - I know there's a better way to do this.
|
||||
*/
|
||||
#define BASE_SINDIR (NDADDR)
|
||||
#define BASE_DINDIR (NDADDR+NINDIR(fs))
|
||||
#define BASE_TINDIR (NDADDR+NINDIR(fs)+NINDIR(fs)*NINDIR(fs))
|
||||
#define BASE_SINDIR (UFS_NDADDR)
|
||||
#define BASE_DINDIR (UFS_NDADDR+NINDIR(fs))
|
||||
#define BASE_TINDIR (UFS_NDADDR+NINDIR(fs)+NINDIR(fs)*NINDIR(fs))
|
||||
|
||||
#define D_UNITS (NINDIR(fs))
|
||||
#define T_UNITS (NINDIR(fs)*NINDIR(fs))
|
||||
@ -221,7 +221,7 @@ lfs_bmap(struct lfs *fs, struct ufs1_dinode *idinode, daddr_t lbn)
|
||||
*/
|
||||
if(lbn < 0) {
|
||||
lbn *= -1;
|
||||
if(lbn == NDADDR) {
|
||||
if (lbn == UFS_NDADDR) {
|
||||
/* printf("lbn %d: single indir base\n", -lbn); */
|
||||
return idinode->di_ib[0]; /* single indirect */
|
||||
} else if(lbn == BASE_DINDIR+1) {
|
||||
@ -236,7 +236,7 @@ lfs_bmap(struct lfs *fs, struct ufs1_dinode *idinode, daddr_t lbn)
|
||||
* Find the immediate parent. This is essentially finding the
|
||||
* residue of modulus, and then rounding accordingly.
|
||||
*/
|
||||
residue = (lbn-NDADDR) % NINDIR(fs);
|
||||
residue = (lbn-UFS_NDADDR) % NINDIR(fs);
|
||||
if(residue == 1) {
|
||||
/* Double indirect. Parent is the triple. */
|
||||
up = idinode->di_ib[2];
|
||||
@ -265,12 +265,12 @@ lfs_bmap(struct lfs *fs, struct ufs1_dinode *idinode, daddr_t lbn)
|
||||
}
|
||||
} else {
|
||||
/* Direct block. Its parent must be a single indirect. */
|
||||
if(lbn < NDADDR)
|
||||
if (lbn < UFS_NDADDR)
|
||||
return idinode->di_db[lbn];
|
||||
else {
|
||||
/* Parent is an indirect block. */
|
||||
up = -(((lbn-NDADDR) / D_UNITS) * D_UNITS + NDADDR);
|
||||
off = (lbn-NDADDR) % D_UNITS;
|
||||
up = -(((lbn-UFS_NDADDR) / D_UNITS) * D_UNITS + UFS_NDADDR);
|
||||
off = (lbn-UFS_NDADDR) % D_UNITS;
|
||||
/* printf("lbn %d: parent is %d/%d\n", lbn,up,off); */
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.c,v 1.25 2012/11/25 19:42:14 jakllsch Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.26 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -58,7 +58,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: dir.c,v 1.25 2012/11/25 19:42:14 jakllsch Exp $");
|
||||
__RCSID("$NetBSD: dir.c,v 1.26 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -559,7 +559,7 @@ expanddir(struct ext2fs_dinode *dp, char *name)
|
||||
char *firstblk;
|
||||
|
||||
lastbn = lblkno(&sblock, inosize(dp));
|
||||
if (lastbn >= NDADDR - 1 || fs2h32(dp->e2di_blocks[lastbn]) == 0 ||
|
||||
if (lastbn >= EXT2FS_NDADDR - 1 || fs2h32(dp->e2di_blocks[lastbn]) == 0 ||
|
||||
inosize(dp) == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: inode.c,v 1.32 2012/11/25 19:42:14 jakllsch Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.33 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -58,7 +58,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: inode.c,v 1.32 2012/11/25 19:42:14 jakllsch Exp $");
|
||||
__RCSID("$NetBSD: inode.c,v 1.33 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -183,7 +183,7 @@ ckinode(struct ext2fs_dinode *dp, struct inodesc *idesc)
|
||||
return (KEEPON);
|
||||
dino = *dp;
|
||||
ndb = howmany(inosize(&dino), sblock.e2fs_bsize);
|
||||
for (ap = &dino.e2di_blocks[0]; ap < &dino.e2di_blocks[NDADDR];
|
||||
for (ap = &dino.e2di_blocks[0]; ap < &dino.e2di_blocks[EXT2FS_NDADDR];
|
||||
ap++,ndb--) {
|
||||
idesc->id_numfrags = 1;
|
||||
if (*ap == 0) {
|
||||
@ -215,9 +215,9 @@ ckinode(struct ext2fs_dinode *dp, struct inodesc *idesc)
|
||||
return (ret);
|
||||
}
|
||||
idesc->id_numfrags = 1;
|
||||
remsize = inosize(&dino) - sblock.e2fs_bsize * NDADDR;
|
||||
remsize = inosize(&dino) - sblock.e2fs_bsize * EXT2FS_NDADDR;
|
||||
sizepb = sblock.e2fs_bsize;
|
||||
for (ap = &dino.e2di_blocks[NDADDR], n = 1; n <= NIADDR; ap++, n++) {
|
||||
for (ap = &dino.e2di_blocks[EXT2FS_NDADDR], n = 1; n <= EXT2FS_NIADDR; ap++, n++) {
|
||||
if (*ap) {
|
||||
idesc->id_blkno = fs2h32(*ap);
|
||||
ret = iblock(idesc, n, remsize);
|
||||
@ -499,8 +499,8 @@ cacheino(struct ext2fs_dinode *dp, ino_t inumber)
|
||||
unsigned int blks;
|
||||
|
||||
blks = howmany(inosize(dp), sblock.e2fs_bsize);
|
||||
if (blks > NDADDR)
|
||||
blks = NDADDR + NIADDR;
|
||||
if (blks > EXT2FS_NDADDR)
|
||||
blks = EXT2FS_NDADDR + EXT2FS_NIADDR;
|
||||
/* XXX ondisk32 */
|
||||
inp = malloc(sizeof(*inp) + (blks - 1) * sizeof(int32_t));
|
||||
if (inp == NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass1.c,v 1.22 2012/11/25 19:42:14 jakllsch Exp $ */
|
||||
/* $NetBSD: pass1.c,v 1.23 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -58,7 +58,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass1.c,v 1.22 2012/11/25 19:42:14 jakllsch Exp $");
|
||||
__RCSID("$NetBSD: pass1.c,v 1.23 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -170,7 +170,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
if (mode == 0 || (dp->e2di_dtime != 0 && dp->e2di_nlink == 0)) {
|
||||
if (mode == 0 && (
|
||||
memcmp(dp->e2di_blocks, zino.e2di_blocks,
|
||||
(NDADDR + NIADDR) * sizeof(u_int32_t)) ||
|
||||
(EXT2FS_NDADDR + EXT2FS_NIADDR) * sizeof(u_int32_t)) ||
|
||||
dp->e2di_mode || inosize(dp))) {
|
||||
pfatal("PARTIALLY ALLOCATED INODE I=%llu",
|
||||
(unsigned long long)inumber);
|
||||
@ -241,30 +241,30 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
if (inosize(dp) < EXT2_MAXSYMLINKLEN ||
|
||||
(EXT2_MAXSYMLINKLEN == 0 && dp->e2di_blocks == 0)) {
|
||||
ndb = howmany(inosize(dp), sizeof(u_int32_t));
|
||||
if (ndb > NDADDR) {
|
||||
j = ndb - NDADDR;
|
||||
if (ndb > EXT2FS_NDADDR) {
|
||||
j = ndb - EXT2FS_NDADDR;
|
||||
for (ndb = 1; j > 1; j--)
|
||||
ndb *= NINDIR(&sblock);
|
||||
ndb += NDADDR;
|
||||
ndb += EXT2FS_NDADDR;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Linux puts things in blocks for FIFO, so skip this check */
|
||||
if (mode != IFIFO) {
|
||||
for (j = ndb; j < NDADDR; j++)
|
||||
for (j = ndb; j < EXT2FS_NDADDR; j++)
|
||||
if (dp->e2di_blocks[j] != 0) {
|
||||
if (debug)
|
||||
printf("bad direct addr: %d\n",
|
||||
fs2h32(dp->e2di_blocks[j]));
|
||||
goto unknown;
|
||||
}
|
||||
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
|
||||
for (j = 0, ndb -= EXT2FS_NDADDR; ndb > 0; j++)
|
||||
ndb /= NINDIR(&sblock);
|
||||
for (; j < NIADDR; j++) {
|
||||
if (dp->e2di_blocks[j+NDADDR] != 0) {
|
||||
for (; j < EXT2FS_NIADDR; j++) {
|
||||
if (dp->e2di_blocks[j+EXT2FS_NDADDR] != 0) {
|
||||
if (debug)
|
||||
printf("bad indirect addr: %d\n",
|
||||
fs2h32(dp->e2di_blocks[j+NDADDR]));
|
||||
fs2h32(dp->e2di_blocks[j+EXT2FS_NDADDR]));
|
||||
goto unknown;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setup.c,v 1.28 2011/09/16 16:13:18 plunky Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.29 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -58,7 +58,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: setup.c,v 1.28 2011/09/16 16:13:18 plunky Exp $");
|
||||
__RCSID("$NetBSD: setup.c,v 1.29 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -180,8 +180,8 @@ setup(const char *dev)
|
||||
maxfsblock = sblock.e2fs.e2fs_bcount;
|
||||
maxino = sblock.e2fs_ncg * sblock.e2fs.e2fs_ipg;
|
||||
sizepb = sblock.e2fs_bsize;
|
||||
maxfilesize = sblock.e2fs_bsize * NDADDR - 1;
|
||||
for (i = 0; i < NIADDR; i++) {
|
||||
maxfilesize = sblock.e2fs_bsize * EXT2FS_NDADDR - 1;
|
||||
for (i = 0; i < EXT2FS_NIADDR; i++) {
|
||||
sizepb *= NINDIR(&sblock);
|
||||
maxfilesize += sizepb;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.c,v 1.53 2011/03/06 17:08:16 bouyer Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.54 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: dir.c,v 1.53 2011/03/06 17:08:16 bouyer Exp $");
|
||||
__RCSID("$NetBSD: dir.c,v 1.54 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -367,7 +367,7 @@ fileerror(ino_t cwd, ino_t ino, const char *errmesg)
|
||||
pinode(ino);
|
||||
printf("\n");
|
||||
getpathname(pathbuf, sizeof(pathbuf), cwd, ino);
|
||||
if (ino < ROOTINO || ino > maxino) {
|
||||
if (ino < UFS_ROOTINO || ino > maxino) {
|
||||
pfatal("NAME=%s\n", pathbuf);
|
||||
return;
|
||||
}
|
||||
@ -534,11 +534,11 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
|
||||
if (parentdir != 0)
|
||||
inoinfo(parentdir)->ino_linkcnt++;
|
||||
if (lfdir == 0) {
|
||||
dp = ginode(ROOTINO);
|
||||
dp = ginode(UFS_ROOTINO);
|
||||
idesc.id_name = lfname;
|
||||
idesc.id_type = DATA;
|
||||
idesc.id_func = findino;
|
||||
idesc.id_number = ROOTINO;
|
||||
idesc.id_number = UFS_ROOTINO;
|
||||
idesc.id_uid = iswap32(DIP(dp, uid));
|
||||
idesc.id_gid = iswap32(DIP(dp, gid));
|
||||
if ((ckinode(dp, &idesc) & FOUND) != 0) {
|
||||
@ -546,21 +546,21 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
|
||||
} else {
|
||||
pwarn("NO lost+found DIRECTORY");
|
||||
if (preen || reply("CREATE")) {
|
||||
lfdir = allocdir(ROOTINO, (ino_t)0, lfmode);
|
||||
lfdir = allocdir(UFS_ROOTINO, (ino_t)0, lfmode);
|
||||
if (lfdir != 0) {
|
||||
if (makeentry(ROOTINO, lfdir, lfname) != 0) {
|
||||
if (makeentry(UFS_ROOTINO, lfdir, lfname) != 0) {
|
||||
numdirs++;
|
||||
if (preen)
|
||||
printf(" (CREATED)\n");
|
||||
} else {
|
||||
freedir(lfdir, ROOTINO);
|
||||
freedir(lfdir, UFS_ROOTINO);
|
||||
lfdir = 0;
|
||||
if (preen)
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
if (lfdir != 0) {
|
||||
reparent(lfdir, ROOTINO);
|
||||
reparent(lfdir, UFS_ROOTINO);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -580,19 +580,19 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
|
||||
return (0);
|
||||
}
|
||||
oldlfdir = lfdir;
|
||||
lfdir = allocdir(ROOTINO, (ino_t)0, lfmode);
|
||||
lfdir = allocdir(UFS_ROOTINO, (ino_t)0, lfmode);
|
||||
if (lfdir == 0) {
|
||||
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
|
||||
markclean = 0;
|
||||
return (0);
|
||||
}
|
||||
if ((changeino(ROOTINO, lfname, lfdir) & ALTERED) == 0) {
|
||||
if ((changeino(UFS_ROOTINO, lfname, lfdir) & ALTERED) == 0) {
|
||||
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
|
||||
markclean = 0;
|
||||
return (0);
|
||||
}
|
||||
inodirty();
|
||||
reparent(lfdir, ROOTINO);
|
||||
reparent(lfdir, UFS_ROOTINO);
|
||||
idesc.id_type = ADDR;
|
||||
idesc.id_func = pass4check;
|
||||
idesc.id_number = oldlfdir;
|
||||
@ -665,8 +665,8 @@ makeentry(ino_t parent, ino_t ino, const char *name)
|
||||
struct inodesc idesc;
|
||||
char pathbuf[MAXPATHLEN + 1];
|
||||
|
||||
if (parent < ROOTINO || parent >= maxino ||
|
||||
ino < ROOTINO || ino >= maxino)
|
||||
if (parent < UFS_ROOTINO || parent >= maxino ||
|
||||
ino < UFS_ROOTINO || ino >= maxino)
|
||||
return (0);
|
||||
dp = ginode(parent);
|
||||
memset(&idesc, 0, sizeof(struct inodesc));
|
||||
@ -717,7 +717,7 @@ expanddir(union dinode *dp, char *name)
|
||||
dp1 = &dp->dp1;
|
||||
|
||||
lastbn = lblkno(sblock, iswap64(DIP(dp, size)));
|
||||
if (lastbn >= NDADDR - 1 || DIP(dp, db[lastbn]) == 0 ||
|
||||
if (lastbn >= UFS_NDADDR - 1 || DIP(dp, db[lastbn]) == 0 ||
|
||||
DIP(dp, size) == 0)
|
||||
return (0);
|
||||
if ((newblk = allocblk(sblock->fs_frag)) == 0)
|
||||
@ -797,7 +797,7 @@ allocdir(ino_t parent, ino_t request, int mode)
|
||||
daddr_t dirblk;
|
||||
|
||||
ino = allocino(request, IFDIR|mode);
|
||||
if (ino < ROOTINO)
|
||||
if (ino < UFS_ROOTINO)
|
||||
return 0;
|
||||
update_uquot(ino, 0, 0, btodb(sblock->fs_fsize), 1);
|
||||
dirhead.dot_reclen = iswap16(12);
|
||||
@ -829,7 +829,7 @@ allocdir(ino_t parent, ino_t request, int mode)
|
||||
dirty(bp);
|
||||
DIP_SET(dp, nlink, iswap16(2));
|
||||
inodirty();
|
||||
if (ino == ROOTINO) {
|
||||
if (ino == UFS_ROOTINO) {
|
||||
inoinfo(ino)->ino_linkcnt = iswap16(DIP(dp, nlink));
|
||||
cacheino(dp, ino);
|
||||
return(ino);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: inode.c,v 1.64 2011/03/06 17:08:16 bouyer Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.65 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: inode.c,v 1.64 2011/03/06 17:08:16 bouyer Exp $");
|
||||
__RCSID("$NetBSD: inode.c,v 1.65 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -93,7 +93,7 @@ ckinode(union dinode *dp, struct inodesc *idesc)
|
||||
else
|
||||
dino.dp1 = dp->dp1;
|
||||
ndb = howmany(iswap64(DIP(&dino, size)), sblock->fs_bsize);
|
||||
for (i = 0; i < NDADDR; i++) {
|
||||
for (i = 0; i < UFS_NDADDR; i++) {
|
||||
if (--ndb == 0 &&
|
||||
(offset = blkoff(sblock, iswap64(DIP(&dino, size)))) != 0)
|
||||
idesc->id_numfrags =
|
||||
@ -132,9 +132,9 @@ ckinode(union dinode *dp, struct inodesc *idesc)
|
||||
return (ret);
|
||||
}
|
||||
idesc->id_numfrags = sblock->fs_frag;
|
||||
remsize = iswap64(DIP(&dino, size)) - sblock->fs_bsize * NDADDR;
|
||||
remsize = iswap64(DIP(&dino, size)) - sblock->fs_bsize * UFS_NDADDR;
|
||||
sizepb = sblock->fs_bsize;
|
||||
for (i = 0; i < NIADDR; i++) {
|
||||
for (i = 0; i < UFS_NIADDR; i++) {
|
||||
if (DIP(&dino, ib[i])) {
|
||||
if (is_ufs2)
|
||||
idesc->id_blkno = iswap64(dino.dp2.di_ib[i]);
|
||||
@ -323,7 +323,7 @@ ginode(ino_t inumber)
|
||||
daddr_t iblk;
|
||||
int blkoff;
|
||||
|
||||
if (inumber < ROOTINO || inumber > maxino)
|
||||
if (inumber < UFS_ROOTINO || inumber > maxino)
|
||||
errexit("bad inode number %llu to ginode",
|
||||
(unsigned long long)inumber);
|
||||
if (startinum == 0 ||
|
||||
@ -358,7 +358,7 @@ swap_dinode1(union dinode *dp, int n)
|
||||
doinglevel2 ||
|
||||
(maxsymlinklen < 0) ||
|
||||
(iswap64(dp1->di_size) > (uint64_t)maxsymlinklen)) {
|
||||
for (j = 0; j < (NDADDR + NIADDR); j++)
|
||||
for (j = 0; j < (UFS_NDADDR + UFS_NIADDR); j++)
|
||||
dp1->di_db[j] = bswap32(dp1->di_db[j]);
|
||||
}
|
||||
}
|
||||
@ -374,7 +374,7 @@ swap_dinode2(union dinode *dp, int n)
|
||||
for (i = 0; i < n; i++, dp2++) {
|
||||
ffs_dinode2_swap(dp2, dp2);
|
||||
if ((iswap16(dp2->di_mode) & IFMT) != IFLNK) {
|
||||
for (j = 0; j < (NDADDR + NIADDR + NXADDR); j++)
|
||||
for (j = 0; j < (UFS_NDADDR + UFS_NIADDR + UFS_NXADDR); j++)
|
||||
dp2->di_extb[j] = bswap64(dp2->di_extb[j]);
|
||||
}
|
||||
}
|
||||
@ -483,8 +483,8 @@ cacheino(union dinode *dp, ino_t inumber)
|
||||
|
||||
size = iswap64(DIP(dp, size));
|
||||
blks = howmany(size, sblock->fs_bsize);
|
||||
if (blks > NDADDR)
|
||||
blks = NDADDR + NIADDR;
|
||||
if (blks > UFS_NDADDR)
|
||||
blks = UFS_NDADDR + UFS_NIADDR;
|
||||
if (blks > 0)
|
||||
extra = (blks - 1) * sizeof (int64_t);
|
||||
else
|
||||
@ -496,19 +496,19 @@ cacheino(union dinode *dp, ino_t inumber)
|
||||
inp->i_nexthash = *inpp;
|
||||
*inpp = inp;
|
||||
inp->i_child = inp->i_sibling = 0;
|
||||
if (inumber == ROOTINO)
|
||||
inp->i_parent = ROOTINO;
|
||||
if (inumber == UFS_ROOTINO)
|
||||
inp->i_parent = UFS_ROOTINO;
|
||||
else
|
||||
inp->i_parent = (ino_t)0;
|
||||
inp->i_dotdot = (ino_t)0;
|
||||
inp->i_number = inumber;
|
||||
inp->i_isize = size;
|
||||
inp->i_numblks = blks;
|
||||
for (i = 0; i < (blks < NDADDR ? blks : NDADDR); i++)
|
||||
for (i = 0; i < (blks < UFS_NDADDR ? blks : UFS_NDADDR); i++)
|
||||
inp->i_blks[i] = DIP(dp, db[i]);
|
||||
if (blks > NDADDR)
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
inp->i_blks[NDADDR + i] = DIP(dp, ib[i]);
|
||||
if (blks > UFS_NDADDR)
|
||||
for (i = 0; i < UFS_NIADDR; i++)
|
||||
inp->i_blks[UFS_NDADDR + i] = DIP(dp, ib[i]);
|
||||
if (inplast == listmax) {
|
||||
ninpsort = (struct inoinfo **)realloc((char *)inpsort,
|
||||
(unsigned)(listmax + 100) * sizeof(struct inoinfo *));
|
||||
@ -620,7 +620,7 @@ findino(struct inodesc *idesc)
|
||||
if (dirp->d_ino == 0)
|
||||
return (KEEPON);
|
||||
if (strcmp(dirp->d_name, idesc->id_name) == 0 &&
|
||||
iswap32(dirp->d_ino) >= ROOTINO && iswap32(dirp->d_ino) <= maxino) {
|
||||
iswap32(dirp->d_ino) >= UFS_ROOTINO && iswap32(dirp->d_ino) <= maxino) {
|
||||
idesc->id_parent = iswap32(dirp->d_ino);
|
||||
return (STOP|FOUND);
|
||||
}
|
||||
@ -647,7 +647,7 @@ pinode(ino_t ino)
|
||||
struct passwd *pw;
|
||||
|
||||
printf(" I=%llu ", (unsigned long long)ino);
|
||||
if (ino < ROOTINO || ino > maxino)
|
||||
if (ino < UFS_ROOTINO || ino > maxino)
|
||||
return;
|
||||
dp = ginode(ino);
|
||||
printf(" OWNER=");
|
||||
@ -709,7 +709,7 @@ allocino(ino_t request, int type)
|
||||
int nfrags;
|
||||
|
||||
if (request == 0)
|
||||
request = ROOTINO;
|
||||
request = UFS_ROOTINO;
|
||||
else if (inoinfo(request)->ino_state != USTATE)
|
||||
return (0);
|
||||
for (ino = request; ino < maxino; ino++) {
|
||||
@ -880,7 +880,7 @@ readblk(union dinode *dp, off_t offset, struct bufarea **bp)
|
||||
return 0;
|
||||
if (offset >= filesize)
|
||||
return 0; /* short read */
|
||||
if (blkno < NDADDR) {
|
||||
if (blkno < UFS_NDADDR) {
|
||||
blkno = is_ufs2 ? iswap64(dp->dp2.di_db[blkno]) :
|
||||
iswap32(dp->dp1.di_db[blkno]);
|
||||
if (blkno == 0)
|
||||
@ -888,17 +888,17 @@ readblk(union dinode *dp, off_t offset, struct bufarea **bp)
|
||||
*bp = getdatablk(blkno, sblock->fs_bsize);
|
||||
return (bp != NULL) ? sblock->fs_bsize : 0;
|
||||
}
|
||||
blkno -= NDADDR;
|
||||
blkno -= UFS_NDADDR;
|
||||
/* find indir level */
|
||||
for (ilevel = 1, nblks = naddrperblk;
|
||||
ilevel <= NIADDR;
|
||||
ilevel <= UFS_NIADDR;
|
||||
ilevel++, nblks *= naddrperblk) {
|
||||
if (blkno < nblks)
|
||||
break;
|
||||
else
|
||||
blkno -= nblks;
|
||||
}
|
||||
if (ilevel > NIADDR)
|
||||
if (ilevel > UFS_NIADDR)
|
||||
errexit("bad ofsset %" PRIu64 " to readblk", offset);
|
||||
|
||||
/* get the first indirect block */
|
||||
@ -954,7 +954,7 @@ expandfile(union dinode *dp)
|
||||
/* compute location of new block */
|
||||
blkno = lblkno(sblock, filesize);
|
||||
|
||||
if (blkno < NDADDR) {
|
||||
if (blkno < UFS_NDADDR) {
|
||||
/* easy way: allocate a direct block */
|
||||
if ((bp = getnewblk(&newblk)) == NULL) {
|
||||
return NULL;
|
||||
@ -968,17 +968,17 @@ expandfile(union dinode *dp)
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
blkno -= NDADDR;
|
||||
blkno -= UFS_NDADDR;
|
||||
/* find indir level */
|
||||
for (ilevel = 1, nblks = naddrperblk;
|
||||
ilevel <= NIADDR;
|
||||
ilevel <= UFS_NIADDR;
|
||||
ilevel++, nblks *= naddrperblk) {
|
||||
if (blkno < nblks)
|
||||
break;
|
||||
else
|
||||
blkno -= nblks;
|
||||
}
|
||||
if (ilevel > NIADDR)
|
||||
if (ilevel > UFS_NIADDR)
|
||||
errexit("bad filesize %" PRIu64 " to expandfile", filesize);
|
||||
|
||||
/* get the first indirect block, allocating if needed */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.80 2011/08/29 14:34:59 joerg Exp $ */
|
||||
/* $NetBSD: main.c,v 1.81 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.80 2011/08/29 14:34:59 joerg Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.81 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -412,7 +412,7 @@ checkfilesys(const char *filesys, const char *origfs, int child)
|
||||
(long long)(((n_ffree * 1000 + (daddr_t)sblock->fs_dsize / 2)
|
||||
/ (daddr_t)sblock->fs_dsize) % 10));
|
||||
if (debug &&
|
||||
(n_files -= maxino - ROOTINO - sblock->fs_cstotal.cs_nifree))
|
||||
(n_files -= maxino - UFS_ROOTINO - sblock->fs_cstotal.cs_nifree))
|
||||
printf("%llu files missing\n", (unsigned long long)n_files);
|
||||
if (debug) {
|
||||
n_blks += sblock->fs_ncg *
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass1.c,v 1.50 2013/01/06 22:06:00 riastradh Exp $ */
|
||||
/* $NetBSD: pass1.c,v 1.51 2013/01/22 09:39:11 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass1.c,v 1.50 2013/01/06 22:06:00 riastradh Exp $");
|
||||
__RCSID("$NetBSD: pass1.c,v 1.51 2013/01/22 09:39:11 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -171,7 +171,7 @@ pass1(void)
|
||||
* Scan the allocated inodes.
|
||||
*/
|
||||
for (ii = 0; ii < inosused; ii++, inumber++) {
|
||||
if (inumber < ROOTINO) {
|
||||
if (inumber < UFS_ROOTINO) {
|
||||
(void)getnextinode(inumber);
|
||||
continue;
|
||||
}
|
||||
@ -247,15 +247,15 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
if (mode == 0) {
|
||||
if ((is_ufs2 &&
|
||||
(memcmp(dp->dp2.di_db, ufs2_zino.di_db,
|
||||
NDADDR * sizeof(int64_t)) ||
|
||||
UFS_NDADDR * sizeof(int64_t)) ||
|
||||
memcmp(dp->dp2.di_ib, ufs2_zino.di_ib,
|
||||
NIADDR * sizeof(int64_t))))
|
||||
UFS_NIADDR * sizeof(int64_t))))
|
||||
||
|
||||
(!is_ufs2 &&
|
||||
(memcmp(dp->dp1.di_db, ufs1_zino.di_db,
|
||||
NDADDR * sizeof(int32_t)) ||
|
||||
UFS_NDADDR * sizeof(int32_t)) ||
|
||||
memcmp(dp->dp1.di_ib, ufs1_zino.di_ib,
|
||||
NIADDR * sizeof(int32_t)))) ||
|
||||
UFS_NIADDR * sizeof(int32_t)))) ||
|
||||
mode || size) {
|
||||
pfatal("PARTIALLY ALLOCATED INODE I=%llu",
|
||||
(unsigned long long)inumber);
|
||||
@ -306,7 +306,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
* conversion altogether. - mycroft, 19MAY1994
|
||||
*/
|
||||
if (!is_ufs2 && doinglevel2 &&
|
||||
size > 0 && size < MAXSYMLINKLEN_UFS1 &&
|
||||
size > 0 && size < UFS1_MAXSYMLINKLEN &&
|
||||
DIP(dp, blocks) != 0) {
|
||||
if (bread(fsreadfd, symbuf,
|
||||
fsbtodb(sblock, iswap32(DIP(dp, db[0]))),
|
||||
@ -336,16 +336,16 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
ndb = howmany(size, sizeof(int64_t));
|
||||
else
|
||||
ndb = howmany(size, sizeof(int32_t));
|
||||
if (ndb > NDADDR) {
|
||||
j = ndb - NDADDR;
|
||||
if (ndb > UFS_NDADDR) {
|
||||
j = ndb - UFS_NDADDR;
|
||||
for (ndb = 1; j > 1; j--)
|
||||
ndb *= NINDIR(sblock);
|
||||
ndb += NDADDR;
|
||||
ndb += UFS_NDADDR;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ndb < NDADDR) {
|
||||
for (j = ndb; j < NDADDR; j++)
|
||||
if (ndb < UFS_NDADDR) {
|
||||
for (j = ndb; j < UFS_NDADDR; j++)
|
||||
if (DIP(dp, db[j]) != 0) {
|
||||
if (debug) {
|
||||
if (!is_ufs2)
|
||||
@ -361,10 +361,10 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
|
||||
for (j = 0, ndb -= UFS_NDADDR; ndb > 0; j++)
|
||||
ndb /= NINDIR(sblock);
|
||||
|
||||
for (; j < NIADDR; j++)
|
||||
for (; j < UFS_NIADDR; j++)
|
||||
if (DIP(dp, ib[j]) != 0) {
|
||||
if (debug) {
|
||||
if (!is_ufs2)
|
||||
@ -429,7 +429,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
||||
int ret, offset;
|
||||
idesc->id_type = ADDR;
|
||||
ndb = howmany(iswap32(dp->dp2.di_extsize), sblock->fs_bsize);
|
||||
for (j = 0; j < NXADDR; j++) {
|
||||
for (j = 0; j < UFS_NXADDR; j++) {
|
||||
if (--ndb == 0 &&
|
||||
(offset = blkoff(sblock, iswap32(dp->dp2.di_extsize))) != 0)
|
||||
idesc->id_numfrags = numfrags(sblock,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass1b.c,v 1.22 2011/03/06 17:08:16 bouyer Exp $ */
|
||||
/* $NetBSD: pass1b.c,v 1.23 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass1b.c,v 1.22 2011/03/06 17:08:16 bouyer Exp $");
|
||||
__RCSID("$NetBSD: pass1b.c,v 1.23 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -78,7 +78,7 @@ pass1b(void)
|
||||
progress_bar(cdevname(), "phase 1b", c, sblock->fs_ncg);
|
||||
#endif /* PROGRESS */
|
||||
for (i = 0; i < sblock->fs_ipg; i++, inumber++) {
|
||||
if (inumber < ROOTINO)
|
||||
if (inumber < UFS_ROOTINO)
|
||||
continue;
|
||||
dp = ginode(inumber);
|
||||
if (dp == NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass2.c,v 1.48 2011/08/14 12:32:01 christos Exp $ */
|
||||
/* $NetBSD: pass2.c,v 1.49 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass2.c,v 1.48 2011/08/14 12:32:01 christos Exp $");
|
||||
__RCSID("$NetBSD: pass2.c,v 1.49 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -73,7 +73,7 @@ pass2(void)
|
||||
unsigned ii;
|
||||
char pathbuf[MAXPATHLEN + 1];
|
||||
|
||||
rinfo = inoinfo(ROOTINO);
|
||||
rinfo = inoinfo(UFS_ROOTINO);
|
||||
switch (rinfo->ino_state) {
|
||||
|
||||
case USTATE:
|
||||
@ -83,15 +83,15 @@ pass2(void)
|
||||
ckfini(1);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
if (allocdir(UFS_ROOTINO, UFS_ROOTINO, 0755) != UFS_ROOTINO)
|
||||
errexit("CANNOT ALLOCATE ROOT INODE");
|
||||
break;
|
||||
|
||||
case DCLEAR:
|
||||
pfatal("DUPS/BAD IN ROOT INODE");
|
||||
if (reply("REALLOCATE")) {
|
||||
freeino(ROOTINO);
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
freeino(UFS_ROOTINO);
|
||||
if (allocdir(UFS_ROOTINO, UFS_ROOTINO, 0755) != UFS_ROOTINO)
|
||||
errexit("CANNOT ALLOCATE ROOT INODE");
|
||||
break;
|
||||
}
|
||||
@ -106,8 +106,8 @@ pass2(void)
|
||||
case FCLEAR:
|
||||
pfatal("ROOT INODE NOT DIRECTORY");
|
||||
if (reply("REALLOCATE")) {
|
||||
freeino(ROOTINO);
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
freeino(UFS_ROOTINO);
|
||||
if (allocdir(UFS_ROOTINO, UFS_ROOTINO, 0755) != UFS_ROOTINO)
|
||||
errexit("CANNOT ALLOCATE ROOT INODE");
|
||||
break;
|
||||
}
|
||||
@ -116,7 +116,7 @@ pass2(void)
|
||||
ckfini(1);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
dp = ginode(ROOTINO);
|
||||
dp = ginode(UFS_ROOTINO);
|
||||
DIP_SET(dp, mode,
|
||||
iswap16((iswap16(DIP(dp, mode)) & ~IFMT) | IFDIR));
|
||||
inodirty();
|
||||
@ -129,7 +129,7 @@ pass2(void)
|
||||
errexit("BAD STATE %d FOR ROOT INODE", rinfo->ino_state);
|
||||
}
|
||||
if (newinofmt) {
|
||||
info = inoinfo(WINO);
|
||||
info = inoinfo(UFS_WINO);
|
||||
info->ino_state = FSTATE;
|
||||
info->ino_type = DT_WHT;
|
||||
}
|
||||
@ -194,26 +194,26 @@ pass2(void)
|
||||
if (!is_ufs2) {
|
||||
dp->dp1.di_mode = iswap16(IFDIR);
|
||||
dp->dp1.di_size = iswap64(inp->i_isize);
|
||||
maxblk = inp->i_numblks < NDADDR ? inp->i_numblks :
|
||||
NDADDR;
|
||||
maxblk = inp->i_numblks < UFS_NDADDR ? inp->i_numblks :
|
||||
UFS_NDADDR;
|
||||
for (i = 0; i < maxblk; i++)
|
||||
dp->dp1.di_db[i] = inp->i_blks[i];
|
||||
if (inp->i_numblks > NDADDR) {
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
if (inp->i_numblks > UFS_NDADDR) {
|
||||
for (i = 0; i < UFS_NIADDR; i++)
|
||||
dp->dp1.di_ib[i] =
|
||||
inp->i_blks[NDADDR + i];
|
||||
inp->i_blks[UFS_NDADDR + i];
|
||||
}
|
||||
} else {
|
||||
dp->dp2.di_mode = iswap16(IFDIR);
|
||||
dp->dp2.di_size = iswap64(inp->i_isize);
|
||||
maxblk = inp->i_numblks < NDADDR ? inp->i_numblks :
|
||||
NDADDR;
|
||||
maxblk = inp->i_numblks < UFS_NDADDR ? inp->i_numblks :
|
||||
UFS_NDADDR;
|
||||
for (i = 0; i < maxblk; i++)
|
||||
dp->dp2.di_db[i] = inp->i_blks[i];
|
||||
if (inp->i_numblks > NDADDR) {
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
if (inp->i_numblks > UFS_NDADDR) {
|
||||
for (i = 0; i < UFS_NIADDR; i++)
|
||||
dp->dp2.di_ib[i] =
|
||||
inp->i_blks[NDADDR + i];
|
||||
inp->i_blks[UFS_NDADDR + i];
|
||||
}
|
||||
}
|
||||
curino.id_number = inp->i_number;
|
||||
@ -301,7 +301,7 @@ pass2(void)
|
||||
for (inpp = inpsort; inpp < inpend; inpp++) {
|
||||
inp = *inpp;
|
||||
if (inp->i_parent == 0 ||
|
||||
inp->i_number == ROOTINO)
|
||||
inp->i_number == UFS_ROOTINO)
|
||||
continue;
|
||||
pinp = getinoinfo(inp->i_parent);
|
||||
inp->i_sibling = pinp->i_child;
|
||||
@ -310,7 +310,7 @@ pass2(void)
|
||||
/*
|
||||
* Mark all the directories that can be found from the root.
|
||||
*/
|
||||
propagate(ROOTINO);
|
||||
propagate(UFS_ROOTINO);
|
||||
|
||||
#ifdef PROGRESS
|
||||
if (!preen)
|
||||
@ -519,10 +519,10 @@ chk2:
|
||||
if (n == 0)
|
||||
markclean = 0;
|
||||
} else if (newinofmt &&
|
||||
((iswap32(dirp->d_ino) == WINO && dirp->d_type != DT_WHT) ||
|
||||
(iswap32(dirp->d_ino) != WINO && dirp->d_type == DT_WHT))) {
|
||||
((iswap32(dirp->d_ino) == UFS_WINO && dirp->d_type != DT_WHT) ||
|
||||
(iswap32(dirp->d_ino) != UFS_WINO && dirp->d_type == DT_WHT))) {
|
||||
fileerror(idesc->id_number, iswap32(dirp->d_ino), "BAD WHITEOUT ENTRY");
|
||||
dirp->d_ino = iswap32(WINO);
|
||||
dirp->d_ino = iswap32(UFS_WINO);
|
||||
dirp->d_type = DT_WHT;
|
||||
if (reply("FIX") == 1)
|
||||
ret |= ALTERED;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass3.c,v 1.20 2011/03/06 17:08:16 bouyer Exp $ */
|
||||
/* $NetBSD: pass3.c,v 1.21 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass3.c,v 1.20 2011/03/06 17:08:16 bouyer Exp $");
|
||||
__RCSID("$NetBSD: pass3.c,v 1.21 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -76,7 +76,7 @@ pass3(void)
|
||||
#endif /* PROGRESS */
|
||||
inp = *inpp;
|
||||
state = inoinfo(inp->i_number)->ino_state;
|
||||
if (inp->i_number == ROOTINO ||
|
||||
if (inp->i_number == UFS_ROOTINO ||
|
||||
(inp->i_parent != 0 && state != DSTATE))
|
||||
continue;
|
||||
if (state == DCLEAR)
|
||||
@ -89,7 +89,7 @@ pass3(void)
|
||||
*/
|
||||
if (preen &&
|
||||
resolved && usedsoftdep && state == DSTATE) {
|
||||
if (inp->i_dotdot >= ROOTINO)
|
||||
if (inp->i_dotdot >= UFS_ROOTINO)
|
||||
inoinfo(inp->i_dotdot)->ino_linkcnt++;
|
||||
continue;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass4.c,v 1.26 2011/03/06 17:08:16 bouyer Exp $ */
|
||||
/* $NetBSD: pass4.c,v 1.27 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass4.c,v 1.26 2011/03/06 17:08:16 bouyer Exp $");
|
||||
__RCSID("$NetBSD: pass4.c,v 1.27 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -82,7 +82,7 @@ pass4(void)
|
||||
#endif /* PROGRESS */
|
||||
inumber = cg * sblock->fs_ipg;
|
||||
for (i = 0; i < inostathead[cg].il_numalloced; i++, inumber++) {
|
||||
if (inumber < ROOTINO)
|
||||
if (inumber < UFS_ROOTINO)
|
||||
continue;
|
||||
dp = ginode(inumber);
|
||||
info = inoinfo(inumber);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass5.c,v 1.50 2012/08/26 09:33:42 dholland Exp $ */
|
||||
/* $NetBSD: pass5.c,v 1.51 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass5.c,v 1.50 2012/08/26 09:33:42 dholland Exp $");
|
||||
__RCSID("$NetBSD: pass5.c,v 1.51 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -75,7 +75,7 @@ pass5(void)
|
||||
struct inostat *info;
|
||||
u_int32_t ncgsize;
|
||||
|
||||
inoinfo(WINO)->ino_state = USTATE;
|
||||
inoinfo(UFS_WINO)->ino_state = USTATE;
|
||||
memset(newcg, 0, (size_t)fs->fs_cgsize);
|
||||
newcg->cg_niblk = fs->fs_ipg;
|
||||
if (cvtlevel >= 3) {
|
||||
@ -330,14 +330,14 @@ pass5(void)
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((ino_t)j < ROOTINO)
|
||||
if ((ino_t)j < UFS_ROOTINO)
|
||||
break;
|
||||
errexit("BAD STATE %d FOR INODE I=%ld",
|
||||
info->ino_state, (long)j);
|
||||
}
|
||||
}
|
||||
if (c == 0)
|
||||
for (i = 0; i < (long)ROOTINO; i++) {
|
||||
for (i = 0; i < (long)UFS_ROOTINO; i++) {
|
||||
setbit(cg_inosused(newcg, 0), i);
|
||||
newcg->cg_cs.cs_nifree--;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setup.c,v 1.95 2012/01/29 00:58:13 nonaka Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.96 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: setup.c,v 1.95 2012/01/29 00:58:13 nonaka Exp $");
|
||||
__RCSID("$NetBSD: setup.c,v 1.96 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -227,8 +227,8 @@ setup(const char *dev, const char *origdev)
|
||||
maxfsblock = sblock->fs_size;
|
||||
maxino = sblock->fs_ncg * sblock->fs_ipg;
|
||||
sizepb = sblock->fs_bsize;
|
||||
maxfilesize = sblock->fs_bsize * NDADDR - 1;
|
||||
for (i = 0; i < NIADDR; i++) {
|
||||
maxfilesize = sblock->fs_bsize * UFS_NDADDR - 1;
|
||||
for (i = 0; i < UFS_NIADDR; i++) {
|
||||
sizepb *= NINDIR(sblock);
|
||||
maxfilesize += sizepb;
|
||||
}
|
||||
@ -351,14 +351,14 @@ setup(const char *dev, const char *origdev)
|
||||
dirty(&asblk);
|
||||
}
|
||||
}
|
||||
if ((is_ufs2 && sblock->fs_maxsymlinklen != MAXSYMLINKLEN_UFS2)
|
||||
if ((is_ufs2 && sblock->fs_maxsymlinklen != UFS2_MAXSYMLINKLEN)
|
||||
||
|
||||
(!is_ufs2 && sblock->fs_maxsymlinklen != MAXSYMLINKLEN_UFS1))
|
||||
(!is_ufs2 && sblock->fs_maxsymlinklen != UFS1_MAXSYMLINKLEN))
|
||||
{
|
||||
pwarn("INCORRECT MAXSYMLINKLEN=%d IN SUPERBLOCK",
|
||||
sblock->fs_maxsymlinklen);
|
||||
sblock->fs_maxsymlinklen = is_ufs2 ?
|
||||
MAXSYMLINKLEN_UFS2 : MAXSYMLINKLEN_UFS1;
|
||||
UFS2_MAXSYMLINKLEN : UFS1_MAXSYMLINKLEN;
|
||||
if (preen)
|
||||
printf(" (FIXED)\n");
|
||||
if (preen || reply("FIX") == 1) {
|
||||
@ -406,7 +406,7 @@ setup(const char *dev, const char *origdev)
|
||||
doinglevel2++;
|
||||
sblock->fs_old_inodefmt = FS_44INODEFMT;
|
||||
sblock->fs_maxfilesize = maxfilesize;
|
||||
sblock->fs_maxsymlinklen = MAXSYMLINKLEN_UFS1;
|
||||
sblock->fs_maxsymlinklen = UFS1_MAXSYMLINKLEN;
|
||||
sblock->fs_qbmask = ~sblock->fs_bmask;
|
||||
sblock->fs_qfmask = ~sblock->fs_fmask;
|
||||
sbdirty();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: utilities.c,v 1.60 2011/06/09 19:57:52 christos Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.61 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: utilities.c,v 1.60 2011/06/09 19:57:52 christos Exp $");
|
||||
__RCSID("$NetBSD: utilities.c,v 1.61 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -469,7 +469,7 @@ getpathname(char *namebuf, size_t namebuflen, ino_t curdir, ino_t ino)
|
||||
static int busy = 0;
|
||||
struct inostat *info;
|
||||
|
||||
if (curdir == ino && ino == ROOTINO) {
|
||||
if (curdir == ino && ino == UFS_ROOTINO) {
|
||||
(void)strlcpy(namebuf, "/", namebuflen);
|
||||
return;
|
||||
}
|
||||
@ -488,7 +488,7 @@ getpathname(char *namebuf, size_t namebuflen, ino_t curdir, ino_t ino)
|
||||
idesc.id_parent = curdir;
|
||||
goto namelookup;
|
||||
}
|
||||
while (ino != ROOTINO) {
|
||||
while (ino != UFS_ROOTINO) {
|
||||
idesc.id_number = ino;
|
||||
idesc.id_func = findino;
|
||||
idesc.id_name = "..";
|
||||
@ -510,7 +510,7 @@ getpathname(char *namebuf, size_t namebuflen, ino_t curdir, ino_t ino)
|
||||
ino = idesc.id_number;
|
||||
}
|
||||
busy = 0;
|
||||
if (ino != ROOTINO)
|
||||
if (ino != UFS_ROOTINO)
|
||||
*--cp = '?';
|
||||
memmove(namebuf, cp, (size_t)(&namebuf[MAXPATHLEN] - cp));
|
||||
}
|
||||
@ -733,7 +733,7 @@ update_uquot(ino_t inum, uid_t uid, gid_t gid, int64_t bchange, int64_t ichange)
|
||||
static struct uquot *uq_u = NULL;
|
||||
static struct uquot *uq_g = NULL;
|
||||
|
||||
if (inum < ROOTINO)
|
||||
if (inum < UFS_ROOTINO)
|
||||
return;
|
||||
if (is_journal_inode(inum))
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.c,v 1.25 2010/02/16 23:20:30 mlelstv Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.26 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -105,14 +105,14 @@ propagate(void)
|
||||
for (inpp = inpsort; inpp < inpend; inpp++) {
|
||||
inp = *inpp;
|
||||
if (inp->i_parent == 0 ||
|
||||
inp->i_number == ROOTINO)
|
||||
inp->i_number == UFS_ROOTINO)
|
||||
continue;
|
||||
pinp = getinoinfo(inp->i_parent);
|
||||
inp->i_parentp = pinp;
|
||||
inp->i_sibling = pinp->i_child;
|
||||
pinp->i_child = inp;
|
||||
}
|
||||
inp = getinoinfo(ROOTINO);
|
||||
inp = getinoinfo(UFS_ROOTINO);
|
||||
while (inp) {
|
||||
statemap[inp->i_number] = DFOUND;
|
||||
if (inp->i_child &&
|
||||
@ -307,7 +307,7 @@ fileerror(ino_t cwd, ino_t ino, const char *errmesg)
|
||||
printf("\n");
|
||||
pwarn("PARENT=%lld\n", (long long)cwd);
|
||||
getpathname(pathbuf, sizeof(pathbuf), cwd, ino);
|
||||
if (ino < ROOTINO || ino >= maxino) {
|
||||
if (ino < UFS_ROOTINO || ino >= maxino) {
|
||||
pfatal("NAME=%s\n", pathbuf);
|
||||
return;
|
||||
}
|
||||
@ -416,23 +416,23 @@ linkup(ino_t orphan, ino_t parentdir)
|
||||
else if (reply("RECONNECT") == 0)
|
||||
return (0);
|
||||
if (lfdir == 0) {
|
||||
dp = ginode(ROOTINO);
|
||||
dp = ginode(UFS_ROOTINO);
|
||||
idesc.id_name = lfname;
|
||||
idesc.id_type = DATA;
|
||||
idesc.id_func = findino;
|
||||
idesc.id_number = ROOTINO;
|
||||
idesc.id_number = UFS_ROOTINO;
|
||||
if ((ckinode(dp, &idesc) & FOUND) != 0) {
|
||||
lfdir = idesc.id_parent;
|
||||
} else {
|
||||
pwarn("NO lost+found DIRECTORY");
|
||||
if (preen || reply("CREATE")) {
|
||||
lfdir = allocdir(ROOTINO, (ino_t) 0, lfmode);
|
||||
lfdir = allocdir(UFS_ROOTINO, (ino_t) 0, lfmode);
|
||||
if (lfdir != 0) {
|
||||
if (makeentry(ROOTINO, lfdir, lfname) != 0) {
|
||||
if (makeentry(UFS_ROOTINO, lfdir, lfname) != 0) {
|
||||
if (preen)
|
||||
printf(" (CREATED)\n");
|
||||
} else {
|
||||
freedir(lfdir, ROOTINO);
|
||||
freedir(lfdir, UFS_ROOTINO);
|
||||
lfdir = 0;
|
||||
if (preen)
|
||||
printf("\n");
|
||||
@ -453,11 +453,11 @@ linkup(ino_t orphan, ino_t parentdir)
|
||||
if (reply("REALLOCATE") == 0)
|
||||
return (0);
|
||||
oldlfdir = lfdir;
|
||||
if ((lfdir = allocdir(ROOTINO, (ino_t) 0, lfmode)) == 0) {
|
||||
if ((lfdir = allocdir(UFS_ROOTINO, (ino_t) 0, lfmode)) == 0) {
|
||||
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
|
||||
return (0);
|
||||
}
|
||||
if ((changeino(ROOTINO, lfname, lfdir) & ALTERED) == 0) {
|
||||
if ((changeino(UFS_ROOTINO, lfname, lfdir) & ALTERED) == 0) {
|
||||
pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n");
|
||||
return (0);
|
||||
}
|
||||
@ -529,8 +529,8 @@ makeentry(ino_t parent, ino_t ino, const char *name)
|
||||
char pathbuf[MAXPATHLEN + 1];
|
||||
struct uvnode *vp;
|
||||
|
||||
if (parent < ROOTINO || parent >= maxino ||
|
||||
ino < ROOTINO || ino >= maxino)
|
||||
if (parent < UFS_ROOTINO || parent >= maxino ||
|
||||
ino < UFS_ROOTINO || ino >= maxino)
|
||||
return (0);
|
||||
memset(&idesc, 0, sizeof(struct inodesc));
|
||||
idesc.id_type = DATA;
|
||||
@ -566,7 +566,7 @@ expanddir(struct uvnode *vp, struct ufs1_dinode *dp, char *name)
|
||||
char *cp, firstblk[DIRBLKSIZ];
|
||||
|
||||
lastbn = lblkno(fs, dp->di_size);
|
||||
if (lastbn >= NDADDR - 1 || dp->di_db[lastbn] == 0 || dp->di_size == 0)
|
||||
if (lastbn >= UFS_NDADDR - 1 || dp->di_db[lastbn] == 0 || dp->di_size == 0)
|
||||
return (0);
|
||||
dp->di_db[lastbn + 1] = dp->di_db[lastbn];
|
||||
dp->di_db[lastbn] = 0;
|
||||
@ -642,7 +642,7 @@ allocdir(ino_t parent, ino_t request, int mode)
|
||||
VOP_BWRITE(bp);
|
||||
dp->di_nlink = 2;
|
||||
inodirty(VTOI(vp));
|
||||
if (ino == ROOTINO) {
|
||||
if (ino == UFS_ROOTINO) {
|
||||
lncntp[ino] = dp->di_nlink;
|
||||
cacheino(dp, ino);
|
||||
return (ino);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: inode.c,v 1.42 2010/02/16 23:20:30 mlelstv Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.43 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -146,7 +146,7 @@ ckinode(struct ufs1_dinode *dp, struct inodesc *idesc)
|
||||
ndb = howmany(dino.di_size, fs->lfs_bsize);
|
||||
|
||||
thisvp = vget(fs, idesc->id_number);
|
||||
for (lbn = 0; lbn < NDADDR; lbn++) {
|
||||
for (lbn = 0; lbn < UFS_NDADDR; lbn++) {
|
||||
ap = dino.di_db + lbn;
|
||||
if (thisvp)
|
||||
idesc->id_numfrags =
|
||||
@ -189,9 +189,9 @@ ckinode(struct ufs1_dinode *dp, struct inodesc *idesc)
|
||||
return (ret);
|
||||
}
|
||||
idesc->id_numfrags = fs->lfs_frag;
|
||||
remsize = dino.di_size - fs->lfs_bsize * NDADDR;
|
||||
remsize = dino.di_size - fs->lfs_bsize * UFS_NDADDR;
|
||||
sizepb = fs->lfs_bsize;
|
||||
for (ap = &dino.di_ib[0], n = 1; n <= NIADDR; ap++, n++) {
|
||||
for (ap = &dino.di_ib[0], n = 1; n <= UFS_NIADDR; ap++, n++) {
|
||||
if (*ap) {
|
||||
idesc->id_blkno = *ap;
|
||||
ret = iblock(idesc, n, remsize);
|
||||
@ -357,15 +357,15 @@ cacheino(struct ufs1_dinode * dp, ino_t inumber)
|
||||
unsigned int blks;
|
||||
|
||||
blks = howmany(dp->di_size, fs->lfs_bsize);
|
||||
if (blks > NDADDR)
|
||||
blks = NDADDR + NIADDR;
|
||||
if (blks > UFS_NDADDR)
|
||||
blks = UFS_NDADDR + UFS_NIADDR;
|
||||
inp = emalloc(sizeof(*inp) + (blks - 1) * sizeof(ufs_daddr_t));
|
||||
inpp = &inphead[inumber % numdirs];
|
||||
inp->i_nexthash = *inpp;
|
||||
*inpp = inp;
|
||||
inp->i_child = inp->i_sibling = inp->i_parentp = 0;
|
||||
if (inumber == ROOTINO)
|
||||
inp->i_parent = ROOTINO;
|
||||
if (inumber == UFS_ROOTINO)
|
||||
inp->i_parent = UFS_ROOTINO;
|
||||
else
|
||||
inp->i_parent = (ino_t) 0;
|
||||
inp->i_dotdot = (ino_t) 0;
|
||||
@ -509,7 +509,7 @@ findino(struct inodesc * idesc)
|
||||
if (dirp->d_ino == 0)
|
||||
return (KEEPON);
|
||||
if (strcmp(dirp->d_name, idesc->id_name) == 0 &&
|
||||
dirp->d_ino >= ROOTINO && dirp->d_ino < maxino) {
|
||||
dirp->d_ino >= UFS_ROOTINO && dirp->d_ino < maxino) {
|
||||
idesc->id_parent = dirp->d_ino;
|
||||
return (STOP | FOUND);
|
||||
}
|
||||
@ -523,7 +523,7 @@ pinode(ino_t ino)
|
||||
struct passwd *pw;
|
||||
|
||||
printf(" I=%llu ", (unsigned long long)ino);
|
||||
if (ino < ROOTINO || ino >= maxino)
|
||||
if (ino < UFS_ROOTINO || ino >= maxino)
|
||||
return;
|
||||
dp = ginode(ino);
|
||||
if (dp) {
|
||||
@ -584,7 +584,7 @@ allocino(ino_t request, int type)
|
||||
struct ubuf *bp;
|
||||
|
||||
if (request == 0)
|
||||
request = ROOTINO;
|
||||
request = UFS_ROOTINO;
|
||||
else if (statemap[request] != USTATE)
|
||||
return (0);
|
||||
for (ino = request; ino < maxino; ino++)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs.c,v 1.35 2011/07/12 02:46:03 dholland Exp $ */
|
||||
/* $NetBSD: lfs.c,v 1.36 2013/01/22 09:39:12 dholland Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -163,14 +163,14 @@ ufs_bmaparray(struct lfs * fs, struct uvnode * vp, daddr_t bn, daddr_t * bnp, st
|
||||
{
|
||||
struct inode *ip;
|
||||
struct ubuf *bp;
|
||||
struct indir a[NIADDR + 1], *xap;
|
||||
struct indir a[UFS_NIADDR + 1], *xap;
|
||||
daddr_t daddr;
|
||||
daddr_t metalbn;
|
||||
int error, num;
|
||||
|
||||
ip = VTOI(vp);
|
||||
|
||||
if (bn >= 0 && bn < NDADDR) {
|
||||
if (bn >= 0 && bn < UFS_NDADDR) {
|
||||
if (nump != NULL)
|
||||
*nump = 0;
|
||||
*bnp = fsbtodb(fs, ip->i_ffs1_db[bn]);
|
||||
@ -255,11 +255,11 @@ ufs_getlbns(struct lfs * fs, struct uvnode * vp, daddr_t bn, struct indir * ap,
|
||||
|
||||
/* Determine the number of levels of indirection. After this loop is
|
||||
* done, blockcnt indicates the number of data blocks possible at the
|
||||
* given level of indirection, and NIADDR - i is the number of levels
|
||||
* given level of indirection, and UFS_NIADDR - i is the number of levels
|
||||
* of indirection needed to locate the requested block. */
|
||||
|
||||
bn -= NDADDR;
|
||||
for (lbc = 0, i = NIADDR;; i--, bn -= blockcnt) {
|
||||
bn -= UFS_NDADDR;
|
||||
for (lbc = 0, i = UFS_NIADDR;; i--, bn -= blockcnt) {
|
||||
if (i == 0)
|
||||
return (EFBIG);
|
||||
|
||||
@ -271,17 +271,17 @@ ufs_getlbns(struct lfs * fs, struct uvnode * vp, daddr_t bn, struct indir * ap,
|
||||
}
|
||||
|
||||
/* Calculate the address of the first meta-block. */
|
||||
metalbn = -((realbn >= 0 ? realbn : -realbn) - bn + NIADDR - i);
|
||||
metalbn = -((realbn >= 0 ? realbn : -realbn) - bn + UFS_NIADDR - i);
|
||||
|
||||
/* At each iteration, off is the offset into the bap array which is an
|
||||
* array of disk addresses at the current level of indirection. The
|
||||
* logical block number and the offset in that block are stored into
|
||||
* the argument array. */
|
||||
ap->in_lbn = metalbn;
|
||||
ap->in_off = off = NIADDR - i;
|
||||
ap->in_off = off = UFS_NIADDR - i;
|
||||
ap->in_exists = 0;
|
||||
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;
|
||||
@ -393,8 +393,8 @@ lfs_raw_vget(struct lfs * fs, ino_t ino, int fd, ufs_daddr_t daddr)
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(ip->i_lfs_fragsize, 0, NDADDR * sizeof(*ip->i_lfs_fragsize));
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
memset(ip->i_lfs_fragsize, 0, UFS_NDADDR * sizeof(*ip->i_lfs_fragsize));
|
||||
for (i = 0; i < UFS_NDADDR; i++)
|
||||
if (ip->i_ffs1_db[i] != 0)
|
||||
ip->i_lfs_fragsize[i] = blksize(fs, ip, i);
|
||||
|
||||
@ -981,7 +981,7 @@ lfs_balloc(struct uvnode *vp, off_t startoffset, int iosize, struct ubuf **bpp)
|
||||
struct ubuf *ibp, *bp;
|
||||
struct inode *ip;
|
||||
struct lfs *fs;
|
||||
struct indir indirs[NIADDR+2], *idp;
|
||||
struct indir indirs[UFS_NIADDR+2], *idp;
|
||||
daddr_t lbn, lastblock;
|
||||
int bcount;
|
||||
int error, frags, i, nsize, osize, num;
|
||||
@ -1012,7 +1012,7 @@ lfs_balloc(struct uvnode *vp, off_t startoffset, int iosize, struct ubuf **bpp)
|
||||
|
||||
/* Check for block beyond end of file and fragment extension needed. */
|
||||
lastblock = lblkno(fs, ip->i_ffs1_size);
|
||||
if (lastblock < NDADDR && lastblock < lbn) {
|
||||
if (lastblock < UFS_NDADDR && lastblock < lbn) {
|
||||
osize = blksize(fs, ip, lastblock);
|
||||
if (osize < fs->lfs_bsize && osize > 0) {
|
||||
if ((error = lfs_fragextend(vp, osize, fs->lfs_bsize,
|
||||
@ -1034,7 +1034,7 @@ lfs_balloc(struct uvnode *vp, off_t startoffset, int iosize, struct ubuf **bpp)
|
||||
* size or it already exists and contains some fragments and
|
||||
* may need to extend it.
|
||||
*/
|
||||
if (lbn < NDADDR && lblkno(fs, ip->i_ffs1_size) <= lbn) {
|
||||
if (lbn < UFS_NDADDR && lblkno(fs, ip->i_ffs1_size) <= lbn) {
|
||||
osize = blksize(fs, ip, lbn);
|
||||
nsize = fragroundup(fs, offset + iosize);
|
||||
if (lblktosize(fs, lbn) >= ip->i_ffs1_size) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass0.c,v 1.31 2008/04/28 20:23:08 martin Exp $ */
|
||||
/* $NetBSD: pass0.c,v 1.32 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -167,7 +167,7 @@ pass0(void)
|
||||
/*
|
||||
* Make sure all free inodes were found on the list
|
||||
*/
|
||||
for (ino = maxino - 1; ino > ROOTINO; --ino) {
|
||||
for (ino = maxino - 1; ino > UFS_ROOTINO; --ino) {
|
||||
if (visited[ino])
|
||||
continue;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass1.c,v 1.30 2010/02/16 23:20:30 mlelstv Exp $ */
|
||||
/* $NetBSD: pass1.c,v 1.31 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -184,8 +184,8 @@ checkinode(ino_t inumber, struct inodesc * idesc)
|
||||
|
||||
/* XXX - LFS doesn't have this particular problem (?) */
|
||||
if (mode == 0) {
|
||||
if (memcmp(dp->di_db, zino.di_db, NDADDR * sizeof(ufs_daddr_t)) ||
|
||||
memcmp(dp->di_ib, zino.di_ib, NIADDR * sizeof(ufs_daddr_t)) ||
|
||||
if (memcmp(dp->di_db, zino.di_db, UFS_NDADDR * sizeof(ufs_daddr_t)) ||
|
||||
memcmp(dp->di_ib, zino.di_ib, UFS_NIADDR * sizeof(ufs_daddr_t)) ||
|
||||
dp->di_mode || dp->di_size) {
|
||||
pwarn("mode=o%o, ifmt=o%o\n", dp->di_mode, mode);
|
||||
pfatal("PARTIALLY ALLOCATED INODE I=%llu",
|
||||
@ -231,24 +231,24 @@ checkinode(ino_t inumber, struct inodesc * idesc)
|
||||
if (dp->di_size < fs->lfs_maxsymlinklen ||
|
||||
(fs->lfs_maxsymlinklen == 0 && dp->di_blocks == 0)) {
|
||||
ndb = howmany(dp->di_size, sizeof(ufs_daddr_t));
|
||||
if (ndb > NDADDR) {
|
||||
j = ndb - NDADDR;
|
||||
if (ndb > UFS_NDADDR) {
|
||||
j = ndb - UFS_NDADDR;
|
||||
for (ndb = 1; j > 1; j--)
|
||||
ndb *= NINDIR(fs);
|
||||
ndb += NDADDR;
|
||||
ndb += UFS_NDADDR;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j = ndb; j < NDADDR; j++)
|
||||
for (j = ndb; j < UFS_NDADDR; j++)
|
||||
if (dp->di_db[j] != 0) {
|
||||
if (debug)
|
||||
printf("bad direct addr for size %lld lbn %d: 0x%x\n",
|
||||
(long long)dp->di_size, j, (unsigned)dp->di_db[j]);
|
||||
goto unknown;
|
||||
}
|
||||
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
|
||||
for (j = 0, ndb -= UFS_NDADDR; ndb > 0; j++)
|
||||
ndb /= NINDIR(fs);
|
||||
for (; j < NIADDR; j++)
|
||||
for (; j < UFS_NIADDR; j++)
|
||||
if (dp->di_ib[j] != 0) {
|
||||
if (debug)
|
||||
printf("bad indirect addr for size %lld # %d: 0x%x\n",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass2.c,v 1.17 2006/11/09 19:36:36 christos Exp $ */
|
||||
/* $NetBSD: pass2.c,v 1.18 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -68,21 +68,21 @@ pass2(void)
|
||||
struct ufs1_dinode dino;
|
||||
char pathbuf[MAXPATHLEN + 1];
|
||||
|
||||
switch (statemap[ROOTINO]) {
|
||||
switch (statemap[UFS_ROOTINO]) {
|
||||
|
||||
case USTATE:
|
||||
pfatal("ROOT INODE UNALLOCATED");
|
||||
if (reply("ALLOCATE") == 0)
|
||||
err(EEXIT, "%s", "");
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
if (allocdir(UFS_ROOTINO, UFS_ROOTINO, 0755) != UFS_ROOTINO)
|
||||
err(EEXIT, "CANNOT ALLOCATE ROOT INODE\n");
|
||||
break;
|
||||
|
||||
case DCLEAR:
|
||||
pfatal("DUPS/BAD IN ROOT INODE");
|
||||
if (reply("REALLOCATE")) {
|
||||
freeino(ROOTINO);
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
freeino(UFS_ROOTINO);
|
||||
if (allocdir(UFS_ROOTINO, UFS_ROOTINO, 0755) != UFS_ROOTINO)
|
||||
err(EEXIT, "CANNOT ALLOCATE ROOT INODE\n");
|
||||
break;
|
||||
}
|
||||
@ -94,14 +94,14 @@ pass2(void)
|
||||
case FCLEAR:
|
||||
pfatal("ROOT INODE NOT DIRECTORY");
|
||||
if (reply("REALLOCATE")) {
|
||||
freeino(ROOTINO);
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
freeino(UFS_ROOTINO);
|
||||
if (allocdir(UFS_ROOTINO, UFS_ROOTINO, 0755) != UFS_ROOTINO)
|
||||
err(EEXIT, "CANNOT ALLOCATE ROOT INODE\n");
|
||||
break;
|
||||
}
|
||||
if (reply("FIX") == 0)
|
||||
errx(EEXIT, "%s", "");
|
||||
vp = vget(fs, ROOTINO);
|
||||
vp = vget(fs, UFS_ROOTINO);
|
||||
dp = VTOD(vp);
|
||||
dp->di_mode &= ~IFMT;
|
||||
dp->di_mode |= IFDIR;
|
||||
@ -112,10 +112,10 @@ pass2(void)
|
||||
break;
|
||||
|
||||
default:
|
||||
errx(EEXIT, "BAD STATE %d FOR ROOT INODE\n", statemap[ROOTINO]);
|
||||
errx(EEXIT, "BAD STATE %d FOR ROOT INODE\n", statemap[UFS_ROOTINO]);
|
||||
}
|
||||
statemap[WINO] = FSTATE;
|
||||
typemap[WINO] = DT_WHT;
|
||||
statemap[UFS_WINO] = FSTATE;
|
||||
typemap[UFS_WINO] = DT_WHT;
|
||||
/*
|
||||
* Sort the directory list into disk block order.
|
||||
*/
|
||||
@ -340,7 +340,7 @@ chk2:
|
||||
fileerror(idesc->id_number, dirp->d_ino, "I OUT OF RANGE");
|
||||
n = reply("REMOVE");
|
||||
} else if (dirp->d_ino == LFS_IFILE_INUM &&
|
||||
idesc->id_number == ROOTINO) {
|
||||
idesc->id_number == UFS_ROOTINO) {
|
||||
if (dirp->d_type != DT_REG) {
|
||||
fileerror(idesc->id_number, dirp->d_ino,
|
||||
"BAD TYPE FOR IFILE");
|
||||
@ -348,10 +348,10 @@ chk2:
|
||||
if (reply("FIX") == 1)
|
||||
ret |= ALTERED;
|
||||
}
|
||||
} else if (((dirp->d_ino == WINO && (dirp->d_type != DT_WHT)) ||
|
||||
(dirp->d_ino != WINO && dirp->d_type == DT_WHT))) {
|
||||
} else if (((dirp->d_ino == UFS_WINO && (dirp->d_type != DT_WHT)) ||
|
||||
(dirp->d_ino != UFS_WINO && dirp->d_type == DT_WHT))) {
|
||||
fileerror(idesc->id_number, dirp->d_ino, "BAD WHITEOUT ENTRY");
|
||||
dirp->d_ino = WINO;
|
||||
dirp->d_ino = UFS_WINO;
|
||||
dirp->d_type = DT_WHT;
|
||||
if (reply("FIX") == 1)
|
||||
ret |= ALTERED;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass3.c,v 1.9 2006/09/01 19:52:48 perseant Exp $ */
|
||||
/* $NetBSD: pass3.c,v 1.10 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -46,7 +46,7 @@ pass3(void)
|
||||
|
||||
for (inpp = &inpsort[inplast - 1]; inpp >= inpsort; inpp--) {
|
||||
inp = *inpp;
|
||||
if (inp->i_number == ROOTINO || inp->i_number == LFS_IFILE_INUM ||
|
||||
if (inp->i_number == UFS_ROOTINO || inp->i_number == LFS_IFILE_INUM ||
|
||||
!(inp->i_parent == 0 || statemap[inp->i_number] == DSTATE))
|
||||
continue;
|
||||
if (statemap[inp->i_number] == DCLEAR)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass4.c,v 1.17 2010/02/16 23:20:30 mlelstv Exp $ */
|
||||
/* $NetBSD: pass4.c,v 1.18 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -88,7 +88,7 @@ pass4(void)
|
||||
memset(&idesc, 0, sizeof(struct inodesc));
|
||||
idesc.id_type = ADDR;
|
||||
idesc.id_func = pass4check;
|
||||
for (inumber = ROOTINO; inumber <= lastino; inumber++) {
|
||||
for (inumber = UFS_ROOTINO; inumber <= lastino; inumber++) {
|
||||
idesc.id_number = inumber;
|
||||
switch (statemap[inumber]) {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pass6.c,v 1.24 2012/01/05 16:18:00 perseant Exp $ */
|
||||
/* $NetBSD: pass6.c,v 1.25 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -82,7 +82,7 @@ rfw_update_single(struct uvnode *vp, daddr_t lbn, ufs_daddr_t ndaddr, int size)
|
||||
{
|
||||
SEGUSE *sup;
|
||||
struct ubuf *bp;
|
||||
struct indir a[NIADDR + 2], *ap;
|
||||
struct indir a[UFS_NIADDR + 2], *ap;
|
||||
struct inode *ip;
|
||||
daddr_t daddr, ooff;
|
||||
int num, error;
|
||||
@ -138,7 +138,7 @@ rfw_update_single(struct uvnode *vp, daddr_t lbn, ufs_daddr_t ndaddr, int size)
|
||||
*/
|
||||
if (daddr > 0) {
|
||||
oldsn = dtosn(fs, daddr);
|
||||
if (lbn >= 0 && lbn < NDADDR)
|
||||
if (lbn >= 0 && lbn < UFS_NDADDR)
|
||||
osize = ip->i_lfs_fragsize[lbn];
|
||||
else
|
||||
osize = fs->lfs_bsize;
|
||||
@ -158,7 +158,7 @@ rfw_update_single(struct uvnode *vp, daddr_t lbn, ufs_daddr_t ndaddr, int size)
|
||||
}
|
||||
|
||||
/* If block frag size is too large for old EOF, update size */
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
off_t minsize;
|
||||
|
||||
minsize = (lbn << fs->lfs_bshift);
|
||||
@ -197,7 +197,7 @@ rfw_update_single(struct uvnode *vp, daddr_t lbn, ufs_daddr_t ndaddr, int size)
|
||||
* segment no longer owns it, we can forget about its
|
||||
* old size.
|
||||
*/
|
||||
if (lbn >= 0 && lbn < NDADDR)
|
||||
if (lbn >= 0 && lbn < UFS_NDADDR)
|
||||
ip->i_lfs_fragsize[lbn] = size;
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ account_block_changes(struct ufs1_dinode *dp)
|
||||
ip = (vp ? VTOI(vp) : NULL);
|
||||
|
||||
/* Check direct block holdings between existing and new */
|
||||
for (i = 0; i < NDADDR; i++) {
|
||||
for (i = 0; i < UFS_NDADDR; i++) {
|
||||
odaddr = (ip ? ip->i_ffs1_db[i] : 0x0);
|
||||
if (dp->di_db[i] > 0 && dp->di_db[i] != odaddr)
|
||||
rfw_update_single(vp, i, dp->di_db[i],
|
||||
@ -396,10 +396,10 @@ account_block_changes(struct ufs1_dinode *dp)
|
||||
|
||||
/* Check indirect block holdings between existing and new */
|
||||
off = 0;
|
||||
for (i = 0; i < NIADDR; i++) {
|
||||
for (i = 0; i < UFS_NIADDR; i++) {
|
||||
odaddr = (ip ? ip->i_ffs1_ib[i] : 0x0);
|
||||
if (dp->di_ib[i] > 0 && dp->di_ib[i] != odaddr) {
|
||||
lbn = -(NDADDR + off + i);
|
||||
lbn = -(UFS_NDADDR + off + i);
|
||||
rfw_update_single(vp, i, dp->di_ib[i], fs->lfs_bsize);
|
||||
account_indir(vp, dp, lbn, dp->di_ib[i], i);
|
||||
}
|
||||
@ -759,7 +759,7 @@ pass6(void)
|
||||
if (debug)
|
||||
pwarn("alloc ino %d nlink %d\n",
|
||||
(int)inums[j], VTOD(vp)->di_nlink);
|
||||
memset(VTOD(vp)->di_db, 0, (NDADDR + NIADDR) *
|
||||
memset(VTOD(vp)->di_db, 0, (UFS_NDADDR + UFS_NIADDR) *
|
||||
sizeof(ufs_daddr_t));
|
||||
VTOD(vp)->di_blocks = 0;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: segwrite.c,v 1.20 2010/02/16 23:20:30 mlelstv Exp $ */
|
||||
/* $NetBSD: segwrite.c,v 1.21 2013/01/22 09:39:12 dholland Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -122,7 +122,7 @@ lfs_match_indir(struct lfs * fs, struct ubuf * bp)
|
||||
daddr_t lbn;
|
||||
|
||||
lbn = bp->b_lblkno;
|
||||
return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 0);
|
||||
return (lbn < 0 && (-lbn - UFS_NDADDR) % NINDIR(fs) == 0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -131,7 +131,7 @@ lfs_match_dindir(struct lfs * fs, struct ubuf * bp)
|
||||
daddr_t lbn;
|
||||
|
||||
lbn = bp->b_lblkno;
|
||||
return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 1);
|
||||
return (lbn < 0 && (-lbn - UFS_NDADDR) % NINDIR(fs) == 1);
|
||||
}
|
||||
|
||||
int
|
||||
@ -140,7 +140,7 @@ lfs_match_tindir(struct lfs * fs, struct ubuf * bp)
|
||||
daddr_t lbn;
|
||||
|
||||
lbn = bp->b_lblkno;
|
||||
return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 2);
|
||||
return (lbn < 0 && (-lbn - UFS_NDADDR) % NINDIR(fs) == 2);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -435,7 +435,7 @@ lfs_update_single(struct lfs * fs, struct segment * sp, daddr_t lbn,
|
||||
{
|
||||
SEGUSE *sup;
|
||||
struct ubuf *bp;
|
||||
struct indir a[NIADDR + 2], *ap;
|
||||
struct indir a[UFS_NIADDR + 2], *ap;
|
||||
struct inode *ip;
|
||||
struct uvnode *vp;
|
||||
daddr_t daddr, ooff;
|
||||
@ -490,7 +490,7 @@ lfs_update_single(struct lfs * fs, struct segment * sp, daddr_t lbn,
|
||||
*/
|
||||
if (daddr > 0) {
|
||||
u_int32_t oldsn = dtosn(fs, daddr);
|
||||
if (lbn >= 0 && lbn < NDADDR)
|
||||
if (lbn >= 0 && lbn < UFS_NDADDR)
|
||||
osize = ip->i_lfs_fragsize[lbn];
|
||||
else
|
||||
osize = fs->lfs_bsize;
|
||||
@ -505,7 +505,7 @@ lfs_update_single(struct lfs * fs, struct segment * sp, daddr_t lbn,
|
||||
* segment no longer owns it, we can forget about its
|
||||
* old size.
|
||||
*/
|
||||
if (lbn >= 0 && lbn < NDADDR)
|
||||
if (lbn >= 0 && lbn < UFS_NDADDR)
|
||||
ip->i_lfs_fragsize[lbn] = size;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setup.c,v 1.38 2011/08/29 18:43:20 bouyer Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.39 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -124,7 +124,7 @@ calcmaxfilesize(int bshift)
|
||||
uint64_t maxblock;
|
||||
|
||||
nptr = (1 << bshift) / sizeof(uint32_t);
|
||||
maxblock = NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
|
||||
maxblock = UFS_NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
|
||||
|
||||
return maxblock << bshift;
|
||||
}
|
||||
@ -388,10 +388,10 @@ setup(const char *dev)
|
||||
sbdirty();
|
||||
}
|
||||
}
|
||||
if (fs->lfs_maxsymlinklen != MAXSYMLINKLEN_UFS1) {
|
||||
if (fs->lfs_maxsymlinklen != UFS1_MAXSYMLINKLEN) {
|
||||
pwarn("INCORRECT MAXSYMLINKLEN=%d IN SUPERBLOCK",
|
||||
fs->lfs_maxsymlinklen);
|
||||
fs->lfs_maxsymlinklen = MAXSYMLINKLEN_UFS1;
|
||||
fs->lfs_maxsymlinklen = UFS1_MAXSYMLINKLEN;
|
||||
if (preen)
|
||||
printf(" (FIXED)\n");
|
||||
if (preen || reply("FIX") == 1) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: utilities.c,v 1.31 2011/06/09 19:57:53 christos Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.32 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
@ -194,7 +194,7 @@ getpathname(char *namebuf, size_t namebuflen, ino_t curdir, ino_t ino)
|
||||
struct inodesc idesc;
|
||||
static int busy = 0;
|
||||
|
||||
if (curdir == ino && ino == ROOTINO) {
|
||||
if (curdir == ino && ino == UFS_ROOTINO) {
|
||||
(void) strlcpy(namebuf, "/", namebuflen);
|
||||
return;
|
||||
}
|
||||
@ -213,7 +213,7 @@ getpathname(char *namebuf, size_t namebuflen, ino_t curdir, ino_t ino)
|
||||
idesc.id_parent = curdir;
|
||||
goto namelookup;
|
||||
}
|
||||
while (ino != ROOTINO) {
|
||||
while (ino != UFS_ROOTINO) {
|
||||
idesc.id_number = ino;
|
||||
idesc.id_func = findino;
|
||||
idesc.id_name = "..";
|
||||
@ -237,7 +237,7 @@ namelookup:
|
||||
ino = idesc.id_number;
|
||||
}
|
||||
busy = 0;
|
||||
if (ino != ROOTINO)
|
||||
if (ino != UFS_ROOTINO)
|
||||
*--cp = '?';
|
||||
memcpy(namebuf, cp, (size_t) (&namebuf[MAXPATHLEN] - cp));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fsdb.c,v 1.44 2012/03/20 18:50:31 matt Exp $ */
|
||||
/* $NetBSD: fsdb.c,v 1.45 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: fsdb.c,v 1.44 2012/03/20 18:50:31 matt Exp $");
|
||||
__RCSID("$NetBSD: fsdb.c,v 1.45 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -251,8 +251,8 @@ cmdloop(void)
|
||||
HistEvent he;
|
||||
EditLine *elptr;
|
||||
|
||||
curinode = ginode(ROOTINO);
|
||||
curinum = ROOTINO;
|
||||
curinode = ginode(UFS_ROOTINO);
|
||||
curinum = UFS_ROOTINO;
|
||||
printactive();
|
||||
|
||||
hist = history_init();
|
||||
@ -313,9 +313,9 @@ cmdloop(void)
|
||||
static ino_t ocurrent;
|
||||
|
||||
#define GETINUM(ac,inum) inum = strtoull(argv[ac], &cp, 0); \
|
||||
if (inum < ROOTINO || inum >= maxino || cp == argv[ac] || *cp != '\0' ) { \
|
||||
if (inum < UFS_ROOTINO || inum >= maxino || cp == argv[ac] || *cp != '\0' ) { \
|
||||
printf("inode %llu out of range; range is [%llu,%llu]\n", \
|
||||
(unsigned long long)inum, (unsigned long long)ROOTINO, \
|
||||
(unsigned long long)inum, (unsigned long long)UFS_ROOTINO, \
|
||||
(unsigned long long)maxino); \
|
||||
return 1; \
|
||||
}
|
||||
@ -471,16 +471,16 @@ CMDFUNC(blks)
|
||||
}
|
||||
printf("Direct blocks:\n");
|
||||
if (is_ufs2)
|
||||
print_blks64(curinode->dp2.di_db, NDADDR, &blkno);
|
||||
print_blks64(curinode->dp2.di_db, UFS_NDADDR, &blkno);
|
||||
else
|
||||
print_blks32(curinode->dp1.di_db, NDADDR, &blkno);
|
||||
print_blks32(curinode->dp1.di_db, UFS_NDADDR, &blkno);
|
||||
|
||||
if (is_ufs2) {
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
for (i = 0; i < UFS_NIADDR; i++)
|
||||
print_indirblks64(iswap64(curinode->dp2.di_ib[i]), i,
|
||||
&blkno);
|
||||
} else {
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
for (i = 0; i < UFS_NIADDR; i++)
|
||||
print_indirblks32(iswap32(curinode->dp1.di_ib[i]), i,
|
||||
&blkno);
|
||||
}
|
||||
@ -532,7 +532,7 @@ CMDFUNC(findblk)
|
||||
else
|
||||
inosused = sblock->fs_ipg;
|
||||
for (; inosused > 0; inum++, inosused--) {
|
||||
if (inum < ROOTINO)
|
||||
if (inum < UFS_ROOTINO)
|
||||
continue;
|
||||
if (is_ufs2 ? compare_blk64(wantedblk64,
|
||||
ino_to_fsba(sblock, inum)) :
|
||||
@ -571,12 +571,12 @@ CMDFUNC(findblk)
|
||||
continue;
|
||||
}
|
||||
if (is_ufs2 ?
|
||||
find_blks64(curinode->dp2.di_db, NDADDR,
|
||||
find_blks64(curinode->dp2.di_db, UFS_NDADDR,
|
||||
wantedblk64) :
|
||||
find_blks32(curinode->dp1.di_db, NDADDR,
|
||||
find_blks32(curinode->dp1.di_db, UFS_NDADDR,
|
||||
wantedblk32))
|
||||
goto end;
|
||||
for (i = 0; i < NIADDR; i++) {
|
||||
for (i = 0; i < UFS_NIADDR; i++) {
|
||||
if (is_ufs2 ?
|
||||
compare_blk64(wantedblk64,
|
||||
iswap64(curinode->dp2.di_ib[i])) :
|
||||
@ -881,8 +881,8 @@ CMDFUNC(focusname)
|
||||
ocurrent = curinum;
|
||||
|
||||
if (argv[1][0] == '/') {
|
||||
curinum = ROOTINO;
|
||||
curinode = ginode(ROOTINO);
|
||||
curinum = UFS_ROOTINO;
|
||||
curinode = ginode(UFS_ROOTINO);
|
||||
} else {
|
||||
if (!checkactivedir())
|
||||
return 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkfs.c,v 1.112 2012/02/13 12:59:56 wiz Exp $ */
|
||||
/* $NetBSD: mkfs.c,v 1.113 2013/01/22 09:39:12 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1989, 1993
|
||||
@ -73,7 +73,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.112 2012/02/13 12:59:56 wiz Exp $");
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.113 2013/01/22 09:39:12 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -206,8 +206,8 @@ mkfs(const char *fsys, int fi, int fo,
|
||||
sblock.fs_old_flags = 0;
|
||||
} else {
|
||||
sblock.fs_old_inodefmt = FS_44INODEFMT;
|
||||
sblock.fs_maxsymlinklen = (Oflag == 1 ? MAXSYMLINKLEN_UFS1 :
|
||||
MAXSYMLINKLEN_UFS2);
|
||||
sblock.fs_maxsymlinklen = (Oflag == 1 ? UFS1_MAXSYMLINKLEN :
|
||||
UFS2_MAXSYMLINKLEN);
|
||||
sblock.fs_old_flags = FS_FLAGS_UPDATED;
|
||||
if (isappleufs)
|
||||
sblock.fs_old_flags = 0;
|
||||
@ -336,8 +336,8 @@ mkfs(const char *fsys, int fi, int fo,
|
||||
sblock.fs_cblkno = (daddr_t)(sblock.fs_sblkno +
|
||||
roundup(howmany(SBLOCKSIZE, sblock.fs_fsize), sblock.fs_frag));
|
||||
sblock.fs_iblkno = sblock.fs_cblkno + sblock.fs_frag;
|
||||
sblock.fs_maxfilesize = sblock.fs_bsize * NDADDR - 1;
|
||||
for (sizepb = sblock.fs_bsize, i = 0; i < NIADDR; i++) {
|
||||
sblock.fs_maxfilesize = sblock.fs_bsize * UFS_NDADDR - 1;
|
||||
for (sizepb = sblock.fs_bsize, i = 0; i < UFS_NIADDR; i++) {
|
||||
sizepb *= NINDIR(&sblock);
|
||||
sblock.fs_maxfilesize += sizepb;
|
||||
}
|
||||
@ -518,7 +518,7 @@ mkfs(const char *fsys, int fi, int fo,
|
||||
fragnum(&sblock, sblock.fs_size) +
|
||||
(fragnum(&sblock, csfrags) > 0 ?
|
||||
sblock.fs_frag - fragnum(&sblock, csfrags) : 0);
|
||||
sblock.fs_cstotal.cs_nifree = sblock.fs_ncg * sblock.fs_ipg - ROOTINO;
|
||||
sblock.fs_cstotal.cs_nifree = sblock.fs_ncg * sblock.fs_ipg - UFS_ROOTINO;
|
||||
sblock.fs_cstotal.cs_ndir = 0;
|
||||
sblock.fs_dsize -= csfrags;
|
||||
sblock.fs_time = tv.tv_sec;
|
||||
@ -840,7 +840,7 @@ initcg(int cylno, const struct timeval *tv)
|
||||
}
|
||||
acg.cg_cs.cs_nifree += sblock.fs_ipg;
|
||||
if (cylno == 0)
|
||||
for (u = 0; u < ROOTINO; u++) {
|
||||
for (u = 0; u < UFS_ROOTINO; u++) {
|
||||
setbit(cg_inosused(&acg, 0), u);
|
||||
acg.cg_cs.cs_nifree--;
|
||||
}
|
||||
@ -986,8 +986,8 @@ initcg(int cylno, const struct timeval *tv)
|
||||
#endif
|
||||
|
||||
struct direct root_dir[] = {
|
||||
{ ROOTINO, sizeof(struct direct), DT_DIR, 1, "." },
|
||||
{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
|
||||
{ UFS_ROOTINO, sizeof(struct direct), DT_DIR, 1, "." },
|
||||
{ UFS_ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
|
||||
#ifdef LOSTDIR
|
||||
{ LOSTFOUNDINO, sizeof(struct direct), DT_DIR, 10, "lost+found" },
|
||||
#endif
|
||||
@ -998,8 +998,8 @@ struct odirect {
|
||||
u_int16_t d_namlen;
|
||||
u_char d_name[FFS_MAXNAMLEN + 1];
|
||||
} oroot_dir[] = {
|
||||
{ ROOTINO, sizeof(struct direct), 1, "." },
|
||||
{ ROOTINO, sizeof(struct direct), 2, ".." },
|
||||
{ UFS_ROOTINO, sizeof(struct direct), 1, "." },
|
||||
{ UFS_ROOTINO, sizeof(struct direct), 2, ".." },
|
||||
#ifdef LOSTDIR
|
||||
{ LOSTFOUNDINO, sizeof(struct direct), 10, "lost+found" },
|
||||
#endif
|
||||
@ -1007,12 +1007,12 @@ struct odirect {
|
||||
#ifdef LOSTDIR
|
||||
struct direct lost_found_dir[] = {
|
||||
{ LOSTFOUNDINO, sizeof(struct direct), DT_DIR, 1, "." },
|
||||
{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
|
||||
{ UFS_ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
|
||||
{ 0, DIRBLKSIZ, 0, 0, 0 },
|
||||
};
|
||||
struct odirect olost_found_dir[] = {
|
||||
{ LOSTFOUNDINO, sizeof(struct direct), 1, "." },
|
||||
{ ROOTINO, sizeof(struct direct), 2, ".." },
|
||||
{ UFS_ROOTINO, sizeof(struct direct), 2, ".." },
|
||||
{ 0, DIRBLKSIZ, 0, 0 },
|
||||
};
|
||||
#endif
|
||||
@ -1034,7 +1034,7 @@ fsinit(const struct timeval *tv, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
|
||||
dirblksiz = APPLEUFS_DIRBLKSIZ;
|
||||
int nextino = LOSTFOUNDINO+1;
|
||||
#else
|
||||
int nextino = ROOTINO+1;
|
||||
int nextino = UFS_ROOTINO+1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -1158,7 +1158,7 @@ fsinit(const struct timeval *tv, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
|
||||
wtfs(fsbtodb(&sblock, node.dp2.di_db[0]), sblock.fs_fsize, buf);
|
||||
}
|
||||
qinos++;
|
||||
iput(&node, ROOTINO);
|
||||
iput(&node, UFS_ROOTINO);
|
||||
/*
|
||||
* compute the size of the hash table
|
||||
* We know the smallest block size is 4k, so we can use 2k
|
||||
@ -1376,7 +1376,7 @@ iput(union dinode *ip, ino_t ino)
|
||||
if (needswap) {
|
||||
ffs_dinode1_swap(&ip->dp1, dp1);
|
||||
/* ffs_dinode1_swap() doesn't swap blocks addrs */
|
||||
for (i=0; i<NDADDR + NIADDR; i++)
|
||||
for (i=0; i<UFS_NDADDR + UFS_NIADDR; i++)
|
||||
dp1->di_db[i] = bswap32(ip->dp1.di_db[i]);
|
||||
} else
|
||||
*dp1 = ip->dp1;
|
||||
@ -1386,7 +1386,7 @@ iput(union dinode *ip, ino_t ino)
|
||||
dp2 += ino_to_fsbo(&sblock, ino);
|
||||
if (needswap) {
|
||||
ffs_dinode2_swap(&ip->dp2, dp2);
|
||||
for (i=0; i<NDADDR + NIADDR; i++)
|
||||
for (i=0; i<UFS_NDADDR + UFS_NIADDR; i++)
|
||||
dp2->di_db[i] = bswap64(ip->dp2.di_db[i]);
|
||||
} else
|
||||
*dp2 = ip->dp2;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mke2fs.c,v 1.16 2012/03/24 08:22:24 joerg Exp $ */
|
||||
/* $NetBSD: mke2fs.c,v 1.17 2013/01/22 09:39:13 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 Izumi Tsutsui. All rights reserved.
|
||||
@ -100,7 +100,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mke2fs.c,v 1.16 2012/03/24 08:22:24 joerg Exp $");
|
||||
__RCSID("$NetBSD: mke2fs.c,v 1.17 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -932,8 +932,8 @@ fsinit(const struct timeval *tv)
|
||||
/* prepare a bit large directory for preserved files */
|
||||
nblks_lostfound = EXT2_LOSTFOUNDSIZE / sblock.e2fs_bsize;
|
||||
/* ...but only with direct blocks */
|
||||
if (nblks_lostfound > NDADDR)
|
||||
nblks_lostfound = NDADDR;
|
||||
if (nblks_lostfound > EXT2FS_NDADDR)
|
||||
nblks_lostfound = EXT2FS_NDADDR;
|
||||
|
||||
memset(&node, 0, sizeof(node));
|
||||
node.e2di_mode = EXT2_IFDIR | EXT2_LOSTFOUNDUMASK;
|
||||
@ -1119,7 +1119,7 @@ init_resizeino(const struct timeval *tv)
|
||||
*/
|
||||
|
||||
/* set e2di_size which occupies whole blocks through DINDIR blocks */
|
||||
isize = (uint64_t)sblock.e2fs_bsize * NDADDR +
|
||||
isize = (uint64_t)sblock.e2fs_bsize * EXT2FS_NDADDR +
|
||||
(uint64_t)sblock.e2fs_bsize * NINDIR(&sblock) +
|
||||
(uint64_t)sblock.e2fs_bsize * NINDIR(&sblock) * NINDIR(&sblock);
|
||||
if (isize > UINT32_MAX &&
|
||||
@ -1139,16 +1139,16 @@ init_resizeino(const struct timeval *tv)
|
||||
#define TRIPLE 2 /* index of triple indirect block */
|
||||
|
||||
/* zero out entries for direct references */
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
for (i = 0; i < EXT2FS_NDADDR; i++)
|
||||
node.e2di_blocks[i] = 0;
|
||||
/* also zero out entries for single and triple indirect references */
|
||||
node.e2di_blocks[NDADDR + SINGLE] = 0;
|
||||
node.e2di_blocks[NDADDR + TRIPLE] = 0;
|
||||
node.e2di_blocks[EXT2FS_NDADDR + SINGLE] = 0;
|
||||
node.e2di_blocks[EXT2FS_NDADDR + TRIPLE] = 0;
|
||||
|
||||
/* allocate a block for the first level double indirect reference */
|
||||
node.e2di_blocks[NDADDR + DOUBLE] =
|
||||
node.e2di_blocks[EXT2FS_NDADDR + DOUBLE] =
|
||||
alloc(sblock.e2fs_bsize, node.e2di_mode);
|
||||
if (node.e2di_blocks[NDADDR + DOUBLE] == 0)
|
||||
if (node.e2di_blocks[EXT2FS_NDADDR + DOUBLE] == 0)
|
||||
errx(EXIT_FAILURE, "%s: Can't allocate a dindirect block",
|
||||
__func__);
|
||||
|
||||
@ -1231,7 +1231,7 @@ init_resizeino(const struct timeval *tv)
|
||||
free(reserved_gdb);
|
||||
|
||||
/* finally write the first level dindirect block */
|
||||
wtfs(fsbtodb(&sblock, node.e2di_blocks[NDADDR + DOUBLE]),
|
||||
wtfs(fsbtodb(&sblock, node.e2di_blocks[EXT2FS_NDADDR + DOUBLE]),
|
||||
sblock.e2fs_bsize, dindir_block);
|
||||
free(dindir_block);
|
||||
|
||||
@ -1362,7 +1362,7 @@ iput(struct ext2fs_dinode *ip, ino_t ino)
|
||||
e2fs_isave(ip, dp);
|
||||
/* e2fs_i_bswap() doesn't swap e2di_blocks addrs */
|
||||
if ((ip->e2di_mode & EXT2_IFMT) != EXT2_IFLNK) {
|
||||
for (i = 0; i < NDADDR + NIADDR; i++)
|
||||
for (i = 0; i < EXT2FS_NDADDR + EXT2FS_NIADDR; i++)
|
||||
dp->e2di_blocks[i] = h2fs32(ip->e2di_blocks[i]);
|
||||
}
|
||||
/* h2fs32() just for consistency */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make_lfs.c,v 1.19 2012/02/16 02:47:54 perseant Exp $ */
|
||||
/* $NetBSD: make_lfs.c,v 1.20 2013/01/22 09:39:13 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.19 2012/02/16 02:47:54 perseant Exp $");
|
||||
__RCSID("$NetBSD: make_lfs.c,v 1.20 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -108,7 +108,7 @@ ufs_daddr_t ifibc; /* How many indirect blocks */
|
||||
#ifdef MAKE_LF_DIR
|
||||
# define HIGHEST_USED_INO LOSTFOUNDINO
|
||||
#else
|
||||
# define HIGHEST_USED_INO ROOTINO
|
||||
# define HIGHEST_USED_INO UFS_ROOTINO
|
||||
#endif
|
||||
|
||||
static struct lfs lfs_default = {
|
||||
@ -156,7 +156,7 @@ static struct lfs lfs_default = {
|
||||
/* dlfs_fbmask */ DFL_LFS_FBMASK,
|
||||
/* dlfs_blktodb */ 0,
|
||||
/* dlfs_sushift */ 0,
|
||||
/* dlfs_maxsymlinklen */ MAXSYMLINKLEN_UFS1,
|
||||
/* dlfs_maxsymlinklen */ UFS1_MAXSYMLINKLEN,
|
||||
/* dlfs_sboffs */ { 0 },
|
||||
/* dlfs_nclean */ 0,
|
||||
/* dlfs_fsmnt */ { 0 },
|
||||
@ -182,8 +182,8 @@ static struct lfs lfs_default = {
|
||||
#define UMASK 0755
|
||||
|
||||
struct direct lfs_root_dir[] = {
|
||||
{ ROOTINO, sizeof(struct direct), DT_DIR, 1, "."},
|
||||
{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".."},
|
||||
{ UFS_ROOTINO, sizeof(struct direct), DT_DIR, 1, "."},
|
||||
{ UFS_ROOTINO, sizeof(struct direct), DT_DIR, 2, ".."},
|
||||
/* { LFS_IFILE_INUM, sizeof(struct direct), DT_REG, 5, "ifile"}, */
|
||||
#ifdef MAKE_LF_DIR
|
||||
{ LOSTFOUNDINO, sizeof(struct direct), DT_DIR, 10, "lost+found"},
|
||||
@ -193,7 +193,7 @@ struct direct lfs_root_dir[] = {
|
||||
#ifdef MAKE_LF_DIR
|
||||
struct direct lfs_lf_dir[] = {
|
||||
{ LOSTFOUNDINO, sizeof(struct direct), DT_DIR, 1, "." },
|
||||
{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
|
||||
{ UFS_ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -212,7 +212,7 @@ maxfilesize(int bshift)
|
||||
uint64_t maxblock;
|
||||
|
||||
nptr = (1 << bshift) / sizeof(uint32_t);
|
||||
maxblock = NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
|
||||
maxblock = UFS_NDADDR + nptr + nptr * nptr + nptr * nptr * nptr;
|
||||
|
||||
return maxblock << bshift;
|
||||
}
|
||||
@ -228,7 +228,7 @@ make_dinode(ino_t ino, struct ufs1_dinode *dip, int nfrags, struct lfs *fs)
|
||||
int nblocks, bb, base, factor, lvl;
|
||||
|
||||
nblocks = howmany(nfrags, fs->lfs_frag);
|
||||
if(nblocks >= NDADDR)
|
||||
if (nblocks >= UFS_NDADDR)
|
||||
nfrags = roundup(nfrags, fs->lfs_frag);
|
||||
|
||||
dip->di_nlink = 1;
|
||||
@ -242,10 +242,10 @@ make_dinode(ino_t ino, struct ufs1_dinode *dip, int nfrags, struct lfs *fs)
|
||||
|
||||
fsb_per_blk = blkstofrags(fs, 1);
|
||||
|
||||
if (NDADDR < nblocks) {
|
||||
if (UFS_NDADDR < nblocks) {
|
||||
/* Count up how many indirect blocks we need, recursively */
|
||||
/* XXX We are only called with nblocks > 1 for Ifile */
|
||||
bb = nblocks - NDADDR;
|
||||
bb = nblocks - UFS_NDADDR;
|
||||
while (bb > 0) {
|
||||
bb = howmany(bb, NINDIR(fs));
|
||||
ifibc += bb;
|
||||
@ -255,14 +255,14 @@ make_dinode(ino_t ino, struct ufs1_dinode *dip, int nfrags, struct lfs *fs)
|
||||
}
|
||||
|
||||
/* Assign the block addresses for the ifile */
|
||||
for (i = 0; i < MIN(nblocks,NDADDR); i++) {
|
||||
for (i = 0; i < MIN(nblocks,UFS_NDADDR); i++) {
|
||||
dip->di_db[i] = 0x0;
|
||||
}
|
||||
if(nblocks > NDADDR) {
|
||||
if (nblocks > UFS_NDADDR) {
|
||||
dip->di_ib[0] = 0x0;
|
||||
bb = howmany(nblocks - NDADDR, NINDIR(fs)) - 1;
|
||||
bb = howmany(nblocks - UFS_NDADDR, NINDIR(fs)) - 1;
|
||||
factor = NINDIR(fs);
|
||||
base = -NDADDR - factor;
|
||||
base = -UFS_NDADDR - factor;
|
||||
lvl = 1;
|
||||
while (bb > 0) {
|
||||
dip->di_ib[lvl] = 0x0;
|
||||
@ -620,7 +620,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
|
||||
make_dinode(LFS_IFILE_INUM, dip,
|
||||
blkstofrags(fs, fs->lfs_cleansz + fs->lfs_segtabsz + 1), fs);
|
||||
dip->di_size = (fs->lfs_cleansz + fs->lfs_segtabsz + 1) << fs->lfs_bshift;
|
||||
for (i = 0; i < NDADDR && i < (dip->di_size >> fs->lfs_bshift); i++)
|
||||
for (i = 0; i < UFS_NDADDR && i < (dip->di_size >> fs->lfs_bshift); i++)
|
||||
VTOI(fs->lfs_ivnode)->i_lfs_fragsize[i] = fs->lfs_bsize;
|
||||
|
||||
/*
|
||||
@ -677,9 +677,9 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
|
||||
}
|
||||
|
||||
/* Initialize root directory */
|
||||
vp = lfs_raw_vget(fs, ROOTINO, devfd, 0x0);
|
||||
vp = lfs_raw_vget(fs, UFS_ROOTINO, devfd, 0x0);
|
||||
dip = VTOI(vp)->i_din.ffs1_din;
|
||||
make_dinode(ROOTINO, dip, howmany(DIRBLKSIZ,fs->lfs_fsize), fs);
|
||||
make_dinode(UFS_ROOTINO, dip, howmany(DIRBLKSIZ,fs->lfs_fsize), fs);
|
||||
dip->di_mode = IFDIR | UMASK;
|
||||
VTOI(vp)->i_lfs_osize = dip->di_size = DIRBLKSIZ;
|
||||
#ifdef MAKE_LF_DIR
|
||||
@ -689,7 +689,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
|
||||
#endif
|
||||
VTOI(vp)->i_lfs_effnblks = dip->di_blocks =
|
||||
btofsb(fs, roundup(DIRBLKSIZ,fs->lfs_fsize));
|
||||
for (i = 0; i < NDADDR && i < howmany(DIRBLKSIZ, fs->lfs_bsize); i++)
|
||||
for (i = 0; i < UFS_NDADDR && i < howmany(DIRBLKSIZ, fs->lfs_bsize); i++)
|
||||
VTOI(vp)->i_lfs_fragsize[i] = fs->lfs_bsize;
|
||||
if (DIRBLKSIZ < fs->lfs_bsize)
|
||||
VTOI(vp)->i_lfs_fragsize[i - 1] =
|
||||
@ -709,7 +709,7 @@ make_lfs(int devfd, uint secsize, struct dkwedge_info *dkw, int minfree,
|
||||
VTOI(vp)->i_nlink = dip->di_nlink = 2;
|
||||
VTOI(vp)->i_lfs_effnblks = dip->di_blocks =
|
||||
btofsb(fs, roundup(DIRBLKSIZ,fs->lfs_fsize));
|
||||
for (i = 0; i < NDADDR && i < howmany(DIRBLKSIZ, fs->lfs_bsize); i++)
|
||||
for (i = 0; i < UFS_NDADDR && i < howmany(DIRBLKSIZ, fs->lfs_bsize); i++)
|
||||
VTOI(vp)->i_lfs_fragsize[i] = fs->lfs_bsize;
|
||||
if (DIRBLKSIZ < fs->lfs_bsize)
|
||||
VTOI(vp)->i_lfs_fragsize[i - 1] =
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: resize_ffs.c,v 1.33 2012/04/20 13:20:39 christos Exp $ */
|
||||
/* $NetBSD: resize_ffs.c,v 1.34 2013/01/22 09:39:13 dholland Exp $ */
|
||||
/* From sources sent on February 17, 2003 */
|
||||
/*-
|
||||
* As its sole author, I explicitly place this code in the public
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: resize_ffs.c,v 1.33 2012/04/20 13:20:39 christos Exp $");
|
||||
__RCSID("$NetBSD: resize_ffs.c,v 1.34 2013/01/22 09:39:13 dholland Exp $");
|
||||
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
@ -138,7 +138,7 @@ static unsigned char *iflags;
|
||||
|
||||
/* resize_ffs works directly on dinodes, adapt blksize() */
|
||||
#define dblksize(fs, dip, lbn, filesize) \
|
||||
(((lbn) >= NDADDR || (uint64_t)(filesize) >= lblktosize(fs, (lbn) + 1)) \
|
||||
(((lbn) >= UFS_NDADDR || (uint64_t)(filesize) >= lblktosize(fs, (lbn) + 1)) \
|
||||
? (fs)->fs_bsize \
|
||||
: (fragroundup(fs, blkoff(fs, (filesize)))))
|
||||
|
||||
@ -1127,7 +1127,7 @@ map_inode_data_blocks(union dinode * di, mark_callback_t fn)
|
||||
|
||||
/* Scan the direct blocks... */
|
||||
o = 0;
|
||||
for (b = 0; b < NDADDR; b++) {
|
||||
for (b = 0; b < UFS_NDADDR; b++) {
|
||||
inc = markblk(fn, di, DIP(di,di_db[b]), o);
|
||||
if (inc == 0)
|
||||
break;
|
||||
@ -1135,7 +1135,7 @@ map_inode_data_blocks(union dinode * di, mark_callback_t fn)
|
||||
}
|
||||
/* ...and the indirect blocks. */
|
||||
if (inc) {
|
||||
for (b = 0; b < NIADDR; b++) {
|
||||
for (b = 0; b < UFS_NIADDR; b++) {
|
||||
inc = markiblk(fn, di, DIP(di,di_ib[b]), o, b);
|
||||
if (inc == 0)
|
||||
return;
|
||||
@ -1220,7 +1220,7 @@ loadinodes(void)
|
||||
if (is_ufs2) {
|
||||
if (needswap) {
|
||||
ffs_dinode2_swap(&(dp2[i]), &(dp2[i]));
|
||||
for (j = 0; j < NDADDR + NIADDR; j++)
|
||||
for (j = 0; j < UFS_NDADDR + UFS_NIADDR; j++)
|
||||
dp2[i].di_db[j] =
|
||||
bswap32(dp2[i].di_db[j]);
|
||||
}
|
||||
@ -1229,7 +1229,7 @@ loadinodes(void)
|
||||
} else {
|
||||
if (needswap) {
|
||||
ffs_dinode1_swap(&(dp1[i]), &(dp1[i]));
|
||||
for (j = 0; j < NDADDR + NIADDR; j++)
|
||||
for (j = 0; j < UFS_NDADDR + UFS_NIADDR; j++)
|
||||
dp1[i].di_db[j] =
|
||||
bswap32(dp1[i].di_db[j]);
|
||||
}
|
||||
@ -1449,10 +1449,10 @@ moveblocks_callback(union dinode * di, unsigned int inum, void *arg)
|
||||
* Don't || these two calls; we need their
|
||||
* side-effects.
|
||||
*/
|
||||
if (movemap_blocks(dblkptr, NDADDR)) {
|
||||
if (movemap_blocks(dblkptr, UFS_NDADDR)) {
|
||||
iflags[inum] |= IF_DIRTY;
|
||||
}
|
||||
if (movemap_blocks(iblkptr, NIADDR)) {
|
||||
if (movemap_blocks(iblkptr, UFS_NIADDR)) {
|
||||
iflags[inum] |= IF_DIRTY;
|
||||
}
|
||||
break;
|
||||
@ -1517,7 +1517,7 @@ flush_inodes(void)
|
||||
struct ufs1_dinode *dp1 = NULL;
|
||||
struct ufs2_dinode *dp2 = NULL;
|
||||
|
||||
na = NDADDR + NIADDR;
|
||||
na = UFS_NDADDR + UFS_NIADDR;
|
||||
ni = newsb->fs_ipg * newsb->fs_ncg;
|
||||
m = INOPB(newsb) - 1;
|
||||
for (i = 0; i < ni; i++) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dirs.c,v 1.48 2009/04/07 12:38:12 lukem Exp $ */
|
||||
/* $NetBSD: dirs.c,v 1.49 2013/01/22 09:39:13 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dirs.c 8.7 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: dirs.c,v 1.48 2009/04/07 12:38:12 lukem Exp $");
|
||||
__RCSID("$NetBSD: dirs.c,v 1.49 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -286,7 +286,7 @@ treescan(const char *pname, ino_t ino, long (*todo)(const char *, ino_t, int))
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup a pathname which is always assumed to start from the ROOTINO.
|
||||
* Lookup a pathname which is always assumed to start from the root inode.
|
||||
*/
|
||||
struct direct *
|
||||
pathsearch(const char *pathname)
|
||||
@ -297,7 +297,7 @@ pathsearch(const char *pathname)
|
||||
|
||||
strcpy(buffer, pathname);
|
||||
path = buffer;
|
||||
ino = ROOTINO;
|
||||
ino = UFS_ROOTINO;
|
||||
while (*path == '/')
|
||||
path++;
|
||||
dp = NULL;
|
||||
@ -616,7 +616,7 @@ setdirmodes(int flags)
|
||||
ep->e_flags &= ~NEW;
|
||||
continue;
|
||||
}
|
||||
if (node.ino == ROOTINO && dotflag == 0)
|
||||
if (node.ino == UFS_ROOTINO && dotflag == 0)
|
||||
continue;
|
||||
}
|
||||
if (ep == NULL) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: interactive.c,v 1.26 2009/04/07 12:38:12 lukem Exp $ */
|
||||
/* $NetBSD: interactive.c,v 1.27 2013/01/22 09:39:13 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)interactive.c 8.5 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: interactive.c,v 1.26 2009/04/07 12:38:12 lukem Exp $");
|
||||
__RCSID("$NetBSD: interactive.c,v 1.27 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -135,7 +135,7 @@ loop:
|
||||
ino = dirlookup(name);
|
||||
if (ino == 0)
|
||||
break;
|
||||
if (ino == ROOTINO)
|
||||
if (ino == UFS_ROOTINO)
|
||||
dotflag = 1;
|
||||
if (mflag)
|
||||
pathcheck(name);
|
||||
@ -518,7 +518,7 @@ printlist(char *name, char *basename)
|
||||
dp = pathsearch(name);
|
||||
listp = NULL;
|
||||
if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0) ||
|
||||
(!vflag && dp->d_ino == WINO))
|
||||
(!vflag && dp->d_ino == UFS_WINO))
|
||||
return;
|
||||
if ((dirp = rst_opendir(name)) == NULL) {
|
||||
entries = 1;
|
||||
@ -551,7 +551,7 @@ printlist(char *name, char *basename)
|
||||
while ((dp = rst_readdir(dirp)) != NULL) {
|
||||
if (!dflag && TSTINO(dp->d_ino, dumpmap) == 0)
|
||||
continue;
|
||||
if (!vflag && (dp->d_ino == WINO ||
|
||||
if (!vflag && (dp->d_ino == UFS_WINO ||
|
||||
strcmp(dp->d_name, ".") == 0 ||
|
||||
strcmp(dp->d_name, "..") == 0))
|
||||
continue;
|
||||
@ -659,7 +659,7 @@ formatf(struct afile *list, int nentry)
|
||||
haveprefix = 0;
|
||||
havepostfix = 0;
|
||||
precision = 0;
|
||||
bigino = ROOTINO;
|
||||
bigino = UFS_ROOTINO;
|
||||
endlist = &list[nentry];
|
||||
for (fp = &list[0]; fp < endlist; fp++) {
|
||||
if (bigino < fp->fnum)
|
||||
@ -728,7 +728,7 @@ glob_readdir(RST_DIR *dirp)
|
||||
static struct dirent adirent;
|
||||
|
||||
while ((dp = rst_readdir(dirp)) != NULL) {
|
||||
if (!vflag && dp->d_fileno == WINO)
|
||||
if (!vflag && dp->d_fileno == UFS_WINO)
|
||||
continue;
|
||||
if (dflag || TSTINO(dp->d_fileno, dumpmap))
|
||||
break;
|
||||
@ -751,7 +751,7 @@ glob_stat(const char *name, struct stat *stp)
|
||||
|
||||
dp = pathsearch(name);
|
||||
if (dp == NULL || (!dflag && TSTINO(dp->d_fileno, dumpmap) == 0) ||
|
||||
(!vflag && dp->d_fileno == WINO))
|
||||
(!vflag && dp->d_fileno == UFS_WINO))
|
||||
return (-1);
|
||||
if (inodetype(dp->d_fileno) == NODE)
|
||||
stp->st_mode = S_IFDIR;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.34 2011/08/29 14:35:03 joerg Exp $ */
|
||||
/* $NetBSD: main.c,v 1.35 2013/01/22 09:39:13 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.34 2011/08/29 14:35:03 joerg Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.35 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -221,7 +221,7 @@ main(int argc, char *argv[])
|
||||
extractdirs(1);
|
||||
removeoldleaves();
|
||||
vprintf(stdout, "Calculate node updates.\n");
|
||||
treescan(".", ROOTINO, nodeupdates);
|
||||
treescan(".", UFS_ROOTINO, nodeupdates);
|
||||
findunreflinks();
|
||||
removeoldnodes();
|
||||
} else {
|
||||
@ -232,7 +232,7 @@ main(int argc, char *argv[])
|
||||
initsymtable((char *)0);
|
||||
extractdirs(1);
|
||||
vprintf(stdout, "Calculate extraction list.\n");
|
||||
treescan(".", ROOTINO, nodeupdates);
|
||||
treescan(".", UFS_ROOTINO, nodeupdates);
|
||||
}
|
||||
createleaves(symtbl);
|
||||
createlinks();
|
||||
@ -240,7 +240,7 @@ main(int argc, char *argv[])
|
||||
checkrestore();
|
||||
if (dflag) {
|
||||
vprintf(stdout, "Verify the directory structure\n");
|
||||
treescan(".", ROOTINO, verifyfile);
|
||||
treescan(".", UFS_ROOTINO, verifyfile);
|
||||
}
|
||||
dumpsymtable(symtbl, (long)1);
|
||||
break;
|
||||
@ -284,7 +284,7 @@ main(int argc, char *argv[])
|
||||
ino = dirlookup(name);
|
||||
if (ino == 0)
|
||||
continue;
|
||||
if (ino == ROOTINO)
|
||||
if (ino == UFS_ROOTINO)
|
||||
dotflag = 1;
|
||||
if (mflag)
|
||||
pathcheck(name);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: restore.c,v 1.20 2006/12/18 20:07:32 christos Exp $ */
|
||||
/* $NetBSD: restore.c,v 1.21 2013/01/22 09:39:13 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)restore.c 8.3 (Berkeley) 9/13/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: restore.c,v 1.20 2006/12/18 20:07:32 christos Exp $");
|
||||
__RCSID("$NetBSD: restore.c,v 1.21 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -82,7 +82,7 @@ addfile(const char *name, ino_t ino, int type)
|
||||
dprintf(stdout, "%s: not on the tape\n", name);
|
||||
return (descend);
|
||||
}
|
||||
if (ino == WINO && command == 'i' && !vflag)
|
||||
if (ino == UFS_WINO && command == 'i' && !vflag)
|
||||
return (descend);
|
||||
if (!mflag) {
|
||||
(void) snprintf(buf, sizeof(buf), "./%llu",
|
||||
@ -158,7 +158,7 @@ removeoldleaves(void)
|
||||
ino_t i, mydirino;
|
||||
|
||||
vprintf(stdout, "Mark entries to be removed.\n");
|
||||
if ((ep = lookupino(WINO)) != NULL) {
|
||||
if ((ep = lookupino(UFS_WINO)) != NULL) {
|
||||
vprintf(stdout, "Delete whiteouts\n");
|
||||
for ( ; ep != NULL; ep = nextep) {
|
||||
nextep = ep->e_links;
|
||||
@ -174,7 +174,7 @@ removeoldleaves(void)
|
||||
freeentry(ep);
|
||||
}
|
||||
}
|
||||
for (i = ROOTINO + 1; i < maxino; i++) {
|
||||
for (i = UFS_ROOTINO + 1; i < maxino; i++) {
|
||||
ep = lookupino(i);
|
||||
if (ep == NULL)
|
||||
continue;
|
||||
@ -519,7 +519,7 @@ findunreflinks(void)
|
||||
ino_t i;
|
||||
|
||||
vprintf(stdout, "Find unreferenced names.\n");
|
||||
for (i = ROOTINO; i < maxino; i++) {
|
||||
for (i = UFS_ROOTINO; i < maxino; i++) {
|
||||
ep = lookupino(i);
|
||||
if (ep == NULL || ep->e_type == LEAF || TSTINO(i, dumpmap) == 0)
|
||||
continue;
|
||||
@ -602,7 +602,7 @@ createleaves(const char *symtabfile)
|
||||
vprintf(stdout, "Extract new leaves.\n");
|
||||
dumpsymtable(symtabfile, volno);
|
||||
}
|
||||
first = lowerbnd(ROOTINO);
|
||||
first = lowerbnd(UFS_ROOTINO);
|
||||
curvol = volno;
|
||||
while (curfile.ino < maxino) {
|
||||
first = lowerbnd(first);
|
||||
@ -682,7 +682,7 @@ createfiles(void)
|
||||
getvol((long)1);
|
||||
skipmaps();
|
||||
skipdirs();
|
||||
first = lowerbnd(ROOTINO);
|
||||
first = lowerbnd(UFS_ROOTINO);
|
||||
last = upperbnd(maxino - 1);
|
||||
|
||||
new_volume:
|
||||
@ -781,7 +781,7 @@ createlinks(void)
|
||||
ino_t i;
|
||||
char name[BUFSIZ];
|
||||
|
||||
if ((ep = lookupino(WINO)) != NULL) {
|
||||
if ((ep = lookupino(UFS_WINO)) != NULL) {
|
||||
vprintf(stdout, "Add whiteouts\n");
|
||||
for ( ; ep != NULL; ep = ep->e_links) {
|
||||
if ((ep->e_flags & NEW) == 0)
|
||||
@ -791,7 +791,7 @@ createlinks(void)
|
||||
}
|
||||
}
|
||||
vprintf(stdout, "Add links\n");
|
||||
for (i = ROOTINO; i < maxino; i++) {
|
||||
for (i = UFS_ROOTINO; i < maxino; i++) {
|
||||
ep = lookupino(i);
|
||||
if (ep == NULL)
|
||||
continue;
|
||||
@ -821,7 +821,7 @@ checkrestore(void)
|
||||
ino_t i;
|
||||
|
||||
vprintf(stdout, "Check the symbol table.\n");
|
||||
for (i = WINO; i < maxino; i++) {
|
||||
for (i = UFS_WINO; i < maxino; i++) {
|
||||
for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
|
||||
ep->e_flags &= ~KEEP;
|
||||
if (ep->e_type == NODE)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: symtab.c,v 1.28 2011/09/16 16:13:18 plunky Exp $ */
|
||||
/* $NetBSD: symtab.c,v 1.29 2013/01/22 09:39:13 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)symtab.c 8.3 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: symtab.c,v 1.28 2011/09/16 16:13:18 plunky Exp $");
|
||||
__RCSID("$NetBSD: symtab.c,v 1.29 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -85,7 +85,7 @@ lookupino(ino_t inum)
|
||||
{
|
||||
struct entry *ep;
|
||||
|
||||
if (inum < WINO || inum >= maxino)
|
||||
if (inum < UFS_WINO || inum >= maxino)
|
||||
return (NULL);
|
||||
for (ep = entry[inum % entrytblsize]; ep != NULL; ep = ep->e_next)
|
||||
if (ep->e_ino == inum)
|
||||
@ -101,7 +101,7 @@ addino(ino_t inum, struct entry *np)
|
||||
{
|
||||
struct entry **epp;
|
||||
|
||||
if (inum < WINO || inum >= maxino)
|
||||
if (inum < UFS_WINO || inum >= maxino)
|
||||
panic("addino: out of range %llu\n", (unsigned long long)inum);
|
||||
epp = &entry[inum % entrytblsize];
|
||||
np->e_ino = inum;
|
||||
@ -122,7 +122,7 @@ deleteino(ino_t inum)
|
||||
struct entry *next;
|
||||
struct entry **prev;
|
||||
|
||||
if (inum < WINO || inum >= maxino)
|
||||
if (inum < UFS_WINO || inum >= maxino)
|
||||
panic("deleteino: out of range %llu\n",
|
||||
(unsigned long long)inum);
|
||||
prev = &entry[inum % entrytblsize];
|
||||
@ -149,7 +149,7 @@ lookupname(const char *name)
|
||||
char buf[MAXPATHLEN];
|
||||
|
||||
cp = name;
|
||||
for (ep = lookupino(ROOTINO); ep != NULL; ep = ep->e_entries) {
|
||||
for (ep = lookupino(UFS_ROOTINO); ep != NULL; ep = ep->e_entries) {
|
||||
for (np = buf; *cp != '/' && *cp != '\0'; )
|
||||
*np++ = *cp++;
|
||||
*np = '\0';
|
||||
@ -198,7 +198,7 @@ myname(struct entry *ep)
|
||||
for (cp = &namebuf[MAXPATHLEN - 2]; cp > &namebuf[ep->e_namlen]; ) {
|
||||
cp -= ep->e_namlen;
|
||||
memmove(cp, ep->e_name, (long)ep->e_namlen);
|
||||
if (ep == lookupino(ROOTINO))
|
||||
if (ep == lookupino(UFS_ROOTINO))
|
||||
return (cp);
|
||||
*(--cp) = '/';
|
||||
ep = ep->e_parent;
|
||||
@ -238,12 +238,12 @@ addentry(const char *name, ino_t inum, int type)
|
||||
np->e_type = type & ~LINK;
|
||||
ep = lookupparent(name);
|
||||
if (ep == NULL) {
|
||||
if (inum != ROOTINO || lookupino(ROOTINO) != NULL)
|
||||
if (inum != UFS_ROOTINO || lookupino(UFS_ROOTINO) != NULL)
|
||||
panic("bad name to addentry %s\n", name);
|
||||
np->e_name = savename(name);
|
||||
np->e_namlen = strlen(name);
|
||||
np->e_parent = np;
|
||||
addino(ROOTINO, np);
|
||||
addino(UFS_ROOTINO, np);
|
||||
return (np);
|
||||
}
|
||||
np->e_name = savename(strrchr(name, '/') + 1);
|
||||
@ -469,7 +469,7 @@ dumpsymtable(const char *filename, int32_t checkpt)
|
||||
* Assign indicies to each entry
|
||||
* Write out the string entries
|
||||
*/
|
||||
for (i = WINO; i <= maxino; i++) {
|
||||
for (i = UFS_WINO; i <= maxino; i++) {
|
||||
for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
|
||||
ep->e_index = mynum++;
|
||||
(void) fwrite(ep->e_name, sizeof(char),
|
||||
@ -481,7 +481,7 @@ dumpsymtable(const char *filename, int32_t checkpt)
|
||||
*/
|
||||
tep = &temp;
|
||||
stroff = 0;
|
||||
for (i = WINO; i <= maxino; i++) {
|
||||
for (i = UFS_WINO; i <= maxino; i++) {
|
||||
for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
|
||||
memmove(tep, ep, (long)sizeof(struct entry));
|
||||
tep->e_name = (char *)stroff;
|
||||
@ -551,7 +551,7 @@ initsymtable(const char *filename)
|
||||
calloc((unsigned)entrytblsize, sizeof(struct entry *));
|
||||
if (entry == NULL)
|
||||
panic("no memory for entry table\n");
|
||||
ep = addentry(".", ROOTINO, NODE);
|
||||
ep = addentry(".", UFS_ROOTINO, NODE);
|
||||
ep->e_flags |= NEW;
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tape.c,v 1.66 2011/08/29 14:35:03 joerg Exp $ */
|
||||
/* $NetBSD: tape.c,v 1.67 2013/01/22 09:39:13 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -39,7 +39,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tape.c 8.9 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: tape.c,v 1.66 2011/08/29 14:35:03 joerg Exp $");
|
||||
__RCSID("$NetBSD: tape.c,v 1.67 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -360,7 +360,7 @@ setup(void)
|
||||
* extracted.
|
||||
*/
|
||||
if (oldinofmt == 0)
|
||||
SETINO(WINO, dumpmap);
|
||||
SETINO(UFS_WINO, dumpmap);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: utilities.c,v 1.22 2005/08/19 02:07:19 christos Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.23 2013/01/22 09:39:13 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)utilities.c 8.5 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: utilities.c,v 1.22 2005/08/19 02:07:19 christos Exp $");
|
||||
__RCSID("$NetBSD: utilities.c,v 1.23 2013/01/22 09:39:13 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -288,7 +288,7 @@ upperbnd(ino_t start)
|
||||
{
|
||||
struct entry *ep;
|
||||
|
||||
for ( ; start > ROOTINO; start--) {
|
||||
for ( ; start > UFS_ROOTINO; start--) {
|
||||
ep = lookupino(start);
|
||||
if (ep == NULL || ep->e_type == NODE)
|
||||
continue;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: readufs.c,v 1.10 2011/02/21 02:31:57 itohy Exp $ */
|
||||
/* $NetBSD: readufs.c,v 1.11 2013/01/22 09:39:14 dholland Exp $ */
|
||||
/* from Id: readufs.c,v 1.9 2003/12/16 13:54:11 itohy Exp */
|
||||
|
||||
/*
|
||||
@ -108,7 +108,7 @@ ufs_read(union ufs_dinode *di, void *buf, unsigned off, size_t count)
|
||||
RAW_READ_QUEUE_INIT();
|
||||
|
||||
/* Read direct blocks. */
|
||||
for ( ; off < NDADDR && count > 0; off++) {
|
||||
for ( ; off < UFS_NDADDR && count > 0; off++) {
|
||||
#if defined(USE_UFS1) && defined(USE_UFS2)
|
||||
if (uver == UFSTYPE_UFS1)
|
||||
pos = di->di1.di_db[off];
|
||||
@ -125,10 +125,10 @@ ufs_read(union ufs_dinode *di, void *buf, unsigned off, size_t count)
|
||||
b += bsize;
|
||||
count -= bsize;
|
||||
}
|
||||
off -= NDADDR;
|
||||
off -= UFS_NDADDR;
|
||||
|
||||
/* Read indirect blocks. */
|
||||
for (i = 0; i < NIADDR && count > 0; i++) {
|
||||
for (i = 0; i < UFS_NIADDR && count > 0; i++) {
|
||||
#if defined(USE_UFS1) && defined(USE_UFS2)
|
||||
if (uver == UFSTYPE_UFS1)
|
||||
pos = di->di1.di_ib[i];
|
||||
@ -254,7 +254,7 @@ ufs_lookup_path(const char *path)
|
||||
{
|
||||
char fn[FFS_MAXNAMLEN + 1];
|
||||
char *p;
|
||||
ino32_t ino = ROOTINO;
|
||||
ino32_t ino = UFS_ROOTINO;
|
||||
|
||||
do {
|
||||
while (*path == '/')
|
||||
@ -335,7 +335,7 @@ main(argc, argv)
|
||||
errx(1, "%s: unknown fs", argv[1]);
|
||||
|
||||
#if 1
|
||||
ufs_list_dir(ROOTINO);
|
||||
ufs_list_dir(UFS_ROOTINO);
|
||||
{
|
||||
void *p;
|
||||
size_t cnt;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: installboot.c,v 1.15 2008/04/28 20:23:29 martin Exp $ */
|
||||
/* $NetBSD: installboot.c,v 1.16 2013/01/22 09:39:14 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -314,7 +314,7 @@ loadblocknums(char *boot, int devfd)
|
||||
* Get the block numbers; we don't handle fragments
|
||||
*/
|
||||
ap = ip->di_db;
|
||||
for (i = 0; i < NDADDR && *ap && ndb; i++, ap++, ndb--) {
|
||||
for (i = 0; i < UFS_NDADDR && *ap && ndb; i++, ap++, ndb--) {
|
||||
blk = fsbtodb(fs, *ap);
|
||||
if (verbose)
|
||||
printf("%d: %d\n", i, blk);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: genfth.cf,v 1.7 2010/02/13 23:38:17 eeh Exp $
|
||||
# $NetBSD: genfth.cf,v 1.8 2013/01/22 09:39:14 dholland Exp $
|
||||
|
||||
#
|
||||
# Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -161,9 +161,9 @@ define fs1_magic_value FS_UFS1_MAGIC
|
||||
define fs2_magic_value FS_UFS2_MAGIC
|
||||
define fs_42postblfmt FS_42POSTBLFMT
|
||||
define fs_44inodefmt FS_44INODEFMT
|
||||
define ndaddr NDADDR
|
||||
define niaddr NIADDR
|
||||
define rootino ROOTINO
|
||||
define ndaddr UFS_NDADDR
|
||||
define niaddr UFS_NIADDR
|
||||
define rootino UFS_ROOTINO
|
||||
define ifmt IFMT
|
||||
define ifdir IFDIR
|
||||
define iflnk IFLNK
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: readufs.c,v 1.14 2011/02/21 02:31:58 itohy Exp $ */
|
||||
/* $NetBSD: readufs.c,v 1.15 2013/01/22 09:39:14 dholland Exp $ */
|
||||
/* from Id: readufs.c,v 1.8 2003/04/08 09:19:32 itohy Exp */
|
||||
|
||||
/*
|
||||
@ -108,7 +108,7 @@ ufs_read(union ufs_dinode *di, void *buf, unsigned off, size_t count)
|
||||
RAW_READ_QUEUE_INIT();
|
||||
|
||||
/* Read direct blocks. */
|
||||
for ( ; off < NDADDR && count > 0; off++) {
|
||||
for ( ; off < UFS_NDADDR && count > 0; off++) {
|
||||
#if defined(USE_UFS1) && defined(USE_UFS2)
|
||||
if (uver == UFSTYPE_UFS1)
|
||||
pos = di->di1.di_db[off];
|
||||
@ -125,10 +125,10 @@ ufs_read(union ufs_dinode *di, void *buf, unsigned off, size_t count)
|
||||
b += bsize;
|
||||
count -= bsize;
|
||||
}
|
||||
off -= NDADDR;
|
||||
off -= UFS_NDADDR;
|
||||
|
||||
/* Read indirect blocks. */
|
||||
for (i = 0; i < NIADDR && count > 0; i++) {
|
||||
for (i = 0; i < UFS_NIADDR && count > 0; i++) {
|
||||
#if defined(USE_UFS1) && defined(USE_UFS2)
|
||||
if (uver == UFSTYPE_UFS1)
|
||||
pos = di->di1.di_ib[i];
|
||||
@ -258,7 +258,7 @@ ufs_lookup_path(const char *path)
|
||||
{
|
||||
char fn[FFS_MAXNAMLEN + 1];
|
||||
char *p;
|
||||
ino32_t ino = ROOTINO;
|
||||
ino32_t ino = UFS_ROOTINO;
|
||||
|
||||
do {
|
||||
while (*path == '/')
|
||||
@ -339,7 +339,7 @@ main(argc, argv)
|
||||
errx(1, "%s: unknown fs", argv[1]);
|
||||
|
||||
#if 1
|
||||
ufs_list_dir(ROOTINO);
|
||||
ufs_list_dir(UFS_ROOTINO);
|
||||
{
|
||||
void *p;
|
||||
size_t cnt;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs.c,v 1.13 2012/05/21 21:34:16 dsl Exp $ */
|
||||
/* $NetBSD: ext2fs.c,v 1.14 2013/01/22 09:39:14 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer.
|
||||
@ -240,37 +240,37 @@ block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
|
||||
/*
|
||||
* Index structure of an inode:
|
||||
*
|
||||
* e2di_blocks[0..NDADDR-1]
|
||||
* e2di_blocks[0..EXT2FS_NDADDR-1]
|
||||
* hold block numbers for blocks
|
||||
* 0..NDADDR-1
|
||||
* 0..EXT2FS_NDADDR-1
|
||||
*
|
||||
* e2di_blocks[NDADDR+0]
|
||||
* block NDADDR+0 is the single indirect block
|
||||
* e2di_blocks[EXT2FS_NDADDR+0]
|
||||
* block EXT2FS_NDADDR+0 is the single indirect block
|
||||
* holds block numbers for blocks
|
||||
* NDADDR .. NDADDR + NINDIR(fs)-1
|
||||
* EXT2FS_NDADDR .. EXT2FS_NDADDR + NINDIR(fs)-1
|
||||
*
|
||||
* e2di_blocks[NDADDR+1]
|
||||
* block NDADDR+1 is the double indirect block
|
||||
* e2di_blocks[EXT2FS_NDADDR+1]
|
||||
* block EXT2FS_NDADDR+1 is the double indirect block
|
||||
* holds block numbers for INDEX blocks for blocks
|
||||
* NDADDR + NINDIR(fs) ..
|
||||
* NDADDR + NINDIR(fs) + NINDIR(fs)**2 - 1
|
||||
* EXT2FS_NDADDR + NINDIR(fs) ..
|
||||
* EXT2FS_NDADDR + NINDIR(fs) + NINDIR(fs)**2 - 1
|
||||
*
|
||||
* e2di_blocks[NDADDR+2]
|
||||
* block NDADDR+2 is the triple indirect block
|
||||
* e2di_blocks[EXT2FS_NDADDR+2]
|
||||
* block EXT2FS_NDADDR+2 is the triple indirect block
|
||||
* holds block numbers for double-indirect
|
||||
* blocks for blocks
|
||||
* NDADDR + NINDIR(fs) + NINDIR(fs)**2 ..
|
||||
* NDADDR + NINDIR(fs) + NINDIR(fs)**2
|
||||
* EXT2FS_NDADDR + NINDIR(fs) + NINDIR(fs)**2 ..
|
||||
* EXT2FS_NDADDR + NINDIR(fs) + NINDIR(fs)**2
|
||||
* + NINDIR(fs)**3 - 1
|
||||
*/
|
||||
|
||||
if (file_block < NDADDR) {
|
||||
if (file_block < EXT2FS_NDADDR) {
|
||||
/* Direct block. */
|
||||
*disk_block_p = fs2h32(fp->f_di.e2di_blocks[file_block]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_block -= NDADDR;
|
||||
file_block -= EXT2FS_NDADDR;
|
||||
|
||||
ind_cache = file_block >> LN2_IND_CACHE_SZ;
|
||||
if (ind_cache == fp->f_ind_cache_block) {
|
||||
@ -283,14 +283,14 @@ block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
|
||||
level += fp->f_nishift;
|
||||
if (file_block < (indp_t)1 << level)
|
||||
break;
|
||||
if (level > NIADDR * fp->f_nishift)
|
||||
if (level > EXT2FS_NIADDR * fp->f_nishift)
|
||||
/* Block number too high */
|
||||
return EFBIG;
|
||||
file_block -= (indp_t)1 << level;
|
||||
}
|
||||
|
||||
ind_block_num =
|
||||
fs2h32(fp->f_di.e2di_blocks[NDADDR + (level / fp->f_nishift - 1)]);
|
||||
fs2h32(fp->f_di.e2di_blocks[EXT2FS_NDADDR + (level / fp->f_nishift - 1)]);
|
||||
|
||||
for (;;) {
|
||||
level -= fp->f_nishift;
|
||||
@ -1000,7 +1000,7 @@ void e2fs_i_bswap(struct ext2fs_dinode *old, struct ext2fs_dinode *new)
|
||||
new->e2di_dacl = bswap32(old->e2di_dacl);
|
||||
new->e2di_faddr = bswap32(old->e2di_faddr);
|
||||
memcpy(&new->e2di_blocks[0], &old->e2di_blocks[0],
|
||||
(NDADDR + NIADDR) * sizeof(uint32_t));
|
||||
(EXT2FS_NDADDR + EXT2FS_NIADDR) * sizeof(uint32_t));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs.c,v 1.58 2012/05/21 21:34:16 dsl Exp $ */
|
||||
/* $NetBSD: ufs.c,v 1.59 2013/01/22 09:39:14 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -324,33 +324,33 @@ block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
|
||||
/*
|
||||
* Index structure of an inode:
|
||||
*
|
||||
* di_db[0..NDADDR-1] hold block numbers for blocks
|
||||
* 0..NDADDR-1
|
||||
* di_db[0..UFS_NDADDR-1] hold block numbers for blocks
|
||||
* 0..UFS_NDADDR-1
|
||||
*
|
||||
* di_ib[0] index block 0 is the single indirect block
|
||||
* holds block numbers for blocks
|
||||
* NDADDR .. NDADDR + NINDIR(fs)-1
|
||||
* UFS_NDADDR .. UFS_NDADDR + NINDIR(fs)-1
|
||||
*
|
||||
* di_ib[1] index block 1 is the double indirect block
|
||||
* holds block numbers for INDEX blocks for blocks
|
||||
* NDADDR + NINDIR(fs) ..
|
||||
* NDADDR + NINDIR(fs) + NINDIR(fs)**2 - 1
|
||||
* UFS_NDADDR + NINDIR(fs) ..
|
||||
* UFS_NDADDR + NINDIR(fs) + NINDIR(fs)**2 - 1
|
||||
*
|
||||
* di_ib[2] index block 2 is the triple indirect block
|
||||
* holds block numbers for double-indirect
|
||||
* blocks for blocks
|
||||
* NDADDR + NINDIR(fs) + NINDIR(fs)**2 ..
|
||||
* NDADDR + NINDIR(fs) + NINDIR(fs)**2
|
||||
* UFS_NDADDR + NINDIR(fs) + NINDIR(fs)**2 ..
|
||||
* UFS_NDADDR + NINDIR(fs) + NINDIR(fs)**2
|
||||
* + NINDIR(fs)**3 - 1
|
||||
*/
|
||||
|
||||
if (file_block < NDADDR) {
|
||||
if (file_block < UFS_NDADDR) {
|
||||
/* Direct block. */
|
||||
*disk_block_p = fp->f_di.di_db[file_block];
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_block -= NDADDR;
|
||||
file_block -= UFS_NDADDR;
|
||||
|
||||
ind_cache = file_block >> LN2_IND_CACHE_SZ;
|
||||
if (ind_cache == fp->f_ind_cache_block) {
|
||||
@ -362,7 +362,7 @@ block_map(struct open_file *f, indp_t file_block, indp_t *disk_block_p)
|
||||
level += fp->f_nishift;
|
||||
if (file_block < (indp_t)1 << level)
|
||||
break;
|
||||
if (level > NIADDR * fp->f_nishift)
|
||||
if (level > UFS_NIADDR * fp->f_nishift)
|
||||
/* Block number too high */
|
||||
return EFBIG;
|
||||
file_block -= (indp_t)1 << level;
|
||||
@ -641,7 +641,7 @@ ufs_open(const char *path, struct open_file *f)
|
||||
|
||||
/* alloc a block sized buffer used for all fs transfers */
|
||||
fp->f_buf = alloc(fs->fs_bsize);
|
||||
inumber = ROOTINO;
|
||||
inumber = UFS_ROOTINO;
|
||||
if ((rc = read_inode(inumber, f)) != 0)
|
||||
goto out;
|
||||
|
||||
@ -740,7 +740,7 @@ ufs_open(const char *path, struct open_file *f)
|
||||
if (*cp != '/')
|
||||
inumber = parent_inumber;
|
||||
else
|
||||
inumber = (ino32_t)ROOTINO;
|
||||
inumber = (ino32_t)UFS_ROOTINO;
|
||||
|
||||
if ((rc = read_inode(inumber, f)) != 0)
|
||||
goto out;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.220 2011/10/24 11:43:30 hannken Exp $ */
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.221 2013/01/22 09:39:14 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1995
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.220 2011/10/24 11:43:30 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.221 2013/01/22 09:39:14 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_nfs.h"
|
||||
@ -814,7 +814,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct mbuf *nam, const char *
|
||||
* traversals of the mount point (i.e. "..") will not work if
|
||||
* the nfsnode gets flushed out of the cache. Ufs does not have
|
||||
* this problem, because one can identify root inodes by their
|
||||
* number == ROOTINO (2). So, just unlock, but no rele.
|
||||
* number == UFS_ROOTINO (2). So, just unlock, but no rele.
|
||||
*/
|
||||
|
||||
nmp->nm_vnode = vp;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: chfs_inode.h,v 1.6 2012/10/19 12:44:39 ttoth Exp $ */
|
||||
/* $NetBSD: chfs_inode.h,v 1.7 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 Department of Software Engineering,
|
||||
@ -142,10 +142,11 @@ struct chfs_inode
|
||||
/* struct chfs_inode to struct vnode */
|
||||
#define ITOV(ip) ((ip)->vp)
|
||||
|
||||
/* copied from ufs_dinode.h */
|
||||
#define NDADDR 12 /* Direct addresses in inode. */
|
||||
/* XXX copied from ufs_dinode.h and should not be duplicated here */
|
||||
#define UFS_NDADDR 12 /* Direct addresses in inode. */
|
||||
|
||||
#define ROOTINO ((ino_t)2)
|
||||
/* XXX this should not be duplicated here */
|
||||
#define UFS_ROOTINO ((ino_t)2)
|
||||
|
||||
/* File permissions. */
|
||||
#define IEXEC 0000100 /* Executable. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: chfs_vfsops.c,v 1.6 2012/10/19 12:44:39 ttoth Exp $ */
|
||||
/* $NetBSD: chfs_vfsops.c,v 1.7 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 Department of Software Engineering,
|
||||
@ -435,7 +435,7 @@ chfs_root(struct mount *mp, struct vnode **vpp)
|
||||
struct vnode *vp;
|
||||
int error;
|
||||
|
||||
if ((error = VFS_VGET(mp, (ino_t)ROOTINO, &vp)) != 0)
|
||||
if ((error = VFS_VGET(mp, (ino_t)UFS_ROOTINO, &vp)) != 0)
|
||||
return error;
|
||||
*vpp = vp;
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: chfs_vnops.c,v 1.13 2012/11/05 17:27:40 dholland Exp $ */
|
||||
/* $NetBSD: chfs_vnops.c,v 1.14 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 Department of Software Engineering,
|
||||
@ -595,7 +595,7 @@ chfs_chown(struct vnode *vp, uid_t uid, gid_t gid, kauth_cred_t cred)
|
||||
(((size) + (chmp)->chm_fs_qfmask) & (chmp)->chm_fs_fmask)
|
||||
|
||||
#define blksize(chmp, ip, lbn) \
|
||||
(((lbn) >= NDADDR || (ip)->size >= lblktosize(chmp, (lbn) + 1)) \
|
||||
(((lbn) >= UFS_NDADDR || (ip)->size >= lblktosize(chmp, (lbn) + 1)) \
|
||||
? (chmp)->chm_fs_bsize \
|
||||
: (fragroundup(chmp, blkoff(chmp, (ip)->size))))
|
||||
|
||||
@ -853,7 +853,7 @@ chfs_write(void *v)
|
||||
* the fragment if there is one.
|
||||
*/
|
||||
|
||||
if (nsize > osize && lblkno(chmp, osize) < NDADDR &&
|
||||
if (nsize > osize && lblkno(chmp, osize) < UFS_NDADDR &&
|
||||
lblkno(chmp, osize) != lblkno(chmp, nsize) &&
|
||||
blkroundup(chmp, osize) != osize) {
|
||||
off_t eob;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_balloc.c,v 1.36 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ext2fs_balloc.c,v 1.37 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.36 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.37 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_uvmhist.h"
|
||||
@ -96,12 +96,12 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
||||
daddr_t nb;
|
||||
struct buf *bp, *nbp;
|
||||
struct vnode *vp = ITOV(ip);
|
||||
struct indir indirs[NIADDR + 2];
|
||||
struct indir indirs[EXT2FS_NIADDR + 2];
|
||||
daddr_t newb, lbn, pref;
|
||||
int32_t *bap; /* XXX ondisk32 */
|
||||
int num, i, error;
|
||||
u_int deallocated;
|
||||
daddr_t *blkp, *allocblk, allociblk[NIADDR + 1];
|
||||
daddr_t *blkp, *allocblk, allociblk[EXT2FS_NIADDR + 1];
|
||||
int32_t *allocib; /* XXX ondisk32 */
|
||||
int unwindidx = -1;
|
||||
UVMHIST_FUNC("ext2fs_balloc"); UVMHIST_CALLED(ubchist);
|
||||
@ -117,9 +117,9 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
||||
lbn = bn;
|
||||
|
||||
/*
|
||||
* The first NDADDR blocks are direct blocks
|
||||
* The first EXT2FS_NDADDR blocks are direct blocks
|
||||
*/
|
||||
if (bn < NDADDR) {
|
||||
if (bn < EXT2FS_NDADDR) {
|
||||
/* XXX ondisk32 */
|
||||
nb = fs2h32(ip->i_e2fs_blocks[bn]);
|
||||
if (nb != 0) {
|
||||
@ -177,7 +177,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
||||
*/
|
||||
--num;
|
||||
/* XXX ondisk32 */
|
||||
nb = fs2h32(ip->i_e2fs_blocks[NDADDR + indirs[0].in_off]);
|
||||
nb = fs2h32(ip->i_e2fs_blocks[EXT2FS_NDADDR + indirs[0].in_off]);
|
||||
allocib = NULL;
|
||||
allocblk = allociblk;
|
||||
if (nb == 0) {
|
||||
@ -198,7 +198,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
||||
if ((error = bwrite(bp)) != 0)
|
||||
goto fail;
|
||||
unwindidx = 0;
|
||||
allocib = &ip->i_e2fs_blocks[NDADDR + indirs[0].in_off];
|
||||
allocib = &ip->i_e2fs_blocks[EXT2FS_NDADDR + indirs[0].in_off];
|
||||
/* XXX ondisk32 */
|
||||
*allocib = h2fs32((int32_t)newb);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_bmap.c,v 1.25 2009/10/19 18:41:17 bouyer Exp $ */
|
||||
/* $NetBSD: ext2fs_bmap.c,v 1.26 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993
|
||||
@ -65,7 +65,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap.c,v 1.25 2009/10/19 18:41:17 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_bmap.c,v 1.26 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -139,7 +139,7 @@ ext2fs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, struct indir *ap,
|
||||
struct buf *bp, *cbp;
|
||||
struct ufsmount *ump;
|
||||
struct mount *mp;
|
||||
struct indir a[NIADDR+1], *xap;
|
||||
struct indir a[EXT2FS_NIADDR+1], *xap;
|
||||
daddr_t daddr;
|
||||
daddr_t metalbn;
|
||||
int error, maxrun = 0, num;
|
||||
@ -163,14 +163,14 @@ ext2fs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, struct indir *ap,
|
||||
maxrun = MAXBSIZE / mp->mnt_stat.f_iosize - 1;
|
||||
}
|
||||
|
||||
if (bn >= 0 && bn < NDADDR) {
|
||||
if (bn >= 0 && bn < EXT2FS_NDADDR) {
|
||||
/* XXX ondisk32 */
|
||||
*bnp = blkptrtodb(ump, fs2h32(ip->i_e2fs_blocks[bn]));
|
||||
if (*bnp == 0)
|
||||
*bnp = -1;
|
||||
else if (runp)
|
||||
/* XXX ondisk32 */
|
||||
for (++bn; bn < NDADDR && *runp < maxrun &&
|
||||
for (++bn; bn < EXT2FS_NDADDR && *runp < maxrun &&
|
||||
is_sequential(ump, (daddr_t)fs2h32(ip->i_e2fs_blocks[bn - 1]),
|
||||
(daddr_t)fs2h32(ip->i_e2fs_blocks[bn]));
|
||||
++bn, ++*runp);
|
||||
@ -187,10 +187,10 @@ ext2fs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, struct indir *ap,
|
||||
|
||||
/* Get disk address out of indirect block array */
|
||||
/* XXX ondisk32 */
|
||||
daddr = fs2h32(ip->i_e2fs_blocks[NDADDR + xap->in_off]);
|
||||
daddr = fs2h32(ip->i_e2fs_blocks[EXT2FS_NDADDR + xap->in_off]);
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (num > NIADDR + 1 || num < 1) {
|
||||
if (num > EXT2FS_NIADDR + 1 || num < 1) {
|
||||
printf("ext2fs_bmaparray: num=%d\n", num);
|
||||
panic("ext2fs_bmaparray: num");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_bswap.c,v 1.18 2012/11/19 00:36:21 jakllsch Exp $ */
|
||||
/* $NetBSD: ext2fs_bswap.c,v 1.19 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer.
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_bswap.c,v 1.18 2012/11/19 00:36:21 jakllsch Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_bswap.c,v 1.19 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ufs/ext2fs/ext2fs.h>
|
||||
@ -119,6 +119,6 @@ void e2fs_i_bswap(struct ext2fs_dinode *old, struct ext2fs_dinode *new)
|
||||
new->e2di_uid_high = bswap16(old->e2di_uid_high);
|
||||
new->e2di_gid_high = bswap16(old->e2di_gid_high);
|
||||
memcpy(&new->e2di_blocks[0], &old->e2di_blocks[0],
|
||||
(NDADDR + NIADDR) * sizeof(uint32_t));
|
||||
(EXT2FS_NDADDR + EXT2FS_NIADDR) * sizeof(uint32_t));
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_dinode.h,v 1.25 2012/11/21 20:45:36 jakllsch Exp $ */
|
||||
/* $NetBSD: ext2fs_dinode.h,v 1.26 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1989, 1993
|
||||
@ -92,10 +92,15 @@
|
||||
* are defined by types with precise widths.
|
||||
*/
|
||||
|
||||
#define NDADDR 12 /* Direct addresses in inode. */
|
||||
#define NIADDR 3 /* Indirect addresses in inode. */
|
||||
/*
|
||||
* XXX these are the same values as UFS_NDADDR/UFS_NIADDR and it is
|
||||
* far from clear that there isn't code that relies on them being the
|
||||
* same.
|
||||
*/
|
||||
#define EXT2FS_NDADDR 12 /* Direct addresses in inode. */
|
||||
#define EXT2FS_NIADDR 3 /* Indirect addresses in inode. */
|
||||
|
||||
#define EXT2_MAXSYMLINKLEN ((NDADDR+NIADDR) * sizeof (uint32_t))
|
||||
#define EXT2_MAXSYMLINKLEN ((EXT2FS_NDADDR+EXT2FS_NIADDR) * sizeof (uint32_t))
|
||||
|
||||
struct ext2fs_dinode {
|
||||
uint16_t e2di_mode; /* 0: IFMT, permissions; see below. */
|
||||
@ -110,7 +115,8 @@ struct ext2fs_dinode {
|
||||
uint32_t e2di_nblock; /* 28: Blocks count */
|
||||
uint32_t e2di_flags; /* 32: Status flags (chflags) */
|
||||
uint32_t e2di_version; /* 36: was reserved1 */
|
||||
uint32_t e2di_blocks[NDADDR+NIADDR]; /* 40: disk blocks */
|
||||
uint32_t e2di_blocks[EXT2FS_NDADDR+EXT2FS_NIADDR];
|
||||
/* 40: disk blocks */
|
||||
uint32_t e2di_gen; /* 100: generation number */
|
||||
uint32_t e2di_facl; /* 104: file ACL (not implemented) */
|
||||
uint32_t e2di_dacl; /* 108: dir ACL (not implemented) */
|
||||
@ -123,8 +129,8 @@ struct ext2fs_dinode {
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define E2MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(uint32_t))
|
||||
/* XXX how does this differ from EXT2_MAXSYMLINKLEN above? */
|
||||
#define E2MAXSYMLINKLEN ((EXT2FS_NDADDR + EXT2FS_NIADDR) * sizeof(uint32_t))
|
||||
|
||||
/* File permissions. */
|
||||
#define EXT2_IEXEC 0000100 /* Executable. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_inode.c,v 1.77 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ext2fs_inode.c,v 1.78 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.77 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.78 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -87,6 +87,14 @@ extern int prtactive;
|
||||
static int ext2fs_indirtrunc(struct inode *, daddr_t, daddr_t,
|
||||
daddr_t, int, long *);
|
||||
|
||||
/*
|
||||
* These are fortunately the same values; it is likely that there is
|
||||
* code that assumes they're equal. In any event, neither ought to
|
||||
* ever change because it's a property of the on-disk formats.
|
||||
*/
|
||||
CTASSERT(EXT2FS_NDADDR == UFS_NDADDR);
|
||||
CTASSERT(EXT2FS_NIADDR == UFS_NIADDR);
|
||||
|
||||
/*
|
||||
* Get the size of an inode.
|
||||
*/
|
||||
@ -285,9 +293,9 @@ ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,
|
||||
{
|
||||
daddr_t lastblock;
|
||||
struct inode *oip = VTOI(ovp);
|
||||
daddr_t bn, lastiblock[NIADDR], indir_lbn[NIADDR];
|
||||
daddr_t bn, lastiblock[EXT2FS_NIADDR], indir_lbn[EXT2FS_NIADDR];
|
||||
/* XXX ondisk32 */
|
||||
int32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
|
||||
int32_t oldblks[EXT2FS_NDADDR + EXT2FS_NIADDR], newblks[EXT2FS_NDADDR + EXT2FS_NIADDR];
|
||||
struct m_ext2fs *fs;
|
||||
int offset, size, level;
|
||||
long count, blocksreleased = 0;
|
||||
@ -370,7 +378,7 @@ ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,
|
||||
* the file is truncated to 0.
|
||||
*/
|
||||
lastblock = lblkno(fs, length + fs->e2fs_bsize - 1) - 1;
|
||||
lastiblock[SINGLE] = lastblock - NDADDR;
|
||||
lastiblock[SINGLE] = lastblock - EXT2FS_NDADDR;
|
||||
lastiblock[DOUBLE] = lastiblock[SINGLE] - NINDIR(fs);
|
||||
lastiblock[TRIPLE] = lastiblock[DOUBLE] - NINDIR(fs) * NINDIR(fs);
|
||||
nblocks = btodb(fs->e2fs_bsize);
|
||||
@ -383,13 +391,13 @@ ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,
|
||||
memcpy((void *)oldblks, (void *)&oip->i_e2fs_blocks[0], sizeof oldblks);
|
||||
sync = 0;
|
||||
for (level = TRIPLE; level >= SINGLE; level--) {
|
||||
if (lastiblock[level] < 0 && oldblks[NDADDR + level] != 0) {
|
||||
if (lastiblock[level] < 0 && oldblks[EXT2FS_NDADDR + level] != 0) {
|
||||
sync = 1;
|
||||
oip->i_e2fs_blocks[NDADDR + level] = 0;
|
||||
oip->i_e2fs_blocks[EXT2FS_NDADDR + level] = 0;
|
||||
lastiblock[level] = -1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < NDADDR; i++) {
|
||||
for (i = 0; i < EXT2FS_NDADDR; i++) {
|
||||
if (i > lastblock && oldblks[i] != 0) {
|
||||
sync = 1;
|
||||
oip->i_e2fs_blocks[i] = 0;
|
||||
@ -419,12 +427,12 @@ ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,
|
||||
/*
|
||||
* Indirect blocks first.
|
||||
*/
|
||||
indir_lbn[SINGLE] = -NDADDR;
|
||||
indir_lbn[SINGLE] = -EXT2FS_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--) {
|
||||
/* XXX ondisk32 */
|
||||
bn = fs2h32(oip->i_e2fs_blocks[NDADDR + level]);
|
||||
bn = fs2h32(oip->i_e2fs_blocks[EXT2FS_NDADDR + level]);
|
||||
if (bn != 0) {
|
||||
error = ext2fs_indirtrunc(oip, indir_lbn[level],
|
||||
fsbtodb(fs, bn), lastiblock[level], level, &count);
|
||||
@ -432,7 +440,7 @@ ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,
|
||||
allerror = error;
|
||||
blocksreleased += count;
|
||||
if (lastiblock[level] < 0) {
|
||||
oip->i_e2fs_blocks[NDADDR + level] = 0;
|
||||
oip->i_e2fs_blocks[EXT2FS_NDADDR + level] = 0;
|
||||
ext2fs_blkfree(oip, bn);
|
||||
blocksreleased += nblocks;
|
||||
}
|
||||
@ -444,7 +452,7 @@ ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,
|
||||
/*
|
||||
* All whole direct blocks or frags.
|
||||
*/
|
||||
for (i = NDADDR - 1; i > lastblock; i--) {
|
||||
for (i = EXT2FS_NDADDR - 1; i > lastblock; i--) {
|
||||
/* XXX ondisk32 */
|
||||
bn = fs2h32(oip->i_e2fs_blocks[i]);
|
||||
if (bn == 0)
|
||||
@ -457,10 +465,10 @@ ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,
|
||||
done:
|
||||
#ifdef DIAGNOSTIC
|
||||
for (level = SINGLE; level <= TRIPLE; level++)
|
||||
if (newblks[NDADDR + level] !=
|
||||
oip->i_e2fs_blocks[NDADDR + level])
|
||||
if (newblks[EXT2FS_NDADDR + level] !=
|
||||
oip->i_e2fs_blocks[EXT2FS_NDADDR + level])
|
||||
panic("ext2fs_truncate1");
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
for (i = 0; i < EXT2FS_NDADDR; i++)
|
||||
if (newblks[i] != oip->i_e2fs_blocks[i])
|
||||
panic("ext2fs_truncate2");
|
||||
if (length == 0 &&
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_lookup.c,v 1.72 2012/11/05 17:27:40 dholland Exp $ */
|
||||
/* $NetBSD: ext2fs_lookup.c,v 1.73 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Modified for NetBSD 1.2E
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.72 2012/11/05 17:27:40 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.73 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -1045,7 +1045,7 @@ ext2fs_checkpath(struct inode *source, struct inode *target,
|
||||
error = EEXIST;
|
||||
goto out;
|
||||
}
|
||||
rootino = ROOTINO;
|
||||
rootino = UFS_ROOTINO;
|
||||
error = 0;
|
||||
if (target->i_number == rootino)
|
||||
goto out;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_rename.c,v 1.4 2012/06/04 20:13:47 riastradh Exp $ */
|
||||
/* $NetBSD: ext2fs_rename.c,v 1.5 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2012 The NetBSD Foundation, Inc.
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.4 2012/06/04 20:13:47 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_rename.c,v 1.5 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -634,7 +634,7 @@ ext2fs_rename_recalculate_fulr(struct vnode *dvp,
|
||||
if (ep->e2d_ino == 0)
|
||||
goto next; /* Entry is unused. */
|
||||
|
||||
if (fs2h32(ep->e2d_ino) == WINO)
|
||||
if (fs2h32(ep->e2d_ino) == UFS_WINO)
|
||||
goto next; /* Entry is whiteout. */
|
||||
|
||||
if (fcnp->cn_namelen != ep->e2d_namlen)
|
||||
@ -825,7 +825,7 @@ ext2fs_gro_genealogy(struct mount *mp, kauth_cred_t cred,
|
||||
KASSERT(!ext2fs_rmdired_p(vp));
|
||||
|
||||
/* Did we hit the root without finding fdvp? */
|
||||
if (VTOI(vp)->i_number == ROOTINO) {
|
||||
if (VTOI(vp)->i_number == UFS_ROOTINO) {
|
||||
vput(vp);
|
||||
*intermediate_node_ret = NULL;
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs_vnops.c,v 1.105 2012/11/21 23:11:23 jakllsch Exp $ */
|
||||
/* $NetBSD: ext2fs_vnops.c,v 1.106 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
@ -65,7 +65,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.105 2012/11/21 23:11:23 jakllsch Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.106 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -1011,7 +1011,7 @@ ext2fs_vinit(struct mount *mntp, int (**specops)(void *),
|
||||
case VREG:
|
||||
break;
|
||||
}
|
||||
if (ip->i_number == ROOTINO)
|
||||
if (ip->i_number == UFS_ROOTINO)
|
||||
vp->v_vflag |= VV_ROOT;
|
||||
/*
|
||||
* Initialize modrev times
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_alloc.c,v 1.132 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ffs_alloc.c,v 1.133 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -70,7 +70,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.132 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.133 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -835,7 +835,7 @@ ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int flags,
|
||||
}
|
||||
|
||||
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
|
||||
if (lbn < NDADDR + NINDIR(fs)) {
|
||||
if (lbn < UFS_NDADDR + NINDIR(fs)) {
|
||||
cg = ino_to_cg(fs, ip->i_number);
|
||||
return (cgbase(fs, cg) + fs->fs_frag);
|
||||
}
|
||||
@ -899,7 +899,7 @@ ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int flags,
|
||||
}
|
||||
|
||||
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
|
||||
if (lbn < NDADDR + NINDIR(fs)) {
|
||||
if (lbn < UFS_NDADDR + NINDIR(fs)) {
|
||||
cg = ino_to_cg(fs, ip->i_number);
|
||||
return (cgbase(fs, cg) + fs->fs_frag);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_balloc.c,v 1.55 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ffs_balloc.c,v 1.56 2013/01/22 09:39:15 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.55 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.56 2013/01/22 09:39:15 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -104,11 +104,11 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct fs *fs = ip->i_fs;
|
||||
struct ufsmount *ump = ip->i_ump;
|
||||
struct indir indirs[NIADDR + 2];
|
||||
struct indir indirs[UFS_NIADDR + 2];
|
||||
daddr_t newb, pref, nb;
|
||||
int32_t *bap; /* XXX ondisk32 */
|
||||
int deallocated, osize, nsize, num, i, error;
|
||||
int32_t *blkp, *allocblk, allociblk[NIADDR + 1];
|
||||
int32_t *blkp, *allocblk, allociblk[UFS_NIADDR + 1];
|
||||
int32_t *allocib;
|
||||
int unwindidx = -1;
|
||||
#ifdef FFS_EI
|
||||
@ -135,7 +135,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
||||
*/
|
||||
|
||||
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,10 +161,10 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
||||
}
|
||||
|
||||
/*
|
||||
* The first NDADDR blocks are direct blocks
|
||||
* The first UFS_NDADDR blocks are direct blocks
|
||||
*/
|
||||
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
nb = ufs_rw32(ip->i_ffs1_db[lbn], needswap);
|
||||
if (nb != 0 && ip->i_size >= lblktosize(fs, lbn + 1)) {
|
||||
|
||||
@ -521,11 +521,11 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct fs *fs = ip->i_fs;
|
||||
struct ufsmount *ump = ip->i_ump;
|
||||
struct indir indirs[NIADDR + 2];
|
||||
struct indir indirs[UFS_NIADDR + 2];
|
||||
daddr_t newb, pref, nb;
|
||||
int64_t *bap;
|
||||
int deallocated, osize, nsize, num, i, error;
|
||||
daddr_t *blkp, *allocblk, allociblk[NIADDR + 1];
|
||||
daddr_t *blkp, *allocblk, allociblk[UFS_NIADDR + 1];
|
||||
int64_t *allocib;
|
||||
int unwindidx = -1;
|
||||
#ifdef FFS_EI
|
||||
@ -550,7 +550,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
||||
* 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,
|
||||
@ -658,7 +658,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
||||
*/
|
||||
|
||||
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) {
|
||||
@ -684,10 +684,10 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
||||
}
|
||||
|
||||
/*
|
||||
* The first NDADDR blocks are direct blocks
|
||||
* The first UFS_NDADDR blocks are direct blocks
|
||||
*/
|
||||
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
nb = ufs_rw64(ip->i_ffs2_db[lbn], needswap);
|
||||
if (nb != 0 && ip->i_size >= lblktosize(fs, lbn + 1)) {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_bswap.c,v 1.35 2011/03/06 17:08:38 bouyer Exp $ */
|
||||
/* $NetBSD: ffs_bswap.c,v 1.36 2013/01/22 09:39:16 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Manuel Bouyer.
|
||||
@ -30,7 +30,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_bswap.c,v 1.35 2011/03/06 17:08:38 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_bswap.c,v 1.36 2013/01/22 09:39:16 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#if defined(_KERNEL)
|
||||
@ -128,7 +128,7 @@ ffs_dinode1_swap(struct ufs1_dinode *o, struct ufs1_dinode *n)
|
||||
n->di_mtimensec = bswap32(o->di_mtimensec);
|
||||
n->di_ctime = bswap32(o->di_ctime);
|
||||
n->di_ctimensec = bswap32(o->di_ctimensec);
|
||||
memcpy(n->di_db, o->di_db, (NDADDR + NIADDR) * sizeof(u_int32_t));
|
||||
memcpy(n->di_db, o->di_db, (UFS_NDADDR + UFS_NIADDR) * sizeof(u_int32_t));
|
||||
n->di_flags = bswap32(o->di_flags);
|
||||
n->di_blocks = bswap32(o->di_blocks);
|
||||
n->di_gen = bswap32(o->di_gen);
|
||||
@ -158,7 +158,7 @@ ffs_dinode2_swap(struct ufs2_dinode *o, struct ufs2_dinode *n)
|
||||
n->di_kernflags = bswap32(o->di_kernflags);
|
||||
n->di_flags = bswap32(o->di_flags);
|
||||
n->di_extsize = bswap32(o->di_extsize);
|
||||
memcpy(n->di_extb, o->di_extb, (NXADDR + NDADDR + NIADDR) * 8);
|
||||
memcpy(n->di_extb, o->di_extb, (UFS_NXADDR + UFS_NDADDR + UFS_NIADDR) * 8);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_inode.c,v 1.111 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ffs_inode.c,v 1.112 2013/01/22 09:39:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -61,7 +61,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.111 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.112 2013/01/22 09:39:16 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -208,8 +208,8 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
{
|
||||
daddr_t lastblock;
|
||||
struct inode *oip = VTOI(ovp);
|
||||
daddr_t bn, lastiblock[NIADDR], indir_lbn[NIADDR];
|
||||
daddr_t blks[NDADDR + NIADDR];
|
||||
daddr_t bn, lastiblock[UFS_NIADDR], indir_lbn[UFS_NIADDR];
|
||||
daddr_t blks[UFS_NDADDR + UFS_NIADDR];
|
||||
struct fs *fs;
|
||||
int offset, pgoffset, level;
|
||||
int64_t count, blocksreleased = 0;
|
||||
@ -261,7 +261,7 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
*/
|
||||
|
||||
if (osize < length) {
|
||||
if (lblkno(fs, osize) < NDADDR &&
|
||||
if (lblkno(fs, osize) < UFS_NDADDR &&
|
||||
lblkno(fs, osize) != lblkno(fs, length) &&
|
||||
blkroundup(fs, osize) != osize) {
|
||||
off_t eob;
|
||||
@ -349,7 +349,7 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t 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);
|
||||
@ -361,14 +361,14 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
*/
|
||||
sync = 0;
|
||||
for (level = TRIPLE; level >= SINGLE; level--) {
|
||||
blks[NDADDR + level] = DIP(oip, ib[level]);
|
||||
if (lastiblock[level] < 0 && blks[NDADDR + level] != 0) {
|
||||
blks[UFS_NDADDR + level] = DIP(oip, ib[level]);
|
||||
if (lastiblock[level] < 0 && blks[UFS_NDADDR + level] != 0) {
|
||||
sync = 1;
|
||||
DIP_ASSIGN(oip, ib[level], 0);
|
||||
lastiblock[level] = -1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < NDADDR; i++) {
|
||||
for (i = 0; i < UFS_NDADDR; i++) {
|
||||
blks[i] = DIP(oip, db[i]);
|
||||
if (i > lastblock && blks[i] != 0) {
|
||||
sync = 1;
|
||||
@ -388,15 +388,15 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t 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++) {
|
||||
bn = DIP(oip, db[i]);
|
||||
DIP_ASSIGN(oip, db[i], blks[i]);
|
||||
blks[i] = bn;
|
||||
}
|
||||
for (i = 0; i < NIADDR; i++) {
|
||||
for (i = 0; i < UFS_NIADDR; i++) {
|
||||
bn = DIP(oip, ib[i]);
|
||||
DIP_ASSIGN(oip, ib[i], blks[NDADDR + i]);
|
||||
blks[NDADDR + i] = bn;
|
||||
DIP_ASSIGN(oip, ib[i], blks[UFS_NDADDR + i]);
|
||||
blks[UFS_NDADDR + i] = bn;
|
||||
}
|
||||
|
||||
oip->i_size = osize;
|
||||
@ -408,7 +408,7 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t 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--) {
|
||||
@ -441,7 +441,7 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
/*
|
||||
* All whole direct blocks or frags.
|
||||
*/
|
||||
for (i = NDADDR - 1; i > lastblock; i--) {
|
||||
for (i = UFS_NDADDR - 1; i > lastblock; i--) {
|
||||
long bsize;
|
||||
|
||||
if (oip->i_ump->um_fstype == UFS1)
|
||||
@ -506,9 +506,9 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
done:
|
||||
#ifdef DIAGNOSTIC
|
||||
for (level = SINGLE; level <= TRIPLE; level++)
|
||||
if (blks[NDADDR + level] != DIP(oip, ib[level]))
|
||||
if (blks[UFS_NDADDR + level] != DIP(oip, ib[level]))
|
||||
panic("itrunc1");
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
for (i = 0; i < UFS_NDADDR; i++)
|
||||
if (blks[i] != DIP(oip, db[i]))
|
||||
panic("itrunc2");
|
||||
if (length == 0 &&
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.120 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.121 2013/01/22 09:39:16 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.120 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.121 2013/01/22 09:39:16 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -476,7 +476,7 @@ snapshot_setup(struct mount *mp, struct vnode *vp)
|
||||
error = UFS_WAPBL_BEGIN(mp);
|
||||
if (error)
|
||||
return error;
|
||||
for (blkno = NDADDR, n = 0; blkno < numblks; blkno += NINDIR(fs)) {
|
||||
for (blkno = UFS_NDADDR, n = 0; blkno < numblks; blkno += NINDIR(fs)) {
|
||||
error = ffs_balloc(vp, lblktosize(fs, (off_t)blkno),
|
||||
fs->fs_bsize, l->l_cred, B_METAONLY, &ibp);
|
||||
if (error)
|
||||
@ -682,7 +682,7 @@ snapshot_expunge(struct mount *mp, struct vnode *vp, struct fs *copy_fs,
|
||||
*/
|
||||
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) {
|
||||
error = UFS_WAPBL_BEGIN(mp);
|
||||
@ -821,7 +821,7 @@ out:
|
||||
|
||||
/*
|
||||
* Write the superblock and its summary information to the snapshot.
|
||||
* Make sure, the first NDADDR blocks get copied to the snapshot.
|
||||
* Make sure, the first UFS_NDADDR blocks get copied to the snapshot.
|
||||
*/
|
||||
static int
|
||||
snapshot_writefs(struct mount *mp, struct vnode *vp, void *sbbuf)
|
||||
@ -873,10 +873,11 @@ snapshot_writefs(struct mount *mp, struct vnode *vp, void *sbbuf)
|
||||
bawrite(bp);
|
||||
}
|
||||
/*
|
||||
* Copy the first NDADDR blocks to the snapshot so ffs_copyonwrite()
|
||||
* and ffs_snapblkfree() will always work on indirect blocks.
|
||||
* Copy the first UFS_NDADDR blocks to the snapshot so
|
||||
* ffs_copyonwrite() and ffs_snapblkfree() will always work on
|
||||
* indirect blocks.
|
||||
*/
|
||||
for (loc = 0; loc < NDADDR; loc++) {
|
||||
for (loc = 0; loc < UFS_NDADDR; loc++) {
|
||||
if (db_get(ip, loc) != 0)
|
||||
continue;
|
||||
error = ffs_balloc(vp, lblktosize(fs, (off_t)loc),
|
||||
@ -980,8 +981,8 @@ cgaccount1(int cg, struct vnode *vp, void *data, int 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, ns), loc))
|
||||
db_assign(ip, loc, BLK_NOCOPY);
|
||||
else if (db_get(ip, loc) == BLK_NOCOPY) {
|
||||
@ -995,7 +996,7 @@ cgaccount1(int cg, struct vnode *vp, void *data, int passno)
|
||||
if ((error = ffs_balloc(vp, lblktosize(fs, (off_t)(base + loc)),
|
||||
fs->fs_bsize, l->l_cred, B_METAONLY, &ibp)) != 0)
|
||||
return (error);
|
||||
indiroff = (base + loc - NDADDR) % NINDIR(fs);
|
||||
indiroff = (base + loc - UFS_NDADDR) % NINDIR(fs);
|
||||
for ( ; loc < len; loc++, indiroff++) {
|
||||
if (indiroff >= NINDIR(fs)) {
|
||||
bawrite(ibp);
|
||||
@ -1082,7 +1083,7 @@ expunge(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
||||
dip1->di_mode = 0;
|
||||
dip1->di_size = 0;
|
||||
dip1->di_blocks = 0;
|
||||
memset(&dip1->di_db[0], 0, (NDADDR + NIADDR) * sizeof(int32_t));
|
||||
memset(&dip1->di_db[0], 0, (UFS_NDADDR + UFS_NIADDR) * sizeof(int32_t));
|
||||
} else {
|
||||
dip2 = (struct ufs2_dinode *)bp->b_data +
|
||||
ino_to_fsbo(fs, cancelip->i_number);
|
||||
@ -1095,7 +1096,7 @@ expunge(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
||||
dip2->di_mode = 0;
|
||||
dip2->di_size = 0;
|
||||
dip2->di_blocks = 0;
|
||||
memset(&dip2->di_db[0], 0, (NDADDR + NIADDR) * sizeof(int64_t));
|
||||
memset(&dip2->di_db[0], 0, (UFS_NDADDR + UFS_NIADDR) * sizeof(int64_t));
|
||||
}
|
||||
bdwrite(bp);
|
||||
UFS_WAPBL_END(mp);
|
||||
@ -1108,21 +1109,21 @@ expunge(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
||||
bap = &cancelip->i_ffs1_db[0];
|
||||
else
|
||||
bap = &cancelip->i_ffs2_db[0];
|
||||
error = (*acctfunc)(snapvp, bap, 0, NDADDR, fs, 0, expungetype);
|
||||
error = (*acctfunc)(snapvp, bap, 0, UFS_NDADDR, fs, 0, expungetype);
|
||||
if (error)
|
||||
return (error);
|
||||
if (fs->fs_magic == FS_UFS1_MAGIC)
|
||||
bap = &cancelip->i_ffs1_ib[0];
|
||||
else
|
||||
bap = &cancelip->i_ffs2_ib[0];
|
||||
error = (*acctfunc)(snapvp, bap, 0, NIADDR, fs, -1, expungetype);
|
||||
error = (*acctfunc)(snapvp, bap, 0, UFS_NIADDR, fs, -1, expungetype);
|
||||
if (error)
|
||||
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(snapvp, ITOV(cancelip), i,
|
||||
ib_get(cancelip, i), lbn, rlbn, len,
|
||||
blksperindir, fs, acctfunc, expungetype);
|
||||
@ -1147,7 +1148,7 @@ indiracct(struct vnode *snapvp, struct vnode *cancelvp, int level,
|
||||
{
|
||||
int error, num, i;
|
||||
daddr_t subblksperindir;
|
||||
struct indir indirs[NIADDR + 2];
|
||||
struct indir indirs[UFS_NIADDR + 2];
|
||||
daddr_t last;
|
||||
void *bap;
|
||||
struct buf *bp;
|
||||
@ -1247,7 +1248,7 @@ snapacct(struct vnode *vp, void *bap, int oldblkp, int lastblkp,
|
||||
if (blkno == 0 || blkno == BLK_NOCOPY || blkno == BLK_SNAP)
|
||||
continue;
|
||||
lbn = fragstoblks(fs, blkno);
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
blkno = db_get(ip, lbn);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
} else {
|
||||
@ -1256,7 +1257,7 @@ snapacct(struct vnode *vp, void *bap, int oldblkp, int lastblkp,
|
||||
if (error)
|
||||
break;
|
||||
blkno = idb_get(ip, ibp->b_data,
|
||||
(lbn - NDADDR) % NINDIR(fs));
|
||||
(lbn - UFS_NDADDR) % NINDIR(fs));
|
||||
}
|
||||
/*
|
||||
* If we are expunging a snapshot vnode and we
|
||||
@ -1265,16 +1266,16 @@ snapacct(struct vnode *vp, void *bap, int oldblkp, int lastblkp,
|
||||
* we took our current snapshot and can be ignored.
|
||||
*/
|
||||
if (expungetype == BLK_SNAP && blkno == BLK_NOCOPY) {
|
||||
if (lbn >= NDADDR)
|
||||
if (lbn >= UFS_NDADDR)
|
||||
brelse(ibp, 0);
|
||||
} else {
|
||||
if (blkno != 0)
|
||||
panic("snapacct: bad block");
|
||||
if (lbn < NDADDR)
|
||||
if (lbn < UFS_NDADDR)
|
||||
db_assign(ip, lbn, expungetype);
|
||||
else {
|
||||
idb_assign(ip, ibp->b_data,
|
||||
(lbn - NDADDR) % NINDIR(fs), expungetype);
|
||||
(lbn - UFS_NDADDR) % NINDIR(fs), expungetype);
|
||||
bdwrite(ibp);
|
||||
}
|
||||
}
|
||||
@ -1464,7 +1465,7 @@ ffs_snapremove(struct vnode *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 = db_get(ip, blkno);
|
||||
if (dblk == BLK_NOCOPY || dblk == BLK_SNAP)
|
||||
db_assign(ip, blkno, 0);
|
||||
@ -1476,7 +1477,7 @@ ffs_snapremove(struct vnode *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 = ffs_balloc(vp, lblktosize(fs, (off_t)blkno),
|
||||
fs->fs_bsize, l->l_cred, B_METAONLY, &ibp);
|
||||
if (error)
|
||||
@ -1559,7 +1560,7 @@ retry:
|
||||
/*
|
||||
* Lookup block being written.
|
||||
*/
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
blkno = db_get(ip, lbn);
|
||||
} else {
|
||||
mutex_exit(&si->si_lock);
|
||||
@ -1569,7 +1570,7 @@ retry:
|
||||
mutex_enter(&si->si_lock);
|
||||
break;
|
||||
}
|
||||
indiroff = (lbn - NDADDR) % NINDIR(fs);
|
||||
indiroff = (lbn - UFS_NDADDR) % NINDIR(fs);
|
||||
blkno = idb_get(ip, ibp->b_data, indiroff);
|
||||
mutex_enter(&si->si_lock);
|
||||
if (gen != si->si_gen) {
|
||||
@ -1594,7 +1595,7 @@ retry:
|
||||
*/
|
||||
if (claimedblk)
|
||||
panic("snapblkfree: inconsistent block type");
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
db_assign(ip, lbn, BLK_NOCOPY);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
} else {
|
||||
@ -1616,7 +1617,7 @@ retry:
|
||||
* (default), or does not care about the block,
|
||||
* it is not needed.
|
||||
*/
|
||||
if (lbn >= NDADDR)
|
||||
if (lbn >= UFS_NDADDR)
|
||||
brelse(ibp, 0);
|
||||
continue;
|
||||
}
|
||||
@ -1637,7 +1638,7 @@ retry:
|
||||
lbn, (unsigned long long)inum);
|
||||
#endif
|
||||
mutex_exit(&si->si_lock);
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
db_assign(ip, lbn, bno);
|
||||
} else {
|
||||
idb_assign(ip, ibp->b_data, indiroff, bno);
|
||||
@ -1658,7 +1659,7 @@ retry:
|
||||
mutex_exit(&si->si_snaplock);
|
||||
return (error == 0);
|
||||
}
|
||||
if (lbn >= NDADDR)
|
||||
if (lbn >= UFS_NDADDR)
|
||||
brelse(ibp, 0);
|
||||
#ifdef DEBUG
|
||||
if (snapdebug)
|
||||
@ -1958,7 +1959,7 @@ retry:
|
||||
/*
|
||||
* Check to see if block needs to be copied.
|
||||
*/
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
blkno = db_get(ip, lbn);
|
||||
} else {
|
||||
mutex_exit(&si->si_lock);
|
||||
@ -2129,7 +2130,7 @@ ffs_snapshot_read(struct vnode *vp, struct uio *uio, int ioflag)
|
||||
static int
|
||||
snapblkaddr(struct vnode *vp, daddr_t lbn, daddr_t *res)
|
||||
{
|
||||
struct indir indirs[NIADDR + 2];
|
||||
struct indir indirs[UFS_NIADDR + 2];
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct fs *fs = ip->i_fs;
|
||||
struct buf *bp;
|
||||
@ -2137,7 +2138,7 @@ snapblkaddr(struct vnode *vp, daddr_t lbn, daddr_t *res)
|
||||
|
||||
KASSERT(lbn >= 0);
|
||||
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
*res = db_get(ip, lbn);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.281 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.282 2013/01/22 09:39:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -61,7 +61,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.281 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.282 2013/01/22 09:39:16 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -1609,7 +1609,7 @@ ffs_statvfs(struct mount *mp, struct statvfs *sbp)
|
||||
sbp->f_bavail = sbp->f_bfree - sbp->f_bresvd;
|
||||
else
|
||||
sbp->f_bavail = 0;
|
||||
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;
|
||||
sbp->f_favail = sbp->f_ffree;
|
||||
sbp->f_fresvd = 0;
|
||||
@ -1936,7 +1936,7 @@ ffs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
|
||||
|
||||
memcpy(&ufh, fhp, sizeof(ufh));
|
||||
fs = VFSTOUFS(mp)->um_fs;
|
||||
if (ufh.ufid_ino < ROOTINO ||
|
||||
if (ufh.ufid_ino < UFS_ROOTINO ||
|
||||
ufh.ufid_ino >= fs->fs_ncg * fs->fs_ipg)
|
||||
return (ESTALE);
|
||||
return (ufs_fhtovp(mp, &ufh, vpp));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_vnops.c,v 1.121 2012/04/29 22:54:00 chs Exp $ */
|
||||
/* $NetBSD: ffs_vnops.c,v 1.122 2013/01/22 09:39:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
@ -61,7 +61,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.121 2012/04/29 22:54:00 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.122 2013/01/22 09:39:16 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -333,7 +333,7 @@ ffs_fsync(void *v)
|
||||
} */ *ap = v;
|
||||
struct buf *bp;
|
||||
int num, error, i;
|
||||
struct indir ia[NIADDR + 1];
|
||||
struct indir ia[UFS_NIADDR + 1];
|
||||
int bsize;
|
||||
daddr_t blk_high;
|
||||
struct vnode *vp;
|
||||
@ -405,7 +405,7 @@ ffs_fsync(void *v)
|
||||
* Then, flush indirect blocks.
|
||||
*/
|
||||
|
||||
if (blk_high >= NDADDR) {
|
||||
if (blk_high >= UFS_NDADDR) {
|
||||
error = ufs_getlbns(vp, blk_high, ia, &num);
|
||||
if (error)
|
||||
goto out;
|
||||
@ -613,7 +613,7 @@ ffs_gop_size(struct vnode *vp, off_t size, off_t *eobp, int flags)
|
||||
|
||||
olbn = lblkno(fs, ip->i_size);
|
||||
nlbn = lblkno(fs, size);
|
||||
if (nlbn < NDADDR && olbn <= nlbn) {
|
||||
if (nlbn < UFS_NDADDR && olbn <= nlbn) {
|
||||
*eobp = fragroundup(fs, size);
|
||||
} else {
|
||||
*eobp = blkroundup(fs, size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_wapbl.c,v 1.18 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ffs_wapbl.c,v 1.19 2013/01/22 09:39:16 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.18 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.19 2013/01/22 09:39:16 dholland Exp $");
|
||||
|
||||
#define WAPBL_INTERNAL
|
||||
|
||||
@ -753,8 +753,8 @@ wapbl_find_log_start(struct mount *mp, struct vnode *vp, off_t logsize,
|
||||
|
||||
/* add in number of indirect blocks needed */
|
||||
indir_blks = 0;
|
||||
if (desired_blks >= NDADDR) {
|
||||
struct indir indirs[NIADDR + 2];
|
||||
if (desired_blks >= UFS_NDADDR) {
|
||||
struct indir indirs[UFS_NIADDR + 2];
|
||||
int num;
|
||||
|
||||
error = ufs_getlbns(vp, desired_blks, indirs, &num);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fs.h,v 1.59 2012/04/23 17:19:00 drochner Exp $ */
|
||||
/* $NetBSD: fs.h,v 1.60 2013/01/22 09:39:16 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
@ -703,12 +703,12 @@ struct ocg {
|
||||
* Determining the size of a file block in the file system.
|
||||
*/
|
||||
#define blksize(fs, ip, lbn) \
|
||||
(((lbn) >= NDADDR || (ip)->i_size >= lblktosize(fs, (lbn) + 1)) \
|
||||
(((lbn) >= UFS_NDADDR || (ip)->i_size >= lblktosize(fs, (lbn) + 1)) \
|
||||
? (fs)->fs_bsize \
|
||||
: ((int32_t)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 \
|
||||
: ((int32_t)fragroundup(fs, blkoff(fs, (uint64_t)(size)))))
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs.h,v 1.136 2012/02/16 02:47:55 perseant Exp $ */
|
||||
/* $NetBSD: lfs.h,v 1.137 2013/01/22 09:39:17 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -303,7 +303,7 @@ struct lfid {
|
||||
*/
|
||||
|
||||
/* Address calculations for metadata located in the inode */
|
||||
#define S_INDIR(fs) -NDADDR
|
||||
#define S_INDIR(fs) -UFS_NDADDR
|
||||
#define D_INDIR(fs) (S_INDIR(fs) - NINDIR(fs) - 1)
|
||||
#define T_INDIR(fs) (D_INDIR(fs) - NINDIR(fs) * NINDIR(fs) - 1)
|
||||
|
||||
@ -856,7 +856,7 @@ struct lfs {
|
||||
#define INOPF(fs) ((fs)->lfs_inopf)
|
||||
|
||||
#define blksize(fs, ip, lbn) \
|
||||
(((lbn) >= NDADDR || (ip)->i_ffs1_size >= ((lbn) + 1) << (fs)->lfs_bshift) \
|
||||
(((lbn) >= UFS_NDADDR || (ip)->i_ffs1_size >= ((lbn) + 1) << (fs)->lfs_bshift) \
|
||||
? (fs)->lfs_bsize \
|
||||
: (fragroundup(fs, blkoff(fs, (ip)->i_ffs1_size))))
|
||||
#define blkoff(fs, loc) ((int)((loc) & (fs)->lfs_bmask))
|
||||
@ -892,7 +892,7 @@ struct lfs {
|
||||
#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->lfs_frag) */ \
|
||||
((fsb) &~ ((fs)->lfs_frag - 1))
|
||||
#define dblksize(fs, dp, lbn) \
|
||||
(((lbn) >= NDADDR || (dp)->di_size >= ((lbn) + 1) << (fs)->lfs_bshift)\
|
||||
(((lbn) >= UFS_NDADDR || (dp)->di_size >= ((lbn) + 1) << (fs)->lfs_bshift)\
|
||||
? (fs)->lfs_bsize \
|
||||
: (fragroundup(fs, blkoff(fs, (dp)->di_size))))
|
||||
|
||||
@ -991,7 +991,7 @@ struct lbnentry {
|
||||
struct lfs_inode_ext {
|
||||
off_t lfs_osize; /* size of file on disk */
|
||||
u_int32_t lfs_effnblocks; /* number of blocks when i/o completes */
|
||||
size_t lfs_fragsize[NDADDR]; /* size of on-disk direct blocks */
|
||||
size_t lfs_fragsize[UFS_NDADDR]; /* size of on-disk direct blocks */
|
||||
TAILQ_ENTRY(inode) lfs_dchain; /* Dirop chain. */
|
||||
TAILQ_ENTRY(inode) lfs_pchain; /* Paging chain. */
|
||||
#define LFSI_NO_GOP_WRITE 0x01
|
||||
@ -1069,10 +1069,10 @@ struct lfs_inode_ext {
|
||||
|
||||
/*
|
||||
* The minimum number of blocks to create a new inode. This is:
|
||||
* directory direct block (1) + NIADDR indirect blocks + inode block (1) +
|
||||
* ifile direct block (1) + NIADDR indirect blocks = 3 + 2 * NIADDR blocks.
|
||||
* directory direct block (1) + UFS_NIADDR indirect blocks + inode block (1) +
|
||||
* ifile direct block (1) + UFS_NIADDR indirect blocks = 3 + 2 * UFS_NIADDR blocks.
|
||||
*/
|
||||
#define LFS_NRESERVE(F) (btofsb((F), (2 * NIADDR + 3) << (F)->lfs_bshift))
|
||||
#define LFS_NRESERVE(F) (btofsb((F), (2 * UFS_NIADDR + 3) << (F)->lfs_bshift))
|
||||
|
||||
/* Statistics Counters */
|
||||
struct lfs_stats { /* Must match sysctl list in lfs_vfsops.h ! */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_alloc.c,v 1.112 2012/02/16 02:47:55 perseant Exp $ */
|
||||
/* $NetBSD: lfs_alloc.c,v 1.113 2013/01/22 09:39:17 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.112 2012/02/16 02:47:55 perseant Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.113 2013/01/22 09:39:17 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -296,7 +296,7 @@ lfs_ialloc(struct lfs *fs, struct vnode *pvp, ino_t new_ino, int new_gen,
|
||||
vp = *vpp;
|
||||
ip = VTOI(vp);
|
||||
|
||||
memset(ip->i_lfs_fragsize, 0, NDADDR * sizeof(*ip->i_lfs_fragsize));
|
||||
memset(ip->i_lfs_fragsize, 0, UFS_NDADDR * sizeof(*ip->i_lfs_fragsize));
|
||||
|
||||
uvm_vnp_setsize(vp, 0);
|
||||
lfs_mark_vnode(vp);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_balloc.c,v 1.71 2012/12/20 08:03:45 hannken Exp $ */
|
||||
/* $NetBSD: lfs_balloc.c,v 1.72 2013/01/22 09:39:17 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_balloc.c,v 1.71 2012/12/20 08:03:45 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.72 2013/01/22 09:39:17 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -106,7 +106,7 @@ u_int64_t locked_fakequeue_count;
|
||||
* to disk are given the new special disk address UNWRITTEN == -2, so that
|
||||
* they can be differentiated from completely new blocks.
|
||||
*/
|
||||
/* VOP_BWRITE NIADDR+2 times */
|
||||
/* VOP_BWRITE UFS_NIADDR+2 times */
|
||||
int
|
||||
lfs_balloc(struct vnode *vp, off_t startoffset, int iosize, kauth_cred_t cred,
|
||||
int flags, struct buf **bpp)
|
||||
@ -116,7 +116,7 @@ lfs_balloc(struct vnode *vp, off_t startoffset, int iosize, kauth_cred_t cred,
|
||||
struct buf *ibp, *bp;
|
||||
struct inode *ip;
|
||||
struct lfs *fs;
|
||||
struct indir indirs[NIADDR+2], *idp;
|
||||
struct indir indirs[UFS_NIADDR+2], *idp;
|
||||
daddr_t lbn, lastblock;
|
||||
int bcount;
|
||||
int error, frags, i, nsize, osize, num;
|
||||
@ -151,7 +151,7 @@ lfs_balloc(struct vnode *vp, off_t startoffset, int iosize, kauth_cred_t cred,
|
||||
|
||||
/* Check for block beyond end of file and fragment extension needed. */
|
||||
lastblock = lblkno(fs, ip->i_size);
|
||||
if (lastblock < NDADDR && lastblock < lbn) {
|
||||
if (lastblock < UFS_NDADDR && lastblock < lbn) {
|
||||
osize = blksize(fs, ip, lastblock);
|
||||
if (osize < fs->lfs_bsize && osize > 0) {
|
||||
if ((error = lfs_fragextend(vp, osize, fs->lfs_bsize,
|
||||
@ -175,7 +175,7 @@ lfs_balloc(struct vnode *vp, off_t startoffset, int iosize, kauth_cred_t cred,
|
||||
* size or it already exists and contains some fragments and
|
||||
* may need to extend it.
|
||||
*/
|
||||
if (lbn < NDADDR && lblkno(fs, ip->i_size) <= lbn) {
|
||||
if (lbn < UFS_NDADDR && lblkno(fs, ip->i_size) <= lbn) {
|
||||
osize = blksize(fs, ip, lbn);
|
||||
nsize = fragroundup(fs, offset + iosize);
|
||||
if (lblktosize(fs, lbn) >= ip->i_size) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_debug.c,v 1.39 2011/07/17 20:54:54 joerg Exp $ */
|
||||
/* $NetBSD: lfs_debug.c,v 1.40 2013/01/22 09:39:17 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_debug.c,v 1.39 2011/07/17 20:54:54 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.40 2013/01/22 09:39:17 dholland Exp $");
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
@ -201,12 +201,12 @@ lfs_dump_dinode(struct ufs1_dinode *dip)
|
||||
"blocks ", dip->di_blocks);
|
||||
printf("inum %d\n", dip->di_inumber);
|
||||
printf("Direct Addresses\n");
|
||||
for (i = 0; i < NDADDR; i++) {
|
||||
for (i = 0; i < UFS_NDADDR; i++) {
|
||||
printf("\t%x", dip->di_db[i]);
|
||||
if ((i % 6) == 5)
|
||||
printf("\n");
|
||||
}
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
for (i = 0; i < UFS_NIADDR; i++)
|
||||
printf("\t%x", dip->di_ib[i]);
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_inode.c,v 1.126 2011/11/23 19:42:10 bouyer Exp $ */
|
||||
/* $NetBSD: lfs_inode.c,v 1.127 2013/01/22 09:39:17 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_inode.c,v 1.126 2011/11/23 19:42:10 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.127 2013/01/22 09:39:17 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -191,16 +191,16 @@ lfs_update(struct vnode *vp, const struct timespec *acc,
|
||||
* Truncate the inode oip to at most length size, freeing the
|
||||
* disk blocks.
|
||||
*/
|
||||
/* VOP_BWRITE 1 + NIADDR + lfs_balloc == 2 + 2*NIADDR times */
|
||||
/* VOP_BWRITE 1 + UFS_NIADDR + lfs_balloc == 2 + 2*UFS_NIADDR times */
|
||||
|
||||
int
|
||||
lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
{
|
||||
daddr_t lastblock;
|
||||
struct inode *oip = VTOI(ovp);
|
||||
daddr_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
|
||||
daddr_t bn, lbn, lastiblock[UFS_NIADDR], indir_lbn[UFS_NIADDR];
|
||||
/* XXX ondisk32 */
|
||||
int32_t newblks[NDADDR + NIADDR];
|
||||
int32_t newblks[UFS_NDADDR + UFS_NIADDR];
|
||||
struct lfs *fs;
|
||||
struct buf *bp;
|
||||
int offset, size, level;
|
||||
@ -267,7 +267,7 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
if (ioflag & IO_SYNC)
|
||||
aflags |= B_SYNC;
|
||||
if (usepc) {
|
||||
if (lblkno(fs, osize) < NDADDR &&
|
||||
if (lblkno(fs, osize) < UFS_NDADDR &&
|
||||
lblkno(fs, osize) != lblkno(fs, length) &&
|
||||
blkroundup(fs, osize) != osize) {
|
||||
off_t eob;
|
||||
@ -304,13 +304,13 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
return (lfs_update(ovp, NULL, NULL, 0));
|
||||
} else {
|
||||
error = lfs_reserve(fs, ovp, NULL,
|
||||
btofsb(fs, (NIADDR + 2) << fs->lfs_bshift));
|
||||
btofsb(fs, (UFS_NIADDR + 2) << fs->lfs_bshift));
|
||||
if (error)
|
||||
return (error);
|
||||
error = lfs_balloc(ovp, length - 1, 1, cred,
|
||||
aflags, &bp);
|
||||
lfs_reserve(fs, ovp, NULL,
|
||||
-btofsb(fs, (NIADDR + 2) << fs->lfs_bshift));
|
||||
-btofsb(fs, (UFS_NIADDR + 2) << fs->lfs_bshift));
|
||||
if (error)
|
||||
return (error);
|
||||
oip->i_ffs1_size = oip->i_size = length;
|
||||
@ -323,7 +323,7 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
}
|
||||
|
||||
if ((error = lfs_reserve(fs, ovp, NULL,
|
||||
btofsb(fs, (2 * NIADDR + 3) << fs->lfs_bshift))) != 0)
|
||||
btofsb(fs, (2 * UFS_NIADDR + 3) << fs->lfs_bshift))) != 0)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
@ -350,7 +350,7 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
error = lfs_balloc(ovp, length - 1, 1, cred, aflags, &bp);
|
||||
if (error) {
|
||||
lfs_reserve(fs, ovp, NULL,
|
||||
-btofsb(fs, (2 * NIADDR + 3) << fs->lfs_bshift));
|
||||
-btofsb(fs, (2 * UFS_NIADDR + 3) << fs->lfs_bshift));
|
||||
goto errout;
|
||||
}
|
||||
obufsize = bp->b_bufsize;
|
||||
@ -388,7 +388,7 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
error = ufs_balloc_range(ovp, length - 1, 1, cred, aflags);
|
||||
if (error) {
|
||||
lfs_reserve(fs, ovp, NULL,
|
||||
-btofsb(fs, (2 * NIADDR + 3) << fs->lfs_bshift));
|
||||
-btofsb(fs, (2 * UFS_NIADDR + 3) << fs->lfs_bshift));
|
||||
goto errout;
|
||||
}
|
||||
xlbn = lblkno(fs, length);
|
||||
@ -404,7 +404,7 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
((ioflag & IO_SYNC) ? PGO_SYNCIO : 0));
|
||||
if (error) {
|
||||
lfs_reserve(fs, ovp, NULL,
|
||||
-btofsb(fs, (2 * NIADDR + 3) << fs->lfs_bshift));
|
||||
-btofsb(fs, (2 * UFS_NIADDR + 3) << fs->lfs_bshift));
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
@ -426,7 +426,7 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
lastblock = lblkno(fs, QUAD_MAX - fs->lfs_bsize);
|
||||
else
|
||||
lastblock = lblkno(fs, length + fs->lfs_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 = btofsb(fs, fs->lfs_bsize);
|
||||
@ -438,10 +438,10 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
memcpy((void *)newblks, (void *)&oip->i_ffs1_db[0], sizeof newblks);
|
||||
for (level = TRIPLE; level >= SINGLE; level--)
|
||||
if (lastiblock[level] < 0) {
|
||||
newblks[NDADDR+level] = 0;
|
||||
newblks[UFS_NDADDR+level] = 0;
|
||||
lastiblock[level] = -1;
|
||||
}
|
||||
for (i = NDADDR - 1; i > lastblock; i--)
|
||||
for (i = UFS_NDADDR - 1; i > lastblock; i--)
|
||||
newblks[i] = 0;
|
||||
|
||||
oip->i_size = oip->i_ffs1_size = osize;
|
||||
@ -452,7 +452,7 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t 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--) {
|
||||
@ -483,7 +483,7 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
/*
|
||||
* All whole direct blocks or frags.
|
||||
*/
|
||||
for (i = NDADDR - 1; i > lastblock; i--) {
|
||||
for (i = UFS_NDADDR - 1; i > lastblock; i--) {
|
||||
long bsize, obsize;
|
||||
|
||||
bn = oip->i_ffs1_db[i];
|
||||
@ -545,11 +545,11 @@ done:
|
||||
lfs_update_seguse(fs, oip, lastseg, bc);
|
||||
#ifdef DIAGNOSTIC
|
||||
for (level = SINGLE; level <= TRIPLE; level++)
|
||||
if ((newblks[NDADDR + level] == 0) !=
|
||||
if ((newblks[UFS_NDADDR + level] == 0) !=
|
||||
((oip->i_ffs1_ib[level]) == 0)) {
|
||||
panic("lfs itrunc1");
|
||||
}
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
for (i = 0; i < UFS_NDADDR; i++)
|
||||
if ((newblks[i] == 0) != (oip->i_ffs1_db[i] == 0)) {
|
||||
panic("lfs itrunc2");
|
||||
}
|
||||
@ -590,7 +590,7 @@ done:
|
||||
(void) chkdq(oip, -blocksreleased, NOCRED, 0);
|
||||
#endif
|
||||
lfs_reserve(fs, ovp, NULL,
|
||||
-btofsb(fs, (2 * NIADDR + 3) << fs->lfs_bshift));
|
||||
-btofsb(fs, (2 * UFS_NIADDR + 3) << fs->lfs_bshift));
|
||||
genfs_node_unlock(ovp);
|
||||
errout:
|
||||
oip->i_lfs_hiblk = lblkno(fs, oip->i_size + fs->lfs_bsize - 1) - 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_rfw.c,v 1.12 2009/02/22 20:28:07 ad Exp $ */
|
||||
/* $NetBSD: lfs_rfw.c,v 1.13 2013/01/22 09:39:17 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.12 2009/02/22 20:28:07 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.13 2013/01/22 09:39:17 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -216,7 +216,7 @@ update_meta(struct lfs *fs, ino_t ino, int vers, daddr_t lbn,
|
||||
struct inode *ip;
|
||||
#ifdef DEBUG
|
||||
daddr_t odaddr;
|
||||
struct indir a[NIADDR];
|
||||
struct indir a[UFS_NIADDR];
|
||||
int num;
|
||||
int i;
|
||||
#endif /* DEBUG */
|
||||
@ -253,7 +253,7 @@ update_meta(struct lfs *fs, ino_t ino, int vers, daddr_t lbn,
|
||||
if (ip->i_size <= (lbn << fs->lfs_bshift)) {
|
||||
u_int64_t newsize;
|
||||
|
||||
if (lbn < NDADDR)
|
||||
if (lbn < UFS_NDADDR)
|
||||
newsize = ip->i_ffs1_size = (lbn << fs->lfs_bshift) +
|
||||
(size - fs->lfs_fsize) + 1;
|
||||
else
|
||||
@ -276,7 +276,7 @@ update_meta(struct lfs *fs, ino_t ino, int vers, daddr_t lbn,
|
||||
LFS_WRITESEGENTRY(sup, fs, dtosn(fs, ndaddr), bp);
|
||||
|
||||
/* differences here should be due to UNWRITTEN indirect blocks. */
|
||||
KASSERT((lblkno(fs, ip->i_size) > NDADDR &&
|
||||
KASSERT((lblkno(fs, ip->i_size) > UFS_NDADDR &&
|
||||
ip->i_lfs_effnblks == ip->i_ffs1_blocks) ||
|
||||
ip->i_lfs_effnblks >= ip->i_ffs1_blocks);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_segment.c,v 1.224 2012/02/16 02:47:55 perseant Exp $ */
|
||||
/* $NetBSD: lfs_segment.c,v 1.225 2013/01/22 09:39:17 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.224 2012/02/16 02:47:55 perseant Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.225 2013/01/22 09:39:17 dholland Exp $");
|
||||
|
||||
#ifdef DEBUG
|
||||
# define vndebug(vp, str) do { \
|
||||
@ -908,7 +908,7 @@ lfs_writefile(struct lfs *fs, struct segment *sp, struct vnode *vp)
|
||||
*/
|
||||
frag = 0;
|
||||
if (sp->seg_flags & SEGM_CLEAN) {
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
for (i = 0; i < UFS_NDADDR; i++)
|
||||
if (ip->i_lfs_fragsize[i] > 0 &&
|
||||
ip->i_lfs_fragsize[i] < fs->lfs_bsize)
|
||||
++frag;
|
||||
@ -1219,7 +1219,7 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip)
|
||||
DLOG((DLOG_SEG, "lfs_writeinode: cleansing ino %d eff %d != nblk %d)"
|
||||
" at %x\n", ip->i_number, ip->i_lfs_effnblks,
|
||||
ip->i_ffs1_blocks, fs->lfs_offset));
|
||||
for (daddrp = cdp->di_db; daddrp < cdp->di_ib + NIADDR;
|
||||
for (daddrp = cdp->di_db; daddrp < cdp->di_ib + UFS_NIADDR;
|
||||
daddrp++) {
|
||||
if (*daddrp == UNWRITTEN) {
|
||||
DLOG((DLOG_SEG, "lfs_writeinode: wiping UNWRITTEN\n"));
|
||||
@ -1234,7 +1234,7 @@ lfs_writeinode(struct lfs *fs, struct segment *sp, struct inode *ip)
|
||||
* This should be identical to the check in lfs_vget().
|
||||
*/
|
||||
for (i = (cdp->di_size + fs->lfs_bsize - 1) >> fs->lfs_bshift;
|
||||
i < NDADDR; i++) {
|
||||
i < UFS_NDADDR; i++) {
|
||||
KASSERT(i >= 0);
|
||||
if ((cdp->di_mode & IFMT) == IFLNK)
|
||||
continue;
|
||||
@ -1460,7 +1460,7 @@ lfs_update_single(struct lfs *fs, struct segment *sp,
|
||||
{
|
||||
SEGUSE *sup;
|
||||
struct buf *bp;
|
||||
struct indir a[NIADDR + 2], *ap;
|
||||
struct indir a[UFS_NIADDR + 2], *ap;
|
||||
struct inode *ip;
|
||||
daddr_t daddr, ooff;
|
||||
int num, error;
|
||||
@ -1545,7 +1545,7 @@ lfs_update_single(struct lfs *fs, struct segment *sp,
|
||||
}
|
||||
#endif
|
||||
KASSERT(oldsn < fs->lfs_nseg);
|
||||
if (lbn >= 0 && lbn < NDADDR)
|
||||
if (lbn >= 0 && lbn < UFS_NDADDR)
|
||||
osize = ip->i_lfs_fragsize[lbn];
|
||||
else
|
||||
osize = fs->lfs_bsize;
|
||||
@ -1585,7 +1585,7 @@ lfs_update_single(struct lfs *fs, struct segment *sp,
|
||||
* segment no longer owns it, we can forget about its
|
||||
* old size.
|
||||
*/
|
||||
if (lbn >= 0 && lbn < NDADDR)
|
||||
if (lbn >= 0 && lbn < UFS_NDADDR)
|
||||
ip->i_lfs_fragsize[lbn] = size;
|
||||
}
|
||||
|
||||
@ -2455,7 +2455,7 @@ lfs_match_indir(struct lfs *fs, struct buf *bp)
|
||||
|
||||
ASSERT_SEGLOCK(fs);
|
||||
lbn = bp->b_lblkno;
|
||||
return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 0);
|
||||
return (lbn < 0 && (-lbn - UFS_NDADDR) % NINDIR(fs) == 0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -2465,7 +2465,7 @@ lfs_match_dindir(struct lfs *fs, struct buf *bp)
|
||||
|
||||
ASSERT_SEGLOCK(fs);
|
||||
lbn = bp->b_lblkno;
|
||||
return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 1);
|
||||
return (lbn < 0 && (-lbn - UFS_NDADDR) % NINDIR(fs) == 1);
|
||||
}
|
||||
|
||||
int
|
||||
@ -2475,7 +2475,7 @@ lfs_match_tindir(struct lfs *fs, struct buf *bp)
|
||||
|
||||
ASSERT_SEGLOCK(fs);
|
||||
lbn = bp->b_lblkno;
|
||||
return (lbn < 0 && (-lbn - NDADDR) % NINDIR(fs) == 2);
|
||||
return (lbn < 0 && (-lbn - UFS_NDADDR) % NINDIR(fs) == 2);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.143 2012/12/20 08:03:45 hannken Exp $ */
|
||||
/* $NetBSD: lfs_syscalls.c,v 1.144 2013/01/22 09:39:18 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
|
||||
@ -61,7 +61,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.143 2012/12/20 08:03:45 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.144 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#ifndef LFS
|
||||
# define LFS /* for prototypes in syscallargs.h */
|
||||
@ -413,7 +413,7 @@ lfs_markv(struct proc *p, fsid_t *fsidp, BLOCK_INFO *blkiov,
|
||||
else
|
||||
obsize = fs->lfs_bsize;
|
||||
/* Check for fragment size change */
|
||||
if (blkp->bi_lbn >= 0 && blkp->bi_lbn < NDADDR) {
|
||||
if (blkp->bi_lbn >= 0 && blkp->bi_lbn < UFS_NDADDR) {
|
||||
obsize = ip->i_lfs_fragsize[blkp->bi_lbn];
|
||||
}
|
||||
if (obsize != blkp->bi_size) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.297 2012/12/20 08:03:45 hannken Exp $ */
|
||||
/* $NetBSD: lfs_vfsops.c,v 1.298 2013/01/22 09:39:18 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.297 2012/12/20 08:03:45 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.298 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_lfs.h"
|
||||
@ -1967,11 +1967,11 @@ lfs_vinit(struct mount *mp, struct vnode **vpp)
|
||||
ufs_vinit(mp, lfs_specop_p, lfs_fifoop_p, &vp);
|
||||
ip = VTOI(vp);
|
||||
|
||||
memset(ip->i_lfs_fragsize, 0, NDADDR * sizeof(*ip->i_lfs_fragsize));
|
||||
memset(ip->i_lfs_fragsize, 0, UFS_NDADDR * sizeof(*ip->i_lfs_fragsize));
|
||||
if (vp->v_type != VLNK || ip->i_size >= ip->i_ump->um_maxsymlinklen) {
|
||||
#ifdef DEBUG
|
||||
for (i = (ip->i_size + fs->lfs_bsize - 1) >> fs->lfs_bshift;
|
||||
i < NDADDR; i++) {
|
||||
i < UFS_NDADDR; i++) {
|
||||
if ((vp->v_type == VBLK || vp->v_type == VCHR) &&
|
||||
i == 0)
|
||||
continue;
|
||||
@ -1980,14 +1980,14 @@ lfs_vinit(struct mount *mp, struct vnode **vpp)
|
||||
panic("inconsistent inode (direct)");
|
||||
}
|
||||
}
|
||||
for ( ; i < NDADDR + NIADDR; i++) {
|
||||
if (ip->i_ffs1_ib[i - NDADDR] != 0) {
|
||||
for ( ; i < UFS_NDADDR + UFS_NIADDR; i++) {
|
||||
if (ip->i_ffs1_ib[i - UFS_NDADDR] != 0) {
|
||||
lfs_dump_dinode(ip->i_din.ffs1_din);
|
||||
panic("inconsistent inode (indirect)");
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
for (i = 0; i < NDADDR; i++)
|
||||
for (i = 0; i < UFS_NDADDR; i++)
|
||||
if (ip->i_ffs1_db[i] != 0)
|
||||
ip->i_lfs_fragsize[i] = blksize(fs, ip, i);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_vnops.c,v 1.242 2012/05/09 00:21:18 riastradh Exp $ */
|
||||
/* $NetBSD: lfs_vnops.c,v 1.243 2013/01/22 09:39:18 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.242 2012/05/09 00:21:18 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.243 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -1045,7 +1045,7 @@ lfs_close(void *v)
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct lfs *fs = ip->i_lfs;
|
||||
|
||||
if ((ip->i_number == ROOTINO || ip->i_number == LFS_IFILE_INUM) &&
|
||||
if ((ip->i_number == UFS_ROOTINO || ip->i_number == LFS_IFILE_INUM) &&
|
||||
fs->lfs_stoplwp == curlwp) {
|
||||
mutex_enter(&lfs_lock);
|
||||
log(LOG_NOTICE, "lfs_close: releasing log wrap control\n");
|
||||
@ -1540,7 +1540,7 @@ lfs_fcntl(void *v)
|
||||
daddr_t off;
|
||||
|
||||
/* Only respect LFS fcntls on fs root or Ifile */
|
||||
if (VTOI(ap->a_vp)->i_number != ROOTINO &&
|
||||
if (VTOI(ap->a_vp)->i_number != UFS_ROOTINO &&
|
||||
VTOI(ap->a_vp)->i_number != LFS_IFILE_INUM) {
|
||||
return ufs_fcntl(v);
|
||||
}
|
||||
@ -2579,7 +2579,7 @@ lfs_gop_size(struct vnode *vp, off_t size, off_t *eobp, int flags)
|
||||
|
||||
olbn = lblkno(fs, ip->i_size);
|
||||
nlbn = lblkno(fs, size);
|
||||
if (!(flags & GOP_SIZE_MEM) && nlbn < NDADDR && olbn <= nlbn) {
|
||||
if (!(flags & GOP_SIZE_MEM) && nlbn < UFS_NDADDR && olbn <= nlbn) {
|
||||
*eobp = fragroundup(fs, size);
|
||||
} else {
|
||||
*eobp = blkroundup(fs, size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dinode.h,v 1.21 2009/06/28 09:26:18 ad Exp $ */
|
||||
/* $NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
@ -58,15 +58,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_W 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)
|
||||
|
||||
/*
|
||||
* A dinode contains all the meta-data associated with a UFS file.
|
||||
@ -75,9 +75,9 @@
|
||||
* are defined by types with precise widths.
|
||||
*/
|
||||
|
||||
#define NXADDR 2
|
||||
#define NDADDR 12 /* Direct addresses in inode. */
|
||||
#define NIADDR 3 /* Indirect addresses in inode. */
|
||||
#define UFS_NXADDR 2
|
||||
#define UFS_NDADDR 12 /* Direct addresses in inode. */
|
||||
#define UFS_NIADDR 3 /* Indirect addresses in inode. */
|
||||
|
||||
struct ufs1_dinode {
|
||||
u_int16_t di_mode; /* 0: IFMT, permissions; see below. */
|
||||
@ -93,8 +93,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. */
|
||||
int32_t di_db[NDADDR]; /* 40: Direct disk blocks. */
|
||||
int32_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */
|
||||
int32_t di_db[UFS_NDADDR]; /* 40: Direct disk blocks. */
|
||||
int32_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. */
|
||||
int32_t di_gen; /* 108: Generation number. */
|
||||
@ -123,9 +123,9 @@ struct ufs2_dinode {
|
||||
u_int32_t di_kernflags; /* 84: Kernel flags. */
|
||||
u_int32_t di_flags; /* 88: Status flags (chflags). */
|
||||
int32_t di_extsize; /* 92: External attributes block. */
|
||||
int64_t di_extb[NXADDR];/* 96: External attributes block. */
|
||||
int64_t di_db[NDADDR]; /* 112: Direct disk blocks. */
|
||||
int64_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */
|
||||
int64_t di_extb[UFS_NXADDR];/* 96: External attributes block. */
|
||||
int64_t di_db[UFS_NDADDR]; /* 112: Direct disk blocks. */
|
||||
int64_t di_ib[UFS_NIADDR]; /* 208: Indirect disk blocks. */
|
||||
u_int64_t di_modrev; /* 232: i_modrev for NFSv4 */
|
||||
int64_t di_spare[2]; /* 240: Reserved; currently unused */
|
||||
};
|
||||
@ -141,12 +141,12 @@ struct ufs2_dinode {
|
||||
#define di_ogid di_u.oldids[1]
|
||||
#define di_ouid di_u.oldids[0]
|
||||
#define di_rdev di_db[0]
|
||||
#define MAXSYMLINKLEN_UFS1 ((NDADDR + NIADDR) * sizeof(int32_t))
|
||||
#define MAXSYMLINKLEN_UFS2 ((NDADDR + NIADDR) * sizeof(int64_t))
|
||||
#define UFS1_MAXSYMLINKLEN ((UFS_NDADDR + UFS_NIADDR) * sizeof(int32_t))
|
||||
#define UFS2_MAXSYMLINKLEN ((UFS_NDADDR + UFS_NIADDR) * sizeof(int64_t))
|
||||
|
||||
#define MAXSYMLINKLEN(ip) \
|
||||
#define UFS_MAXSYMLINKLEN(ip) \
|
||||
((ip)->i_ump->um_fstype == UFS1) ? \
|
||||
MAXSYMLINKLEN_UFS1 : MAXSYMLINKLEN_UFS2
|
||||
UFS1_MAXSYMLINKLEN : UFS2_MAXSYMLINKLEN
|
||||
|
||||
/* NeXT used to keep short symlinks in the inode even when using
|
||||
* FS_42INODEFMT. In that case fs->fs_maxsymlinklen is probably -1,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_bmap.c,v 1.49 2011/03/06 17:08:39 bouyer Exp $ */
|
||||
/* $NetBSD: ufs_bmap.c,v 1.50 2013/01/22 09:39:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.49 2011/03/06 17:08:39 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.50 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -122,7 +122,7 @@ ufs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, struct indir *ap,
|
||||
struct buf *bp, *cbp;
|
||||
struct ufsmount *ump;
|
||||
struct mount *mp;
|
||||
struct indir a[NIADDR + 1], *xap;
|
||||
struct indir a[UFS_NIADDR + 1], *xap;
|
||||
daddr_t daddr;
|
||||
daddr_t metalbn;
|
||||
int error, maxrun = 0, num;
|
||||
@ -146,7 +146,7 @@ ufs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, struct indir *ap,
|
||||
maxrun = MAXPHYS / mp->mnt_stat.f_iosize - 1;
|
||||
}
|
||||
|
||||
if (bn >= 0 && bn < NDADDR) {
|
||||
if (bn >= 0 && bn < UFS_NDADDR) {
|
||||
if (nump != NULL)
|
||||
*nump = 0;
|
||||
if (ump->um_fstype == UFS1)
|
||||
@ -177,7 +177,7 @@ ufs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, struct indir *ap,
|
||||
}
|
||||
} else if (runp) {
|
||||
if (ump->um_fstype == UFS1) {
|
||||
for (++bn; bn < NDADDR && *runp < maxrun &&
|
||||
for (++bn; bn < UFS_NDADDR && *runp < maxrun &&
|
||||
is_sequential(ump,
|
||||
ufs_rw32(ip->i_ffs1_db[bn - 1],
|
||||
UFS_MPNEEDSWAP(ump)),
|
||||
@ -185,7 +185,7 @@ ufs_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *bnp, struct indir *ap,
|
||||
UFS_MPNEEDSWAP(ump)));
|
||||
++bn, ++*runp);
|
||||
} else {
|
||||
for (++bn; bn < NDADDR && *runp < maxrun &&
|
||||
for (++bn; bn < UFS_NDADDR && *runp < maxrun &&
|
||||
is_sequential(ump,
|
||||
ufs_rw64(ip->i_ffs2_db[bn - 1],
|
||||
UFS_MPNEEDSWAP(ump)),
|
||||
@ -349,17 +349,17 @@ ufs_getlbns(struct vnode *vp, daddr_t bn, struct indir *ap, int *nump)
|
||||
realbn = bn;
|
||||
if (bn < 0)
|
||||
bn = -bn;
|
||||
KASSERT(bn >= NDADDR);
|
||||
KASSERT(bn >= UFS_NDADDR);
|
||||
|
||||
/*
|
||||
* Determine the number of levels of indirection. After this loop
|
||||
* is done, blockcnt indicates the number of data blocks possible
|
||||
* at the given level of indirection, and NIADDR - i is the number
|
||||
* at the given level of indirection, and UFS_NIADDR - i is the number
|
||||
* of levels of indirection needed to locate the requested block.
|
||||
*/
|
||||
|
||||
bn -= NDADDR;
|
||||
for (lbc = 0, i = NIADDR;; i--, bn -= blockcnt) {
|
||||
bn -= UFS_NDADDR;
|
||||
for (lbc = 0, i = UFS_NIADDR;; i--, bn -= blockcnt) {
|
||||
if (i == 0)
|
||||
return (EFBIG);
|
||||
|
||||
@ -371,7 +371,7 @@ ufs_getlbns(struct vnode *vp, daddr_t bn, struct indir *ap, int *nump)
|
||||
}
|
||||
|
||||
/* Calculate the address of the first meta-block. */
|
||||
metalbn = -((realbn >= 0 ? realbn : -realbn) - bn + NIADDR - i);
|
||||
metalbn = -((realbn >= 0 ? realbn : -realbn) - bn + UFS_NIADDR - i);
|
||||
|
||||
/*
|
||||
* At each iteration, off is the offset into the bap array which is
|
||||
@ -380,10 +380,10 @@ ufs_getlbns(struct vnode *vp, daddr_t bn, struct indir *ap, int *nump)
|
||||
* into the argument array.
|
||||
*/
|
||||
ap->in_lbn = metalbn;
|
||||
ap->in_off = off = NIADDR - i;
|
||||
ap->in_off = off = UFS_NIADDR - i;
|
||||
ap->in_exists = 0;
|
||||
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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_inode.c,v 1.88 2011/09/20 14:01:33 chs Exp $ */
|
||||
/* $NetBSD: ufs_inode.c,v 1.89 2013/01/22 09:39:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.88 2011/09/20 14:01:33 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.89 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -114,7 +114,7 @@ ufs_inactive(void *v)
|
||||
if (vp->v_mount->mnt_wapbl) {
|
||||
uint64_t incr = MNINDIR(ip->i_ump) <<
|
||||
vp->v_mount->mnt_fs_bshift; /* Power of 2 */
|
||||
uint64_t base = NDADDR <<
|
||||
uint64_t base = UFS_NDADDR <<
|
||||
vp->v_mount->mnt_fs_bshift;
|
||||
while (!error && ip->i_size > base + incr) {
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_lookup.c,v 1.121 2012/12/20 08:03:45 hannken Exp $ */
|
||||
/* $NetBSD: ufs_lookup.c,v 1.122 2013/01/22 09:39:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.121 2012/12/20 08:03:45 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.122 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ffs.h"
|
||||
@ -970,7 +970,7 @@ ufs_direnter(struct vnode *dvp, const struct ufs_lookup_results *ulr,
|
||||
* copy in the new entry, and write out the block.
|
||||
*/
|
||||
if (ep->d_ino == 0 ||
|
||||
(ufs_rw32(ep->d_ino, needswap) == WINO &&
|
||||
(ufs_rw32(ep->d_ino, needswap) == UFS_WINO &&
|
||||
memcmp(ep->d_name, dirp->d_name, dirp->d_namlen) == 0)) {
|
||||
if (spacefree + dsize < newentrysize)
|
||||
panic("ufs_direnter: compact1");
|
||||
@ -1078,13 +1078,13 @@ ufs_dirremove(struct vnode *dvp, const struct ufs_lookup_results *ulr,
|
||||
|
||||
if (flags & DOWHITEOUT) {
|
||||
/*
|
||||
* Whiteout entry: set d_ino to WINO.
|
||||
* Whiteout entry: set d_ino to UFS_WINO.
|
||||
*/
|
||||
error = ufs_blkatoff(dvp, (off_t)ulr->ulr_offset, (void *)&ep,
|
||||
&bp, true);
|
||||
if (error)
|
||||
return (error);
|
||||
ep->d_ino = ufs_rw32(WINO, needswap);
|
||||
ep->d_ino = ufs_rw32(UFS_WINO, needswap);
|
||||
ep->d_type = DT_WHT;
|
||||
goto out;
|
||||
}
|
||||
@ -1238,7 +1238,7 @@ ufs_dirempty(struct inode *ip, ino_t parentino, kauth_cred_t cred)
|
||||
if (dp->d_reclen == 0)
|
||||
return (0);
|
||||
/* skip empty entries */
|
||||
if (dp->d_ino == 0 || ufs_rw32(dp->d_ino, needswap) == WINO)
|
||||
if (dp->d_ino == 0 || ufs_rw32(dp->d_ino, needswap) == UFS_WINO)
|
||||
continue;
|
||||
/* accept only "." and ".." */
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
@ -1290,7 +1290,7 @@ ufs_checkpath(struct inode *source, struct inode *target, kauth_cred_t cred)
|
||||
error = EEXIST;
|
||||
goto out;
|
||||
}
|
||||
rootino = ROOTINO;
|
||||
rootino = UFS_ROOTINO;
|
||||
error = 0;
|
||||
if (target->i_number == rootino)
|
||||
goto out;
|
||||
@ -1417,7 +1417,7 @@ ufs_parentcheck(struct vnode *upper, struct vnode *lower, kauth_cred_t cred,
|
||||
*upperchild_ret = upper;
|
||||
return 0;
|
||||
}
|
||||
if (VTOI(lower)->i_number == ROOTINO) {
|
||||
if (VTOI(lower)->i_number == UFS_ROOTINO) {
|
||||
*found_ret = 0;
|
||||
*upperchild_ret = NULL;
|
||||
return 0;
|
||||
@ -1441,7 +1441,7 @@ ufs_parentcheck(struct vnode *upper, struct vnode *lower, kauth_cred_t cred,
|
||||
*upperchild_ret = current;
|
||||
return 0;
|
||||
}
|
||||
if (found_ino == ROOTINO) {
|
||||
if (found_ino == UFS_ROOTINO) {
|
||||
vput(current);
|
||||
*found_ret = 0;
|
||||
*upperchild_ret = NULL;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_readwrite.c,v 1.104 2012/04/29 22:54:01 chs Exp $ */
|
||||
/* $NetBSD: ufs_readwrite.c,v 1.105 2013/01/22 09:39:18 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.104 2012/04/29 22:54:01 chs Exp $");
|
||||
__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.105 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#ifdef LFS_READWRITE
|
||||
#define FS struct lfs
|
||||
@ -310,7 +310,7 @@ WRITE(void *v)
|
||||
* the fragment if there is one.
|
||||
*/
|
||||
|
||||
if (nsize > osize && lblkno(fs, osize) < NDADDR &&
|
||||
if (nsize > osize && lblkno(fs, osize) < UFS_NDADDR &&
|
||||
lblkno(fs, osize) != lblkno(fs, nsize) &&
|
||||
blkroundup(fs, osize) != osize) {
|
||||
off_t eob;
|
||||
@ -447,7 +447,7 @@ WRITE(void *v)
|
||||
|
||||
#ifdef LFS_READWRITE
|
||||
error = lfs_reserve(fs, vp, NULL,
|
||||
btofsb(fs, (NIADDR + 1) << fs->lfs_bshift));
|
||||
btofsb(fs, (UFS_NIADDR + 1) << fs->lfs_bshift));
|
||||
if (error)
|
||||
break;
|
||||
need_unreserve = true;
|
||||
@ -481,7 +481,7 @@ WRITE(void *v)
|
||||
#ifdef LFS_READWRITE
|
||||
(void)VOP_BWRITE(bp->b_vp, bp);
|
||||
lfs_reserve(fs, vp, NULL,
|
||||
-btofsb(fs, (NIADDR + 1) << fs->lfs_bshift));
|
||||
-btofsb(fs, (UFS_NIADDR + 1) << fs->lfs_bshift));
|
||||
need_unreserve = false;
|
||||
#else
|
||||
if (ioflag & IO_SYNC)
|
||||
@ -497,7 +497,7 @@ WRITE(void *v)
|
||||
#ifdef LFS_READWRITE
|
||||
if (need_unreserve) {
|
||||
lfs_reserve(fs, vp, NULL,
|
||||
-btofsb(fs, (NIADDR + 1) << fs->lfs_bshift));
|
||||
-btofsb(fs, (UFS_NIADDR + 1) << fs->lfs_bshift));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_rename.c,v 1.5 2012/06/04 20:13:47 riastradh Exp $ */
|
||||
/* $NetBSD: ufs_rename.c,v 1.6 2013/01/22 09:39:18 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2012 The NetBSD Foundation, Inc.
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_rename.c,v 1.5 2012/06/04 20:13:47 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_rename.c,v 1.6 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -688,7 +688,7 @@ ufs_rename_recalculate_fulr(struct vnode *dvp,
|
||||
if (ep->d_ino == 0)
|
||||
goto next; /* Entry is unused. */
|
||||
|
||||
if (ufs_rw32(ep->d_ino, needswap) == WINO)
|
||||
if (ufs_rw32(ep->d_ino, needswap) == UFS_WINO)
|
||||
goto next; /* Entry is whiteout. */
|
||||
|
||||
if (fcnp->cn_namelen != ufs_direct_namlen(ep, dvp))
|
||||
@ -962,7 +962,7 @@ ufs_gro_genealogy(struct mount *mp, kauth_cred_t cred,
|
||||
KASSERT(!ufs_rmdired_p(vp));
|
||||
|
||||
/* Did we hit the root without finding fdvp? */
|
||||
if (VTOI(vp)->i_number == ROOTINO) {
|
||||
if (VTOI(vp)->i_number == UFS_ROOTINO) {
|
||||
vput(vp);
|
||||
*intermediate_node_ret = NULL;
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_vfsops.c,v 1.51 2012/04/04 19:52:48 tron Exp $ */
|
||||
/* $NetBSD: ufs_vfsops.c,v 1.52 2013/01/22 09:39:18 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vfsops.c,v 1.51 2012/04/04 19:52:48 tron Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vfsops.c,v 1.52 2013/01/22 09:39:18 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -90,7 +90,7 @@ ufs_root(struct mount *mp, struct vnode **vpp)
|
||||
struct vnode *nvp;
|
||||
int error;
|
||||
|
||||
if ((error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp)) != 0)
|
||||
if ((error = VFS_VGET(mp, (ino_t)UFS_ROOTINO, &nvp)) != 0)
|
||||
return (error);
|
||||
*vpp = nvp;
|
||||
return (0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_vnops.c,v 1.210 2012/06/04 20:13:47 riastradh Exp $ */
|
||||
/* $NetBSD: ufs_vnops.c,v 1.211 2013/01/22 09:39:19 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -66,7 +66,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.210 2012/06/04 20:13:47 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.211 2013/01/22 09:39:19 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -589,7 +589,7 @@ ufs_setattr(void *v)
|
||||
if (vp->v_mount->mnt_wapbl) {
|
||||
uint64_t incr = MNINDIR(ip->i_ump) <<
|
||||
vp->v_mount->mnt_fs_bshift; /* Power of 2 */
|
||||
uint64_t base = NDADDR <<
|
||||
uint64_t base = UFS_NDADDR <<
|
||||
vp->v_mount->mnt_fs_bshift;
|
||||
while (!error && ip->i_size > base + incr &&
|
||||
ip->i_size > vap->va_size + incr) {
|
||||
@ -934,7 +934,7 @@ ufs_whiteout(void *v)
|
||||
#endif
|
||||
|
||||
newdir = pool_cache_get(ufs_direct_cache, PR_WAITOK);
|
||||
newdir->d_ino = WINO;
|
||||
newdir->d_ino = UFS_WINO;
|
||||
newdir->d_namlen = cnp->cn_namelen;
|
||||
memcpy(newdir->d_name, cnp->cn_nameptr,
|
||||
(size_t)cnp->cn_namelen);
|
||||
@ -1792,7 +1792,7 @@ ufs_vinit(struct mount *mntp, int (**specops)(void *), int (**fifoops)(void *),
|
||||
case VREG:
|
||||
break;
|
||||
}
|
||||
if (ip->i_number == ROOTINO)
|
||||
if (ip->i_number == UFS_ROOTINO)
|
||||
vp->v_vflag |= VV_ROOT;
|
||||
/*
|
||||
* Initialize modrev times
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dumplfs.c,v 1.38 2010/02/16 18:57:53 mlelstv Exp $ */
|
||||
/* $NetBSD: dumplfs.c,v 1.39 2013/01/22 09:39:19 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dumplfs.c 8.5 (Berkeley) 5/24/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: dumplfs.c,v 1.38 2010/02/16 18:57:53 mlelstv Exp $");
|
||||
__RCSID("$NetBSD: dumplfs.c,v 1.39 2013/01/22 09:39:19 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -294,7 +294,7 @@ dump_ifile(int fd, struct lfs *lfsp, int do_ientries, int do_segentries, daddr_t
|
||||
|
||||
(void)printf("\nIFILE contents\n");
|
||||
nblocks = dip->di_size >> lfsp->lfs_bshift;
|
||||
block_limit = MIN(nblocks, NDADDR);
|
||||
block_limit = MIN(nblocks, UFS_NDADDR);
|
||||
|
||||
/* Get the direct block */
|
||||
if ((ipage = malloc(psize)) == NULL)
|
||||
@ -325,7 +325,7 @@ dump_ifile(int fd, struct lfs *lfsp, int do_ientries, int do_segentries, daddr_t
|
||||
inum = dump_ipage_ifile(lfsp, inum, ipage, lfsp->lfs_ifpb);
|
||||
}
|
||||
|
||||
if (nblocks <= NDADDR)
|
||||
if (nblocks <= UFS_NDADDR)
|
||||
goto e0;
|
||||
|
||||
/* Dump out blocks off of single indirect block */
|
||||
@ -472,12 +472,12 @@ dump_dinode(struct ufs1_dinode *dip)
|
||||
"ctime ", ctime(&ct));
|
||||
(void)printf(" inum %d\n", dip->di_inumber);
|
||||
(void)printf(" Direct Addresses\n");
|
||||
for (i = 0; i < NDADDR; i++) {
|
||||
for (i = 0; i < UFS_NDADDR; i++) {
|
||||
(void)printf("\t0x%x", dip->di_db[i]);
|
||||
if ((i % 6) == 5)
|
||||
(void)printf("\n");
|
||||
}
|
||||
for (i = 0; i < NIADDR; i++)
|
||||
for (i = 0; i < UFS_NIADDR; i++)
|
||||
(void)printf("\t0x%x", dip->di_ib[i]);
|
||||
(void)printf("\n");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs.c,v 1.6 2010/01/14 16:27:49 tsutsui Exp $ */
|
||||
/* $NetBSD: ext2fs.c,v 1.7 2013/01/22 09:39:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer.
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: ext2fs.c,v 1.6 2010/01/14 16:27:49 tsutsui Exp $");
|
||||
__RCSID("$NetBSD: ext2fs.c,v 1.7 2013/01/22 09:39:19 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -248,12 +248,12 @@ ext2fs_find_disk_blocks(ib_params *params, ino_t ino,
|
||||
lblk = 0;
|
||||
level_i = 0;
|
||||
level[0].blknums = &inode->e2di_blocks[0];
|
||||
level[0].blkcount = NDADDR;
|
||||
level[1].blknums = &inode->e2di_blocks[NDADDR + 0];
|
||||
level[0].blkcount = UFS_NDADDR;
|
||||
level[1].blknums = &inode->e2di_blocks[UFS_NDADDR + 0];
|
||||
level[1].blkcount = 1;
|
||||
level[2].blknums = &inode->e2di_blocks[NDADDR + 1];
|
||||
level[2].blknums = &inode->e2di_blocks[UFS_NDADDR + 1];
|
||||
level[2].blkcount = 1;
|
||||
level[3].blknums = &inode->e2di_blocks[NDADDR + 2];
|
||||
level[3].blknums = &inode->e2di_blocks[UFS_NDADDR + 2];
|
||||
level[3].blkcount = 1;
|
||||
|
||||
/* Walk the data blocks. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs.c,v 1.29 2010/01/14 16:27:49 tsutsui Exp $ */
|
||||
/* $NetBSD: ffs.c,v 1.30 2013/01/22 09:39:19 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: ffs.c,v 1.29 2010/01/14 16:27:49 tsutsui Exp $");
|
||||
__RCSID("$NetBSD: ffs.c,v 1.30 2013/01/22 09:39:19 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -173,7 +173,7 @@ ffs_find_disk_blocks_ufs1(ib_params *params, ino_t ino,
|
||||
lblk = 0;
|
||||
level_i = 0;
|
||||
level[0].blknums = &inode->di_db[0];
|
||||
level[0].blkcount = NDADDR;
|
||||
level[0].blkcount = UFS_NDADDR;
|
||||
level[1].blknums = &inode->di_ib[0];
|
||||
level[1].blkcount = 1;
|
||||
level[2].blknums = &inode->di_ib[1];
|
||||
@ -310,7 +310,7 @@ ffs_find_disk_blocks_ufs2(ib_params *params, ino_t ino,
|
||||
lblk = 0;
|
||||
level_i = 0;
|
||||
level[0].blknums = &inode->di_db[0];
|
||||
level[0].blkcount = NDADDR;
|
||||
level[0].blkcount = UFS_NDADDR;
|
||||
level[1].blknums = &inode->di_ib[0];
|
||||
level[1].blkcount = 1;
|
||||
level[2].blknums = &inode->di_ib[1];
|
||||
@ -560,10 +560,10 @@ ffs_findstage2(ib_params *params, uint32_t *maxblk, ib_block *blocks)
|
||||
|
||||
/* Get the inode number of the secondary bootstrap. */
|
||||
if (is_ufs2)
|
||||
rv = ffs_find_disk_blocks_ufs2(params, ROOTINO,
|
||||
rv = ffs_find_disk_blocks_ufs2(params, UFS_ROOTINO,
|
||||
ffs_findstage2_ino, &ino);
|
||||
else
|
||||
rv = ffs_find_disk_blocks_ufs1(params, ROOTINO,
|
||||
rv = ffs_find_disk_blocks_ufs1(params, UFS_ROOTINO,
|
||||
ffs_findstage2_ino, &ino);
|
||||
if (rv != 2) {
|
||||
warnx("Could not find secondary bootstrap `%s' in `%s'",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs.c,v 1.48 2012/06/22 06:15:18 sjg Exp $ */
|
||||
/* $NetBSD: ffs.c,v 1.49 2013/01/22 09:39:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
@ -71,7 +71,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(__lint)
|
||||
__RCSID("$NetBSD: ffs.c,v 1.48 2012/06/22 06:15:18 sjg Exp $");
|
||||
__RCSID("$NetBSD: ffs.c,v 1.49 2013/01/22 09:39:19 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -283,7 +283,7 @@ ffs_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts)
|
||||
errx(1, "Image file `%s' not created.", image);
|
||||
TIMER_RESULTS(start, "ffs_create_image");
|
||||
|
||||
fsopts->curinode = ROOTINO;
|
||||
fsopts->curinode = UFS_ROOTINO;
|
||||
|
||||
if (debug & DEBUG_FS_MAKEFS)
|
||||
putchar('\n');
|
||||
@ -368,7 +368,7 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts)
|
||||
|
||||
/* calculate size of tree */
|
||||
ffs_size_dir(root, fsopts);
|
||||
fsopts->inodes += ROOTINO; /* include first two inodes */
|
||||
fsopts->inodes += UFS_ROOTINO; /* include first two inodes */
|
||||
|
||||
if (debug & DEBUG_FS_VALIDATE)
|
||||
printf("ffs_validate: size of tree: %lld bytes, %lld inodes\n",
|
||||
@ -548,11 +548,11 @@ ffs_create_image(const char *image, fsinfo_t *fsopts)
|
||||
(long long)fs->fs_cstotal.cs_ndir);
|
||||
}
|
||||
|
||||
if ((off_t)(fs->fs_cstotal.cs_nifree + ROOTINO) < fsopts->inodes) {
|
||||
if ((off_t)(fs->fs_cstotal.cs_nifree + UFS_ROOTINO) < fsopts->inodes) {
|
||||
warnx(
|
||||
"Image file `%s' has %lld free inodes; %lld are required.",
|
||||
image,
|
||||
(long long)(fs->fs_cstotal.cs_nifree + ROOTINO),
|
||||
(long long)(fs->fs_cstotal.cs_nifree + UFS_ROOTINO),
|
||||
(long long)fsopts->inodes);
|
||||
return (-1);
|
||||
}
|
||||
@ -619,8 +619,8 @@ ffs_size_dir(fsnode *root, fsinfo_t *fsopts)
|
||||
|
||||
slen = strlen(node->symlink) + 1;
|
||||
if (slen >= (ffs_opts->version == 1 ?
|
||||
MAXSYMLINKLEN_UFS1 :
|
||||
MAXSYMLINKLEN_UFS2))
|
||||
UFS1_MAXSYMLINKLEN :
|
||||
UFS2_MAXSYMLINKLEN))
|
||||
ADDSIZE(slen);
|
||||
}
|
||||
}
|
||||
@ -673,7 +673,7 @@ ffs_build_dinode1(struct ufs1_dinode *dinp, dirbuf_t *dbufp, fsnode *cur,
|
||||
ufs_rw32(cur->inode->st.st_rdev, fsopts->needswap);
|
||||
} else if (S_ISLNK(cur->type)) { /* symlink */
|
||||
slen = strlen(cur->symlink);
|
||||
if (slen < MAXSYMLINKLEN_UFS1) { /* short link */
|
||||
if (slen < UFS1_MAXSYMLINKLEN) { /* short link */
|
||||
memcpy(dinp->di_db, cur->symlink, slen);
|
||||
} else
|
||||
membuf = cur->symlink;
|
||||
@ -725,7 +725,7 @@ ffs_build_dinode2(struct ufs2_dinode *dinp, dirbuf_t *dbufp, fsnode *cur,
|
||||
ufs_rw64(cur->inode->st.st_rdev, fsopts->needswap);
|
||||
} else if (S_ISLNK(cur->type)) { /* symlink */
|
||||
slen = strlen(cur->symlink);
|
||||
if (slen < MAXSYMLINKLEN_UFS2) { /* short link */
|
||||
if (slen < UFS2_MAXSYMLINKLEN) { /* short link */
|
||||
memcpy(dinp->di_db, cur->symlink, slen);
|
||||
} else
|
||||
membuf = cur->symlink;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_alloc.c,v 1.19 2012/04/19 17:28:26 christos Exp $ */
|
||||
/* $NetBSD: ffs_alloc.c,v 1.20 2013/01/22 09:39:19 dholland Exp $ */
|
||||
/* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */
|
||||
|
||||
/*
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(__lint)
|
||||
__RCSID("$NetBSD: ffs_alloc.c,v 1.19 2012/04/19 17:28:26 christos Exp $");
|
||||
__RCSID("$NetBSD: ffs_alloc.c,v 1.20 2013/01/22 09:39:19 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -164,7 +164,7 @@ ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int32_t *bap)
|
||||
|
||||
fs = ip->i_fs;
|
||||
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
|
||||
if (lbn < NDADDR + NINDIR(fs)) {
|
||||
if (lbn < UFS_NDADDR + NINDIR(fs)) {
|
||||
cg = ino_to_cg(fs, ip->i_number);
|
||||
return (fs->fs_fpg * cg + fs->fs_frag);
|
||||
}
|
||||
@ -203,7 +203,7 @@ ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int64_t *bap)
|
||||
|
||||
fs = ip->i_fs;
|
||||
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
|
||||
if (lbn < NDADDR + NINDIR(fs)) {
|
||||
if (lbn < UFS_NDADDR + NINDIR(fs)) {
|
||||
cg = ino_to_cg(fs, ip->i_number);
|
||||
return (fs->fs_fpg * cg + fs->fs_frag);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_balloc.c,v 1.13 2004/06/20 22:20:18 jmc Exp $ */
|
||||
/* $NetBSD: ffs_balloc.c,v 1.14 2013/01/22 09:39:19 dholland Exp $ */
|
||||
/* From NetBSD: ffs_balloc.c,v 1.25 2001/08/08 08:36:36 lukem Exp */
|
||||
|
||||
/*
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(__lint)
|
||||
__RCSID("$NetBSD: ffs_balloc.c,v 1.13 2004/06/20 22:20:18 jmc Exp $");
|
||||
__RCSID("$NetBSD: ffs_balloc.c,v 1.14 2013/01/22 09:39:19 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -88,11 +88,11 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
int32_t nb;
|
||||
struct buf *bp, *nbp;
|
||||
struct fs *fs = ip->i_fs;
|
||||
struct indir indirs[NIADDR + 2];
|
||||
struct indir indirs[UFS_NIADDR + 2];
|
||||
daddr_t newb, pref;
|
||||
int32_t *bap;
|
||||
int osize, nsize, num, i, error;
|
||||
int32_t *allocblk, allociblk[NIADDR + 1];
|
||||
int32_t *allocblk, allociblk[UFS_NIADDR + 1];
|
||||
int32_t *allocib;
|
||||
const int needswap = UFS_FSNEEDSWAP(fs);
|
||||
|
||||
@ -113,7 +113,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
*/
|
||||
|
||||
lastlbn = lblkno(fs, ip->i_ffs1_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) {
|
||||
@ -123,10 +123,10 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
}
|
||||
|
||||
/*
|
||||
* The first NDADDR blocks are direct blocks
|
||||
* The first UFS_NDADDR blocks are direct blocks
|
||||
*/
|
||||
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
nb = ufs_rw32(ip->i_ffs1_db[lbn], needswap);
|
||||
if (nb != 0 && ip->i_ffs1_size >= lblktosize(fs, lbn + 1)) {
|
||||
|
||||
@ -339,11 +339,11 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
int size;
|
||||
struct buf *bp, *nbp;
|
||||
struct fs *fs = ip->i_fs;
|
||||
struct indir indirs[NIADDR + 2];
|
||||
struct indir indirs[UFS_NIADDR + 2];
|
||||
daddr_t newb, pref, nb;
|
||||
int64_t *bap;
|
||||
int osize, nsize, num, i, error;
|
||||
int64_t *allocblk, allociblk[NIADDR + 1];
|
||||
int64_t *allocblk, allociblk[UFS_NIADDR + 1];
|
||||
int64_t *allocib;
|
||||
const int needswap = UFS_FSNEEDSWAP(fs);
|
||||
|
||||
@ -364,7 +364,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
*/
|
||||
|
||||
lastlbn = lblkno(fs, ip->i_ffs2_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) {
|
||||
@ -374,10 +374,10 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
||||
}
|
||||
|
||||
/*
|
||||
* The first NDADDR blocks are direct blocks
|
||||
* The first UFS_NDADDR blocks are direct blocks
|
||||
*/
|
||||
|
||||
if (lbn < NDADDR) {
|
||||
if (lbn < UFS_NDADDR) {
|
||||
nb = ufs_rw64(ip->i_ffs2_db[lbn], needswap);
|
||||
if (nb != 0 && ip->i_ffs2_size >= lblktosize(fs, lbn + 1)) {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkfs.c,v 1.24 2012/04/19 19:48:14 dholland Exp $ */
|
||||
/* $NetBSD: mkfs.c,v 1.25 2013/01/22 09:39:19 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
@ -48,7 +48,7 @@
|
||||
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
|
||||
#else
|
||||
#ifdef __RCSID
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.24 2012/04/19 19:48:14 dholland Exp $");
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.25 2013/01/22 09:39:19 dholland Exp $");
|
||||
#endif
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
@ -157,8 +157,8 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
||||
sblock.fs_old_flags = 0;
|
||||
} else {
|
||||
sblock.fs_old_inodefmt = FS_44INODEFMT;
|
||||
sblock.fs_maxsymlinklen = (Oflag == 1 ? MAXSYMLINKLEN_UFS1 :
|
||||
MAXSYMLINKLEN_UFS2);
|
||||
sblock.fs_maxsymlinklen = (Oflag == 1 ? UFS1_MAXSYMLINKLEN :
|
||||
UFS2_MAXSYMLINKLEN);
|
||||
sblock.fs_old_flags = FS_FLAGS_UPDATED;
|
||||
sblock.fs_flags = 0;
|
||||
}
|
||||
@ -264,7 +264,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
||||
sblock.fs_sblockloc = SBLOCK_UFS1;
|
||||
sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t);
|
||||
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode);
|
||||
sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
|
||||
sblock.fs_maxsymlinklen = ((UFS_NDADDR + UFS_NIADDR) *
|
||||
sizeof (int32_t));
|
||||
sblock.fs_old_inodefmt = FS_44INODEFMT;
|
||||
sblock.fs_old_cgoffset = 0;
|
||||
@ -288,7 +288,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
||||
#endif
|
||||
sblock.fs_nindir = sblock.fs_bsize / sizeof(int64_t);
|
||||
sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs2_dinode);
|
||||
sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
|
||||
sblock.fs_maxsymlinklen = ((UFS_NDADDR + UFS_NIADDR) *
|
||||
sizeof (int64_t));
|
||||
}
|
||||
|
||||
@ -298,8 +298,8 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
||||
sblock.fs_cblkno = (daddr_t)(sblock.fs_sblkno +
|
||||
roundup(howmany(SBLOCKSIZE, sblock.fs_fsize), sblock.fs_frag));
|
||||
sblock.fs_iblkno = sblock.fs_cblkno + sblock.fs_frag;
|
||||
sblock.fs_maxfilesize = sblock.fs_bsize * NDADDR - 1;
|
||||
for (sizepb = sblock.fs_bsize, i = 0; i < NIADDR; i++) {
|
||||
sblock.fs_maxfilesize = sblock.fs_bsize * UFS_NDADDR - 1;
|
||||
for (sizepb = sblock.fs_bsize, i = 0; i < UFS_NIADDR; i++) {
|
||||
sizepb *= NINDIR(&sblock);
|
||||
sblock.fs_maxfilesize += sizepb;
|
||||
}
|
||||
@ -459,7 +459,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
||||
fragnum(&sblock, sblock.fs_size) +
|
||||
(fragnum(&sblock, csfrags) > 0 ?
|
||||
sblock.fs_frag - fragnum(&sblock, csfrags) : 0);
|
||||
sblock.fs_cstotal.cs_nifree = sblock.fs_ncg * sblock.fs_ipg - ROOTINO;
|
||||
sblock.fs_cstotal.cs_nifree = sblock.fs_ncg * sblock.fs_ipg - UFS_ROOTINO;
|
||||
sblock.fs_cstotal.cs_ndir = 0;
|
||||
sblock.fs_dsize -= csfrags;
|
||||
sblock.fs_time = start_time.tv_sec;
|
||||
@ -669,7 +669,7 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts)
|
||||
if (cylno == 0) {
|
||||
size_t r;
|
||||
|
||||
for (r = 0; r < ROOTINO; r++) {
|
||||
for (r = 0; r < UFS_ROOTINO; r++) {
|
||||
setbit(cg_inosused(&acg, 0), r);
|
||||
acg.cg_cs.cs_nifree--;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ufs_bmap.c,v 1.16 2005/10/08 03:21:17 chs Exp $ */
|
||||
/* $NetBSD: ufs_bmap.c,v 1.17 2013/01/22 09:39:19 dholland Exp $ */
|
||||
/* From: NetBSD: ufs_bmap.c,v 1.14 2001/11/08 05:00:51 chs Exp */
|
||||
|
||||
/*
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(__lint)
|
||||
__RCSID("$NetBSD: ufs_bmap.c,v 1.16 2005/10/08 03:21:17 chs Exp $");
|
||||
__RCSID("$NetBSD: ufs_bmap.c,v 1.17 2013/01/22 09:39:19 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -88,17 +88,17 @@ ufs_getlbns(struct inode *ip, daddr_t bn, struct indir *ap, int *nump)
|
||||
if ((long)bn < 0)
|
||||
bn = -(long)bn;
|
||||
|
||||
assert (bn >= NDADDR);
|
||||
assert (bn >= UFS_NDADDR);
|
||||
|
||||
/*
|
||||
* Determine the number of levels of indirection. After this loop
|
||||
* is done, blockcnt indicates the number of data blocks possible
|
||||
* at the given level of indirection, and NIADDR - i is the number
|
||||
* at the given level of indirection, and UFS_NIADDR - i is the number
|
||||
* of levels of indirection needed to locate the requested block.
|
||||
*/
|
||||
|
||||
bn -= NDADDR;
|
||||
for (lbc = 0, i = NIADDR;; i--, bn -= blockcnt) {
|
||||
bn -= UFS_NDADDR;
|
||||
for (lbc = 0, i = UFS_NIADDR;; i--, bn -= blockcnt) {
|
||||
if (i == 0)
|
||||
return (EFBIG);
|
||||
|
||||
@ -110,7 +110,7 @@ ufs_getlbns(struct inode *ip, daddr_t bn, struct indir *ap, int *nump)
|
||||
}
|
||||
|
||||
/* Calculate the address of the first meta-block. */
|
||||
metalbn = -((realbn >= 0 ? realbn : -realbn) - bn + NIADDR - i);
|
||||
metalbn = -((realbn >= 0 ? realbn : -realbn) - bn + UFS_NIADDR - i);
|
||||
|
||||
/*
|
||||
* At each iteration, off is the offset into the bap array which is
|
||||
@ -119,10 +119,10 @@ ufs_getlbns(struct inode *ip, daddr_t bn, struct indir *ap, int *nump)
|
||||
* into the argument array.
|
||||
*/
|
||||
ap->in_lbn = metalbn;
|
||||
ap->in_off = off = NIADDR - i;
|
||||
ap->in_off = off = UFS_NIADDR - i;
|
||||
ap->in_exists = 0;
|
||||
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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: quot.c,v 1.29 2011/03/06 23:41:47 christos Exp $ */
|
||||
/* $NetBSD: quot.c,v 1.30 2013/01/22 09:39:20 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1991, 1994 Wolfgang Solfrank.
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: quot.c,v 1.29 2011/03/06 23:41:47 christos Exp $");
|
||||
__RCSID("$NetBSD: quot.c,v 1.30 2013/01/22 09:39:20 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -150,7 +150,7 @@ virtualblocks(struct fs *super, union dinode *dp)
|
||||
|
||||
sz = DIP(super, dp, size);
|
||||
#ifdef COMPAT
|
||||
if (lblkno(super, sz) >= NDADDR) {
|
||||
if (lblkno(super, sz) >= UFS_NDADDR) {
|
||||
nblk = blkroundup(super, sz);
|
||||
if (sz == nblk)
|
||||
nblk += super->fs_bsize;
|
||||
@ -159,10 +159,10 @@ virtualblocks(struct fs *super, union dinode *dp)
|
||||
return sz / 1024;
|
||||
#else /* COMPAT */
|
||||
|
||||
if (lblkno(super, sz) >= NDADDR) {
|
||||
if (lblkno(super, sz) >= UFS_NDADDR) {
|
||||
nblk = blkroundup(super, sz);
|
||||
sz = lblkno(super, nblk);
|
||||
sz = howmany(sz - NDADDR, NINDIR(super));
|
||||
sz = howmany(sz - UFS_NDADDR, NINDIR(super));
|
||||
while (sz > 0) {
|
||||
nblk += sz * super->fs_bsize;
|
||||
/* One block on this level is in the inode itself */
|
||||
@ -520,8 +520,8 @@ ffs_oldfscompat(struct fs *fs)
|
||||
if (fs->fs_old_inodefmt < FS_44INODEFMT) {
|
||||
quad_t sizepb = fs->fs_bsize;
|
||||
|
||||
fs->fs_maxfilesize = fs->fs_bsize * NDADDR - 1;
|
||||
for (i = 0; i < NIADDR; i++) {
|
||||
fs->fs_maxfilesize = fs->fs_bsize * UFS_NDADDR - 1;
|
||||
for (i = 0; i < UFS_NIADDR; i++) {
|
||||
sizepb *= NINDIR(fs);
|
||||
fs->fs_maxfilesize += sizepb;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: quotacheck.c,v 1.45 2012/04/07 05:07:32 christos Exp $ */
|
||||
/* $NetBSD: quotacheck.c,v 1.46 2013/01/22 09:39:20 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1990, 1993
|
||||
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)quotacheck.c 8.6 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: quotacheck.c,v 1.45 2012/04/07 05:07:32 christos Exp $");
|
||||
__RCSID("$NetBSD: quotacheck.c,v 1.46 2013/01/22 09:39:20 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -430,7 +430,7 @@ chkquota(const char *type, const char *fsname, const char *mntpt, void *v,
|
||||
cg * 100 / sblock.fs_ncg);
|
||||
got_siginfo = 0;
|
||||
}
|
||||
if (ino < ROOTINO)
|
||||
if (ino < UFS_ROOTINO)
|
||||
continue;
|
||||
if ((dp = getnextinode(ino)) == NULL)
|
||||
continue;
|
||||
@ -793,7 +793,7 @@ setinodebuf(ino_t inum)
|
||||
if (inodebuf == NULL &&
|
||||
(inodebuf = malloc((unsigned)inobufsize)) == NULL)
|
||||
errx(1, "Cannot allocate space for inode buffer");
|
||||
while (nextino < ROOTINO)
|
||||
while (nextino < UFS_ROOTINO)
|
||||
getnextinode(nextino);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user