fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB() (Christos already did the lfs ones a few days back)
This commit is contained in:
parent
0980ff6f74
commit
2737439da3
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: badsect.c,v 1.32 2009/03/16 12:53:30 lukem Exp $ */
|
||||
/* $NetBSD: badsect.c,v 1.33 2013/06/23 02:06:04 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1983, 1993
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1981, 1983, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)badsect.c 8.2 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: badsect.c,v 1.32 2009/03/16 12:53:30 lukem Exp $");
|
||||
__RCSID("$NetBSD: badsect.c,v 1.33 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -179,13 +179,13 @@ main(int argc, char *argv[])
|
|||
break;
|
||||
}
|
||||
|
||||
dev_bsize = fs->fs_fsize / fsbtodb(fs, 1);
|
||||
dev_bsize = fs->fs_fsize / FFS_FSBTODB(fs, 1);
|
||||
for (argc -= 2, argv += 2; argc > 0; argc--, argv++) {
|
||||
number = atoi(*argv);
|
||||
if (chkuse(number, 1))
|
||||
continue;
|
||||
if (mknod(*argv, S_IFMT|S_IRUSR|S_IWUSR,
|
||||
(dev_t)dbtofsb(fs, number)) == -1) {
|
||||
(dev_t)FFS_DBTOFSB(fs, number)) == -1) {
|
||||
warn("Cannot mknod `%s'", *argv);
|
||||
errs++;
|
||||
continue;
|
||||
|
@ -206,7 +206,7 @@ chkuse(off_t blkno, int cnt)
|
|||
int cg;
|
||||
off_t fsbn, bn, fsbe;
|
||||
|
||||
fsbn = dbtofsb(fs, blkno);
|
||||
fsbn = FFS_DBTOFSB(fs, blkno);
|
||||
fsbe = fsbn + cnt;
|
||||
if (fsbe > fs->fs_size) {
|
||||
warnx("block %lld out of range of file system",
|
||||
|
@ -229,7 +229,7 @@ chkuse(off_t blkno, int cnt)
|
|||
}
|
||||
}
|
||||
|
||||
rdfs(fsbtodb(fs, cgtod(fs, cg)), (int)sblock.fs_cgsize, &acg);
|
||||
rdfs(FFS_FSBTODB(fs, cgtod(fs, cg)), (int)sblock.fs_cgsize, &acg);
|
||||
|
||||
if (!cg_chkmagic(&acg, needswap)) {
|
||||
warnx("cg %d: bad magic number", cg);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clri.c,v 1.22 2009/07/26 03:22:01 dholland Exp $ */
|
||||
/* $NetBSD: clri.c,v 1.23 2013/06/23 02:06:04 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)clri.c 8.3 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: clri.c,v 1.22 2009/07/26 03:22:01 dholland Exp $");
|
||||
__RCSID("$NetBSD: clri.c,v 1.23 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -165,7 +165,7 @@ main(int argc, char *argv[])
|
|||
|
||||
/* read in the appropriate block. */
|
||||
offset = ino_to_fsba(sbp, inonum); /* inode to fs blk */
|
||||
offset = fsbtodb(sbp, offset); /* fs blk disk blk */
|
||||
offset = FFS_FSBTODB(sbp, offset); /* fs blk disk blk */
|
||||
offset *= DEV_BSIZE; /* disk blk to bytes */
|
||||
|
||||
/* seek and read the block */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_inode.c,v 1.21 2013/06/19 17:51:25 dholland Exp $ */
|
||||
/* $NetBSD: ffs_inode.c,v 1.22 2013/06/23 02:06:04 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.21 2013/06/19 17:51:25 dholland Exp $");
|
||||
__RCSID("$NetBSD: ffs_inode.c,v 1.22 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -134,7 +134,7 @@ fs_parametrize(void)
|
|||
#endif
|
||||
|
||||
/* Fill out ufsi struct */
|
||||
ufsi.ufs_dsize = fsbtodb(sblock,sblock->fs_size);
|
||||
ufsi.ufs_dsize = FFS_FSBTODB(sblock,sblock->fs_size);
|
||||
ufsi.ufs_bsize = sblock->fs_bsize;
|
||||
ufsi.ufs_bshift = sblock->fs_bshift;
|
||||
ufsi.ufs_fsize = sblock->fs_fsize;
|
||||
|
@ -148,7 +148,7 @@ fs_parametrize(void)
|
|||
ufsi.ufs_qbmask = sblock->fs_qbmask;
|
||||
ufsi.ufs_qfmask = sblock->fs_qfmask;
|
||||
|
||||
dev_bsize = sblock->fs_fsize / fsbtodb(sblock, 1);
|
||||
dev_bsize = sblock->fs_fsize / FFS_FSBTODB(sblock, 1);
|
||||
|
||||
return &ufsi;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ fs_mapinodes(ino_t maxino __unused, u_int64_t *tape_size, int *anydirskipped)
|
|||
|
||||
for (cg = 0; cg < sblock->fs_ncg; cg++) {
|
||||
ino = cg * sblock->fs_ipg;
|
||||
bread(fsbtodb(sblock, cgtod(sblock, cg)), (char *)cgp,
|
||||
bread(FFS_FSBTODB(sblock, cgtod(sblock, cg)), (char *)cgp,
|
||||
sblock->fs_cgsize);
|
||||
if (needswap)
|
||||
ffs_cg_swap(cgp, cgp, sblock);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: inode.c,v 1.34 2013/06/19 17:51:25 dholland Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.35 2013/06/23 02:06:04 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.34 2013/06/19 17:51:25 dholland Exp $");
|
||||
__RCSID("$NetBSD: inode.c,v 1.35 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -432,7 +432,7 @@ getnextinode(ino_t inumber)
|
|||
(unsigned long long)inumber);
|
||||
if (inumber >= lastinum) {
|
||||
readcnt++;
|
||||
dblk = fsbtodb(&sblock, fsck_ino_to_fsba(&sblock, lastinum));
|
||||
dblk = EXT2_FSBTODB(&sblock, fsck_ino_to_fsba(&sblock, lastinum));
|
||||
if (readcnt % readpercg == 0) {
|
||||
size = partialsize;
|
||||
lastinum += partialcnt;
|
||||
|
@ -767,7 +767,7 @@ inonblock(struct ext2fs_dinode *dp)
|
|||
if ((sblock.e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_HUGE_FILE)) {
|
||||
nblock |= (uint64_t)fs2h16(dp->e2di_nblock_high) << 32;
|
||||
if (fs2h32(dp->e2di_flags) & EXT2_HUGE_FILE) {
|
||||
nblock = fsbtodb(&sblock, nblock);
|
||||
nblock = EXT2_FSBTODB(&sblock, nblock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -798,11 +798,11 @@ inosnblock(struct ext2fs_dinode *dp, uint64_t nblock)
|
|||
return;
|
||||
}
|
||||
|
||||
if (dbtofsb(&sblock, nblock) <= 0xffffffffffffULL) {
|
||||
if (EXT2_DBTOFSB(&sblock, nblock) <= 0xffffffffffffULL) {
|
||||
flags |= EXT2_HUGE_FILE;
|
||||
dp->e2di_flags = h2fs32(flags);
|
||||
dp->e2di_nblock = h2fs32(dbtofsb(&sblock, nblock));
|
||||
dp->e2di_nblock_high = h2fs16((dbtofsb(&sblock, nblock) >> 32));
|
||||
dp->e2di_nblock = h2fs32(EXT2_DBTOFSB(&sblock, nblock));
|
||||
dp->e2di_nblock_high = h2fs16((EXT2_DBTOFSB(&sblock, nblock) >> 32));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: setup.c,v 1.30 2013/06/19 17:51:25 dholland Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.31 2013/06/23 02:06:04 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.30 2013/06/19 17:51:25 dholland Exp $");
|
||||
__RCSID("$NetBSD: setup.c,v 1.31 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -147,7 +147,7 @@ setup(const char *dev)
|
|||
if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0)
|
||||
return 0;
|
||||
for (cg = 1; cg < proto.e2fs_ncg; cg++) {
|
||||
bflag = fsbtodb(&proto,
|
||||
bflag = EXT2_FSBTODB(&proto,
|
||||
cg * proto.e2fs.e2fs_bpg +
|
||||
proto.e2fs.e2fs_first_dblock);
|
||||
if (readsb(0) != 0)
|
||||
|
@ -220,7 +220,7 @@ setup(const char *dev)
|
|||
if (bread(fsreadfd,
|
||||
(char *)&sblock.e2fs_gd[i * sblock.e2fs_bsize /
|
||||
sizeof(struct ext2_gd)],
|
||||
fsbtodb(&sblock, ((sblock.e2fs_bsize > 1024) ? 0 : 1) +
|
||||
EXT2_FSBTODB(&sblock, ((sblock.e2fs_bsize > 1024) ? 0 : 1) +
|
||||
i + 1),
|
||||
sblock.e2fs_bsize) != 0 && !asked) {
|
||||
pfatal("BAD SUMMARY INFORMATION");
|
||||
|
@ -335,7 +335,7 @@ readsb(int listerr)
|
|||
* so we can tell if this is an alternate later.
|
||||
*/
|
||||
super *= dev_bsize;
|
||||
dev_bsize = sblock.e2fs_bsize / fsbtodb(&sblock, 1);
|
||||
dev_bsize = sblock.e2fs_bsize / EXT2_FSBTODB(&sblock, 1);
|
||||
sblk.b_bno = super / dev_bsize;
|
||||
|
||||
if (sblock.e2fs_ncg == 1) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: utilities.c,v 1.22 2011/06/09 19:57:51 christos Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.23 2013/06/23 02:06:04 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -58,7 +58,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: utilities.c,v 1.22 2011/06/09 19:57:51 christos Exp $");
|
||||
__RCSID("$NetBSD: utilities.c,v 1.23 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -183,7 +183,7 @@ getdatablk(daddr_t blkno, long size)
|
|||
struct bufarea *bp;
|
||||
|
||||
for (bp = bufhead.b_next; bp != &bufhead; bp = bp->b_next)
|
||||
if (bp->b_bno == fsbtodb(&sblock, blkno))
|
||||
if (bp->b_bno == EXT2_FSBTODB(&sblock, blkno))
|
||||
goto foundit;
|
||||
for (bp = bufhead.b_prev; bp != &bufhead; bp = bp->b_prev)
|
||||
if ((bp->b_flags & B_INUSE) == 0)
|
||||
|
@ -210,7 +210,7 @@ getblk(struct bufarea *bp, daddr_t blk, long size)
|
|||
{
|
||||
daddr_t dblk;
|
||||
|
||||
dblk = fsbtodb(&sblock, blk);
|
||||
dblk = EXT2_FSBTODB(&sblock, blk);
|
||||
if (bp->b_bno != dblk) {
|
||||
flush(fswritefd, bp);
|
||||
bp->b_errs = bread(fsreadfd, bp->b_un.b_buf, dblk, size);
|
||||
|
@ -238,7 +238,7 @@ flush(int fd, struct bufarea *bp)
|
|||
for (i = 0; i < sblock.e2fs_ngdb; i++) {
|
||||
bwrite(fswritefd, (char *)
|
||||
&sblock.e2fs_gd[i* sblock.e2fs_bsize / sizeof(struct ext2_gd)],
|
||||
fsbtodb(&sblock, ((sblock.e2fs_bsize>1024)?0:1)+i+1),
|
||||
EXT2_FSBTODB(&sblock, ((sblock.e2fs_bsize>1024)?0:1)+i+1),
|
||||
sblock.e2fs_bsize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: inode.c,v 1.66 2013/06/19 17:51:25 dholland Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.67 2013/06/23 02:06:04 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.66 2013/06/19 17:51:25 dholland Exp $");
|
||||
__RCSID("$NetBSD: inode.c,v 1.67 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -402,7 +402,7 @@ getnextinode(ino_t inumber)
|
|||
|
||||
if (inumber >= lastinum) {
|
||||
readcnt++;
|
||||
dblk = fsbtodb(sblock, ino_to_fsba(sblock, lastinum));
|
||||
dblk = FFS_FSBTODB(sblock, ino_to_fsba(sblock, lastinum));
|
||||
if (readcnt % readpercg == 0) {
|
||||
size = partialsize;
|
||||
lastinum += partialcnt;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pass1.c,v 1.53 2013/06/19 18:02:21 dholland Exp $ */
|
||||
/* $NetBSD: pass1.c,v 1.54 2013/06/23 02:06:04 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.53 2013/06/19 18:02:21 dholland Exp $");
|
||||
__RCSID("$NetBSD: pass1.c,v 1.54 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -309,7 +309,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
|||
size > 0 && size < UFS1_MAXSYMLINKLEN &&
|
||||
DIP(dp, blocks) != 0) {
|
||||
if (bread(fsreadfd, symbuf,
|
||||
fsbtodb(sblock, iswap32(DIP(dp, db[0]))),
|
||||
FFS_FSBTODB(sblock, iswap32(DIP(dp, db[0]))),
|
||||
(long)secsize) != 0)
|
||||
errexit("cannot read symlink");
|
||||
if (debug) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pass5.c,v 1.51 2013/01/22 09:39:12 dholland Exp $ */
|
||||
/* $NetBSD: pass5.c,v 1.52 2013/06/23 02:06:04 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.51 2013/01/22 09:39:12 dholland Exp $");
|
||||
__RCSID("$NetBSD: pass5.c,v 1.52 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -225,7 +225,7 @@ pass5(void)
|
|||
*/
|
||||
if ((cvtlevel && sblk.b_dirty) || doswap) {
|
||||
bwrite(fswritefd, sblk.b_un.b_buf,
|
||||
fsbtodb(sblock, cgsblock(sblock, c)),
|
||||
FFS_FSBTODB(sblock, cgsblock(sblock, c)),
|
||||
sblock->fs_sbsize);
|
||||
} else {
|
||||
/*
|
||||
|
@ -248,7 +248,7 @@ pass5(void)
|
|||
dofix(&idesc[3],
|
||||
"ALTERNATE SUPERBLK(S) ARE INCORRECT")) {
|
||||
bwrite(fswritefd, sblk.b_un.b_buf,
|
||||
fsbtodb(sblock, cgsblock(sblock, c)),
|
||||
FFS_FSBTODB(sblock, cgsblock(sblock, c)),
|
||||
sblock->fs_sbsize);
|
||||
}
|
||||
sb_oldfscompat_read(sblock, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: setup.c,v 1.98 2013/06/19 17:51:25 dholland Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.99 2013/06/23 02:06:04 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.98 2013/06/19 17:51:25 dholland Exp $");
|
||||
__RCSID("$NetBSD: setup.c,v 1.99 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -157,7 +157,7 @@ setup(const char *dev, const char *origdev)
|
|||
if (reply("LOOK FOR ALTERNATE SUPERBLOCKS") == 0)
|
||||
return (0);
|
||||
for (cg = 0; cg < proto.fs_ncg; cg++) {
|
||||
bflag = fsbtodb(&proto, cgsblock(&proto, cg));
|
||||
bflag = FFS_FSBTODB(&proto, cgsblock(&proto, cg));
|
||||
if (readsb(0) != 0)
|
||||
break;
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ setup(const char *dev, const char *origdev)
|
|||
sblock->fs_cssize - i : sblock->fs_bsize;
|
||||
ccsp = (struct csum *)((char *)sblock->fs_csp + i);
|
||||
if (bread(fsreadfd, (char *)ccsp,
|
||||
fsbtodb(sblock, sblock->fs_csaddr + j * sblock->fs_frag),
|
||||
FFS_FSBTODB(sblock, sblock->fs_csaddr + j * sblock->fs_frag),
|
||||
size) != 0 && !asked) {
|
||||
pfatal("BAD SUMMARY INFORMATION");
|
||||
if (reply("CONTINUE") == 0) {
|
||||
|
@ -470,7 +470,7 @@ setup(const char *dev, const char *origdev)
|
|||
if (doswap) {
|
||||
ffs_csum_swap(ccsp, ccsp, size);
|
||||
bwrite(fswritefd, (char *)ccsp,
|
||||
fsbtodb(sblock,
|
||||
FFS_FSBTODB(sblock,
|
||||
sblock->fs_csaddr + j * sblock->fs_frag),
|
||||
size);
|
||||
}
|
||||
|
@ -793,11 +793,11 @@ readsb(int listerr)
|
|||
{ badsb(listerr, "SIZE PREPOSTEROUSLY LARGE"); return (0); }
|
||||
/*
|
||||
* Compute block size that the filesystem is based on,
|
||||
* according to fsbtodb, and adjust superblock block number
|
||||
* according to FFS_FSBTODB, and adjust superblock block number
|
||||
* so we can tell if this is an alternate later.
|
||||
*/
|
||||
super *= dev_bsize;
|
||||
dev_bsize = sblock->fs_fsize / fsbtodb(sblock, 1);
|
||||
dev_bsize = sblock->fs_fsize / FFS_FSBTODB(sblock, 1);
|
||||
sblk.b_bno = super / dev_bsize;
|
||||
sblk.b_size = SBLOCKSIZE;
|
||||
if (bflag)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: utilities.c,v 1.61 2013/01/22 09:39:12 dholland Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.62 2013/06/23 02:06:04 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.61 2013/01/22 09:39:12 dholland Exp $");
|
||||
__RCSID("$NetBSD: utilities.c,v 1.62 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -181,7 +181,7 @@ getdatablk(daddr_t blkno, long size)
|
|||
struct bufarea *bp;
|
||||
|
||||
for (bp = bufhead.b_next; bp != &bufhead; bp = bp->b_next)
|
||||
if (bp->b_bno == fsbtodb(sblock, blkno))
|
||||
if (bp->b_bno == FFS_FSBTODB(sblock, blkno))
|
||||
goto foundit;
|
||||
for (bp = bufhead.b_prev; bp != &bufhead; bp = bp->b_prev)
|
||||
if ((bp->b_flags & B_INUSE) == 0)
|
||||
|
@ -206,7 +206,7 @@ getblk(struct bufarea *bp, daddr_t blk, long size)
|
|||
{
|
||||
daddr_t dblk;
|
||||
|
||||
dblk = fsbtodb(sblock, blk);
|
||||
dblk = FFS_FSBTODB(sblock, blk);
|
||||
totalreads++;
|
||||
if (bp->b_bno != dblk) {
|
||||
flush(fswritefd, bp);
|
||||
|
@ -241,7 +241,7 @@ flush(int fd, struct bufarea *bp)
|
|||
if (needswap)
|
||||
ffs_csum_swap(ccsp, ccsp, size);
|
||||
bwrite(fswritefd, (char *)ccsp,
|
||||
fsbtodb(sblock, sblock->fs_csaddr + j * sblock->fs_frag),
|
||||
FFS_FSBTODB(sblock, sblock->fs_csaddr + j * sblock->fs_frag),
|
||||
size);
|
||||
if (needswap)
|
||||
ffs_csum_swap(ccsp, ccsp, size);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fsdb.c,v 1.47 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: fsdb.c,v 1.48 2013/06/23 02:06:04 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.47 2013/06/19 17:51:26 dholland Exp $");
|
||||
__RCSID("$NetBSD: fsdb.c,v 1.48 2013/06/23 02:06:04 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -508,7 +508,7 @@ CMDFUNC(findblk)
|
|||
memset(wantedblk64, 0, sizeof(uint64_t) * wantedblksize);
|
||||
for (i = 1; i < argc; i++)
|
||||
wantedblk64[i - 1] =
|
||||
dbtofsb(sblock, strtoull(argv[i], NULL, 0));
|
||||
FFS_DBTOFSB(sblock, strtoull(argv[i], NULL, 0));
|
||||
} else {
|
||||
wantedblk32 = malloc(sizeof(uint32_t) * wantedblksize);
|
||||
if (wantedblk32 == NULL) {
|
||||
|
@ -518,7 +518,7 @@ CMDFUNC(findblk)
|
|||
memset(wantedblk32, 0, sizeof(uint32_t) * wantedblksize);
|
||||
for (i = 1; i < argc; i++)
|
||||
wantedblk32[i - 1] =
|
||||
dbtofsb(sblock, strtoull(argv[i], NULL, 0));
|
||||
FFS_DBTOFSB(sblock, strtoull(argv[i], NULL, 0));
|
||||
}
|
||||
findblk_numtofind = wantedblksize;
|
||||
for (c = 0; c < sblock->fs_ncg; c++) {
|
||||
|
@ -539,7 +539,7 @@ CMDFUNC(findblk)
|
|||
compare_blk32(wantedblk32,
|
||||
ino_to_fsba(sblock, inum))) {
|
||||
printf("block %llu: inode block (%llu-%llu)\n",
|
||||
(unsigned long long)fsbtodb(sblock,
|
||||
(unsigned long long)FFS_FSBTODB(sblock,
|
||||
ino_to_fsba(sblock, inum)),
|
||||
(unsigned long long)
|
||||
(inum / FFS_INOPB(sblock)) * FFS_INOPB(sblock),
|
||||
|
@ -639,7 +639,7 @@ static int
|
|||
founddatablk(uint64_t blk)
|
||||
{
|
||||
printf("%llu: data block of inode %llu\n",
|
||||
(unsigned long long)fsbtodb(sblock, blk),
|
||||
(unsigned long long)FFS_FSBTODB(sblock, blk),
|
||||
(unsigned long long)curinum);
|
||||
findblk_numtofind--;
|
||||
if (findblk_numtofind == 0)
|
||||
|
@ -669,7 +669,7 @@ find_indirblks32(uint32_t blk, int ind_level, uint32_t *wantedblk)
|
|||
uint32_t idblk[MAXNINDIR];
|
||||
size_t i;
|
||||
|
||||
bread(fsreadfd, (char *)idblk, fsbtodb(sblock, blk),
|
||||
bread(fsreadfd, (char *)idblk, FFS_FSBTODB(sblock, blk),
|
||||
(int)sblock->fs_bsize);
|
||||
if (ind_level <= 0) {
|
||||
if (find_blks32(idblk,
|
||||
|
@ -715,7 +715,7 @@ find_indirblks64(uint64_t blk, int ind_level, uint64_t *wantedblk)
|
|||
uint64_t idblk[MAXNINDIR];
|
||||
size_t i;
|
||||
|
||||
bread(fsreadfd, (char *)idblk, fsbtodb(sblock, blk),
|
||||
bread(fsreadfd, (char *)idblk, FFS_FSBTODB(sblock, blk),
|
||||
(int)sblock->fs_bsize);
|
||||
if (ind_level <= 0) {
|
||||
if (find_blks64(idblk,
|
||||
|
@ -808,7 +808,7 @@ print_indirblks32(uint32_t blk, int ind_level, uint64_t *blknum)
|
|||
|
||||
printf("Indirect block %lld (level %d):\n", (long long)blk,
|
||||
ind_level+1);
|
||||
bread(fsreadfd, (char *)idblk, fsbtodb(sblock, blk),
|
||||
bread(fsreadfd, (char *)idblk, FFS_FSBTODB(sblock, blk),
|
||||
(int)sblock->fs_bsize);
|
||||
if (ind_level <= 0) {
|
||||
print_blks32(idblk, ptrperblk, blknum);
|
||||
|
@ -836,7 +836,7 @@ print_indirblks64(uint64_t blk, int ind_level, uint64_t *blknum)
|
|||
|
||||
printf("Indirect block %lld (level %d):\n", (long long)blk,
|
||||
ind_level+1);
|
||||
bread(fsreadfd, (char *)idblk, fsbtodb(sblock, blk),
|
||||
bread(fsreadfd, (char *)idblk, FFS_FSBTODB(sblock, blk),
|
||||
(int)sblock->fs_bsize);
|
||||
if (ind_level <= 0) {
|
||||
print_blks64(idblk, ptrperblk, blknum);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fsirand.c,v 1.30 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: fsirand.c,v 1.31 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: fsirand.c,v 1.30 2013/06/19 17:51:26 dholland Exp $");
|
||||
__RCSID("$NetBSD: fsirand.c,v 1.31 2013/06/23 02:06:05 dholland Exp $");
|
||||
#endif /* lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -150,7 +150,7 @@ fixinodes(int fd, struct fs *fs, struct disklabel *lab, int pflag, long xorval)
|
|||
|
||||
for (ino = 0, imax = fs->fs_ipg * fs->fs_ncg; ino < imax;) {
|
||||
off_t sp;
|
||||
sp = (off_t) fsbtodb(fs, ino_to_fsba(fs, ino)) *
|
||||
sp = (off_t) FFS_FSBTODB(fs, ino_to_fsba(fs, ino)) *
|
||||
(off_t) lab->d_secsize;
|
||||
|
||||
if (lseek(fd, sp, SEEK_SET) == (off_t) -1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkfs.c,v 1.116 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: mkfs.c,v 1.117 2013/06/23 02:06:05 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.116 2013/06/19 17:51:26 dholland Exp $");
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.117 2013/06/23 02:06:05 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -296,7 +296,7 @@ mkfs(const char *fsys, int fi, int fo,
|
|||
fserr(21);
|
||||
}
|
||||
sblock.fs_fsbtodb = ilog2(sblock.fs_fsize / sectorsize);
|
||||
sblock.fs_size = dbtofsb(&sblock, fssize);
|
||||
sblock.fs_size = FFS_DBTOFSB(&sblock, fssize);
|
||||
if (Oflag <= 1) {
|
||||
if ((uint64_t)sblock.fs_size >= 1ull << 31) {
|
||||
printf("Too many fragments (0x%" PRIx64
|
||||
|
@ -541,7 +541,7 @@ mkfs(const char *fsys, int fi, int fo,
|
|||
printf("%s: %.1fMB (%lld sectors) block size %d, "
|
||||
"fragment size %d\n",
|
||||
fsys, (float)sblock.fs_size * sblock.fs_fsize * B2MBFACTOR,
|
||||
(long long)fsbtodb(&sblock, sblock.fs_size),
|
||||
(long long)FFS_FSBTODB(&sblock, sblock.fs_size),
|
||||
sblock.fs_bsize, sblock.fs_fsize);
|
||||
printf("\tusing %d cylinder groups of %.2fMB, %d blks, "
|
||||
"%d inodes.\n",
|
||||
|
@ -654,7 +654,7 @@ mkfs(const char *fsys, int fi, int fo,
|
|||
printf("super-block backups (for fsck_ffs -b #) at:\n");
|
||||
/* If we are printing more than one line of numbers, line up columns */
|
||||
fld_width = verbosity < 4 ? 1 : snprintf(NULL, 0, "%" PRIu64,
|
||||
(uint64_t)fsbtodb(&sblock, cgsblock(&sblock, sblock.fs_ncg-1)));
|
||||
(uint64_t)FFS_FSBTODB(&sblock, cgsblock(&sblock, sblock.fs_ncg-1)));
|
||||
/* Get terminal width */
|
||||
if (ioctl(fileno(stdout), TIOCGWINSZ, &winsize) == 0)
|
||||
max_cols = winsize.ws_col;
|
||||
|
@ -682,7 +682,7 @@ mkfs(const char *fsys, int fi, int fo,
|
|||
}
|
||||
/* Print superblock numbers */
|
||||
len = printf("%s%*" PRIu64 ",", col ? " " : "", fld_width,
|
||||
(uint64_t)fsbtodb(&sblock, cgsblock(&sblock, cylno)));
|
||||
(uint64_t)FFS_FSBTODB(&sblock, cgsblock(&sblock, cylno)));
|
||||
col += len;
|
||||
if (col + len < max_cols)
|
||||
/* Next number fits */
|
||||
|
@ -736,13 +736,13 @@ mkfs(const char *fsys, int fi, int fo,
|
|||
/* Write out first and last cylinder summary sectors */
|
||||
if (needswap)
|
||||
ffs_csum_swap(fscs_0, fscs_0, sblock.fs_fsize);
|
||||
wtfs(fsbtodb(&sblock, sblock.fs_csaddr), sblock.fs_fsize, fscs_0);
|
||||
wtfs(FFS_FSBTODB(&sblock, sblock.fs_csaddr), sblock.fs_fsize, fscs_0);
|
||||
|
||||
if (fscs_next > fscs_reset) {
|
||||
if (needswap)
|
||||
ffs_csum_swap(fscs_reset, fscs_reset, sblock.fs_fsize);
|
||||
fs_csaddr++;
|
||||
wtfs(fsbtodb(&sblock, fs_csaddr), sblock.fs_fsize, fscs_reset);
|
||||
wtfs(FFS_FSBTODB(&sblock, fs_csaddr), sblock.fs_fsize, fscs_reset);
|
||||
}
|
||||
|
||||
/* mfs doesn't need these permanently allocated */
|
||||
|
@ -924,7 +924,7 @@ initcg(int cylno, const struct timeval *tv)
|
|||
if (needswap)
|
||||
ffs_csum_swap(fscs_reset, fscs_reset, sblock.fs_fsize);
|
||||
fs_csaddr++;
|
||||
wtfs(fsbtodb(&sblock, fs_csaddr), sblock.fs_fsize, fscs_reset);
|
||||
wtfs(FFS_FSBTODB(&sblock, fs_csaddr), sblock.fs_fsize, fscs_reset);
|
||||
fscs_next = fscs_reset;
|
||||
memset(fscs_next, 0, sblock.fs_fsize);
|
||||
}
|
||||
|
@ -949,7 +949,7 @@ initcg(int cylno, const struct timeval *tv)
|
|||
dp2++;
|
||||
}
|
||||
}
|
||||
wtfs(fsbtodb(&sblock, cgsblock(&sblock, cylno)), iobufsize, iobuf);
|
||||
wtfs(FFS_FSBTODB(&sblock, cgsblock(&sblock, cylno)), iobufsize, iobuf);
|
||||
/*
|
||||
* For the old file system, we have to initialize all the inodes.
|
||||
*/
|
||||
|
@ -966,7 +966,7 @@ initcg(int cylno, const struct timeval *tv)
|
|||
do
|
||||
dp1->di_gen = arc4random() & INT32_MAX;
|
||||
while ((char *)++dp1 < &iobuf[iobuf_memsize]);
|
||||
wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i),
|
||||
wtfs(FFS_FSBTODB(&sblock, cgimin(&sblock, cylno) + i),
|
||||
d * sblock.fs_bsize / sblock.fs_frag, &iobuf[start]);
|
||||
}
|
||||
}
|
||||
|
@ -1070,7 +1070,7 @@ fsinit(const struct timeval *tv, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
|
|||
qblocks += node.dp1.di_blocks;
|
||||
node.dp1.di_uid = geteuid();
|
||||
node.dp1.di_gid = getegid();
|
||||
wtfs(fsbtodb(&sblock, node.dp1.di_db[0]), node.dp1.di_size,
|
||||
wtfs(FFS_FSBTODB(&sblock, node.dp1.di_db[0]), node.dp1.di_size,
|
||||
buf);
|
||||
} else {
|
||||
node.dp2.di_atime = tv->tv_sec;
|
||||
|
@ -1092,7 +1092,7 @@ fsinit(const struct timeval *tv, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
|
|||
qblocks += node.dp2.di_blocks;
|
||||
node.dp2.di_uid = geteuid();
|
||||
node.dp2.di_gid = getegid();
|
||||
wtfs(fsbtodb(&sblock, node.dp2.di_db[0]), node.dp2.di_size,
|
||||
wtfs(FFS_FSBTODB(&sblock, node.dp2.di_db[0]), node.dp2.di_size,
|
||||
buf);
|
||||
}
|
||||
qinos++;
|
||||
|
@ -1124,7 +1124,7 @@ fsinit(const struct timeval *tv, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
|
|||
node.dp1.di_blocks = btodb(fragroundup(&sblock,
|
||||
node.dp1.di_size));
|
||||
qblocks += node.dp1.di_blocks;
|
||||
wtfs(fsbtodb(&sblock, node.dp1.di_db[0]), sblock.fs_fsize, buf);
|
||||
wtfs(FFS_FSBTODB(&sblock, node.dp1.di_db[0]), sblock.fs_fsize, buf);
|
||||
} else {
|
||||
if (mfs) {
|
||||
node.dp2.di_mode = IFDIR | mfsmode;
|
||||
|
@ -1151,7 +1151,7 @@ fsinit(const struct timeval *tv, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
|
|||
node.dp2.di_blocks = btodb(fragroundup(&sblock,
|
||||
node.dp2.di_size));
|
||||
qblocks += node.dp2.di_blocks;
|
||||
wtfs(fsbtodb(&sblock, node.dp2.di_db[0]), sblock.fs_fsize, buf);
|
||||
wtfs(FFS_FSBTODB(&sblock, node.dp2.di_db[0]), sblock.fs_fsize, buf);
|
||||
}
|
||||
qinos++;
|
||||
iput(&node, UFS_ROOTINO);
|
||||
|
@ -1212,7 +1212,7 @@ fsinit(const struct timeval *tv, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
|
|||
node.dp1.di_size));
|
||||
node.dp1.di_uid = geteuid();
|
||||
node.dp1.di_gid = getegid();
|
||||
wtfs(fsbtodb(&sblock, node.dp1.di_db[0]),
|
||||
wtfs(FFS_FSBTODB(&sblock, node.dp1.di_db[0]),
|
||||
node.dp1.di_size, buf);
|
||||
} else {
|
||||
node.dp2.di_atime = tv->tv_sec;
|
||||
|
@ -1234,7 +1234,7 @@ fsinit(const struct timeval *tv, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid)
|
|||
node.dp2.di_size));
|
||||
node.dp2.di_uid = geteuid();
|
||||
node.dp2.di_gid = getegid();
|
||||
wtfs(fsbtodb(&sblock, node.dp2.di_db[0]),
|
||||
wtfs(FFS_FSBTODB(&sblock, node.dp2.di_db[0]),
|
||||
node.dp2.di_size, buf);
|
||||
}
|
||||
iput(&node, nextino);
|
||||
|
@ -1279,7 +1279,7 @@ alloc(int size, int mode)
|
|||
int i, frag;
|
||||
daddr_t d, blkno;
|
||||
|
||||
rdfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, &acg);
|
||||
rdfs(FFS_FSBTODB(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, &acg);
|
||||
/* fs -> host byte order */
|
||||
if (needswap)
|
||||
ffs_cg_swap(&acg, &acg, &sblock);
|
||||
|
@ -1328,7 +1328,7 @@ goth:
|
|||
/* host -> fs byte order */
|
||||
if (needswap)
|
||||
ffs_cg_swap(&acg, &acg, &sblock);
|
||||
wtfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, &acg);
|
||||
wtfs(FFS_FSBTODB(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, &acg);
|
||||
return (d);
|
||||
}
|
||||
|
||||
|
@ -1343,7 +1343,7 @@ iput(union dinode *ip, ino_t ino)
|
|||
struct ufs1_dinode *dp1;
|
||||
struct ufs2_dinode *dp2;
|
||||
|
||||
rdfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, &acg);
|
||||
rdfs(FFS_FSBTODB(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, &acg);
|
||||
/* fs -> host byte order */
|
||||
if (needswap)
|
||||
ffs_cg_swap(&acg, &acg, &sblock);
|
||||
|
@ -1356,7 +1356,7 @@ iput(union dinode *ip, ino_t ino)
|
|||
/* host -> fs byte order */
|
||||
if (needswap)
|
||||
ffs_cg_swap(&acg, &acg, &sblock);
|
||||
wtfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, &acg);
|
||||
wtfs(FFS_FSBTODB(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize, &acg);
|
||||
sblock.fs_cstotal.cs_nifree--;
|
||||
fscs_0->cs_nifree--;
|
||||
if (ino >= (ino_t)(sblock.fs_ipg * sblock.fs_ncg)) {
|
||||
|
@ -1364,7 +1364,7 @@ iput(union dinode *ip, ino_t ino)
|
|||
(unsigned long long)ino);
|
||||
fserr(32);
|
||||
}
|
||||
d = fsbtodb(&sblock, ino_to_fsba(&sblock, ino));
|
||||
d = FFS_FSBTODB(&sblock, ino_to_fsba(&sblock, ino));
|
||||
rdfs(d, sblock.fs_bsize, (char *)iobuf);
|
||||
if (sblock.fs_magic == FS_UFS1_MAGIC) {
|
||||
dp1 = (struct ufs1_dinode *)iobuf;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mke2fs.c,v 1.19 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: mke2fs.c,v 1.20 2013/06/23 02:06:05 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.19 2013/06/19 17:51:26 dholland Exp $");
|
||||
__RCSID("$NetBSD: mke2fs.c,v 1.20 2013/06/23 02:06:05 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -263,7 +263,7 @@ mke2fs(const char *fsys, int fi, int fo)
|
|||
* bsize is a power of two (i.e. 2048 bytes or more).
|
||||
*/
|
||||
sblock.e2fs.e2fs_first_dblock = (sblock.e2fs_bsize > BBSIZE) ? 0 : 1;
|
||||
minfssize = fsbtodb(&sblock,
|
||||
minfssize = EXT2_FSBTODB(&sblock,
|
||||
sblock.e2fs.e2fs_first_dblock +
|
||||
NBLOCK_SUPERBLOCK +
|
||||
1 /* at least one group descriptor */ +
|
||||
|
@ -278,7 +278,7 @@ mke2fs(const char *fsys, int fi, int fo)
|
|||
errx(EXIT_FAILURE, "Filesystem size %" PRId64
|
||||
" < minimum size of %" PRId64 "\n", fssize, minfssize);
|
||||
|
||||
bcount = dbtofsb(&sblock, fssize);
|
||||
bcount = EXT2_DBTOFSB(&sblock, fssize);
|
||||
|
||||
/*
|
||||
* While many people claim that ext2fs is a (bad) clone of ufs/ffs,
|
||||
|
@ -674,7 +674,7 @@ mke2fs(const char *fsys, int fi, int fo)
|
|||
e2fs_sbsave(&sblock.e2fs, (struct ext2fs *)(iobuf + sboff));
|
||||
e2fs_cgsave(gd, (struct ext2_gd *)(iobuf + sblock.e2fs_bsize),
|
||||
sizeof(struct ext2_gd) * sblock.e2fs_ncg);
|
||||
wtfs(fsbtodb(&sblock, cgbase(&sblock, 0)) + sboff / sectorsize,
|
||||
wtfs(EXT2_FSBTODB(&sblock, cgbase(&sblock, 0)) + sboff / sectorsize,
|
||||
iobufsize - sboff, iobuf + sboff);
|
||||
|
||||
munmap(iobuf, iobufsize);
|
||||
|
@ -707,7 +707,7 @@ initcg(uint cylno)
|
|||
sblock.e2fs_bsize * NBLOCK_SUPERBLOCK),
|
||||
sizeof(struct ext2_gd) * sblock.e2fs_ncg);
|
||||
/* write superblock and group descriptor backups */
|
||||
wtfs(fsbtodb(&sblock, cgbase(&sblock, cylno)) +
|
||||
wtfs(EXT2_FSBTODB(&sblock, cgbase(&sblock, cylno)) +
|
||||
sboff / sectorsize, iobufsize - sboff, iobuf + sboff);
|
||||
}
|
||||
|
||||
|
@ -729,7 +729,7 @@ initcg(uint cylno)
|
|||
i = i * NBBY;
|
||||
for (; i < cgoverhead(cylno); i++)
|
||||
setbit(buf, i);
|
||||
wtfs(fsbtodb(&sblock, gd[cylno].ext2bgd_b_bitmap), sblock.e2fs_bsize,
|
||||
wtfs(EXT2_FSBTODB(&sblock, gd[cylno].ext2bgd_b_bitmap), sblock.e2fs_bsize,
|
||||
buf);
|
||||
|
||||
/*
|
||||
|
@ -747,7 +747,7 @@ initcg(uint cylno)
|
|||
for (i = 1; i < EXT2_FIRSTINO; i++)
|
||||
setbit(buf, EXT2_INO_INDEX(i));
|
||||
}
|
||||
wtfs(fsbtodb(&sblock, gd[cylno].ext2bgd_i_bitmap), sblock.e2fs_bsize,
|
||||
wtfs(EXT2_FSBTODB(&sblock, gd[cylno].ext2bgd_i_bitmap), sblock.e2fs_bsize,
|
||||
buf);
|
||||
|
||||
/*
|
||||
|
@ -764,7 +764,7 @@ initcg(uint cylno)
|
|||
/* h2fs32() just for consistency */
|
||||
dp->e2di_gen = h2fs32(arc4random());
|
||||
}
|
||||
wtfs(fsbtodb(&sblock, gd[cylno].ext2bgd_i_tables + i),
|
||||
wtfs(EXT2_FSBTODB(&sblock, gd[cylno].ext2bgd_i_tables + i),
|
||||
sblock.e2fs_bsize, buf);
|
||||
}
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ fsinit(const struct timeval *tv)
|
|||
node.e2di_gid = getegid();
|
||||
node.e2di_nlink = PREDEFDIR;
|
||||
/* e2di_nblock is a number of disk blocks, not ext2fs blocks */
|
||||
node.e2di_nblock = fsbtodb(&sblock, nblks_lostfound);
|
||||
node.e2di_nblock = EXT2_FSBTODB(&sblock, nblks_lostfound);
|
||||
node.e2di_blocks[0] = alloc(sblock.e2fs_bsize, node.e2di_mode);
|
||||
if (node.e2di_blocks[0] == 0) {
|
||||
printf("%s: can't allocate block for lost+found\n", __func__);
|
||||
|
@ -960,12 +960,12 @@ fsinit(const struct timeval *tv)
|
|||
}
|
||||
node.e2di_blocks[i] = blk;
|
||||
}
|
||||
wtfs(fsbtodb(&sblock, node.e2di_blocks[0]), sblock.e2fs_bsize, buf);
|
||||
wtfs(EXT2_FSBTODB(&sblock, node.e2di_blocks[0]), sblock.e2fs_bsize, buf);
|
||||
pad_dir.e2d_reclen = sblock.e2fs_bsize;
|
||||
for (i = 1; i < nblks_lostfound; i++) {
|
||||
memset(buf, 0, sblock.e2fs_bsize);
|
||||
copy_dir(&pad_dir, (struct ext2fs_direct *)buf);
|
||||
wtfs(fsbtodb(&sblock, node.e2di_blocks[i]), sblock.e2fs_bsize,
|
||||
wtfs(EXT2_FSBTODB(&sblock, node.e2di_blocks[i]), sblock.e2fs_bsize,
|
||||
buf);
|
||||
}
|
||||
iput(&node, EXT2_LOSTFOUNDINO);
|
||||
|
@ -991,13 +991,13 @@ fsinit(const struct timeval *tv)
|
|||
node.e2di_gid = getegid();
|
||||
node.e2di_nlink = PREDEFROOTDIR;
|
||||
/* e2di_nblock is a number of disk block, not ext2fs block */
|
||||
node.e2di_nblock = fsbtodb(&sblock, 1);
|
||||
node.e2di_nblock = EXT2_FSBTODB(&sblock, 1);
|
||||
node.e2di_blocks[0] = alloc(node.e2di_size, node.e2di_mode);
|
||||
if (node.e2di_blocks[0] == 0) {
|
||||
printf("%s: can't allocate block for root dir\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
wtfs(fsbtodb(&sblock, node.e2di_blocks[0]), sblock.e2fs_bsize, buf);
|
||||
wtfs(EXT2_FSBTODB(&sblock, node.e2di_blocks[0]), sblock.e2fs_bsize, buf);
|
||||
iput(&node, EXT2_ROOTINO);
|
||||
return 1;
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ init_resizeino(const struct timeval *tv)
|
|||
__func__);
|
||||
|
||||
/* account this first block */
|
||||
nblock = fsbtodb(&sblock, 1);
|
||||
nblock = EXT2_FSBTODB(&sblock, 1);
|
||||
|
||||
/* allocate buffer to set data in the dindirect block */
|
||||
dindir_block = malloc(sblock.e2fs_bsize);
|
||||
|
@ -1214,15 +1214,15 @@ init_resizeino(const struct timeval *tv)
|
|||
*/
|
||||
reserved_gdb[n++] = h2fs32(cgbase(&sblock, cylno) +
|
||||
NBLOCK_SUPERBLOCK + i);
|
||||
nblock += fsbtodb(&sblock, 1);
|
||||
nblock += EXT2_FSBTODB(&sblock, 1);
|
||||
}
|
||||
for (; n < EXT2_NINDIR(&sblock); n++)
|
||||
reserved_gdb[n] = 0;
|
||||
|
||||
/* write group descriptor block as the second dindirect refs */
|
||||
wtfs(fsbtodb(&sblock, fs2h32(dindir_block[i])),
|
||||
wtfs(EXT2_FSBTODB(&sblock, fs2h32(dindir_block[i])),
|
||||
sblock.e2fs_bsize, reserved_gdb);
|
||||
nblock += fsbtodb(&sblock, 1);
|
||||
nblock += EXT2_FSBTODB(&sblock, 1);
|
||||
}
|
||||
for (; i < EXT2_NINDIR(&sblock); i++) {
|
||||
/* leave trailing entries unallocated */
|
||||
|
@ -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[EXT2FS_NDADDR + DOUBLE]),
|
||||
wtfs(EXT2_FSBTODB(&sblock, node.e2di_blocks[EXT2FS_NDADDR + DOUBLE]),
|
||||
sblock.e2fs_bsize, dindir_block);
|
||||
free(dindir_block);
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ alloc(uint32_t size, uint16_t mode)
|
|||
bbp = malloc(sblock.e2fs_bsize);
|
||||
if (bbp == NULL)
|
||||
return 0;
|
||||
rdfs(fsbtodb(&sblock, gd[0].ext2bgd_b_bitmap), sblock.e2fs_bsize, bbp);
|
||||
rdfs(EXT2_FSBTODB(&sblock, gd[0].ext2bgd_b_bitmap), sblock.e2fs_bsize, bbp);
|
||||
|
||||
/* XXX: kernel uses e2fs_fpg here */
|
||||
len = sblock.e2fs.e2fs_bpg / NBBY;
|
||||
|
@ -1295,7 +1295,7 @@ alloc(uint32_t size, uint16_t mode)
|
|||
errx(EXIT_FAILURE, "%s: inconsistent bitmap\n", __func__);
|
||||
|
||||
setbit(bbp, bno);
|
||||
wtfs(fsbtodb(&sblock, gd[0].ext2bgd_b_bitmap), sblock.e2fs_bsize, bbp);
|
||||
wtfs(EXT2_FSBTODB(&sblock, gd[0].ext2bgd_b_bitmap), sblock.e2fs_bsize, bbp);
|
||||
free(bbp);
|
||||
/* XXX: modified group descriptors won't be written into backups */
|
||||
gd[0].ext2bgd_nbfree--;
|
||||
|
@ -1338,7 +1338,7 @@ iput(struct ext2fs_dinode *ip, ino_t ino)
|
|||
__func__, (uint64_t)ino, c);
|
||||
|
||||
/* update inode bitmap */
|
||||
rdfs(fsbtodb(&sblock, gd[0].ext2bgd_i_bitmap),
|
||||
rdfs(EXT2_FSBTODB(&sblock, gd[0].ext2bgd_i_bitmap),
|
||||
sblock.e2fs_bsize, bp);
|
||||
|
||||
/* more sanity */
|
||||
|
@ -1346,7 +1346,7 @@ iput(struct ext2fs_dinode *ip, ino_t ino)
|
|||
errx(EXIT_FAILURE, "%s: inode %" PRIu64
|
||||
" already in use\n", __func__, (uint64_t)ino);
|
||||
setbit(bp, EXT2_INO_INDEX(ino));
|
||||
wtfs(fsbtodb(&sblock, gd[0].ext2bgd_i_bitmap),
|
||||
wtfs(EXT2_FSBTODB(&sblock, gd[0].ext2bgd_i_bitmap),
|
||||
sblock.e2fs_bsize, bp);
|
||||
gd[c].ext2bgd_nifree--;
|
||||
sblock.e2fs.e2fs_ficount--;
|
||||
|
@ -1357,7 +1357,7 @@ iput(struct ext2fs_dinode *ip, ino_t ino)
|
|||
").\n", __func__, (uint64_t)ino);
|
||||
|
||||
/* update an inode entry in the table */
|
||||
d = fsbtodb(&sblock, ino_to_fsba(&sblock, ino));
|
||||
d = EXT2_FSBTODB(&sblock, ino_to_fsba(&sblock, ino));
|
||||
rdfs(d, sblock.e2fs_bsize, bp);
|
||||
|
||||
dp = (struct ext2fs_dinode *)(bp +
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: resize_ffs.c,v 1.35 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: resize_ffs.c,v 1.36 2013/06/23 02:06:05 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.35 2013/06/19 17:51:26 dholland Exp $");
|
||||
__RCSID("$NetBSD: resize_ffs.c,v 1.36 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
@ -146,8 +146,8 @@ static unsigned char *iflags;
|
|||
/*
|
||||
* Number of disk sectors per block/fragment
|
||||
*/
|
||||
#define NSPB(fs) (fsbtodb((fs),1) << (fs)->fs_fragshift)
|
||||
#define NSPF(fs) (fsbtodb((fs),1))
|
||||
#define NSPB(fs) (FFS_FSBTODB((fs),1) << (fs)->fs_fragshift)
|
||||
#define NSPF(fs) (FFS_FSBTODB((fs),1))
|
||||
|
||||
/* global flags */
|
||||
int is_ufs2 = 0;
|
||||
|
@ -182,7 +182,7 @@ isplainfile(void)
|
|||
}
|
||||
/*
|
||||
* Read size bytes starting at blkno into buf. blkno is in DEV_BSIZE
|
||||
* units, ie, after fsbtodb(); size is in bytes.
|
||||
* units, ie, after FFS_FSBTODB(); size is in bytes.
|
||||
*/
|
||||
static void
|
||||
readat(off_t blkno, void *buf, int size)
|
||||
|
@ -222,7 +222,7 @@ readat(off_t blkno, void *buf, int size)
|
|||
}
|
||||
/*
|
||||
* Write size bytes from buf starting at blkno. blkno is in DEV_BSIZE
|
||||
* units, ie, after fsbtodb(); size is in bytes.
|
||||
* units, ie, after FFS_FSBTODB(); size is in bytes.
|
||||
*/
|
||||
static void
|
||||
writeat(off_t blkno, const void *buf, int size)
|
||||
|
@ -328,13 +328,13 @@ loadcgs(void)
|
|||
csums = nfmalloc(oldsb->fs_cssize, "cg summary");
|
||||
for (cg = 0; cg < oldsb->fs_ncg; cg++) {
|
||||
cgs[cg] = (struct cg *) cgp;
|
||||
readat(fsbtodb(oldsb, cgtod(oldsb, cg)), cgp, cgblksz);
|
||||
readat(FFS_FSBTODB(oldsb, cgtod(oldsb, cg)), cgp, cgblksz);
|
||||
if (needswap)
|
||||
ffs_cg_swap(cgs[cg],cgs[cg],oldsb);
|
||||
cgflags[cg] = 0;
|
||||
cgp += cgblksz;
|
||||
}
|
||||
readat(fsbtodb(oldsb, oldsb->fs_csaddr), csums, oldsb->fs_cssize);
|
||||
readat(FFS_FSBTODB(oldsb, oldsb->fs_csaddr), csums, oldsb->fs_cssize);
|
||||
if (needswap)
|
||||
ffs_csum_swap(csums,csums,oldsb->fs_cssize);
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ initcg(int cgn)
|
|||
newsb->fs_cstotal.cs_nifree += cg->cg_cs.cs_nifree;
|
||||
if (is_ufs2 == 0)
|
||||
/* Write out the cleared inodes. */
|
||||
writeat(fsbtodb(newsb, cgimin(newsb, cgn)), zinodes,
|
||||
writeat(FFS_FSBTODB(newsb, cgimin(newsb, cgn)), zinodes,
|
||||
newsb->fs_ipg * sizeof(*zinodes));
|
||||
/* Dirty the cg. */
|
||||
cgflags[cgn] |= CGF_DIRTY;
|
||||
|
@ -927,7 +927,7 @@ grow(void)
|
|||
zinodes = alloconce(newsb->fs_ipg * sizeof(*zinodes), "zeroed inodes");
|
||||
memset(zinodes, 0, newsb->fs_ipg * sizeof(*zinodes));
|
||||
/* Update the size. */
|
||||
newsb->fs_size = dbtofsb(newsb, newsize);
|
||||
newsb->fs_size = FFS_DBTOFSB(newsb, newsize);
|
||||
/* Did we actually not grow? (This can happen if newsize is less than
|
||||
* a frag larger than the old size - unlikely, but no excuse to
|
||||
* misbehave if it happens.) */
|
||||
|
@ -941,7 +941,7 @@ grow(void)
|
|||
* overwriting anything important by this. (The choice of sbbuf as
|
||||
* what to write is irrelevant; it's just something handy that's known
|
||||
* to be at least one frag in size.) */
|
||||
writeat(fsbtodb(newsb,newsb->fs_size - 1), &sbbuf, newsb->fs_fsize);
|
||||
writeat(FFS_FSBTODB(newsb,newsb->fs_size - 1), &sbbuf, newsb->fs_fsize);
|
||||
if (is_ufs2)
|
||||
newsb->fs_ncg = howmany(newsb->fs_size, newsb->fs_fpg);
|
||||
else {
|
||||
|
@ -963,7 +963,7 @@ grow(void)
|
|||
/ NSPF(newsb);
|
||||
printf("Warning: last cylinder group is too small;\n");
|
||||
printf(" dropping it. New size = %lu.\n",
|
||||
(unsigned long int) fsbtodb(newsb, newsb->fs_size));
|
||||
(unsigned long int) FFS_FSBTODB(newsb, newsb->fs_size));
|
||||
}
|
||||
/* Find out how big the csum area is, and realloc csums if bigger. */
|
||||
newsb->fs_cssize = fragroundup(newsb,
|
||||
|
@ -1089,7 +1089,7 @@ markiblk(mark_callback_t fn, union dinode * di, off_t bn, off_t o, int lev)
|
|||
return (i);
|
||||
}
|
||||
(*fn) (bn, newsb->fs_frag, newsb->fs_bsize, MDB_INDIR_PRE);
|
||||
readat(fsbtodb(newsb, bn), indirblks[lev], newsb->fs_bsize);
|
||||
readat(FFS_FSBTODB(newsb, bn), indirblks[lev], newsb->fs_bsize);
|
||||
if (needswap)
|
||||
for (k = 0; k < howmany(MAXBSIZE, sizeof(int32_t)); k++)
|
||||
indirblks[lev][k] = bswap32(indirblks[lev][k]);
|
||||
|
@ -1213,7 +1213,7 @@ loadinodes(void)
|
|||
dp1 = (struct ufs1_dinode *)ibuf;
|
||||
|
||||
for (ino = 0,imax = oldsb->fs_ipg * oldsb->fs_ncg; ino < imax; ) {
|
||||
readat(fsbtodb(oldsb, ino_to_fsba(oldsb, ino)), ibuf,
|
||||
readat(FFS_FSBTODB(oldsb, ino_to_fsba(oldsb, ino)), ibuf,
|
||||
oldsb->fs_bsize);
|
||||
|
||||
for (i = 0; i < oldsb->fs_inopb; i++) {
|
||||
|
@ -1385,9 +1385,9 @@ perform_data_move(void)
|
|||
((run > 0) &&
|
||||
(blkmove[i] != blkmove[i - 1] + 1))) {
|
||||
if (run > 0) {
|
||||
readat(fsbtodb(oldsb, i - run), &buf[0],
|
||||
readat(FFS_FSBTODB(oldsb, i - run), &buf[0],
|
||||
run << oldsb->fs_fshift);
|
||||
writeat(fsbtodb(oldsb, blkmove[i - run]),
|
||||
writeat(FFS_FSBTODB(oldsb, blkmove[i - run]),
|
||||
&buf[0], run << oldsb->fs_fshift);
|
||||
}
|
||||
run = 0;
|
||||
|
@ -1396,9 +1396,9 @@ perform_data_move(void)
|
|||
run++;
|
||||
}
|
||||
if (run > 0) {
|
||||
readat(fsbtodb(oldsb, i - run), &buf[0],
|
||||
readat(FFS_FSBTODB(oldsb, i - run), &buf[0],
|
||||
run << oldsb->fs_fshift);
|
||||
writeat(fsbtodb(oldsb, blkmove[i - run]), &buf[0],
|
||||
writeat(FFS_FSBTODB(oldsb, blkmove[i - run]), &buf[0],
|
||||
run << oldsb->fs_fshift);
|
||||
}
|
||||
}
|
||||
|
@ -1467,7 +1467,7 @@ moveindir_callback(off_t off, unsigned int nfrag, unsigned int nbytes,
|
|||
|
||||
if (kind == MDB_INDIR_PRE) {
|
||||
int32_t blk[howmany(MAXBSIZE, sizeof(int32_t))];
|
||||
readat(fsbtodb(oldsb, off), &blk[0], oldsb->fs_bsize);
|
||||
readat(FFS_FSBTODB(oldsb, off), &blk[0], oldsb->fs_bsize);
|
||||
if (needswap)
|
||||
for (i = 0; i < howmany(MAXBSIZE, sizeof(int32_t)); i++)
|
||||
blk[i] = bswap32(blk[i]);
|
||||
|
@ -1476,7 +1476,7 @@ moveindir_callback(off_t off, unsigned int nfrag, unsigned int nbytes,
|
|||
for (i = 0; i < howmany(MAXBSIZE,
|
||||
sizeof(int32_t)); i++)
|
||||
blk[i] = bswap32(blk[i]);
|
||||
writeat(fsbtodb(oldsb, off), &blk[0], oldsb->fs_bsize);
|
||||
writeat(FFS_FSBTODB(oldsb, off), &blk[0], oldsb->fs_bsize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1557,7 +1557,7 @@ flush_inodes(void)
|
|||
}
|
||||
}
|
||||
|
||||
writeat(fsbtodb(newsb, ino_to_fsba(newsb, i)),
|
||||
writeat(FFS_FSBTODB(newsb, ino_to_fsba(newsb, i)),
|
||||
ibuf, newsb->fs_bsize);
|
||||
}
|
||||
}
|
||||
|
@ -1653,9 +1653,9 @@ update_dir_data(off_t bn, unsigned int size, unsigned int nb, int kind)
|
|||
struct direct d;
|
||||
char ch[MAXBSIZE];
|
||||
} buf;
|
||||
readat(fsbtodb(oldsb, bn), &buf, size << oldsb->fs_fshift);
|
||||
readat(FFS_FSBTODB(oldsb, bn), &buf, size << oldsb->fs_fshift);
|
||||
if (update_dirents((char *) &buf, nb)) {
|
||||
writeat(fsbtodb(oldsb, bn), &buf,
|
||||
writeat(FFS_FSBTODB(oldsb, bn), &buf,
|
||||
size << oldsb->fs_fshift);
|
||||
}
|
||||
}
|
||||
|
@ -1690,7 +1690,7 @@ shrink(void)
|
|||
/* Update the timestamp. */
|
||||
newsb->fs_time = timestamp();
|
||||
/* Update the size figures. */
|
||||
newsb->fs_size = dbtofsb(newsb, newsize);
|
||||
newsb->fs_size = FFS_DBTOFSB(newsb, newsize);
|
||||
if (is_ufs2)
|
||||
newsb->fs_ncg = howmany(newsb->fs_size, newsb->fs_fpg);
|
||||
else {
|
||||
|
@ -1711,7 +1711,7 @@ shrink(void)
|
|||
|
||||
printf("Warning: last cylinder group is too small;\n");
|
||||
printf(" dropping it. New size = %lu.\n",
|
||||
(unsigned long int) fsbtodb(newsb, newsb->fs_size));
|
||||
(unsigned long int) FFS_FSBTODB(newsb, newsb->fs_size));
|
||||
}
|
||||
/* Let's make sure we're not being shrunk into oblivion. */
|
||||
if (newsb->fs_ncg < 1)
|
||||
|
@ -1980,13 +1980,13 @@ flush_cgs(void)
|
|||
cgs[i]->cg_irotor = 0;
|
||||
if (needswap)
|
||||
ffs_cg_swap(cgs[i],cgs[i],newsb);
|
||||
writeat(fsbtodb(newsb, cgtod(newsb, i)), cgs[i],
|
||||
writeat(FFS_FSBTODB(newsb, cgtod(newsb, i)), cgs[i],
|
||||
cgblksz);
|
||||
}
|
||||
}
|
||||
if (needswap)
|
||||
ffs_csum_swap(csums,csums,newsb->fs_cssize);
|
||||
writeat(fsbtodb(newsb, newsb->fs_csaddr), csums, newsb->fs_cssize);
|
||||
writeat(FFS_FSBTODB(newsb, newsb->fs_csaddr), csums, newsb->fs_cssize);
|
||||
}
|
||||
/*
|
||||
* Write the superblock, both to the main superblock and to each cg's
|
||||
|
@ -2016,7 +2016,7 @@ write_sbs(void)
|
|||
ffs_sb_swap(newsb,newsb);
|
||||
writeat(where / DEV_BSIZE, newsb, SBLOCKSIZE);
|
||||
for (i = 0; i < oldsb->fs_ncg; i++) {
|
||||
writeat(fsbtodb(oldsb, cgsblock(oldsb, i)), newsb, SBLOCKSIZE);
|
||||
writeat(FFS_FSBTODB(oldsb, cgsblock(oldsb, i)), newsb, SBLOCKSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2164,9 +2164,9 @@ main(int argc, char **argv)
|
|||
* just once, so being generous is cheap. */
|
||||
memcpy(newsb, oldsb, SBLOCKSIZE);
|
||||
loadcgs();
|
||||
if (newsize > fsbtodb(oldsb, oldsb->fs_size)) {
|
||||
if (newsize > FFS_FSBTODB(oldsb, oldsb->fs_size)) {
|
||||
grow();
|
||||
} else if (newsize < fsbtodb(oldsb, oldsb->fs_size)) {
|
||||
} else if (newsize < FFS_FSBTODB(oldsb, oldsb->fs_size)) {
|
||||
if (is_ufs2)
|
||||
errx(EXIT_FAILURE,"shrinking not supported for ufs2");
|
||||
shrink();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: scan_ffs.c,v 1.22 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: scan_ffs.c,v 1.23 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005-2007 Juan Romero Pardines
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: scan_ffs.c,v 1.22 2013/06/19 17:51:26 dholland Exp $");
|
||||
__RCSID("$NetBSD: scan_ffs.c,v 1.23 2013/06/23 02:06:05 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -49,9 +49,6 @@ __RCSID("$NetBSD: scan_ffs.c,v 1.22 2013/06/19 17:51:26 dholland Exp $");
|
|||
#include <ufs/lfs/lfs_extern.h>
|
||||
|
||||
/* Undefine macros defined by both lfs/lfs.h and ffs/fs.h */
|
||||
#undef fsbtodb
|
||||
#undef dbtofsb
|
||||
#undef blkoff
|
||||
#undef lblktosize
|
||||
#undef lblkno
|
||||
#undef numfrags
|
||||
|
@ -66,9 +63,6 @@ __RCSID("$NetBSD: scan_ffs.c,v 1.22 2013/06/19 17:51:26 dholland Exp $");
|
|||
|
||||
/* Undefine macros defined by both lfs/lfs.h and ffs/fs.h */
|
||||
/* ...to make sure we don't later depend on their (ambigious) definition */
|
||||
#undef fsbtodb
|
||||
#undef dbtofsb
|
||||
#undef blkoff
|
||||
#undef lblktosize
|
||||
#undef lblkno
|
||||
#undef numfrags
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tunefs.c,v 1.45 2012/04/07 04:52:21 christos Exp $ */
|
||||
/* $NetBSD: tunefs.c,v 1.46 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)tunefs.c 8.3 (Berkeley) 5/3/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: tunefs.c,v 1.45 2012/04/07 04:52:21 christos Exp $");
|
||||
__RCSID("$NetBSD: tunefs.c,v 1.46 2013/06/23 02:06:05 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -332,7 +332,7 @@ main(int argc, char *argv[])
|
|||
bwrite(sblockloc, buf, SBLOCKSIZE, special);
|
||||
if (Aflag)
|
||||
for (i = 0; i < sblock.fs_ncg; i++)
|
||||
bwrite(fsbtodb(&sblock, cgsblock(&sblock, i)),
|
||||
bwrite(FFS_FSBTODB(&sblock, cgsblock(&sblock, i)),
|
||||
buf, SBLOCKSIZE, special);
|
||||
close(fi);
|
||||
exit(0);
|
||||
|
@ -517,7 +517,7 @@ getsb(struct fs *fs, const char *file)
|
|||
break;
|
||||
}
|
||||
|
||||
dev_bsize = fs->fs_fsize / fsbtodb(fs, 1);
|
||||
dev_bsize = fs->fs_fsize / FFS_FSBTODB(fs, 1);
|
||||
sblockloc = sblock_try[i] / dev_bsize;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: readufs_ffs.c,v 1.6 2011/02/21 02:31:57 itohy Exp $ */
|
||||
/* $NetBSD: readufs_ffs.c,v 1.7 2013/06/23 02:06:05 dholland Exp $ */
|
||||
/* from Id: readufs_ffs.c,v 1.8 2004/06/12 04:26:39 itohy Exp */
|
||||
|
||||
/*
|
||||
|
@ -128,7 +128,7 @@ get_ffs_inode(ino32_t ino, union ufs_dinode *dibuf)
|
|||
union ufs_dinode *di;
|
||||
unsigned ioff;
|
||||
|
||||
RAW_READ(buf, fsbtodb(&fsi, ino_to_fsba(&fsi, ino)),
|
||||
RAW_READ(buf, FFS_FSBTODB(&fsi, ino_to_fsba(&fsi, ino)),
|
||||
(size_t) fsi.bsize);
|
||||
|
||||
ioff = ino_to_fsbo(&fsi, ino);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: installboot.c,v 1.17 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: installboot.c,v 1.18 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -294,7 +294,7 @@ loadblocknums(char *boot, int devfd)
|
|||
if ((buf = malloc(fs->fs_bsize)) == NULL)
|
||||
errx(1, "No memory for filesystem block");
|
||||
|
||||
blk = fsbtodb(fs, ino_to_fsba(fs, statbuf.st_ino));
|
||||
blk = FFS_FSBTODB(fs, ino_to_fsba(fs, statbuf.st_ino));
|
||||
devread(devfd, buf, blk, fs->fs_bsize, "inode");
|
||||
ip = (struct ufs1_dinode *)(buf) + ino_to_fsbo(fs, statbuf.st_ino);
|
||||
|
||||
|
@ -315,7 +315,7 @@ loadblocknums(char *boot, int devfd)
|
|||
*/
|
||||
ap = ip->di_db;
|
||||
for (i = 0; i < UFS_NDADDR && *ap && ndb; i++, ap++, ndb--) {
|
||||
blk = fsbtodb(fs, *ap);
|
||||
blk = FFS_FSBTODB(fs, *ap);
|
||||
if (verbose)
|
||||
printf("%d: %d\n", i, blk);
|
||||
block_table[i] = blk;
|
||||
|
@ -327,12 +327,12 @@ loadblocknums(char *boot, int devfd)
|
|||
* Just one level of indirections; there isn't much room
|
||||
* for more in the 1st-level bootblocks anyway.
|
||||
*/
|
||||
blk = fsbtodb(fs, ip->di_ib[0]);
|
||||
blk = FFS_FSBTODB(fs, ip->di_ib[0]);
|
||||
devread(devfd, buf, blk, fs->fs_bsize, "indirect block");
|
||||
/* XXX ondisk32 */
|
||||
ap = (int32_t *)buf;
|
||||
for (; i < FFS_NINDIR(fs) && *ap && ndb; i++, ap++, ndb--) {
|
||||
blk = fsbtodb(fs, *ap);
|
||||
blk = FFS_FSBTODB(fs, *ap);
|
||||
if (verbose)
|
||||
printf("%d: %d\n", i, blk);
|
||||
block_table[i] = blk;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: readufs_ffs.c,v 1.13 2011/02/21 02:31:58 itohy Exp $ */
|
||||
/* $NetBSD: readufs_ffs.c,v 1.14 2013/06/23 02:06:05 dholland Exp $ */
|
||||
/* from Id: readufs_ffs.c,v 1.6 2003/04/08 09:19:32 itohy Exp */
|
||||
|
||||
/*
|
||||
|
@ -129,7 +129,7 @@ get_ffs_inode(ino32_t ino, union ufs_dinode *dibuf)
|
|||
union ufs_dinode *di;
|
||||
unsigned ioff;
|
||||
|
||||
RAW_READ(buf, fsbtodb(&fsi, ino_to_fsba(&fsi, ino)),
|
||||
RAW_READ(buf, FFS_FSBTODB(&fsi, ino_to_fsba(&fsi, ino)),
|
||||
(size_t) fsi.bsize);
|
||||
|
||||
ioff = ino_to_fsbo(&fsi, ino);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs.c,v 1.16 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ext2fs.c,v 1.17 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer.
|
||||
|
@ -115,7 +115,7 @@
|
|||
#endif
|
||||
typedef uint32_t ino32_t;
|
||||
#ifndef FSBTODB
|
||||
#define FSBTODB(fs, indp) fsbtodb(fs, indp)
|
||||
#define FSBTODB(fs, indp) EXT2_FSBTODB(fs, indp)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: minixfs3.c,v 1.3 2013/06/19 18:18:12 dholland Exp $ */
|
||||
/* $NetBSD: minixfs3.c,v 1.4 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2012
|
||||
|
@ -138,7 +138,7 @@
|
|||
|
||||
typedef uint32_t ino32_t;
|
||||
#ifndef FSBTODB
|
||||
#define FSBTODB(fs, indp) fsbtodb(fs, indp)
|
||||
#define FSBTODB(fs, indp) MFS_FSBTODB(fs, indp)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: minixfs3.h,v 1.3 2013/06/19 18:18:12 dholland Exp $ */
|
||||
/* $NetBSD: minixfs3.h,v 1.4 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2012
|
||||
|
@ -117,7 +117,7 @@ struct mfs_sblock {
|
|||
#define NO_BLOCK ((block_t) 0) /* absence of a block number */
|
||||
|
||||
/* Turn file system block numbers into disk block addresses */
|
||||
#define fsbtodb(fs, b) ((b) << (fs)->mfs_fsbtodb)
|
||||
#define MFS_FSBTODB(fs, b) ((b) << (fs)->mfs_fsbtodb)
|
||||
|
||||
#define ino_to_fsba(fs, x) \
|
||||
(((x) - 1) / (fs)->mfs_inodes_per_block + \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ufs.c,v 1.61 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ufs.c,v 1.62 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
@ -138,7 +138,7 @@ struct fs {
|
|||
typedef uint32_t ino32_t;
|
||||
|
||||
#ifndef FSBTODB
|
||||
#define FSBTODB(fs, indp) fsbtodb(fs, indp)
|
||||
#define FSBTODB(fs, indp) FFS_FSBTODB(fs, indp)
|
||||
#endif
|
||||
#ifndef UFS_NINDIR
|
||||
#define UFS_NINDIR FFS_NINDIR
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs.h,v 1.34 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ext2fs.h,v 1.35 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -362,8 +362,8 @@ void e2fs_cg_bswap(struct ext2_gd *, struct ext2_gd *, int);
|
|||
* Turn file system block numbers into disk block addresses.
|
||||
* This maps file system blocks to device size blocks.
|
||||
*/
|
||||
#define fsbtodb(fs, b) ((b) << (fs)->e2fs_fsbtodb)
|
||||
#define dbtofsb(fs, b) ((b) >> (fs)->e2fs_fsbtodb)
|
||||
#define EXT2_FSBTODB(fs, b) ((b) << (fs)->e2fs_fsbtodb)
|
||||
#define EXT2_DBTOFSB(fs, b) ((b) >> (fs)->e2fs_fsbtodb)
|
||||
|
||||
/*
|
||||
* Macros for handling inode numbers:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_alloc.c,v 1.44 2012/12/20 08:03:44 hannken Exp $ */
|
||||
/* $NetBSD: ext2fs_alloc.c,v 1.45 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.44 2012/12/20 08:03:44 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_alloc.c,v 1.45 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -355,7 +355,7 @@ ext2fs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
|
|||
fs = ip->i_e2fs;
|
||||
if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0)
|
||||
return (0);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs,
|
||||
error = bread(ip->i_devvp, EXT2_FSBTODB(fs,
|
||||
fs->e2fs_gd[cg].ext2bgd_b_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
|
@ -441,7 +441,7 @@ ext2fs_nodealloccg(struct inode *ip, int cg, daddr_t ipref, int mode)
|
|||
fs = ip->i_e2fs;
|
||||
if (fs->e2fs_gd[cg].ext2bgd_nifree == 0)
|
||||
return (0);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs,
|
||||
error = bread(ip->i_devvp, EXT2_FSBTODB(fs,
|
||||
fs->e2fs_gd[cg].ext2bgd_i_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
|
@ -509,7 +509,7 @@ ext2fs_blkfree(struct inode *ip, daddr_t bno)
|
|||
return;
|
||||
}
|
||||
error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
|
||||
EXT2_FSBTODB(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
return;
|
||||
|
@ -552,7 +552,7 @@ ext2fs_vfree(struct vnode *pvp, ino_t ino, int mode)
|
|||
fs->e2fs_fsmnt);
|
||||
cg = ino_to_cg(fs, ino);
|
||||
error = bread(pip->i_devvp,
|
||||
fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap),
|
||||
EXT2_FSBTODB(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap),
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
return (0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_balloc.c,v 1.37 2013/01/22 09:39:15 dholland Exp $ */
|
||||
/* $NetBSD: ext2fs_balloc.c,v 1.38 2013/06/23 02:06:05 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.37 2013/01/22 09:39:15 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_balloc.c,v 1.38 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_uvmhist.h"
|
||||
|
@ -155,7 +155,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
|||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
if (bpp != NULL) {
|
||||
bp = getblk(vp, bn, fs->e2fs_bsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
bp->b_blkno = EXT2_FSBTODB(fs, newb);
|
||||
if (flags & B_CLRBUF)
|
||||
clrbuf(bp);
|
||||
*bpp = bp;
|
||||
|
@ -189,7 +189,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
|||
*allocblk++ = nb;
|
||||
ip->i_e2fs_last_blk = newb;
|
||||
bp = getblk(vp, indirs[1].in_lbn, fs->e2fs_bsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
bp->b_blkno = EXT2_FSBTODB(fs, newb);
|
||||
clrbuf(bp);
|
||||
/*
|
||||
* Write synchronously so that indirect blocks
|
||||
|
@ -231,7 +231,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
|||
*allocblk++ = nb;
|
||||
ip->i_e2fs_last_blk = newb;
|
||||
nbp = getblk(vp, indirs[i].in_lbn, fs->e2fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
nbp->b_blkno = EXT2_FSBTODB(fs, nb);
|
||||
clrbuf(nbp);
|
||||
/*
|
||||
* Write synchronously so that indirect blocks
|
||||
|
@ -282,7 +282,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
|||
}
|
||||
if (bpp != NULL) {
|
||||
nbp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
nbp->b_blkno = EXT2_FSBTODB(fs, nb);
|
||||
if (flags & B_CLRBUF)
|
||||
clrbuf(nbp);
|
||||
*bpp = nbp;
|
||||
|
@ -299,7 +299,7 @@ ext2fs_balloc(struct inode *ip, daddr_t bn, int size,
|
|||
}
|
||||
} else {
|
||||
nbp = getblk(vp, lbn, fs->e2fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
nbp->b_blkno = EXT2_FSBTODB(fs, nb);
|
||||
}
|
||||
*bpp = nbp;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_inode.c,v 1.79 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ext2fs_inode.c,v 1.80 2013/06/23 02:06:05 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.79 2013/06/19 17:51:26 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.80 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -146,7 +146,7 @@ ext2fs_nblock(struct inode *ip)
|
|||
nblock |= (uint64_t)ip->i_e2fs_nblock_high << 32;
|
||||
|
||||
if ((ip->i_e2fs_flags & EXT2_HUGE_FILE)) {
|
||||
nblock = fsbtodb(fs, nblock);
|
||||
nblock = EXT2_FSBTODB(fs, nblock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,10 +174,10 @@ ext2fs_setnblock(struct inode *ip, uint64_t nblock)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (dbtofsb(fs, nblock) <= 0xffffffffffffULL) {
|
||||
if (EXT2_DBTOFSB(fs, nblock) <= 0xffffffffffffULL) {
|
||||
SET(ip->i_e2fs_flags, EXT2_HUGE_FILE);
|
||||
ip->i_e2fs_nblock = dbtofsb(fs, nblock) & 0xffffffff;
|
||||
ip->i_e2fs_nblock_high = (dbtofsb(fs, nblock) >> 32) & 0xffff;
|
||||
ip->i_e2fs_nblock = EXT2_DBTOFSB(fs, nblock) & 0xffffffff;
|
||||
ip->i_e2fs_nblock_high = (EXT2_DBTOFSB(fs, nblock) >> 32) & 0xffff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ ext2fs_update(struct vnode *vp, const struct timespec *acc,
|
|||
fs = ip->i_e2fs;
|
||||
|
||||
error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
EXT2_FSBTODB(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->e2fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
return (error);
|
||||
|
@ -435,7 +435,7 @@ ext2fs_truncate(struct vnode *ovp, off_t length, int ioflag,
|
|||
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);
|
||||
EXT2_FSBTODB(fs, bn), lastiblock[level], level, &count);
|
||||
if (error)
|
||||
allerror = error;
|
||||
blocksreleased += count;
|
||||
|
@ -577,7 +577,7 @@ ext2fs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, daddr_t lastbn,
|
|||
if (nb == 0)
|
||||
continue;
|
||||
if (level > SINGLE) {
|
||||
error = ext2fs_indirtrunc(ip, nlbn, fsbtodb(fs, nb),
|
||||
error = ext2fs_indirtrunc(ip, nlbn, EXT2_FSBTODB(fs, nb),
|
||||
(daddr_t)-1, level - 1,
|
||||
&blkcount);
|
||||
if (error)
|
||||
|
@ -596,7 +596,7 @@ ext2fs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, daddr_t lastbn,
|
|||
/* XXX ondisk32 */
|
||||
nb = fs2h32(bap[i]);
|
||||
if (nb != 0) {
|
||||
error = ext2fs_indirtrunc(ip, nlbn, fsbtodb(fs, nb),
|
||||
error = ext2fs_indirtrunc(ip, nlbn, EXT2_FSBTODB(fs, nb),
|
||||
last, level - 1, &blkcount);
|
||||
if (error)
|
||||
allerror = error;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_vfsops.c,v 1.170 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ext2fs_vfsops.c,v 1.171 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.170 2013/06/19 17:51:26 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.171 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -581,7 +581,7 @@ ext2fs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
|
|||
|
||||
for (i = 0; i < fs->e2fs_ngdb; i++) {
|
||||
error = bread(devvp ,
|
||||
fsbtodb(fs, fs->e2fs.e2fs_first_dblock +
|
||||
EXT2_FSBTODB(fs, fs->e2fs.e2fs_first_dblock +
|
||||
1 /* superblock */ + i),
|
||||
fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
|
@ -629,7 +629,7 @@ loop:
|
|||
* Step 6: re-read inode data for all active vnodes.
|
||||
*/
|
||||
ip = VTOI(vp);
|
||||
error = bread(devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
error = bread(devvp, EXT2_FSBTODB(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
|
@ -728,7 +728,7 @@ ext2fs_mountfs(struct vnode *devvp, struct mount *mp)
|
|||
m_fs->e2fs_gd = kmem_alloc(m_fs->e2fs_ngdb * m_fs->e2fs_bsize, KM_SLEEP);
|
||||
for (i = 0; i < m_fs->e2fs_ngdb; i++) {
|
||||
error = bread(devvp ,
|
||||
fsbtodb(m_fs, m_fs->e2fs.e2fs_first_dblock +
|
||||
EXT2_FSBTODB(m_fs, m_fs->e2fs.e2fs_first_dblock +
|
||||
1 /* superblock */ + i),
|
||||
m_fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
|
@ -1047,7 +1047,7 @@ retry:
|
|||
mutex_exit(&ufs_hashlock);
|
||||
|
||||
/* Read in the disk contents for the inode, copy into the inode. */
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
|
||||
error = bread(ump->um_devvp, EXT2_FSBTODB(fs, ino_to_fsba(fs, ino)),
|
||||
(int)fs->e2fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ ext2fs_cgupdate(struct ufsmount *mp, int waitfor)
|
|||
|
||||
allerror = ext2fs_sbupdate(mp, waitfor);
|
||||
for (i = 0; i < fs->e2fs_ngdb; i++) {
|
||||
bp = getblk(mp->um_devvp, fsbtodb(fs,
|
||||
bp = getblk(mp->um_devvp, EXT2_FSBTODB(fs,
|
||||
fs->e2fs.e2fs_first_dblock +
|
||||
1 /* superblock */ + i), fs->e2fs_bsize, 0, 0);
|
||||
e2fs_cgsave(&fs->e2fs_gd[
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_alloc.c,v 1.135 2013/06/19 18:02:21 dholland Exp $ */
|
||||
/* $NetBSD: ffs_alloc.c,v 1.136 2013/06/23 02:06:05 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.135 2013/06/19 18:02:21 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.136 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -402,7 +402,7 @@ ffs_realloccg(struct inode *ip, daddr_t lbprev, daddr_t bpref, int osize,
|
|||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
|
||||
if (bpp != NULL) {
|
||||
if (bp->b_blkno != fsbtodb(fs, bno))
|
||||
if (bp->b_blkno != FFS_FSBTODB(fs, bno))
|
||||
panic("bad blockno");
|
||||
allocbuf(bp, nsize, 1);
|
||||
memset((char *)bp->b_data + osize, 0, nsize - osize);
|
||||
|
@ -480,7 +480,7 @@ ffs_realloccg(struct inode *ip, daddr_t lbprev, daddr_t bpref, int osize,
|
|||
if ((ip->i_ump->um_mountp->mnt_wapbl) &&
|
||||
(ITOV(ip)->v_type != VREG)) {
|
||||
UFS_WAPBL_REGISTER_DEALLOCATION(
|
||||
ip->i_ump->um_mountp, fsbtodb(fs, bprev),
|
||||
ip->i_ump->um_mountp, FFS_FSBTODB(fs, bprev),
|
||||
osize);
|
||||
} else {
|
||||
ffs_blkfree(fs, ip->i_devvp, bprev, (long)osize,
|
||||
|
@ -491,7 +491,7 @@ ffs_realloccg(struct inode *ip, daddr_t lbprev, daddr_t bpref, int osize,
|
|||
(ITOV(ip)->v_type != VREG)) {
|
||||
UFS_WAPBL_REGISTER_DEALLOCATION(
|
||||
ip->i_ump->um_mountp,
|
||||
fsbtodb(fs, (bno + numfrags(fs, nsize))),
|
||||
FFS_FSBTODB(fs, (bno + numfrags(fs, nsize))),
|
||||
request - nsize);
|
||||
} else
|
||||
ffs_blkfree(fs, ip->i_devvp,
|
||||
|
@ -501,7 +501,7 @@ ffs_realloccg(struct inode *ip, daddr_t lbprev, daddr_t bpref, int osize,
|
|||
DIP_ADD(ip, blocks, btodb(nsize - osize));
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
if (bpp != NULL) {
|
||||
bp->b_blkno = fsbtodb(fs, bno);
|
||||
bp->b_blkno = FFS_FSBTODB(fs, bno);
|
||||
allocbuf(bp, nsize, 1);
|
||||
memset((char *)bp->b_data + osize, 0, (u_int)nsize - osize);
|
||||
mutex_enter(bp->b_objlock);
|
||||
|
@ -627,7 +627,7 @@ ffs_valloc(struct vnode *pvp, int mode, kauth_cred_t cred,
|
|||
printf("ino %llu ipref %llu\n", (unsigned long long)ino,
|
||||
(unsigned long long)ipref);
|
||||
#if 0
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
|
||||
error = bread(ump->um_devvp, FFS_FSBTODB(fs, ino_to_fsba(fs, ino)),
|
||||
(int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
#endif
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ ffs_fragextend(struct inode *ip, int cg, daddr_t bprev, int osize, int nsize)
|
|||
return (0);
|
||||
}
|
||||
mutex_exit(&ump->um_lock);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ip->i_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
@ -1103,7 +1103,7 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size, int flags)
|
|||
if (fs->fs_cs(fs, cg).cs_nbfree == 0 && size == fs->fs_bsize)
|
||||
return (0);
|
||||
mutex_exit(&ump->um_lock);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ip->i_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
@ -1303,7 +1303,7 @@ ffs_nodealloccg(struct inode *ip, int cg, daddr_t ipref, int mode, int flags)
|
|||
ibp = NULL;
|
||||
initediblk = -1;
|
||||
retry:
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ip->i_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
@ -1332,7 +1332,7 @@ retry:
|
|||
*/
|
||||
brelse(bp, 0);
|
||||
bp = NULL;
|
||||
error = ffs_getblk(ip->i_devvp, fsbtodb(fs,
|
||||
error = ffs_getblk(ip->i_devvp, FFS_FSBTODB(fs,
|
||||
ino_to_fsba(fs, cg * fs->fs_ipg + initediblk)),
|
||||
FFS_NOBLK, fs->fs_bsize, false, &ibp);
|
||||
if (error)
|
||||
|
@ -1464,7 +1464,7 @@ ffs_blkalloc_ump(struct ufsmount *ump, daddr_t bno, long size)
|
|||
KASSERT(bno < fs->fs_size);
|
||||
|
||||
cg = dtog(fs, bno);
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ump->um_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
return error;
|
||||
|
@ -1572,7 +1572,7 @@ ffs_blkfree_cg(struct fs *fs, struct vnode *devvp, daddr_t bno, long size)
|
|||
dev = devvp->v_rdev;
|
||||
ump = VFSTOUFS(devvp->v_specmountpoint);
|
||||
KASSERT(fs == ump->um_fs);
|
||||
cgblkno = fsbtodb(fs, cgtod(fs, cg));
|
||||
cgblkno = FFS_FSBTODB(fs, cgtod(fs, cg));
|
||||
|
||||
error = bread(devvp, cgblkno, (int)fs->fs_cgsize,
|
||||
NOCRED, B_MODIFY, &bp);
|
||||
|
@ -1632,7 +1632,7 @@ ffs_discardcb(struct work *wk, void *arg)
|
|||
struct disk_discard_range ta;
|
||||
int error;
|
||||
|
||||
ta.bno = fsbtodb(fs, td->bno);
|
||||
ta.bno = FFS_FSBTODB(fs, td->bno);
|
||||
ta.size = td->size >> DEV_BSHIFT;
|
||||
error = VOP_IOCTL(td->devvp, DIOCDISCARD, &ta, FWRITE, FSCRED);
|
||||
#ifdef TRIMDEBUG
|
||||
|
@ -1999,7 +1999,7 @@ ffs_freefile(struct mount *mp, ino_t ino, int mode)
|
|||
cg = ino_to_cg(fs, ino);
|
||||
devvp = ump->um_devvp;
|
||||
dev = devvp->v_rdev;
|
||||
cgbno = fsbtodb(fs, cgtod(fs, cg));
|
||||
cgbno = FFS_FSBTODB(fs, cgtod(fs, cg));
|
||||
|
||||
if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg)
|
||||
panic("ifree: range: dev = 0x%llx, ino = %llu, fs = %s",
|
||||
|
@ -2127,7 +2127,7 @@ ffs_checkfreefile(struct fs *fs, struct vnode *devvp, ino_t ino)
|
|||
if (devvp_is_snapshot)
|
||||
cgbno = fragstoblks(fs, cgtod(fs, cg));
|
||||
else
|
||||
cgbno = fsbtodb(fs, cgtod(fs, cg));
|
||||
cgbno = FFS_FSBTODB(fs, cgtod(fs, cg));
|
||||
if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg)
|
||||
return 1;
|
||||
if (bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, 0, &bp)) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_balloc.c,v 1.57 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ffs_balloc.c,v 1.58 2013/06/23 02:06:05 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.57 2013/06/19 17:51:26 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_balloc.c,v 1.58 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
|
@ -241,7 +241,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
if (error)
|
||||
return (error);
|
||||
if (bpp != NULL) {
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, newb),
|
||||
error = ffs_getblk(vp, lbn, FFS_FSBTODB(fs, newb),
|
||||
nsize, (flags & B_CLRBUF) != 0, bpp);
|
||||
if (error)
|
||||
return error;
|
||||
|
@ -277,7 +277,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
goto fail;
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
error = ffs_getblk(vp, indirs[1].in_lbn, fsbtodb(fs, nb),
|
||||
error = ffs_getblk(vp, indirs[1].in_lbn, FFS_FSBTODB(fs, nb),
|
||||
fs->fs_bsize, true, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
@ -332,7 +332,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
}
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
error = ffs_getblk(vp, indirs[i].in_lbn, fsbtodb(fs, nb),
|
||||
error = ffs_getblk(vp, indirs[i].in_lbn, FFS_FSBTODB(fs, nb),
|
||||
fs->fs_bsize, true, &nbp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
|
@ -389,7 +389,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
if (bpp != NULL) {
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, nb),
|
||||
error = ffs_getblk(vp, lbn, FFS_FSBTODB(fs, nb),
|
||||
fs->fs_bsize, (flags & B_CLRBUF) != 0, bpp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
|
@ -422,7 +422,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
goto fail;
|
||||
}
|
||||
} else {
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, nb),
|
||||
error = ffs_getblk(vp, lbn, FFS_FSBTODB(fs, nb),
|
||||
fs->fs_bsize, true, &nbp);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
@ -454,8 +454,8 @@ fail:
|
|||
fs->fs_bsize, false, &bp) != 0)
|
||||
continue;
|
||||
if (bp->b_oflags & BO_DELWRI) {
|
||||
nb = fsbtodb(fs, cgtod(fs, dtog(fs,
|
||||
dbtofsb(fs, bp->b_blkno))));
|
||||
nb = FFS_FSBTODB(fs, cgtod(fs, dtog(fs,
|
||||
FFS_DBTOFSB(fs, bp->b_blkno))));
|
||||
bwrite(bp);
|
||||
if (ffs_getblk(ip->i_devvp, nb, FFS_NOBLK,
|
||||
fs->fs_cgsize, false, &bp) != 0)
|
||||
|
@ -572,7 +572,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
if (error)
|
||||
return (error);
|
||||
dp->di_extsize = smalllblktosize(fs, nb + 1);
|
||||
dp->di_extb[nb] = dbtofsb(fs, bp->b_blkno);
|
||||
dp->di_extb[nb] = FFS_DBTOFSB(fs, bp->b_blkno);
|
||||
bp->b_xflags |= BX_ALTDATA;
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
if (flags & IO_SYNC)
|
||||
|
@ -594,7 +594,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
return (error);
|
||||
}
|
||||
mutex_enter(&bp->b_interlock);
|
||||
bp->b_blkno = fsbtodb(fs, nb);
|
||||
bp->b_blkno = FFS_FSBTODB(fs, nb);
|
||||
bp->b_xflags |= BX_ALTDATA;
|
||||
mutex_exit(&bp->b_interlock);
|
||||
*bpp = bp;
|
||||
|
@ -613,7 +613,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
return (error);
|
||||
}
|
||||
mutex_enter(&bp->b_interlock);
|
||||
bp->b_blkno = fsbtodb(fs, nb);
|
||||
bp->b_blkno = FFS_FSBTODB(fs, nb);
|
||||
bp->b_xflags |= BX_ALTDATA;
|
||||
mutex_exit(&bp->b_interlock);
|
||||
} else {
|
||||
|
@ -639,13 +639,13 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
nsize, flags, cred, &newb);
|
||||
if (error)
|
||||
return (error);
|
||||
error = ffs_getblk(vp, -1 - lbn, fsbtodb(fs, newb),
|
||||
error = ffs_getblk(vp, -1 - lbn, FFS_FSBTODB(fs, newb),
|
||||
nsize, (flags & BA_CLRBUF) != 0, &bp);
|
||||
if (error)
|
||||
return error;
|
||||
bp->b_xflags |= BX_ALTDATA;
|
||||
}
|
||||
dp->di_extb[lbn] = dbtofsb(fs, bp->b_blkno);
|
||||
dp->di_extb[lbn] = FFS_DBTOFSB(fs, bp->b_blkno);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
*bpp = bp;
|
||||
return (0);
|
||||
|
@ -764,7 +764,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
if (error)
|
||||
return (error);
|
||||
if (bpp != NULL) {
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, newb),
|
||||
error = ffs_getblk(vp, lbn, FFS_FSBTODB(fs, newb),
|
||||
nsize, (flags & B_CLRBUF) != 0, bpp);
|
||||
if (error)
|
||||
return error;
|
||||
|
@ -800,7 +800,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
goto fail;
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
error = ffs_getblk(vp, indirs[1].in_lbn, fsbtodb(fs, nb),
|
||||
error = ffs_getblk(vp, indirs[1].in_lbn, FFS_FSBTODB(fs, nb),
|
||||
fs->fs_bsize, true, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
@ -855,7 +855,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
}
|
||||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
error = ffs_getblk(vp, indirs[i].in_lbn, fsbtodb(fs, nb),
|
||||
error = ffs_getblk(vp, indirs[i].in_lbn, FFS_FSBTODB(fs, nb),
|
||||
fs->fs_bsize, true, &nbp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
|
@ -912,7 +912,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
if (bpp != NULL) {
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, nb),
|
||||
error = ffs_getblk(vp, lbn, FFS_FSBTODB(fs, nb),
|
||||
fs->fs_bsize, (flags & B_CLRBUF) != 0, bpp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
|
@ -945,7 +945,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t off, int size, kauth_cred_t cred,
|
|||
goto fail;
|
||||
}
|
||||
} else {
|
||||
error = ffs_getblk(vp, lbn, fsbtodb(fs, nb),
|
||||
error = ffs_getblk(vp, lbn, FFS_FSBTODB(fs, nb),
|
||||
fs->fs_bsize, true, &nbp);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
@ -977,8 +977,8 @@ fail:
|
|||
fs->fs_bsize, false, &bp) != 0)
|
||||
continue;
|
||||
if (bp->b_oflags & BO_DELWRI) {
|
||||
nb = fsbtodb(fs, cgtod(fs, dtog(fs,
|
||||
dbtofsb(fs, bp->b_blkno))));
|
||||
nb = FFS_FSBTODB(fs, cgtod(fs, dtog(fs,
|
||||
FFS_DBTOFSB(fs, bp->b_blkno))));
|
||||
bwrite(bp);
|
||||
if (ffs_getblk(ip->i_devvp, nb, FFS_NOBLK,
|
||||
fs->fs_cgsize, false, &bp) != 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_inode.c,v 1.113 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ffs_inode.c,v 1.114 2013/06/23 02:06:05 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.113 2013/06/19 17:51:26 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.114 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -148,7 +148,7 @@ ffs_update(struct vnode *vp, const struct timespec *acc,
|
|||
ip->i_ffs1_ogid = ip->i_gid; /* XXX */
|
||||
} /* XXX */
|
||||
error = bread(ip->i_devvp,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
FFS_FSBTODB(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->fs_bsize, NOCRED, B_MODIFY, &bp);
|
||||
if (error) {
|
||||
return (error);
|
||||
|
@ -418,7 +418,7 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
|||
bn = ufs_rw64(oip->i_ffs2_ib[level],UFS_FSNEEDSWAP(fs));
|
||||
if (bn != 0) {
|
||||
error = ffs_indirtrunc(oip, indir_lbn[level],
|
||||
fsbtodb(fs, bn), lastiblock[level], level, &count);
|
||||
FFS_FSBTODB(fs, bn), lastiblock[level], level, &count);
|
||||
if (error)
|
||||
allerror = error;
|
||||
blocksreleased += count;
|
||||
|
@ -427,7 +427,7 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
|||
if (oip->i_ump->um_mountp->mnt_wapbl) {
|
||||
UFS_WAPBL_REGISTER_DEALLOCATION(
|
||||
oip->i_ump->um_mountp,
|
||||
fsbtodb(fs, bn), fs->fs_bsize);
|
||||
FFS_FSBTODB(fs, bn), fs->fs_bsize);
|
||||
} else
|
||||
ffs_blkfree(fs, oip->i_devvp, bn,
|
||||
fs->fs_bsize, oip->i_number);
|
||||
|
@ -455,7 +455,7 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
|||
if ((oip->i_ump->um_mountp->mnt_wapbl) &&
|
||||
(ovp->v_type != VREG)) {
|
||||
UFS_WAPBL_REGISTER_DEALLOCATION(oip->i_ump->um_mountp,
|
||||
fsbtodb(fs, bn), bsize);
|
||||
FFS_FSBTODB(fs, bn), bsize);
|
||||
} else
|
||||
ffs_blkfree(fs, oip->i_devvp, bn, bsize, oip->i_number);
|
||||
blocksreleased += btodb(bsize);
|
||||
|
@ -494,7 +494,7 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
|||
if ((oip->i_ump->um_mountp->mnt_wapbl) &&
|
||||
(ovp->v_type != VREG)) {
|
||||
UFS_WAPBL_REGISTER_DEALLOCATION(
|
||||
oip->i_ump->um_mountp, fsbtodb(fs, bn),
|
||||
oip->i_ump->um_mountp, FFS_FSBTODB(fs, bn),
|
||||
oldspace - newspace);
|
||||
} else
|
||||
ffs_blkfree(fs, oip->i_devvp, bn,
|
||||
|
@ -644,7 +644,7 @@ ffs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, daddr_t lastbn,
|
|||
if (nb == 0)
|
||||
continue;
|
||||
if (level > SINGLE) {
|
||||
error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb),
|
||||
error = ffs_indirtrunc(ip, nlbn, FFS_FSBTODB(fs, nb),
|
||||
(daddr_t)-1, level - 1,
|
||||
&blkcount);
|
||||
if (error)
|
||||
|
@ -654,7 +654,7 @@ ffs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, daddr_t lastbn,
|
|||
if ((ip->i_ump->um_mountp->mnt_wapbl) &&
|
||||
((level > SINGLE) || (ITOV(ip)->v_type != VREG))) {
|
||||
UFS_WAPBL_REGISTER_DEALLOCATION(ip->i_ump->um_mountp,
|
||||
fsbtodb(fs, nb), fs->fs_bsize);
|
||||
FFS_FSBTODB(fs, nb), fs->fs_bsize);
|
||||
} else
|
||||
ffs_blkfree(fs, ip->i_devvp, nb, fs->fs_bsize,
|
||||
ip->i_number);
|
||||
|
@ -668,7 +668,7 @@ ffs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, daddr_t lastbn,
|
|||
last = lastbn % factor;
|
||||
nb = RBAP(ip, i);
|
||||
if (nb != 0) {
|
||||
error = ffs_indirtrunc(ip, nlbn, fsbtodb(fs, nb),
|
||||
error = ffs_indirtrunc(ip, nlbn, FFS_FSBTODB(fs, nb),
|
||||
last, level - 1, &blkcount);
|
||||
if (error)
|
||||
allerror = error;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_snapshot.c,v 1.124 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.125 2013/06/23 02:06:05 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.124 2013/06/19 17:51:26 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.125 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -580,7 +580,7 @@ snapshot_copyfs(struct mount *mp, struct vnode *vp, void **sbbuf)
|
|||
i = fs->fs_frag - loc % fs->fs_frag;
|
||||
len = (i == fs->fs_frag) ? 0 : i * fs->fs_fsize;
|
||||
if (len > 0) {
|
||||
if ((error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + loc),
|
||||
if ((error = bread(devvp, FFS_FSBTODB(fs, fs->fs_csaddr + loc),
|
||||
len, l->l_cred, 0, &bp)) != 0) {
|
||||
free(copyfs->fs_csp, M_UFSMNT);
|
||||
free(*sbbuf, M_UFSMNT);
|
||||
|
@ -964,7 +964,7 @@ cgaccount1(int cg, struct vnode *vp, void *data, int passno)
|
|||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
ns = UFS_FSNEEDSWAP(fs);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ip->i_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, l->l_cred, 0, &bp);
|
||||
if (error) {
|
||||
return (error);
|
||||
|
@ -1172,7 +1172,7 @@ indiracct(struct vnode *snapvp, struct vnode *cancelvp, int level,
|
|||
* We have to expand bread here since it will deadlock looking
|
||||
* up the block number for any blocks that are not in the cache.
|
||||
*/
|
||||
error = ffs_getblk(cancelvp, lbn, fsbtodb(fs, blkno), fs->fs_bsize,
|
||||
error = ffs_getblk(cancelvp, lbn, FFS_FSBTODB(fs, blkno), fs->fs_bsize,
|
||||
false, &bp);
|
||||
if (error)
|
||||
return error;
|
||||
|
@ -1901,8 +1901,8 @@ ffs_copyonwrite(void *v, struct buf *bp, bool data_valid)
|
|||
* By doing these checks we avoid several potential deadlocks.
|
||||
*/
|
||||
fs = ip->i_fs;
|
||||
lbn = fragstoblks(fs, dbtofsb(fs, bp->b_blkno));
|
||||
if (bp->b_blkno >= fsbtodb(fs, fs->fs_size)) {
|
||||
lbn = fragstoblks(fs, FFS_DBTOFSB(fs, bp->b_blkno));
|
||||
if (bp->b_blkno >= FFS_FSBTODB(fs, fs->fs_size)) {
|
||||
mutex_exit(&si->si_lock);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2187,7 +2187,7 @@ rwfsblk(struct vnode *vp, int flags, void *data, daddr_t lbn)
|
|||
nbp->b_bcount = nbp->b_bufsize = fs->fs_bsize;
|
||||
nbp->b_error = 0;
|
||||
nbp->b_data = data;
|
||||
nbp->b_blkno = nbp->b_rawblkno = fsbtodb(fs, blkstofrags(fs, lbn));
|
||||
nbp->b_blkno = nbp->b_rawblkno = FFS_FSBTODB(fs, blkstofrags(fs, lbn));
|
||||
nbp->b_proc = NULL;
|
||||
nbp->b_dev = ip->i_devvp->v_rdev;
|
||||
SET(nbp->b_cflags, BC_BUSY); /* mark buffer busy */
|
||||
|
@ -2223,7 +2223,7 @@ syncsnap(struct vnode *vp)
|
|||
KASSERT(bp->b_bcount == fs->fs_bsize);
|
||||
mutex_exit(&bufcache_lock);
|
||||
error = rwfsblk(vp, B_WRITE, bp->b_data,
|
||||
fragstoblks(fs, dbtofsb(fs, bp->b_blkno)));
|
||||
fragstoblks(fs, FFS_DBTOFSB(fs, bp->b_blkno)));
|
||||
brelse(bp, BC_INVAL | BC_VFLUSH);
|
||||
if (error)
|
||||
return error;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_vfsops.c,v 1.284 2013/06/16 13:33:30 hannken Exp $ */
|
||||
/* $NetBSD: ffs_vfsops.c,v 1.285 2013/06/23 02:06:05 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.284 2013/06/16 13:33:30 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.285 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -789,7 +789,7 @@ ffs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
|
|||
bsize = fs->fs_bsize;
|
||||
if (i + fs->fs_frag > blks)
|
||||
bsize = (blks - i) * fs->fs_fsize;
|
||||
error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), bsize,
|
||||
error = bread(devvp, FFS_FSBTODB(fs, fs->fs_csaddr + i), bsize,
|
||||
NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
return (error);
|
||||
|
@ -850,7 +850,7 @@ ffs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
|
|||
* Step 6: re-read inode data for all active vnodes.
|
||||
*/
|
||||
ip = VTOI(vp);
|
||||
error = bread(devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
error = bread(devvp, FFS_FSBTODB(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
|
@ -1154,7 +1154,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
*/
|
||||
|
||||
if (!ronly) {
|
||||
error = bread(devvp, fsbtodb(fs, fs->fs_size - 1), fs->fs_fsize,
|
||||
error = bread(devvp, FFS_FSBTODB(fs, fs->fs_size - 1), fs->fs_fsize,
|
||||
cred, 0, &bp);
|
||||
if (bp->b_bcount != fs->fs_fsize)
|
||||
error = EINVAL;
|
||||
|
@ -1185,7 +1185,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|||
bsize = fs->fs_bsize;
|
||||
if (i + fs->fs_frag > blks)
|
||||
bsize = (blks - i) * fs->fs_fsize;
|
||||
error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + i), bsize,
|
||||
error = bread(devvp, FFS_FSBTODB(fs, fs->fs_csaddr + i), bsize,
|
||||
cred, 0, &bp);
|
||||
if (error) {
|
||||
kmem_free(fs->fs_csp, allocsbsize);
|
||||
|
@ -1603,7 +1603,7 @@ ffs_statvfs(struct mount *mp, struct statvfs *sbp)
|
|||
sbp->f_iosize = fs->fs_bsize;
|
||||
sbp->f_blocks = fs->fs_dsize;
|
||||
sbp->f_bfree = blkstofrags(fs, fs->fs_cstotal.cs_nbfree) +
|
||||
fs->fs_cstotal.cs_nffree + dbtofsb(fs, fs->fs_pendingblocks);
|
||||
fs->fs_cstotal.cs_nffree + FFS_DBTOFSB(fs, fs->fs_pendingblocks);
|
||||
sbp->f_bresvd = ((u_int64_t) fs->fs_dsize * (u_int64_t)
|
||||
fs->fs_minfree) / (u_int64_t) 100;
|
||||
if (sbp->f_bfree > sbp->f_bresvd)
|
||||
|
@ -1864,7 +1864,7 @@ ffs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
|
|||
mutex_exit(&ufs_hashlock);
|
||||
|
||||
/* Read in the disk contents for the inode, copy into the inode. */
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
|
||||
error = bread(ump->um_devvp, FFS_FSBTODB(fs, ino_to_fsba(fs, ino)),
|
||||
(int)fs->fs_bsize, NOCRED, 0, &bp);
|
||||
if (error) {
|
||||
|
||||
|
@ -2052,7 +2052,7 @@ ffs_cgupdate(struct ufsmount *mp, int waitfor)
|
|||
size = fs->fs_bsize;
|
||||
if (i + fs->fs_frag > blks)
|
||||
size = (blks - i) * fs->fs_fsize;
|
||||
error = ffs_getblk(mp->um_devvp, fsbtodb(fs, fs->fs_csaddr + i),
|
||||
error = ffs_getblk(mp->um_devvp, FFS_FSBTODB(fs, fs->fs_csaddr + i),
|
||||
FFS_NOBLK, size, false, &bp);
|
||||
if (error)
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_wapbl.c,v 1.19 2013/01/22 09:39:16 dholland Exp $ */
|
||||
/* $NetBSD: ffs_wapbl.c,v 1.20 2013/06/23 02:06:05 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.19 2013/01/22 09:39:16 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.20 2013/06/23 02:06:05 dholland Exp $");
|
||||
|
||||
#define WAPBL_INTERNAL
|
||||
|
||||
|
@ -177,7 +177,7 @@ ffs_wapbl_sync_metadata(struct mount *mp, daddr_t *deallocblks,
|
|||
* if it cannot read the cylinder group block
|
||||
*/
|
||||
ffs_blkfree(fs, ump->um_devvp,
|
||||
dbtofsb(fs, deallocblks[i]), dealloclens[i], -1);
|
||||
FFS_DBTOFSB(fs, deallocblks[i]), dealloclens[i], -1);
|
||||
}
|
||||
|
||||
fs->fs_fmod = 0;
|
||||
|
@ -201,7 +201,7 @@ ffs_wapbl_abort_sync_metadata(struct mount *mp, daddr_t *deallocblks,
|
|||
* blkfree succeeded above, then this shouldn't fail because
|
||||
* the buffer will be locked in the current transaction.
|
||||
*/
|
||||
ffs_blkalloc_ump(ump, dbtofsb(fs, deallocblks[i]),
|
||||
ffs_blkalloc_ump(ump, FFS_DBTOFSB(fs, deallocblks[i]),
|
||||
dealloclens[i]);
|
||||
}
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ wapbl_log_position(struct mount *mp, struct fs *fs, struct vnode *devvp,
|
|||
desired_logsize / 1024);
|
||||
|
||||
/* Is there space after after filesystem on partition for log? */
|
||||
logstart = fsbtodb(fs, fs->fs_size);
|
||||
logstart = FFS_FSBTODB(fs, fs->fs_size);
|
||||
error = getdisksize(devvp, &numsecs, &secsize);
|
||||
if (error)
|
||||
return error;
|
||||
|
@ -695,7 +695,7 @@ wapbl_allocate_log_file(struct mount *mp, struct vnode *vp,
|
|||
return error;
|
||||
}
|
||||
|
||||
*startp = fsbtodb(fs, addr);
|
||||
*startp = FFS_FSBTODB(fs, addr);
|
||||
*countp = btodb(logsize);
|
||||
*extradatap = VTOI(vp)->i_number;
|
||||
|
||||
|
@ -819,7 +819,7 @@ wapbl_find_log_start(struct mount *mp, struct vnode *vp, off_t logsize,
|
|||
best_blks < desired_blks && cg >= 0 && cg < fs->fs_ncg;
|
||||
s++, n = -n, cg += n * s) {
|
||||
DPRINTF("check cg %d of %d\n", cg, fs->fs_ncg);
|
||||
error = bread(devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
|
||||
fs->fs_cgsize, FSCRED, 0, &bp);
|
||||
if (error) {
|
||||
continue;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fs.h,v 1.61 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: fs.h,v 1.62 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
|
@ -605,11 +605,11 @@ struct ocg {
|
|||
* This maps file system blocks to device size blocks.
|
||||
*/
|
||||
#if defined (_KERNEL)
|
||||
#define fsbtodb(fs, b) ((b) << ((fs)->fs_fshift - DEV_BSHIFT))
|
||||
#define dbtofsb(fs, b) ((b) >> ((fs)->fs_fshift - DEV_BSHIFT))
|
||||
#define FFS_FSBTODB(fs, b) ((b) << ((fs)->fs_fshift - DEV_BSHIFT))
|
||||
#define FFS_DBTOFSB(fs, b) ((b) >> ((fs)->fs_fshift - DEV_BSHIFT))
|
||||
#else
|
||||
#define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb)
|
||||
#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
|
||||
#define FFS_FSBTODB(fs, b) ((b) << (fs)->fs_fsbtodb)
|
||||
#define FFS_DBTOFSB(fs, b) ((b) >> (fs)->fs_fsbtodb)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -653,11 +653,11 @@ struct ocg {
|
|||
#define blkmap(fs, map, loc) \
|
||||
(((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))
|
||||
#define old_cbtocylno(fs, bno) \
|
||||
(fsbtodb(fs, bno) / (fs)->fs_old_spc)
|
||||
(FFS_FSBTODB(fs, bno) / (fs)->fs_old_spc)
|
||||
#define old_cbtorpos(fs, bno) \
|
||||
((fs)->fs_old_nrpos <= 1 ? 0 : \
|
||||
(fsbtodb(fs, bno) % (fs)->fs_old_spc / (fs)->fs_old_nsect * (fs)->fs_old_trackskew + \
|
||||
fsbtodb(fs, bno) % (fs)->fs_old_spc % (fs)->fs_old_nsect * (fs)->fs_old_interleave) % \
|
||||
(FFS_FSBTODB(fs, bno) % (fs)->fs_old_spc / (fs)->fs_old_nsect * (fs)->fs_old_trackskew + \
|
||||
FFS_FSBTODB(fs, bno) % (fs)->fs_old_spc % (fs)->fs_old_nsect * (fs)->fs_old_interleave) % \
|
||||
(fs)->fs_old_nsect * (fs)->fs_old_nrpos / (fs)->fs_old_npsect)
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dumpfs.c,v 1.60 2013/04/02 13:31:47 taca Exp $ */
|
||||
/* $NetBSD: dumpfs.c,v 1.61 2013/06/23 02:06:05 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1992, 1993
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1992, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)dumpfs.c 8.5 (Berkeley) 4/29/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: dumpfs.c,v 1.60 2013/04/02 13:31:47 taca Exp $");
|
||||
__RCSID("$NetBSD: dumpfs.c,v 1.61 2013/06/23 02:06:05 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -220,7 +220,7 @@ dumpfs(const char *name)
|
|||
}
|
||||
|
||||
|
||||
dev_bsize = afs.fs_fsize / fsbtodb(&afs, 1);
|
||||
dev_bsize = afs.fs_fsize / FFS_FSBTODB(&afs, 1);
|
||||
|
||||
rval = 0;
|
||||
printf("file system: %s\n", name);
|
||||
|
@ -478,7 +478,7 @@ print_cgsum(const char *name, int fd)
|
|||
afs.fs_cssize - i : afs.fs_bsize;
|
||||
ccsp = (struct csum *)((char *)afs.fs_csp + i);
|
||||
if (lseek(fd,
|
||||
(off_t)(fsbtodb(&afs, (afs.fs_csaddr + j * afs.fs_frag))) *
|
||||
(off_t)(FFS_FSBTODB(&afs, (afs.fs_csaddr + j * afs.fs_frag))) *
|
||||
dev_bsize, SEEK_SET) == (off_t)-1)
|
||||
return 1;
|
||||
if (read(fd, ccsp, size) != size)
|
||||
|
@ -518,7 +518,7 @@ print_alt_super(const char *name, int fd)
|
|||
int save_printold;
|
||||
|
||||
for (i = 0; i < afs.fs_ncg; i++) {
|
||||
loc = (off_t)(fsbtodb(&afs, cgsblock(&afs, i))) * dev_bsize;
|
||||
loc = (off_t)(FFS_FSBTODB(&afs, cgsblock(&afs, i))) * dev_bsize;
|
||||
printf("\nalternate %d\n", i);
|
||||
if (pread(fd, &alt, sizeof alt, loc) != sizeof alt) {
|
||||
warnx("%s: error reading alt %d", name, i);
|
||||
|
@ -585,7 +585,7 @@ dumpcg(const char *name, int fd, int c)
|
|||
time_t t;
|
||||
|
||||
printf("cg %d:\n", c);
|
||||
if ((cur = lseek(fd, (off_t)(fsbtodb(&afs, cgtod(&afs, c))) * dev_bsize,
|
||||
if ((cur = lseek(fd, (off_t)(FFS_FSBTODB(&afs, cgtod(&afs, c))) * dev_bsize,
|
||||
SEEK_SET)) == (off_t)-1)
|
||||
return (1);
|
||||
if (read(fd, &acg, afs.fs_bsize) != afs.fs_bsize) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs.c,v 1.8 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ext2fs.c,v 1.9 2013/06/23 02:06:06 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer.
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: ext2fs.c,v 1.8 2013/06/19 17:51:26 dholland Exp $");
|
||||
__RCSID("$NetBSD: ext2fs.c,v 1.9 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -169,7 +169,7 @@ ext2fs_read_gdblock(ib_params *params, struct m_ext2fs *fs)
|
|||
gdpb = fs->e2fs_bsize / sizeof(struct ext2_gd);
|
||||
|
||||
for (i = 0; i < fs->e2fs_ngdb; i++) {
|
||||
if (ext2fs_read_disk_block(params, fsbtodb(fs,
|
||||
if (ext2fs_read_disk_block(params, EXT2_FSBTODB(fs,
|
||||
fs->e2fs.e2fs_first_dblock + 1 /* superblock */ + i),
|
||||
SBSIZE, gdbuf) == 0)
|
||||
return 0;
|
||||
|
@ -236,7 +236,7 @@ ext2fs_find_disk_blocks(ib_params *params, ino_t ino,
|
|||
|
||||
/* Read the inode. */
|
||||
if (ext2fs_read_disk_block(params,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
EXT2_FSBTODB(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
fs->e2fs_bsize, inodebuf))
|
||||
return 0;
|
||||
inode = (void *)inodebuf;
|
||||
|
@ -288,7 +288,7 @@ ext2fs_find_disk_blocks(ib_params *params, ino_t ino,
|
|||
if (blk == 0)
|
||||
memset(level[level_i].diskbuf, 0, MAXBSIZE);
|
||||
else if (ext2fs_read_disk_block(params,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
EXT2_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
fs->e2fs_bsize, level[level_i].diskbuf) == 0)
|
||||
return 0;
|
||||
/* XXX ondisk32 */
|
||||
|
@ -301,10 +301,10 @@ ext2fs_find_disk_blocks(ib_params *params, ino_t ino,
|
|||
/* blk is the next direct level block. */
|
||||
#if 0
|
||||
fprintf(stderr, "ino %lu db %lu blksize %lu\n", ino,
|
||||
fsbtodb(fs, blk), ext2_sblksize(fs, inode->di_size, lblk));
|
||||
EXT2_FSBTODB(fs, blk), ext2_sblksize(fs, inode->di_size, lblk));
|
||||
#endif
|
||||
rv = (*callback)(params, state,
|
||||
fsbtodb(fs, blk) + params->fstype->offset, fs->e2fs_bsize);
|
||||
EXT2_FSBTODB(fs, blk) + params->fstype->offset, fs->e2fs_bsize);
|
||||
lblk++;
|
||||
nblk--;
|
||||
if (rv != 1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs.c,v 1.31 2013/06/19 17:51:26 dholland Exp $ */
|
||||
/* $NetBSD: ffs.c,v 1.32 2013/06/23 02:06:06 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.31 2013/06/19 17:51:26 dholland Exp $");
|
||||
__RCSID("$NetBSD: ffs.c,v 1.32 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -158,7 +158,7 @@ ffs_find_disk_blocks_ufs1(ib_params *params, ino_t ino,
|
|||
|
||||
/* Read the inode. */
|
||||
if (! ffs_read_disk_block(params,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
fs->fs_bsize, inodebuf))
|
||||
return (0);
|
||||
inode = (struct ufs1_dinode *)inodebuf;
|
||||
|
@ -215,7 +215,7 @@ ffs_find_disk_blocks_ufs1(ib_params *params, ino_t ino,
|
|||
if (blk == 0)
|
||||
memset(level[level_i].diskbuf, 0, MAXBSIZE);
|
||||
else if (! ffs_read_disk_block(params,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
fs->fs_bsize, level[level_i].diskbuf))
|
||||
return (0);
|
||||
/* XXX ondisk32 */
|
||||
|
@ -228,10 +228,10 @@ ffs_find_disk_blocks_ufs1(ib_params *params, ino_t ino,
|
|||
/* blk is the next direct level block. */
|
||||
#if 0
|
||||
fprintf(stderr, "ino %lu db %lu blksize %lu\n", ino,
|
||||
fsbtodb(fs, blk), ffs_sblksize(fs, inode->di_size, lblk));
|
||||
FFS_FSBTODB(fs, blk), ffs_sblksize(fs, inode->di_size, lblk));
|
||||
#endif
|
||||
rv = (*callback)(params, state,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
ffs_sblksize(fs, (int64_t)inode->di_size, lblk));
|
||||
lblk++;
|
||||
nblk--;
|
||||
|
@ -295,7 +295,7 @@ ffs_find_disk_blocks_ufs2(ib_params *params, ino_t ino,
|
|||
|
||||
/* Read the inode. */
|
||||
if (! ffs_read_disk_block(params,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
fs->fs_bsize, inodebuf))
|
||||
return (0);
|
||||
inode = (struct ufs2_dinode *)inodebuf;
|
||||
|
@ -352,7 +352,7 @@ ffs_find_disk_blocks_ufs2(ib_params *params, ino_t ino,
|
|||
if (blk == 0)
|
||||
memset(level[level_i].diskbuf, 0, MAXBSIZE);
|
||||
else if (! ffs_read_disk_block(params,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
fs->fs_bsize, level[level_i].diskbuf))
|
||||
return (0);
|
||||
level[level_i].blknums =
|
||||
|
@ -364,10 +364,10 @@ ffs_find_disk_blocks_ufs2(ib_params *params, ino_t ino,
|
|||
/* blk is the next direct level block. */
|
||||
#if 0
|
||||
fprintf(stderr, "ino %lu db %llu blksize %lu\n", ino,
|
||||
fsbtodb(fs, blk), ffs_sblksize(fs, inode->di_size, lblk));
|
||||
FFS_FSBTODB(fs, blk), ffs_sblksize(fs, inode->di_size, lblk));
|
||||
#endif
|
||||
rv = (*callback)(params, state,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
ffs_sblksize(fs, (int64_t)inode->di_size, lblk));
|
||||
lblk++;
|
||||
nblk--;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs.c,v 1.62 2013/06/19 17:51:27 dholland Exp $ */
|
||||
/* $NetBSD: ffs.c,v 1.63 2013/06/23 02:06:06 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.62 2013/06/19 17:51:27 dholland Exp $");
|
||||
__RCSID("$NetBSD: ffs.c,v 1.63 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -1069,7 +1069,7 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts)
|
|||
printf("ffs_write_inode: din %p ino %u cg %d cgino %d\n",
|
||||
dp, ino, cg, cgino);
|
||||
|
||||
ffs_rdfs(fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize, &sbbuf,
|
||||
ffs_rdfs(FFS_FSBTODB(fs, cgtod(fs, cg)), (int)fs->fs_cgsize, &sbbuf,
|
||||
fsopts);
|
||||
cgp = (struct cg *)sbbuf;
|
||||
if (!cg_chkmagic(cgp, fsopts->needswap))
|
||||
|
@ -1112,7 +1112,7 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts)
|
|||
dip->di_gen = random() / 2 + 1;
|
||||
dip++;
|
||||
}
|
||||
ffs_wtfs(fsbtodb(fs, ino_to_fsba(fs,
|
||||
ffs_wtfs(FFS_FSBTODB(fs, ino_to_fsba(fs,
|
||||
cg * fs->fs_ipg + initediblk)),
|
||||
fs->fs_bsize, buf, fsopts);
|
||||
initediblk += FFS_INOPB(fs);
|
||||
|
@ -1120,11 +1120,11 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts)
|
|||
}
|
||||
|
||||
|
||||
ffs_wtfs(fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize, &sbbuf,
|
||||
ffs_wtfs(FFS_FSBTODB(fs, cgtod(fs, cg)), (int)fs->fs_cgsize, &sbbuf,
|
||||
fsopts);
|
||||
|
||||
/* now write inode */
|
||||
d = fsbtodb(fs, ino_to_fsba(fs, ino));
|
||||
d = FFS_FSBTODB(fs, ino_to_fsba(fs, ino));
|
||||
ffs_rdfs(d, fs->fs_bsize, buf, fsopts);
|
||||
if (fsopts->needswap) {
|
||||
if (ffs_opts->version == 1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_alloc.c,v 1.24 2013/06/19 17:51:27 dholland Exp $ */
|
||||
/* $NetBSD: ffs_alloc.c,v 1.25 2013/06/23 02:06:06 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.24 2013/06/19 17:51:27 dholland Exp $");
|
||||
__RCSID("$NetBSD: ffs_alloc.c,v 1.25 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -307,7 +307,7 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
|
|||
|
||||
if (fs->fs_cs(fs, cg).cs_nbfree == 0 && size == fs->fs_bsize)
|
||||
return (0);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ip->i_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NULL, 0, &bp);
|
||||
if (error) {
|
||||
return (0);
|
||||
|
@ -450,7 +450,7 @@ ffs_blkfree(struct inode *ip, daddr_t bno, long size)
|
|||
(unsigned long long)ip->i_number);
|
||||
return;
|
||||
}
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ip->i_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NULL, 0, &bp);
|
||||
if (error) {
|
||||
brelse(bp, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_balloc.c,v 1.18 2013/06/19 17:51:27 dholland Exp $ */
|
||||
/* $NetBSD: ffs_balloc.c,v 1.19 2013/06/23 02:06:06 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.18 2013/06/19 17:51:27 dholland Exp $");
|
||||
__RCSID("$NetBSD: ffs_balloc.c,v 1.19 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -195,7 +195,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
|||
return (error);
|
||||
if (bpp != NULL) {
|
||||
bp = getblk(ip->i_devvp, lbn, nsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
bp->b_blkno = FFS_FSBTODB(fs, newb);
|
||||
clrbuf(bp);
|
||||
*bpp = bp;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
|||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
bp = getblk(ip->i_devvp, indirs[1].in_lbn, fs->fs_bsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, nb);
|
||||
bp->b_blkno = FFS_FSBTODB(fs, nb);
|
||||
clrbuf(bp);
|
||||
/*
|
||||
* Write synchronously so that indirect blocks
|
||||
|
@ -275,7 +275,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
|||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
nbp->b_blkno = FFS_FSBTODB(fs, nb);
|
||||
clrbuf(nbp);
|
||||
/*
|
||||
* Write synchronously so that indirect blocks
|
||||
|
@ -306,7 +306,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
|||
*allocblk++ = nb;
|
||||
if (bpp != NULL) {
|
||||
nbp = getblk(ip->i_devvp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
nbp->b_blkno = FFS_FSBTODB(fs, nb);
|
||||
clrbuf(nbp);
|
||||
*bpp = nbp;
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
|||
return (error);
|
||||
if (bpp != NULL) {
|
||||
bp = getblk(ip->i_devvp, lbn, nsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, newb);
|
||||
bp->b_blkno = FFS_FSBTODB(fs, newb);
|
||||
clrbuf(bp);
|
||||
*bpp = bp;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
|||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
bp = getblk(ip->i_devvp, indirs[1].in_lbn, fs->fs_bsize, 0, 0);
|
||||
bp->b_blkno = fsbtodb(fs, nb);
|
||||
bp->b_blkno = FFS_FSBTODB(fs, nb);
|
||||
clrbuf(bp);
|
||||
/*
|
||||
* Write synchronously so that indirect blocks
|
||||
|
@ -526,7 +526,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
|||
nb = newb;
|
||||
*allocblk++ = nb;
|
||||
nbp = getblk(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
nbp->b_blkno = FFS_FSBTODB(fs, nb);
|
||||
clrbuf(nbp);
|
||||
/*
|
||||
* Write synchronously so that indirect blocks
|
||||
|
@ -557,7 +557,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp)
|
|||
*allocblk++ = nb;
|
||||
if (bpp != NULL) {
|
||||
nbp = getblk(ip->i_devvp, lbn, fs->fs_bsize, 0, 0);
|
||||
nbp->b_blkno = fsbtodb(fs, nb);
|
||||
nbp->b_blkno = FFS_FSBTODB(fs, nb);
|
||||
clrbuf(nbp);
|
||||
*bpp = nbp;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkfs.c,v 1.28 2013/06/19 17:51:27 dholland Exp $ */
|
||||
/* $NetBSD: mkfs.c,v 1.29 2013/06/23 02:06:06 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.28 2013/06/19 17:51:27 dholland Exp $");
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.29 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
@ -258,7 +258,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
|||
exit(21);
|
||||
}
|
||||
sblock.fs_fsbtodb = ilog2(sblock.fs_fsize / sectorsize);
|
||||
sblock.fs_size = fssize = dbtofsb(&sblock, fssize);
|
||||
sblock.fs_size = fssize = FFS_DBTOFSB(&sblock, fssize);
|
||||
|
||||
if (Oflag <= 1) {
|
||||
sblock.fs_magic = FS_UFS1_MAGIC;
|
||||
|
@ -479,7 +479,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
|||
printf("%s: %.1fMB (%lld sectors) block size %d, "
|
||||
"fragment size %d\n",
|
||||
fsys, (float)sblock.fs_size * sblock.fs_fsize * B2MBFACTOR,
|
||||
(long long)fsbtodb(&sblock, sblock.fs_size),
|
||||
(long long)FFS_FSBTODB(&sblock, sblock.fs_size),
|
||||
sblock.fs_bsize, sblock.fs_fsize);
|
||||
printf("\tusing %d cylinder groups of %.2fMB, %d blks, "
|
||||
"%d inodes.\n",
|
||||
|
@ -493,7 +493,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
|||
* subwindows in sysinst.
|
||||
*/
|
||||
printcolwidth = count_digits(
|
||||
fsbtodb(&sblock, cgsblock(&sblock, sblock.fs_ncg -1)));
|
||||
FFS_FSBTODB(&sblock, cgsblock(&sblock, sblock.fs_ncg -1)));
|
||||
nprintcols = 76 / (printcolwidth + 2);
|
||||
|
||||
/*
|
||||
|
@ -520,7 +520,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts)
|
|||
if (cylno % nprintcols == 0)
|
||||
printf("\n");
|
||||
printf(" %*lld,", printcolwidth,
|
||||
(long long)fsbtodb(&sblock, cgsblock(&sblock, cylno)));
|
||||
(long long)FFS_FSBTODB(&sblock, cgsblock(&sblock, cylno)));
|
||||
fflush(stdout);
|
||||
}
|
||||
printf("\n");
|
||||
|
@ -563,7 +563,7 @@ ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts)
|
|||
|
||||
/* Write out the duplicate super blocks */
|
||||
for (cylno = 0; cylno < fs->fs_ncg; cylno++)
|
||||
ffs_wtfs(fsbtodb(fs, cgsblock(fs, cylno)),
|
||||
ffs_wtfs(FFS_FSBTODB(fs, cgsblock(fs, cylno)),
|
||||
sbsize, writebuf, fsopts);
|
||||
|
||||
/* Write out the cylinder group summaries */
|
||||
|
@ -580,7 +580,7 @@ ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts)
|
|||
(struct csum *)wrbuf, size);
|
||||
else
|
||||
memcpy(wrbuf, space, (u_int)size);
|
||||
ffs_wtfs(fsbtodb(fs, fs->fs_csaddr + i), size, wrbuf, fsopts);
|
||||
ffs_wtfs(FFS_FSBTODB(fs, fs->fs_csaddr + i), size, wrbuf, fsopts);
|
||||
space = (char *)space + size;
|
||||
}
|
||||
free(wrbuf);
|
||||
|
@ -757,7 +757,7 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts)
|
|||
dp2++;
|
||||
}
|
||||
}
|
||||
ffs_wtfs(fsbtodb(&sblock, cgsblock(&sblock, cylno)), iobufsize, iobuf,
|
||||
ffs_wtfs(FFS_FSBTODB(&sblock, cgsblock(&sblock, cylno)), iobufsize, iobuf,
|
||||
fsopts);
|
||||
/*
|
||||
* For the old file system, we have to initialize all the inodes.
|
||||
|
@ -771,7 +771,7 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts)
|
|||
dp1->di_gen = random();
|
||||
dp1++;
|
||||
}
|
||||
ffs_wtfs(fsbtodb(&sblock, cgimin(&sblock, cylno) + i),
|
||||
ffs_wtfs(FFS_FSBTODB(&sblock, cgimin(&sblock, cylno) + i),
|
||||
sblock.fs_bsize, &iobuf[start], fsopts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: quotacheck.c,v 1.46 2013/01/22 09:39:20 dholland Exp $ */
|
||||
/* $NetBSD: quotacheck.c,v 1.47 2013/06/23 02:06:06 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.46 2013/01/22 09:39:20 dholland Exp $");
|
||||
__RCSID("$NetBSD: quotacheck.c,v 1.47 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -407,14 +407,14 @@ chkquota(const char *type, const char *fsname, const char *mntpt, void *v,
|
|||
return 1;
|
||||
}
|
||||
|
||||
dev_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1);
|
||||
dev_bsize = sblock.fs_fsize / FFS_FSBTODB(&sblock, 1);
|
||||
maxino = sblock.fs_ncg * sblock.fs_ipg;
|
||||
for (cg = 0; cg < sblock.fs_ncg; cg++) {
|
||||
ino = cg * sblock.fs_ipg;
|
||||
setinodebuf(ino);
|
||||
#ifdef HAVE_UFSv2
|
||||
if (sblock.fs_magic == FS_UFS2_MAGIC) {
|
||||
bread(fsbtodb(&sblock, cgtod(&sblock, cg)), (char *)cgp,
|
||||
bread(FFS_FSBTODB(&sblock, cgtod(&sblock, cg)), (char *)cgp,
|
||||
sblock.fs_cgsize);
|
||||
if (needswap)
|
||||
ffs_cg_swap(cgp, cgp, &sblock);
|
||||
|
@ -740,7 +740,7 @@ getnextinode(ino_t inumber)
|
|||
|
||||
if (inumber >= lastinum) {
|
||||
readcnt++;
|
||||
dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
|
||||
dblk = FFS_FSBTODB(&sblock, ino_to_fsba(&sblock, lastinum));
|
||||
if (readcnt % readpercg == 0) {
|
||||
size = partialsize;
|
||||
lastinum += partialcnt;
|
||||
|
|
Loading…
Reference in New Issue