summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2002-07-31 12:01:14 +0000
committermux <mux@FreeBSD.org>2002-07-31 12:01:14 +0000
commitffba0988ee558a7a26879156644d46d44c24ba8a (patch)
tree47daaae22cea254b64f1377471faae25ff66463e /sbin/fsck_ffs
parent919470cf7d44b541c704c209ee7db09bc6b3b6d7 (diff)
downloadFreeBSD-src-ffba0988ee558a7a26879156644d46d44c24ba8a.zip
FreeBSD-src-ffba0988ee558a7a26879156644d46d44c24ba8a.tar.gz
Fix a bunch of format string warnings which broke
the sparc64 build. Tested on: sparc64, i386
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r--sbin/fsck_ffs/fsutil.c11
-rw-r--r--sbin/fsck_ffs/inode.c4
-rw-r--r--sbin/fsck_ffs/main.c15
-rw-r--r--sbin/fsck_ffs/pass1.c28
-rw-r--r--sbin/fsck_ffs/pass2.c15
-rw-r--r--sbin/fsck_ffs/setup.c5
6 files changed, 43 insertions, 35 deletions
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index be289b2..6776656 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -55,6 +55,7 @@ static const char rcsid[] =
#include <string.h>
#include <ctype.h>
#include <fstab.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -360,11 +361,11 @@ bread(int fd, char *buf, ufs2_daddr_t blk, long size)
if (read(fd, cp, (int)secsize) != secsize) {
(void)lseek(fd, offset + i + secsize, 0);
if (secsize != dev_bsize && dev_bsize != 1)
- printf(" %lld (%lld),",
- (long long)(blk * dev_bsize + i) / secsize,
- (long long)blk + i / dev_bsize);
+ printf(" %jd (%jd),",
+ (intmax_t)(blk * dev_bsize + i) / secsize,
+ (intmax_t)blk + i / dev_bsize);
else
- printf(" %lld,", (long long)blk + i / dev_bsize);
+ printf(" %jd,", (intmax_t)blk + i / dev_bsize);
errs++;
}
}
@@ -399,7 +400,7 @@ bwrite(int fd, char *buf, ufs2_daddr_t blk, long size)
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
(void)lseek(fd, offset + i + dev_bsize, 0);
- printf(" %lld,", (long long)blk + i / dev_bsize);
+ printf(" %jd,", (intmax_t)blk + i / dev_bsize);
}
printf("\n");
return;
diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index 8a2e04b..d05e330 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -562,7 +562,7 @@ pinode(ino_t ino)
printf("MODE=%o\n", DIP(dp, di_mode));
if (preen)
printf("%s: ", cdevname);
- printf("SIZE=%qu ", DIP(dp, di_size));
+ printf("SIZE=%ju ", (uintmax_t)DIP(dp, di_size));
t = DIP(dp, di_mtime);
p = ctime(&t);
printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]);
@@ -572,7 +572,7 @@ void
blkerror(ino_t ino, const char *type, ufs2_daddr_t blk)
{
- pfatal("%lld %s I=%lu", (intmax_t)blk, type, (u_long)ino);
+ pfatal("%jd %s I=%ju", (intmax_t)blk, type, (uintmax_t)ino);
printf("\n");
switch (inoinfo(ino)->ino_state) {
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 2f984d4..d35d7a1 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <fstab.h>
#include <paths.h>
+#include <stdint.h>
#include <string.h>
#include "fsck.h"
@@ -190,8 +191,9 @@ checkfilesys(char *filesys)
struct statfs *mntp;
struct zlncnt *zlnp;
ufs2_daddr_t blks;
- int cylno, size, ret;
+ int cylno, ret;
ino_t files;
+ size_t size;
cdevname = filesys;
if (debug && preen)
@@ -372,11 +374,12 @@ checkfilesys(char *filesys)
pwarn("Reclaimed: %ld directories, %ld files, %lld fragments\n",
countdirs, (long)files - countdirs, (long long)blks);
}
- pwarn("%ld files, %lld used, %llu free ",
- (long)n_files, (long long)n_blks,
- n_ffree + sblock.fs_frag * n_bfree);
- printf("(%qu frags, %qu blocks, %.1f%% fragmentation)\n",
- n_ffree, n_bfree, n_ffree * 100.0 / sblock.fs_dsize);
+ pwarn("%ld files, %jd used, %ju free ",
+ (long)n_files, (intmax_t)n_blks,
+ (uintmax_t)n_ffree + sblock.fs_frag * n_bfree);
+ printf("(%ju frags, %ju blocks, %.1f%% fragmentation)\n",
+ (uintmax_t)n_ffree, (uintmax_t)n_bfree,
+ n_ffree * 100.0 / sblock.fs_dsize);
if (debug) {
if (files < 0)
printf("%d inodes missing\n", -files);
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c
index c1f080f..fce4149 100644
--- a/sbin/fsck_ffs/pass1.c
+++ b/sbin/fsck_ffs/pass1.c
@@ -48,6 +48,7 @@ static const char rcsid[] =
#include <ufs/ffs/fs.h>
#include <err.h>
+#include <stdint.h>
#include <string.h>
#include "fsck.h"
@@ -228,7 +229,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
DIP(dp, di_size) > sblock.fs_maxfilesize ||
(mode == IFDIR && DIP(dp, di_size) > MAXDIRSIZE)) {
if (debug)
- printf("bad size %qu:", DIP(dp, di_size));
+ printf("bad size %ju:", (uintmax_t)DIP(dp, di_size));
goto unknown;
}
if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
@@ -240,7 +241,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
mode == IFSOCK) && DIP(dp, di_size) != 0) {
if (debug)
- printf("bad special-file size %qu:", DIP(dp, di_size));
+ printf("bad special-file size %ju:",
+ (uintmax_t)DIP(dp, di_size));
goto unknown;
}
if ((mode == IFBLK || mode == IFCHR) &&
@@ -252,8 +254,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
ndb = howmany(DIP(dp, di_size), sblock.fs_bsize);
if (ndb < 0) {
if (debug)
- printf("bad size %qu ndb %qu:",
- DIP(dp, di_size), ndb);
+ printf("bad size %ju ndb %ju:",
+ (uintmax_t)DIP(dp, di_size), (uintmax_t)ndb);
goto unknown;
}
if (mode == IFBLK || mode == IFCHR)
@@ -281,8 +283,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
for (j = ndb; ndb < NDADDR && j < NDADDR; j++)
if (DIP(dp, di_db[j]) != 0) {
if (debug)
- printf("bad direct addr[%d]: %qu\n", j,
- (ufs2_daddr_t)DIP(dp, di_db[j]));
+ printf("bad direct addr[%d]: %ju\n", j,
+ (uintmax_t)DIP(dp, di_db[j]));
goto unknown;
}
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
@@ -290,8 +292,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
for (; j < NIADDR; j++)
if (DIP(dp, di_ib[j]) != 0) {
if (debug)
- printf("bad indirect addr: %qu\n",
- DIP(dp, di_ib[j]));
+ printf("bad indirect addr: %ju\n",
+ (uintmax_t)DIP(dp, di_ib[j]));
goto unknown;
}
if (ftypeok(dp) == 0)
@@ -331,9 +333,9 @@ checkinode(ino_t inumber, struct inodesc *idesc)
(void)ckinode(dp, idesc);
idesc->id_entryno *= btodb(sblock.fs_fsize);
if (DIP(dp, di_blocks) != idesc->id_entryno) {
- pwarn("INCORRECT BLOCK COUNT I=%lu (%qu should be %qu)",
- (u_long)inumber, DIP(dp, di_blocks),
- idesc->id_entryno);
+ pwarn("INCORRECT BLOCK COUNT I=%lu (%ju should be %ju)",
+ (u_long)inumber, (uintmax_t)DIP(dp, di_blocks),
+ (uintmax_t)idesc->id_entryno);
if (preen)
printf(" (CORRECTED)\n");
else if (reply("CORRECT") == 0)
@@ -346,8 +348,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
cmd.value = idesc->id_number;
cmd.size = idesc->id_entryno - DIP(dp, di_blocks);
if (debug)
- printf("adjblkcnt ino %qu amount %lld\n",
- cmd.value, (long long)cmd.size);
+ printf("adjblkcnt ino %ju amount %lld\n",
+ (uintmax_t)cmd.value, (long long)cmd.size);
if (sysctl(adjblkcnt, MIBSIZE, 0, 0,
&cmd, sizeof cmd) == -1)
rwerror("ADJUST INODE BLOCK COUNT", cmd.value);
diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c
index 4879a34..597181d 100644
--- a/sbin/fsck_ffs/pass2.c
+++ b/sbin/fsck_ffs/pass2.c
@@ -46,6 +46,7 @@ static const char rcsid[] =
#include <ufs/ffs/fs.h>
#include <err.h>
+#include <stdint.h>
#include <string.h>
#include "fsck.h"
@@ -134,7 +135,7 @@ pass2(void)
inpend = &inpsort[inplast];
for (inpp = inpsort; inpp < inpend; inpp++) {
if (got_siginfo) {
- printf("%s: phase 2: dir %d of %d (%d%%)\n", cdevname,
+ printf("%s: phase 2: dir %td of %d (%d%%)\n", cdevname,
inpp - inpsort, (int)inplast,
(int)((inpp - inpsort) * 100 / inplast));
got_siginfo = 0;
@@ -153,13 +154,13 @@ pass2(void)
} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
getpathname(pathbuf, inp->i_number, inp->i_number);
if (usedsoftdep)
- pfatal("%s %s: LENGTH %d NOT MULTIPLE OF %d",
- "DIRECTORY", pathbuf, inp->i_isize,
- DIRBLKSIZ);
+ pfatal("%s %s: LENGTH %jd NOT MULTIPLE OF %d",
+ "DIRECTORY", pathbuf,
+ (intmax_t)inp->i_isize, DIRBLKSIZ);
else
- pwarn("%s %s: LENGTH %d NOT MULTIPLE OF %d",
- "DIRECTORY", pathbuf, inp->i_isize,
- DIRBLKSIZ);
+ pwarn("%s %s: LENGTH %jd NOT MULTIPLE OF %d",
+ "DIRECTORY", pathbuf,
+ (intmax_t)inp->i_isize, DIRBLKSIZ);
if (preen)
printf(" (ADJUSTED)\n");
inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 83bf30f..c347ddb 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -52,6 +52,7 @@ static const char rcsid[] =
#include <ctype.h>
#include <err.h>
#include <errno.h>
+#include <stdint.h>
#include <string.h>
#include "fsck.h"
@@ -269,8 +270,8 @@ setup(char *dev)
inphead = (struct inoinfo **)calloc((unsigned)numdirs,
sizeof(struct inoinfo *));
if (inpsort == NULL || inphead == NULL) {
- printf("cannot alloc %u bytes for inphead\n",
- (unsigned)numdirs * sizeof(struct inoinfo *));
+ printf("cannot alloc %ju bytes for inphead\n",
+ (uintmax_t)numdirs * sizeof(struct inoinfo *));
goto badsb;
}
bufinit();
OpenPOWER on IntegriCloud