Fix a bunch of format string warnings which broke
the sparc64 build. Tested on: sparc64, i386
This commit is contained in:
parent
781cfb9348
commit
84fc0d7e7f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101037
@ -55,6 +55,7 @@ static const char rcsid[] =
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.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) {
|
if (read(fd, cp, (int)secsize) != secsize) {
|
||||||
(void)lseek(fd, offset + i + secsize, 0);
|
(void)lseek(fd, offset + i + secsize, 0);
|
||||||
if (secsize != dev_bsize && dev_bsize != 1)
|
if (secsize != dev_bsize && dev_bsize != 1)
|
||||||
printf(" %lld (%lld),",
|
printf(" %jd (%jd),",
|
||||||
(long long)(blk * dev_bsize + i) / secsize,
|
(intmax_t)(blk * dev_bsize + i) / secsize,
|
||||||
(long long)blk + i / dev_bsize);
|
(intmax_t)blk + i / dev_bsize);
|
||||||
else
|
else
|
||||||
printf(" %lld,", (long long)blk + i / dev_bsize);
|
printf(" %jd,", (intmax_t)blk + i / dev_bsize);
|
||||||
errs++;
|
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)
|
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
|
||||||
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
|
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
|
||||||
(void)lseek(fd, offset + i + dev_bsize, 0);
|
(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");
|
printf("\n");
|
||||||
return;
|
return;
|
||||||
|
@ -562,7 +562,7 @@ pinode(ino_t ino)
|
|||||||
printf("MODE=%o\n", DIP(dp, di_mode));
|
printf("MODE=%o\n", DIP(dp, di_mode));
|
||||||
if (preen)
|
if (preen)
|
||||||
printf("%s: ", cdevname);
|
printf("%s: ", cdevname);
|
||||||
printf("SIZE=%qu ", DIP(dp, di_size));
|
printf("SIZE=%ju ", (uintmax_t)DIP(dp, di_size));
|
||||||
t = DIP(dp, di_mtime);
|
t = DIP(dp, di_mtime);
|
||||||
p = ctime(&t);
|
p = ctime(&t);
|
||||||
printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]);
|
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)
|
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");
|
printf("\n");
|
||||||
switch (inoinfo(ino)->ino_state) {
|
switch (inoinfo(ino)->ino_state) {
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
@ -190,8 +191,9 @@ checkfilesys(char *filesys)
|
|||||||
struct statfs *mntp;
|
struct statfs *mntp;
|
||||||
struct zlncnt *zlnp;
|
struct zlncnt *zlnp;
|
||||||
ufs2_daddr_t blks;
|
ufs2_daddr_t blks;
|
||||||
int cylno, size, ret;
|
int cylno, ret;
|
||||||
ino_t files;
|
ino_t files;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
cdevname = filesys;
|
cdevname = filesys;
|
||||||
if (debug && preen)
|
if (debug && preen)
|
||||||
@ -372,11 +374,12 @@ checkfilesys(char *filesys)
|
|||||||
pwarn("Reclaimed: %ld directories, %ld files, %lld fragments\n",
|
pwarn("Reclaimed: %ld directories, %ld files, %lld fragments\n",
|
||||||
countdirs, (long)files - countdirs, (long long)blks);
|
countdirs, (long)files - countdirs, (long long)blks);
|
||||||
}
|
}
|
||||||
pwarn("%ld files, %lld used, %llu free ",
|
pwarn("%ld files, %jd used, %ju free ",
|
||||||
(long)n_files, (long long)n_blks,
|
(long)n_files, (intmax_t)n_blks,
|
||||||
n_ffree + sblock.fs_frag * n_bfree);
|
(uintmax_t)n_ffree + sblock.fs_frag * n_bfree);
|
||||||
printf("(%qu frags, %qu blocks, %.1f%% fragmentation)\n",
|
printf("(%ju frags, %ju blocks, %.1f%% fragmentation)\n",
|
||||||
n_ffree, n_bfree, n_ffree * 100.0 / sblock.fs_dsize);
|
(uintmax_t)n_ffree, (uintmax_t)n_bfree,
|
||||||
|
n_ffree * 100.0 / sblock.fs_dsize);
|
||||||
if (debug) {
|
if (debug) {
|
||||||
if (files < 0)
|
if (files < 0)
|
||||||
printf("%d inodes missing\n", -files);
|
printf("%d inodes missing\n", -files);
|
||||||
|
@ -48,6 +48,7 @@ static const char rcsid[] =
|
|||||||
#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"
|
||||||
@ -228,7 +229,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
|||||||
DIP(dp, di_size) > sblock.fs_maxfilesize ||
|
DIP(dp, di_size) > sblock.fs_maxfilesize ||
|
||||||
(mode == IFDIR && DIP(dp, di_size) > MAXDIRSIZE)) {
|
(mode == IFDIR && DIP(dp, di_size) > MAXDIRSIZE)) {
|
||||||
if (debug)
|
if (debug)
|
||||||
printf("bad size %qu:", DIP(dp, di_size));
|
printf("bad size %ju:", (uintmax_t)DIP(dp, di_size));
|
||||||
goto unknown;
|
goto unknown;
|
||||||
}
|
}
|
||||||
if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
|
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 ||
|
if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
|
||||||
mode == IFSOCK) && DIP(dp, di_size) != 0) {
|
mode == IFSOCK) && DIP(dp, di_size) != 0) {
|
||||||
if (debug)
|
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;
|
goto unknown;
|
||||||
}
|
}
|
||||||
if ((mode == IFBLK || mode == IFCHR) &&
|
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);
|
ndb = howmany(DIP(dp, di_size), sblock.fs_bsize);
|
||||||
if (ndb < 0) {
|
if (ndb < 0) {
|
||||||
if (debug)
|
if (debug)
|
||||||
printf("bad size %qu ndb %qu:",
|
printf("bad size %ju ndb %ju:",
|
||||||
DIP(dp, di_size), ndb);
|
(uintmax_t)DIP(dp, di_size), (uintmax_t)ndb);
|
||||||
goto unknown;
|
goto unknown;
|
||||||
}
|
}
|
||||||
if (mode == IFBLK || mode == IFCHR)
|
if (mode == IFBLK || mode == IFCHR)
|
||||||
@ -281,8 +283,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
|||||||
for (j = ndb; ndb < NDADDR && j < NDADDR; j++)
|
for (j = ndb; ndb < NDADDR && j < NDADDR; j++)
|
||||||
if (DIP(dp, di_db[j]) != 0) {
|
if (DIP(dp, di_db[j]) != 0) {
|
||||||
if (debug)
|
if (debug)
|
||||||
printf("bad direct addr[%d]: %qu\n", j,
|
printf("bad direct addr[%d]: %ju\n", j,
|
||||||
(ufs2_daddr_t)DIP(dp, di_db[j]));
|
(uintmax_t)DIP(dp, di_db[j]));
|
||||||
goto unknown;
|
goto unknown;
|
||||||
}
|
}
|
||||||
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
|
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
|
||||||
@ -290,8 +292,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
|||||||
for (; j < NIADDR; j++)
|
for (; j < NIADDR; j++)
|
||||||
if (DIP(dp, di_ib[j]) != 0) {
|
if (DIP(dp, di_ib[j]) != 0) {
|
||||||
if (debug)
|
if (debug)
|
||||||
printf("bad indirect addr: %qu\n",
|
printf("bad indirect addr: %ju\n",
|
||||||
DIP(dp, di_ib[j]));
|
(uintmax_t)DIP(dp, di_ib[j]));
|
||||||
goto unknown;
|
goto unknown;
|
||||||
}
|
}
|
||||||
if (ftypeok(dp) == 0)
|
if (ftypeok(dp) == 0)
|
||||||
@ -331,9 +333,9 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
|||||||
(void)ckinode(dp, idesc);
|
(void)ckinode(dp, idesc);
|
||||||
idesc->id_entryno *= btodb(sblock.fs_fsize);
|
idesc->id_entryno *= btodb(sblock.fs_fsize);
|
||||||
if (DIP(dp, di_blocks) != idesc->id_entryno) {
|
if (DIP(dp, di_blocks) != idesc->id_entryno) {
|
||||||
pwarn("INCORRECT BLOCK COUNT I=%lu (%qu should be %qu)",
|
pwarn("INCORRECT BLOCK COUNT I=%lu (%ju should be %ju)",
|
||||||
(u_long)inumber, DIP(dp, di_blocks),
|
(u_long)inumber, (uintmax_t)DIP(dp, di_blocks),
|
||||||
idesc->id_entryno);
|
(uintmax_t)idesc->id_entryno);
|
||||||
if (preen)
|
if (preen)
|
||||||
printf(" (CORRECTED)\n");
|
printf(" (CORRECTED)\n");
|
||||||
else if (reply("CORRECT") == 0)
|
else if (reply("CORRECT") == 0)
|
||||||
@ -346,8 +348,8 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
|||||||
cmd.value = idesc->id_number;
|
cmd.value = idesc->id_number;
|
||||||
cmd.size = idesc->id_entryno - DIP(dp, di_blocks);
|
cmd.size = idesc->id_entryno - DIP(dp, di_blocks);
|
||||||
if (debug)
|
if (debug)
|
||||||
printf("adjblkcnt ino %qu amount %lld\n",
|
printf("adjblkcnt ino %ju amount %lld\n",
|
||||||
cmd.value, (long long)cmd.size);
|
(uintmax_t)cmd.value, (long long)cmd.size);
|
||||||
if (sysctl(adjblkcnt, MIBSIZE, 0, 0,
|
if (sysctl(adjblkcnt, MIBSIZE, 0, 0,
|
||||||
&cmd, sizeof cmd) == -1)
|
&cmd, sizeof cmd) == -1)
|
||||||
rwerror("ADJUST INODE BLOCK COUNT", cmd.value);
|
rwerror("ADJUST INODE BLOCK COUNT", cmd.value);
|
||||||
|
@ -46,6 +46,7 @@ static const char rcsid[] =
|
|||||||
#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"
|
||||||
@ -134,7 +135,7 @@ pass2(void)
|
|||||||
inpend = &inpsort[inplast];
|
inpend = &inpsort[inplast];
|
||||||
for (inpp = inpsort; inpp < inpend; inpp++) {
|
for (inpp = inpsort; inpp < inpend; inpp++) {
|
||||||
if (got_siginfo) {
|
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,
|
inpp - inpsort, (int)inplast,
|
||||||
(int)((inpp - inpsort) * 100 / inplast));
|
(int)((inpp - inpsort) * 100 / inplast));
|
||||||
got_siginfo = 0;
|
got_siginfo = 0;
|
||||||
@ -153,13 +154,13 @@ pass2(void)
|
|||||||
} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
|
} else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
|
||||||
getpathname(pathbuf, inp->i_number, inp->i_number);
|
getpathname(pathbuf, inp->i_number, inp->i_number);
|
||||||
if (usedsoftdep)
|
if (usedsoftdep)
|
||||||
pfatal("%s %s: LENGTH %d NOT MULTIPLE OF %d",
|
pfatal("%s %s: LENGTH %jd NOT MULTIPLE OF %d",
|
||||||
"DIRECTORY", pathbuf, inp->i_isize,
|
"DIRECTORY", pathbuf,
|
||||||
DIRBLKSIZ);
|
(intmax_t)inp->i_isize, DIRBLKSIZ);
|
||||||
else
|
else
|
||||||
pwarn("%s %s: LENGTH %d NOT MULTIPLE OF %d",
|
pwarn("%s %s: LENGTH %jd NOT MULTIPLE OF %d",
|
||||||
"DIRECTORY", pathbuf, inp->i_isize,
|
"DIRECTORY", pathbuf,
|
||||||
DIRBLKSIZ);
|
(intmax_t)inp->i_isize, DIRBLKSIZ);
|
||||||
if (preen)
|
if (preen)
|
||||||
printf(" (ADJUSTED)\n");
|
printf(" (ADJUSTED)\n");
|
||||||
inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
|
inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
|
||||||
|
@ -52,6 +52,7 @@ static const char rcsid[] =
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
@ -269,8 +270,8 @@ setup(char *dev)
|
|||||||
inphead = (struct inoinfo **)calloc((unsigned)numdirs,
|
inphead = (struct inoinfo **)calloc((unsigned)numdirs,
|
||||||
sizeof(struct inoinfo *));
|
sizeof(struct inoinfo *));
|
||||||
if (inpsort == NULL || inphead == NULL) {
|
if (inpsort == NULL || inphead == NULL) {
|
||||||
printf("cannot alloc %u bytes for inphead\n",
|
printf("cannot alloc %ju bytes for inphead\n",
|
||||||
(unsigned)numdirs * sizeof(struct inoinfo *));
|
(uintmax_t)numdirs * sizeof(struct inoinfo *));
|
||||||
goto badsb;
|
goto badsb;
|
||||||
}
|
}
|
||||||
bufinit();
|
bufinit();
|
||||||
|
Loading…
Reference in New Issue
Block a user