summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/pass1.c
diff options
context:
space:
mode:
authorsbruno <sbruno@FreeBSD.org>2013-03-23 04:26:13 +0000
committersbruno <sbruno@FreeBSD.org>2013-03-23 04:26:13 +0000
commitee156374eead97ea0d36a374d0a9ccb6d2ed7e40 (patch)
tree0919d525762dd205d22121917dfe139e9308d76c /sbin/fsck_ffs/pass1.c
parent1bcec8f048d439f4090ca60786176dd52dbe87b1 (diff)
downloadFreeBSD-src-ee156374eead97ea0d36a374d0a9ccb6d2ed7e40.zip
FreeBSD-src-ee156374eead97ea0d36a374d0a9ccb6d2ed7e40.tar.gz
Revert svn r248625
Clang errors around printf could be trivially fixed, but the breakage in sbin/fsdb were to significant for this type of change. Submitter of this changeset has been notified and hopefully this can be restored soon.
Diffstat (limited to 'sbin/fsck_ffs/pass1.c')
-rw-r--r--sbin/fsck_ffs/pass1.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c
index 3199541..08e84b9 100644
--- a/sbin/fsck_ffs/pass1.c
+++ b/sbin/fsck_ffs/pass1.c
@@ -61,8 +61,6 @@ pass1(void)
{
struct inostat *info;
struct inodesc idesc;
- struct bufarea *cgbp;
- struct cg *cgp;
ino_t inumber, inosused, mininos;
ufs2_daddr_t i, cgd;
u_int8_t *cp;
@@ -94,13 +92,12 @@ pass1(void)
for (c = 0; c < sblock.fs_ncg; c++) {
inumber = c * sblock.fs_ipg;
setinodebuf(inumber);
- cgbp = cgget(c);
- cgp = cgbp->b_un.b_cg;
+ getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
rebuildcg = 0;
- if (!check_cgmagic(c, cgbp))
+ if (!check_cgmagic(c, &cgrp))
rebuildcg = 1;
if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) {
- inosused = cgp->cg_initediblk;
+ inosused = cgrp.cg_initediblk;
if (inosused > sblock.fs_ipg) {
pfatal(
"Too many initialized inodes (%ju > %d) in cylinder group %d\nReset to %d\n",
@@ -130,7 +127,7 @@ pass1(void)
* read only those inodes in from disk.
*/
if ((preen || inoopt) && usedsoftdep && !rebuildcg) {
- cp = &cg_inosused(cgp)[(inosused - 1) / CHAR_BIT];
+ cp = &cg_inosused(&cgrp)[(inosused - 1) / CHAR_BIT];
for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) {
if (*cp == 0)
continue;
@@ -152,7 +149,7 @@ pass1(void)
inostathead[c].il_stat = 0;
continue;
}
- info = Calloc((unsigned)inosused, sizeof(struct inostat));
+ info = calloc((unsigned)inosused, sizeof(struct inostat));
if (info == NULL)
errx(EEXIT, "cannot alloc %u bytes for inoinfo",
(unsigned)(sizeof(struct inostat) * inosused));
@@ -172,7 +169,7 @@ pass1(void)
* valid number for this cylinder group.
*/
if (checkinode(inumber, &idesc, rebuildcg) == 0 &&
- i > cgp->cg_initediblk)
+ i > cgrp.cg_initediblk)
break;
}
/*
@@ -184,16 +181,16 @@ pass1(void)
mininos = roundup(inosused + INOPB(&sblock), INOPB(&sblock));
if (inoopt && !preen && !rebuildcg &&
sblock.fs_magic == FS_UFS2_MAGIC &&
- cgp->cg_initediblk > 2 * INOPB(&sblock) &&
- mininos < cgp->cg_initediblk) {
- i = cgp->cg_initediblk;
+ cgrp.cg_initediblk > 2 * INOPB(&sblock) &&
+ mininos < cgrp.cg_initediblk) {
+ i = cgrp.cg_initediblk;
if (mininos < 2 * INOPB(&sblock))
- cgp->cg_initediblk = 2 * INOPB(&sblock);
+ cgrp.cg_initediblk = 2 * INOPB(&sblock);
else
- cgp->cg_initediblk = mininos;
+ cgrp.cg_initediblk = mininos;
pwarn("CYLINDER GROUP %d: RESET FROM %ju TO %d %s\n",
- c, i, cgp->cg_initediblk, "VALID INODES");
- dirty(cgbp);
+ c, i, cgrp.cg_initediblk, "VALID INODES");
+ cgdirty();
}
if (inosused < sblock.fs_ipg)
continue;
@@ -202,11 +199,11 @@ pass1(void)
inosused = 0;
else
inosused = lastino - (c * sblock.fs_ipg);
- if (rebuildcg && inosused > cgp->cg_initediblk &&
+ if (rebuildcg && inosused > cgrp.cg_initediblk &&
sblock.fs_magic == FS_UFS2_MAGIC) {
- cgp->cg_initediblk = roundup(inosused, INOPB(&sblock));
+ cgrp.cg_initediblk = roundup(inosused, INOPB(&sblock));
pwarn("CYLINDER GROUP %d: FOUND %d VALID INODES\n", c,
- cgp->cg_initediblk);
+ cgrp.cg_initediblk);
}
/*
* If we were not able to determine in advance which inodes
@@ -222,7 +219,7 @@ pass1(void)
inostathead[c].il_stat = 0;
continue;
}
- info = Calloc((unsigned)inosused, sizeof(struct inostat));
+ info = calloc((unsigned)inosused, sizeof(struct inostat));
if (info == NULL)
errx(EEXIT, "cannot alloc %u bytes for inoinfo",
(unsigned)(sizeof(struct inostat) * inosused));
@@ -485,7 +482,7 @@ pass1check(struct inodesc *idesc)
}
return (STOP);
}
- new = (struct dups *)Malloc(sizeof(struct dups));
+ new = (struct dups *)malloc(sizeof(struct dups));
if (new == NULL) {
pfatal("DUP TABLE OVERFLOW.");
if (reply("CONTINUE") == 0) {
OpenPOWER on IntegriCloud