Fix fsck_ffs build with a 64-bit ino_t.

Original code by:	Gleb Kurtsou
This commit is contained in:
Matthew D Fleming
2012-09-27 23:30:58 +00:00
parent fc8fdae0df
commit 623d7cb663
8 changed files with 103 additions and 85 deletions
+2 -1
View File
@@ -137,7 +137,8 @@ inoinfo(ino_t inum)
int iloff; int iloff;
if (inum > maxino) if (inum > maxino)
errx(EEXIT, "inoinfo: inumber %d out of range", inum); errx(EEXIT, "inoinfo: inumber %ju out of range",
(uintmax_t)inum);
ilp = &inostathead[inum / sblock.fs_ipg]; ilp = &inostathead[inum / sblock.fs_ipg];
iloff = inum % sblock.fs_ipg; iloff = inum % sblock.fs_ipg;
if (iloff >= ilp->il_numalloced) if (iloff >= ilp->il_numalloced)
+4 -2
View File
@@ -448,7 +448,8 @@ gjournal_check(const char *filesys)
if (isclr(inosused, cino)) if (isclr(inosused, cino))
continue; continue;
if (getino(disk, &p, ino, &mode) == -1) if (getino(disk, &p, ino, &mode) == -1)
err(1, "getino(cg=%d ino=%d)", cg, ino); err(1, "getino(cg=%d ino=%ju)",
cg, (uintmax_t)ino);
dino = p; dino = p;
/* Not a regular file nor directory? Skip it. */ /* Not a regular file nor directory? Skip it. */
if (!S_ISREG(dino->di_mode) && !S_ISDIR(dino->di_mode)) if (!S_ISREG(dino->di_mode) && !S_ISDIR(dino->di_mode))
@@ -480,7 +481,8 @@ gjournal_check(const char *filesys)
*dino = ufs2_zino; *dino = ufs2_zino;
/* Write the inode back. */ /* Write the inode back. */
if (putino(disk) == -1) if (putino(disk) == -1)
err(1, "putino(cg=%d ino=%d)", cg, ino); err(1, "putino(cg=%d ino=%ju)",
cg, (uintmax_t)ino);
if (cgp->cg_unrefs == 0) { if (cgp->cg_unrefs == 0) {
//printf("No more unreferenced inodes in cg=%d.\n", cg); //printf("No more unreferenced inodes in cg=%d.\n", cg);
break; break;
+7 -4
View File
@@ -285,7 +285,8 @@ ginode(ino_t inumber)
ufs2_daddr_t iblk; ufs2_daddr_t iblk;
if (inumber < ROOTINO || inumber > maxino) if (inumber < ROOTINO || inumber > maxino)
errx(EEXIT, "bad inode number %d to ginode", inumber); errx(EEXIT, "bad inode number %ju to ginode",
(uintmax_t)inumber);
if (startinum == 0 || if (startinum == 0 ||
inumber < startinum || inumber >= startinum + INOPB(&sblock)) { inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
iblk = ino_to_fsba(&sblock, inumber); iblk = ino_to_fsba(&sblock, inumber);
@@ -319,7 +320,8 @@ getnextinode(ino_t inumber, int rebuildcg)
static caddr_t nextinop; static caddr_t nextinop;
if (inumber != nextino++ || inumber > lastvalidinum) if (inumber != nextino++ || inumber > lastvalidinum)
errx(EEXIT, "bad inode number %d to nextinode", inumber); errx(EEXIT, "bad inode number %ju to nextinode",
(uintmax_t)inumber);
if (inumber >= lastinum) { if (inumber >= lastinum) {
readcnt++; readcnt++;
dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum)); dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
@@ -398,7 +400,8 @@ setinodebuf(ino_t inum)
{ {
if (inum % sblock.fs_ipg != 0) if (inum % sblock.fs_ipg != 0)
errx(EEXIT, "bad inode number %d to setinodebuf", inum); errx(EEXIT, "bad inode number %ju to setinodebuf",
(uintmax_t)inum);
lastvalidinum = inum + sblock.fs_ipg - 1; lastvalidinum = inum + sblock.fs_ipg - 1;
startinum = 0; startinum = 0;
nextino = inum; nextino = inum;
@@ -489,7 +492,7 @@ getinoinfo(ino_t inumber)
continue; continue;
return (inp); return (inp);
} }
errx(EEXIT, "cannot find inode %d", inumber); errx(EEXIT, "cannot find inode %ju", (uintmax_t)inumber);
return ((struct inoinfo *)0); return ((struct inoinfo *)0);
} }
+1 -1
View File
@@ -492,7 +492,7 @@ checkfilesys(char *filesys)
n_ffree * 100.0 / sblock.fs_dsize); n_ffree * 100.0 / sblock.fs_dsize);
if (debug) { if (debug) {
if (files < 0) if (files < 0)
printf("%d inodes missing\n", -files); printf("%jd inodes missing\n", (intmax_t)-files);
if (blks < 0) if (blks < 0)
printf("%lld blocks missing\n", -(long long)blks); printf("%lld blocks missing\n", -(long long)blks);
if (duplist != NULL) { if (duplist != NULL) {
+3 -2
View File
@@ -99,8 +99,9 @@ pass1(void)
if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) { if (!rebuildcg && sblock.fs_magic == FS_UFS2_MAGIC) {
inosused = cgrp.cg_initediblk; inosused = cgrp.cg_initediblk;
if (inosused > sblock.fs_ipg) { if (inosused > sblock.fs_ipg) {
pfatal("%s (%d > %d) %s %d\nReset to %d\n", pfatal("%s (%ju > %d) %s %d\nReset to %d\n",
"Too many initialized inodes", inosused, "Too many initialized inodes",
(uintmax_t)inosused,
sblock.fs_ipg, "in cylinder group", c, sblock.fs_ipg, "in cylinder group", c,
sblock.fs_ipg); sblock.fs_ipg);
inosused = sblock.fs_ipg; inosused = sblock.fs_ipg;
+11 -9
View File
@@ -223,13 +223,14 @@ pass2(void)
* inp->i_parent is directory to which ".." should point. * inp->i_parent is directory to which ".." should point.
*/ */
getpathname(pathbuf, inp->i_parent, inp->i_number); getpathname(pathbuf, inp->i_parent, inp->i_number);
printf("BAD INODE NUMBER FOR '..' in DIR I=%d (%s)\n", printf("BAD INODE NUMBER FOR '..' in DIR I=%ju (%s)\n",
inp->i_number, pathbuf); (uintmax_t)inp->i_number, pathbuf);
getpathname(pathbuf, inp->i_dotdot, inp->i_dotdot); getpathname(pathbuf, inp->i_dotdot, inp->i_dotdot);
printf("CURRENTLY POINTS TO I=%d (%s), ", inp->i_dotdot, printf("CURRENTLY POINTS TO I=%ju (%s), ",
pathbuf); (uintmax_t)inp->i_dotdot, pathbuf);
getpathname(pathbuf, inp->i_parent, inp->i_parent); getpathname(pathbuf, inp->i_parent, inp->i_parent);
printf("SHOULD POINT TO I=%d (%s)", inp->i_parent, pathbuf); printf("SHOULD POINT TO I=%ju (%s)",
(uintmax_t)inp->i_parent, pathbuf);
if (cursnapshot != 0) { if (cursnapshot != 0) {
/* /*
* We need to: * We need to:
@@ -443,8 +444,8 @@ pass2check(struct inodesc *idesc)
} else { } else {
getpathname(dirname, idesc->id_number, getpathname(dirname, idesc->id_number,
dirp->d_ino); dirp->d_ino);
pwarn("ZERO LENGTH DIRECTORY %s I=%d", pwarn("ZERO LENGTH DIRECTORY %s I=%ju",
dirname, dirp->d_ino); dirname, (uintmax_t)dirp->d_ino);
/* /*
* We need to: * We need to:
* setcwd(idesc->id_parent); * setcwd(idesc->id_parent);
@@ -507,8 +508,9 @@ pass2check(struct inodesc *idesc)
break; break;
default: default:
errx(EEXIT, "BAD STATE %d FOR INODE I=%d", errx(EEXIT, "BAD STATE %d FOR INODE I=%ju",
inoinfo(dirp->d_ino)->ino_state, dirp->d_ino); inoinfo(dirp->d_ino)->ino_state,
(uintmax_t)dirp->d_ino);
} }
} }
if (n == 0) if (n == 0)
+4 -2
View File
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <ufs/ffs/fs.h> #include <ufs/ffs/fs.h>
#include <err.h> #include <err.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include "fsck.h" #include "fsck.h"
@@ -114,8 +115,9 @@ pass4(void)
break; break;
default: default:
errx(EEXIT, "BAD STATE %d FOR INODE I=%d", errx(EEXIT, "BAD STATE %d FOR INODE I=%ju",
inoinfo(inumber)->ino_state, inumber); inoinfo(inumber)->ino_state,
(uintmax_t)inumber);
} }
} }
} }
+71 -64
View File
@@ -831,8 +831,8 @@ ino_clrat(ino_t parent, off_t diroff, ino_t child)
int doff; int doff;
if (debug) if (debug)
printf("Clearing inode %d from parent %d at offset %jd\n", printf("Clearing inode %ju from parent %ju at offset %jd\n",
child, parent, diroff); (uintmax_t)child, (uintmax_t)parent, diroff);
lbn = lblkno(fs, diroff); lbn = lblkno(fs, diroff);
doff = blkoff(fs, diroff); doff = blkoff(fs, diroff);
@@ -842,8 +842,8 @@ ino_clrat(ino_t parent, off_t diroff, ino_t child)
block = dblk_read(blk, blksize); block = dblk_read(blk, blksize);
dp = (struct direct *)&block[doff]; dp = (struct direct *)&block[doff];
if (dp->d_ino != child) if (dp->d_ino != child)
errx(1, "Inode %d does not exist in %d at %jd", errx(1, "Inode %ju does not exist in %ju at %jd",
child, parent, diroff); (uintmax_t)child, (uintmax_t)parent, diroff);
dp->d_ino = 0; dp->d_ino = 0;
dblk_dirty(blk); dblk_dirty(blk);
/* /*
@@ -879,10 +879,11 @@ ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
* was reallocated. * was reallocated.
*/ */
if (*mode != 0) if (*mode != 0)
printf("Directory %d has bad mode %o\n", printf("Directory %ju has bad mode %o\n",
parent, *mode); (uintmax_t)parent, *mode);
else else
printf("Directory %d has zero mode\n", parent); printf("Directory %ju has zero mode\n",
(uintmax_t)parent);
} }
return (0); return (0);
} }
@@ -891,15 +892,16 @@ ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
blksize = sblksize(fs, DIP(dip, di_size), lbn); blksize = sblksize(fs, DIP(dip, di_size), lbn);
if (diroff + DIRECTSIZ(1) > DIP(dip, di_size) || doff >= blksize) { if (diroff + DIRECTSIZ(1) > DIP(dip, di_size) || doff >= blksize) {
if (debug) if (debug)
printf("ino %d absent from %d due to offset %jd" printf("ino %ju absent from %ju due to offset %jd"
" exceeding size %jd\n", " exceeding size %jd\n",
child, parent, diroff, DIP(dip, di_size)); (uintmax_t)child, (uintmax_t)parent, diroff,
DIP(dip, di_size));
return (0); return (0);
} }
blk = ino_blkatoff(dip, parent, lbn, &frags); blk = ino_blkatoff(dip, parent, lbn, &frags);
if (blk <= 0) { if (blk <= 0) {
if (debug) if (debug)
printf("Sparse directory %d", parent); printf("Sparse directory %ju", (uintmax_t)parent);
return (0); return (0);
} }
block = dblk_read(blk, blksize); block = dblk_read(blk, blksize);
@@ -918,12 +920,13 @@ ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
dpoff += dp->d_reclen; dpoff += dp->d_reclen;
} while (dpoff <= doff); } while (dpoff <= doff);
if (dpoff > fs->fs_bsize) if (dpoff > fs->fs_bsize)
err_suj("Corrupt directory block in dir ino %d\n", parent); err_suj("Corrupt directory block in dir ino %ju\n",
(uintmax_t)parent);
/* Not found. */ /* Not found. */
if (dpoff != doff) { if (dpoff != doff) {
if (debug) if (debug)
printf("ino %d not found in %d, lbn %jd, dpoff %d\n", printf("ino %ju not found in %ju, lbn %jd, dpoff %d\n",
child, parent, lbn, dpoff); (uintmax_t)child, (uintmax_t)parent, lbn, dpoff);
return (0); return (0);
} }
/* /*
@@ -940,8 +943,8 @@ ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
return (1); return (1);
} }
if (debug) if (debug)
printf("ino %d doesn't match dirent ino %d in parent %d\n", printf("ino %ju doesn't match dirent ino %ju in parent %ju\n",
child, dp->d_ino, parent); (uintmax_t)child, (uintmax_t)dp->d_ino, (uintmax_t)parent);
return (0); return (0);
} }
@@ -977,8 +980,8 @@ indir_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, uint64_t *frags,
err_suj("Invalid level for lbn %jd\n", lbn); err_suj("Invalid level for lbn %jd\n", lbn);
if ((flags & VISIT_ROOT) == 0 && blk_isindir(blk, ino, lbn) == 0) { if ((flags & VISIT_ROOT) == 0 && blk_isindir(blk, ino, lbn) == 0) {
if (debug) if (debug)
printf("blk %jd ino %d lbn %jd(%d) is not indir.\n", printf("blk %jd ino %ju lbn %jd(%d) is not indir.\n",
blk, ino, lbn, level); blk, (uintmax_t)ino, lbn, level);
goto out; goto out;
} }
lbnadd = 1; lbnadd = 1;
@@ -1131,8 +1134,8 @@ ino_adjblks(struct suj_ino *sino)
if (blocks == DIP(ip, di_blocks)) if (blocks == DIP(ip, di_blocks))
return; return;
if (debug) if (debug)
printf("ino %d adjusting block count from %jd to %jd\n", printf("ino %ju adjusting block count from %jd to %jd\n",
ino, DIP(ip, di_blocks), blocks); (uintmax_t)ino, DIP(ip, di_blocks), blocks);
DIP_SET(ip, di_blocks, blocks); DIP_SET(ip, di_blocks, blocks);
ino_dirty(ino); ino_dirty(ino);
} }
@@ -1264,8 +1267,8 @@ ino_free_children(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, int frags)
if (isdotdot && skipparent == 1) if (isdotdot && skipparent == 1)
continue; continue;
if (debug) if (debug)
printf("Directory %d removing ino %d name %s\n", printf("Directory %ju removing ino %ju name %s\n",
ino, dp->d_ino, dp->d_name); (uintmax_t)ino, (uintmax_t)dp->d_ino, dp->d_name);
diroff = lblktosize(fs, lbn) + dpoff; diroff = lblktosize(fs, lbn) + dpoff;
ino_remref(ino, dp->d_ino, diroff, isdotdot); ino_remref(ino, dp->d_ino, diroff, isdotdot);
} }
@@ -1283,8 +1286,8 @@ ino_reclaim(union dinode *ip, ino_t ino, int mode)
if (ino == ROOTINO) if (ino == ROOTINO)
err_suj("Attempting to free ROOTINO\n"); err_suj("Attempting to free ROOTINO\n");
if (debug) if (debug)
printf("Truncating and freeing ino %d, nlink %d, mode %o\n", printf("Truncating and freeing ino %ju, nlink %d, mode %o\n",
ino, DIP(ip, di_nlink), DIP(ip, di_mode)); (uintmax_t)ino, DIP(ip, di_nlink), DIP(ip, di_mode));
/* We are freeing an inode or directory. */ /* We are freeing an inode or directory. */
if ((DIP(ip, di_mode) & IFMT) == IFDIR) if ((DIP(ip, di_mode) & IFMT) == IFDIR)
@@ -1328,8 +1331,8 @@ ino_decr(ino_t ino)
reqlink = 1; reqlink = 1;
if (nlink < reqlink) { if (nlink < reqlink) {
if (debug) if (debug)
printf("ino %d not enough links to live %d < %d\n", printf("ino %ju not enough links to live %d < %d\n",
ino, nlink, reqlink); (uintmax_t)ino, nlink, reqlink);
ino_reclaim(ip, ino, mode); ino_reclaim(ip, ino, mode);
return; return;
} }
@@ -1374,7 +1377,7 @@ ino_adjust(struct suj_ino *sino)
break; break;
} }
if (srec == NULL) if (srec == NULL)
errx(1, "Directory %d name not found", ino); errx(1, "Directory %ju name not found", (uintmax_t)ino);
} }
/* /*
* If it's a directory with no real names pointing to it go ahead * If it's a directory with no real names pointing to it go ahead
@@ -1398,21 +1401,23 @@ ino_adjust(struct suj_ino *sino)
ip = ino_read(ino); ip = ino_read(ino);
mode = DIP(ip, di_mode) & IFMT; mode = DIP(ip, di_mode) & IFMT;
if (nlink > LINK_MAX) if (nlink > LINK_MAX)
err_suj( err_suj("ino %ju %s, new link %d, old link %d\n",
"ino %d nlink manipulation error, new link %d, old link %d\n", (uintmax_t)ino, "nlink manipulation error", nlink,
ino, nlink, DIP(ip, di_nlink)); DIP(ip, di_nlink));
if (debug) if (debug)
printf("Adjusting ino %d, nlink %d, old link %d lastmode %o\n", printf("Adjusting ino %ju, nlink %d, old link %d lastmode %o\n",
ino, nlink, DIP(ip, di_nlink), sino->si_mode); (uintmax_t)ino, nlink, DIP(ip, di_nlink), sino->si_mode);
if (mode == 0) { if (mode == 0) {
if (debug) if (debug)
printf("ino %d, zero inode freeing bitmap\n", ino); printf("ino %ju, zero inode freeing bitmap\n",
(uintmax_t)ino);
ino_free(ino, sino->si_mode); ino_free(ino, sino->si_mode);
return; return;
} }
/* XXX Should be an assert? */ /* XXX Should be an assert? */
if (mode != sino->si_mode && debug) if (mode != sino->si_mode && debug)
printf("ino %d, mode %o != %o\n", ino, mode, sino->si_mode); printf("ino %ju, mode %o != %o\n",
(uintmax_t)ino, mode, sino->si_mode);
if ((mode & IFMT) == IFDIR) if ((mode & IFMT) == IFDIR)
reqlink = 2; reqlink = 2;
else else
@@ -1420,15 +1425,16 @@ ino_adjust(struct suj_ino *sino)
/* If the inode doesn't have enough links to live, free it. */ /* If the inode doesn't have enough links to live, free it. */
if (nlink < reqlink) { if (nlink < reqlink) {
if (debug) if (debug)
printf("ino %d not enough links to live %d < %d\n", printf("ino %ju not enough links to live %d < %d\n",
ino, nlink, reqlink); (uintmax_t)ino, nlink, reqlink);
ino_reclaim(ip, ino, mode); ino_reclaim(ip, ino, mode);
return; return;
} }
/* If required write the updated link count. */ /* If required write the updated link count. */
if (DIP(ip, di_nlink) == nlink) { if (DIP(ip, di_nlink) == nlink) {
if (debug) if (debug)
printf("ino %d, link matches, skipping.\n", ino); printf("ino %ju, link matches, skipping.\n",
(uintmax_t)ino);
return; return;
} }
DIP_SET(ip, di_nlink, nlink); DIP_SET(ip, di_nlink, nlink);
@@ -1527,8 +1533,8 @@ ino_trunc(ino_t ino, off_t size)
mode = DIP(ip, di_mode) & IFMT; mode = DIP(ip, di_mode) & IFMT;
cursize = DIP(ip, di_size); cursize = DIP(ip, di_size);
if (debug) if (debug)
printf("Truncating ino %d, mode %o to size %jd from size %jd\n", printf("Truncating ino %ju, mode %o to size %jd from size %jd\n",
ino, mode, size, cursize); (uintmax_t)ino, mode, size, cursize);
/* Skip datablocks for short links and devices. */ /* Skip datablocks for short links and devices. */
if (mode == 0 || mode == IFBLK || mode == IFCHR || if (mode == 0 || mode == IFBLK || mode == IFCHR ||
@@ -1586,7 +1592,8 @@ ino_trunc(ino_t ino, off_t size)
bn = DIP(ip, di_db[visitlbn]); bn = DIP(ip, di_db[visitlbn]);
if (bn == 0) if (bn == 0)
err_suj("Bad blk at ino %d lbn %jd\n", ino, visitlbn); err_suj("Bad blk at ino %ju lbn %jd\n",
(uintmax_t)ino, visitlbn);
oldspace = sblksize(fs, cursize, visitlbn); oldspace = sblksize(fs, cursize, visitlbn);
newspace = sblksize(fs, size, visitlbn); newspace = sblksize(fs, size, visitlbn);
if (oldspace != newspace) { if (oldspace != newspace) {
@@ -1610,8 +1617,8 @@ ino_trunc(ino_t ino, off_t size)
bn = ino_blkatoff(ip, ino, visitlbn, &frags); bn = ino_blkatoff(ip, ino, visitlbn, &frags);
if (bn == 0) if (bn == 0)
err_suj("Block missing from ino %d at lbn %jd\n", err_suj("Block missing from ino %ju at lbn %jd\n",
ino, visitlbn); (uintmax_t)ino, visitlbn);
clrsize = frags * fs->fs_fsize; clrsize = frags * fs->fs_fsize;
buf = dblk_read(bn, clrsize); buf = dblk_read(bn, clrsize);
clrsize -= off; clrsize -= off;
@@ -1656,11 +1663,11 @@ ino_check(struct suj_ino *sino)
err_suj("Inode mode/directory type mismatch %o != %o\n", err_suj("Inode mode/directory type mismatch %o != %o\n",
mode, rrec->jr_mode); mode, rrec->jr_mode);
if (debug) if (debug)
printf("jrefrec: op %d ino %d, nlink %d, parent %d, " printf("jrefrec: op %d ino %ju, nlink %d, parent %d, "
"diroff %jd, mode %o, isat %d, isdot %d\n", "diroff %jd, mode %o, isat %d, isdot %d\n",
rrec->jr_op, rrec->jr_ino, rrec->jr_nlink, rrec->jr_op, (uintmax_t)rrec->jr_ino,
rrec->jr_parent, rrec->jr_diroff, rrec->jr_mode, rrec->jr_nlink, rrec->jr_parent, rrec->jr_diroff,
isat, isdot); rrec->jr_mode, isat, isdot);
mode = rrec->jr_mode & IFMT; mode = rrec->jr_mode & IFMT;
if (rrec->jr_op == JOP_REMREF) if (rrec->jr_op == JOP_REMREF)
removes++; removes++;
@@ -1676,8 +1683,8 @@ ino_check(struct suj_ino *sino)
* by one. * by one.
*/ */
if (debug) if (debug)
printf("ino %d nlink %d newlinks %d removes %d dotlinks %d\n", printf("ino %ju nlink %d newlinks %d removes %d dotlinks %d\n",
ino, nlink, newlinks, removes, dotlinks); (uintmax_t)ino, nlink, newlinks, removes, dotlinks);
nlink += newlinks; nlink += newlinks;
nlink -= removes; nlink -= removes;
sino->si_linkadj = 1; sino->si_linkadj = 1;
@@ -1718,9 +1725,9 @@ blk_check(struct suj_blk *sblk)
sino->si_blkadj = 1; sino->si_blkadj = 1;
} }
if (debug) if (debug)
printf("op %d blk %jd ino %d lbn %jd frags %d isat %d (%d)\n", printf("op %d blk %jd ino %ju lbn %jd frags %d isat %d (%d)\n",
brec->jb_op, blk, brec->jb_ino, brec->jb_lbn, brec->jb_op, blk, (uintmax_t)brec->jb_ino,
brec->jb_frags, isat, frags); brec->jb_lbn, brec->jb_frags, isat, frags);
/* /*
* If we found the block at this address we still have to * If we found the block at this address we still have to
* determine if we need to free the tail end that was * determine if we need to free the tail end that was
@@ -1937,12 +1944,12 @@ ino_unlinked(void)
*/ */
if (DIP(ip, di_nlink) == 0) { if (DIP(ip, di_nlink) == 0) {
if (debug) if (debug)
printf("Freeing unlinked ino %d mode %o\n", printf("Freeing unlinked ino %ju mode %o\n",
ino, mode); ino, mode);
ino_reclaim(ip, ino, mode); ino_reclaim(ip, ino, mode);
} else if (debug) } else if (debug)
printf("Skipping ino %d mode %o with link %d\n", printf("Skipping ino %ju mode %o with link %d\n",
ino, mode, DIP(ip, di_nlink)); (uintmax_t)ino, mode, DIP(ip, di_nlink));
ino = inon; ino = inon;
} }
} }
@@ -2365,27 +2372,27 @@ suj_verifyino(union dinode *ip)
{ {
if (DIP(ip, di_nlink) != 1) { if (DIP(ip, di_nlink) != 1) {
printf("Invalid link count %d for journal inode %d\n", printf("Invalid link count %d for journal inode %ju\n",
DIP(ip, di_nlink), sujino); DIP(ip, di_nlink), (uintmax_t)sujino);
return (-1); return (-1);
} }
if ((DIP(ip, di_flags) & (SF_IMMUTABLE | SF_NOUNLINK)) != if ((DIP(ip, di_flags) & (SF_IMMUTABLE | SF_NOUNLINK)) !=
(SF_IMMUTABLE | SF_NOUNLINK)) { (SF_IMMUTABLE | SF_NOUNLINK)) {
printf("Invalid flags 0x%X for journal inode %d\n", printf("Invalid flags 0x%X for journal inode %ju\n",
DIP(ip, di_flags), sujino); DIP(ip, di_flags), (uintmax_t)sujino);
return (-1); return (-1);
} }
if (DIP(ip, di_mode) != (IFREG | IREAD)) { if (DIP(ip, di_mode) != (IFREG | IREAD)) {
printf("Invalid mode %o for journal inode %d\n", printf("Invalid mode %o for journal inode %ju\n",
DIP(ip, di_mode), sujino); DIP(ip, di_mode), (uintmax_t)sujino);
return (-1); return (-1);
} }
if (DIP(ip, di_size) < SUJ_MIN) { if (DIP(ip, di_size) < SUJ_MIN) {
printf("Invalid size %jd for journal inode %d\n", printf("Invalid size %jd for journal inode %ju\n",
DIP(ip, di_size), sujino); DIP(ip, di_size), (uintmax_t)sujino);
return (-1); return (-1);
} }
@@ -2713,12 +2720,12 @@ suj_check(const char *filesys)
* Build a list of journal blocks in jblocks before parsing the * Build a list of journal blocks in jblocks before parsing the
* available journal blocks in with suj_read(). * available journal blocks in with suj_read().
*/ */
printf("** Reading %jd byte journal from inode %d.\n", printf("** Reading %jd byte journal from inode %ju.\n",
DIP(jip, di_size), sujino); DIP(jip, di_size), (uintmax_t)sujino);
suj_jblocks = jblocks_create(); suj_jblocks = jblocks_create();
blocks = ino_visit(jip, sujino, suj_add_block, 0); blocks = ino_visit(jip, sujino, suj_add_block, 0);
if (blocks != numfrags(fs, DIP(jip, di_size))) { if (blocks != numfrags(fs, DIP(jip, di_size))) {
printf("Sparse journal inode %d.\n", sujino); printf("Sparse journal inode %ju.\n", (uintmax_t)sujino);
return (-1); return (-1);
} }
suj_read(); suj_read();