From a3e9bf8f3fb757b1e3eba53ad26c3006feeaec14 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 5 Dec 2013 23:05:57 +0100 Subject: [PATCH] fsck(8): Raise WARNS to 2 and fix warnings. --- sbin/fsck/Makefile | 3 +-- sbin/fsck/dir.c | 3 +-- sbin/fsck/fsutil.h | 13 ++++--------- sbin/fsck/inode.c | 6 ++---- sbin/fsck/main.c | 5 ++--- sbin/fsck/memzone.c | 2 +- sbin/fsck/memzone.h | 4 +--- sbin/fsck/pass1.c | 19 +++++++++---------- sbin/fsck/pass2.c | 7 +++---- sbin/fsck/pass3.c | 3 +-- sbin/fsck/pass5.c | 4 ++-- sbin/fsck/setup.c | 4 +--- sbin/fsck/utilities.c | 2 +- sys/vfs/ufs/ffs_subr.c | 2 +- 14 files changed, 30 insertions(+), 47 deletions(-) diff --git a/sbin/fsck/Makefile b/sbin/fsck/Makefile index ea7e25b503..b2c9b94136 100644 --- a/sbin/fsck/Makefile +++ b/sbin/fsck/Makefile @@ -1,13 +1,12 @@ # @(#)Makefile 8.2 (Berkeley) 4/27/95 # $FreeBSD: src/sbin/fsck/Makefile,v 1.5.6.1 2001/04/25 10:58:17 ru Exp $ -# $DragonFly: src/sbin/fsck/Makefile,v 1.6 2006/10/19 21:11:13 pavalos Exp $ PROG= fsck MAN= fsck.8 SRCS= dir.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \ pass5.c preen.c setup.c utilities.c memzone.c \ ffs_subr.c ffs_tables.c -WARNS?= 1 +WARNS?= 2 .PATH: ${.CURDIR}/../../sys/vfs/ufs .include diff --git a/sbin/fsck/dir.c b/sbin/fsck/dir.c index 03cfae5539..e38443720e 100644 --- a/sbin/fsck/dir.c +++ b/sbin/fsck/dir.c @@ -28,7 +28,6 @@ * * @(#)dir.c 8.8 (Berkeley) 4/28/95 * $FreeBSD: src/sbin/fsck/dir.c,v 1.15 1999/08/28 00:12:45 peter Exp $ - * $DragonFly: src/sbin/fsck/dir.c,v 1.11 2006/10/19 21:11:13 pavalos Exp $ */ #include @@ -496,7 +495,7 @@ linkup(ufs1_ino_t orphan, ufs1_ino_t parentdir, char *name) dp->di_nlink++; inodirty(); inoinfo(lfdir)->ino_linkcnt++; - pwarn("DIR I=%lu CONNECTED. ", orphan); + pwarn("DIR I=%u CONNECTED. ", orphan); if (parentdir != (ufs1_ino_t)-1) { printf("PARENT WAS I=%lu\n", (u_long)parentdir); /* diff --git a/sbin/fsck/fsutil.h b/sbin/fsck/fsutil.h index 71269d83d6..ff7703f283 100644 --- a/sbin/fsck/fsutil.h +++ b/sbin/fsck/fsutil.h @@ -29,18 +29,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sbin/fsck/fsutil.h,v 1.3.2.1 2001/08/01 05:47:55 obrien Exp $ - * $DragonFly: src/sbin/fsck/fsutil.h,v 1.4 2006/10/12 04:04:03 dillon Exp $ */ void perror(const char *); -void errexit(const char *, ...) - __attribute__((__noreturn__,__format__(__printf__,1,2))); -void pfatal(const char *, ...) - __attribute__((__format__(__printf__,1,2))); -void pwarn(const char *, ...) - __attribute__((__format__(__printf__,1,2))); -void panic(const char *, ...) - __attribute__((__noreturn__,__format__(__printf__,1,2))); +void errexit(const char *, ...) __printflike(1, 2) __dead2; +void pfatal(const char *, ...) __printflike(1, 2); +void pwarn(const char *, ...) __printflike(1, 2); +void panic(const char *, ...) __printflike(1, 2) __dead2; const char *rawname(const char *); const char *unrawname(const char *); #if 0 diff --git a/sbin/fsck/inode.c b/sbin/fsck/inode.c index 3dd3e40b50..d41e96c56f 100644 --- a/sbin/fsck/inode.c +++ b/sbin/fsck/inode.c @@ -420,8 +420,6 @@ getinoinfo(ufs1_ino_t inumber) void inocleanup(void) { - struct inoinfo **inpp; - if (inphead == NULL) return; mzpurge(&inoinfo_zone); @@ -520,7 +518,7 @@ pinode(ufs1_ino_t ino) printf("MODE=%o\n", dp->di_mode); if (preen) printf("%s: ", cdevname); - printf("SIZE=%qu ", dp->di_size); + printf("SIZE=%ju ", (uintmax_t)dp->di_size); t = dp->di_mtime; p = ctime(&t); printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]); @@ -530,7 +528,7 @@ void blkerror(ufs1_ino_t ino, char *type, ufs_daddr_t blk) { - pfatal("%ld %s I=%lu", blk, type, ino); + pfatal("%d %s I=%u", blk, type, ino); printf("\n"); switch (inoinfo(ino)->ino_state) { diff --git a/sbin/fsck/main.c b/sbin/fsck/main.c index 534bdcbdab..6fc15b2934 100644 --- a/sbin/fsck/main.c +++ b/sbin/fsck/main.c @@ -29,7 +29,6 @@ * @(#) Copyright (c) 1980, 1986, 1993 The Regents of the University of California. All rights reserved. * @(#)main.c 8.6 (Berkeley) 5/14/95 * $FreeBSD: src/sbin/fsck/main.c,v 1.21.2.1 2001/01/23 23:11:07 iedowse Exp $ - * $DragonFly: src/sbin/fsck/main.c,v 1.10 2007/04/20 22:20:10 dillon Exp $ */ #include @@ -203,7 +202,7 @@ checkfilesys(char *filesys, char *mntpt, long auxdata, int child) pfatal("CAN'T CHECK FILE SYSTEM."); return (0); case -1: - pwarn("clean, %ld free ", sblock.fs_cstotal.cs_nffree + + pwarn("clean, %d free ", sblock.fs_cstotal.cs_nffree + sblock.fs_frag * sblock.fs_cstotal.cs_nbfree); printf("(%d frags, %d blocks, %.1f%% fragmentation)\n", sblock.fs_cstotal.cs_nffree, sblock.fs_cstotal.cs_nbfree, @@ -281,7 +280,7 @@ checkfilesys(char *filesys, char *mntpt, long auxdata, int child) */ n_ffree = sblock.fs_cstotal.cs_nffree; n_bfree = sblock.fs_cstotal.cs_nbfree; - pwarn("%ld files, %ld used, %ld free ", + pwarn("%d files, %d used, %d free ", n_files, n_blks, n_ffree + sblock.fs_frag * n_bfree); printf("(%d frags, %d blocks, %.1f%% fragmentation)\n", n_ffree, n_bfree, n_ffree * 100.0 / sblock.fs_dsize); diff --git a/sbin/fsck/memzone.c b/sbin/fsck/memzone.c index 943e755f84..a18a37c32e 100644 --- a/sbin/fsck/memzone.c +++ b/sbin/fsck/memzone.c @@ -83,7 +83,7 @@ mzalloc(struct memzone *zone, int bytes) /* * Free memory in bulk */ -void * +void mzpurge(struct memzone *zone) { struct memchunk *chunk; diff --git a/sbin/fsck/memzone.h b/sbin/fsck/memzone.h index 8a25d39e80..b4b0873072 100644 --- a/sbin/fsck/memzone.h +++ b/sbin/fsck/memzone.h @@ -30,8 +30,6 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $DragonFly: src/sbin/fsck/memzone.h,v 1.1 2006/10/12 04:04:03 dillon Exp $ */ struct memchunk { @@ -49,5 +47,5 @@ struct memzone { #define MEMZONE_CHUNK (1024*1024) void *mzalloc(struct memzone *zone, int bytes); -void *mzpurge(struct memzone *zone); +void mzpurge(struct memzone *zone); diff --git a/sbin/fsck/pass1.c b/sbin/fsck/pass1.c index 5dc2228e73..8be48b87dc 100644 --- a/sbin/fsck/pass1.c +++ b/sbin/fsck/pass1.c @@ -28,7 +28,6 @@ * * @(#)pass1.c 8.6 (Berkeley) 4/28/95 * $FreeBSD: src/sbin/fsck/pass1.c,v 1.16.2.5 2002/06/23 22:34:58 iedowse Exp $ - * $DragonFly: src/sbin/fsck/pass1.c,v 1.9 2006/10/12 04:04:03 dillon Exp $ */ #include @@ -185,7 +184,7 @@ checkinode(ufs1_ino_t inumber, struct inodesc *idesc) memcmp(dp->di_ib, zino.di_ib, NIADDR * sizeof(ufs_daddr_t)) || dp->di_mode || dp->di_size) { - pfatal("PARTIALLY ALLOCATED INODE I=%lu", inumber); + pfatal("PARTIALLY ALLOCATED INODE I=%u", inumber); if (reply("CLEAR") == 1) { dp = ginode(inumber); clearinode(dp); @@ -204,7 +203,7 @@ checkinode(ufs1_ino_t inumber, struct inodesc *idesc) dp->di_size > sblock.fs_maxfilesize || (mode == IFDIR && dp->di_size > MAXDIRSIZE)) { if (debug) - printf("bad size %qu:", dp->di_size); + printf("bad size %ju:", (uintmax_t)dp->di_size); goto unknown; } if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) { @@ -216,14 +215,14 @@ checkinode(ufs1_ino_t inumber, struct inodesc *idesc) if ((mode == IFBLK || mode == IFCHR || mode == IFIFO || mode == IFSOCK) && dp->di_size != 0) { if (debug) - printf("bad special-file size %qu:", dp->di_size); + printf("bad special-file size %ju:", (uintmax_t)dp->di_size); goto unknown; } ndb = howmany(dp->di_size, sblock.fs_bsize); if (ndb < 0) { if (debug) - printf("bad size %qu ndb %d:", - dp->di_size, ndb); + printf("bad size %ju ndb %d:", + (uintmax_t)dp->di_size, ndb); goto unknown; } if (mode == IFBLK || mode == IFCHR) @@ -319,7 +318,7 @@ checkinode(ufs1_ino_t inumber, struct inodesc *idesc) ckinode(dp, idesc); idesc->id_entryno *= btodb(sblock.fs_fsize); if (dp->di_blocks != idesc->id_entryno) { - pwarn("INCORRECT BLOCK COUNT I=%lu (%ld should be %ld)", + pwarn("INCORRECT BLOCK COUNT I=%u (%d should be %d)", inumber, dp->di_blocks, idesc->id_entryno); if (preen) printf(" (CORRECTED)\n"); @@ -331,7 +330,7 @@ checkinode(ufs1_ino_t inumber, struct inodesc *idesc) } return; unknown: - pfatal("UNKNOWN FILE TYPE I=%lu", inumber); + pfatal("UNKNOWN FILE TYPE I=%u", inumber); inoinfo(inumber)->ino_state = FCLEAR; if (reply("CLEAR") == 1) { inoinfo(inumber)->ino_state = USTATE; @@ -353,7 +352,7 @@ pass1check(struct inodesc *idesc) if ((anyout = chkrange(blkno, idesc->id_numfrags)) != 0) { blkerror(idesc->id_number, "BAD", blkno); if (badblk++ >= MAXBAD) { - pwarn("EXCESSIVE BAD BLKS I=%lu", + pwarn("EXCESSIVE BAD BLKS I=%u", idesc->id_number); if (preen) printf(" (SKIPPING)\n"); @@ -373,7 +372,7 @@ pass1check(struct inodesc *idesc) } else { blkerror(idesc->id_number, "DUP", blkno); if (dupblk++ >= MAXDUP) { - pwarn("EXCESSIVE DUP BLKS I=%lu", + pwarn("EXCESSIVE DUP BLKS I=%u", idesc->id_number); if (preen) printf(" (SKIPPING)\n"); diff --git a/sbin/fsck/pass2.c b/sbin/fsck/pass2.c index e510b7d305..fdc85a91ae 100644 --- a/sbin/fsck/pass2.c +++ b/sbin/fsck/pass2.c @@ -28,7 +28,6 @@ * * @(#)pass2.c 8.9 (Berkeley) 4/28/95 * $FreeBSD: src/sbin/fsck/pass2.c,v 1.10.2.2 2001/11/24 15:14:59 iedowse Exp $ - * $DragonFly: src/sbin/fsck/pass2.c,v 1.11 2006/10/12 04:04:03 dillon Exp $ */ #include @@ -136,7 +135,7 @@ pass2(void) for (inpp = inpsort; inpp < inpend; inpp++) { if (got_siginfo) { printf("%s: phase 2: dir %d of %ld (%d%%)\n", cdevname, - inpp - inpsort, inplast, (int)((inpp - inpsort) * 100 / + (int)(inpp - inpsort), inplast, (int)((inpp - inpsort) * 100 / inplast)); got_siginfo = 0; } @@ -155,11 +154,11 @@ 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", + pfatal("%s %s: LENGTH %zu NOT MULTIPLE OF %d", "DIRECTORY", pathbuf, inp->i_isize, DIRBLKSIZ); else - pwarn("%s %s: LENGTH %d NOT MULTIPLE OF %d", + pwarn("%s %s: LENGTH %zu NOT MULTIPLE OF %d", "DIRECTORY", pathbuf, inp->i_isize, DIRBLKSIZ); if (preen) diff --git a/sbin/fsck/pass3.c b/sbin/fsck/pass3.c index 73f730dafb..e852687a1d 100644 --- a/sbin/fsck/pass3.c +++ b/sbin/fsck/pass3.c @@ -28,7 +28,6 @@ * * @(#)pass3.c 8.2 (Berkeley) 4/27/95 * $FreeBSD: src/sbin/fsck/pass3.c,v 1.7.2.1 2001/01/23 23:11:07 iedowse Exp $ - * $DragonFly: src/sbin/fsck/pass3.c,v 1.6 2006/10/12 04:04:03 dillon Exp $ */ #include @@ -92,7 +91,7 @@ pass3(void) propagate(); continue; } - pfatal("ORPHANED DIRECTORY LOOP DETECTED I=%lu", orphan); + pfatal("ORPHANED DIRECTORY LOOP DETECTED I=%u", orphan); if (reply("RECONNECT") == 0) continue; memset(&idesc, 0, sizeof(struct inodesc)); diff --git a/sbin/fsck/pass5.c b/sbin/fsck/pass5.c index 033dadaf14..1007248e9a 100644 --- a/sbin/fsck/pass5.c +++ b/sbin/fsck/pass5.c @@ -321,7 +321,7 @@ pass5(void) continue; if (cg_inosused(cg)[i] & (1 << k)) continue; - pwarn("ALLOCATED INODE %d MARKED FREE\n", + pwarn("ALLOCATED INODE %ld MARKED FREE\n", c * fs->fs_ipg + i * NBBY + k); } } @@ -334,7 +334,7 @@ pass5(void) continue; if (cg_blksfree(newcg)[i] & (1 << k)) continue; - pwarn("ALLOCATED FRAG %d MARKED FREE\n", + pwarn("ALLOCATED FRAG %ld MARKED FREE\n", c * fs->fs_fpg + i * NBBY + k); } } diff --git a/sbin/fsck/setup.c b/sbin/fsck/setup.c index dba641dd6b..c8c14f7aa4 100644 --- a/sbin/fsck/setup.c +++ b/sbin/fsck/setup.c @@ -28,7 +28,6 @@ * * @(#)setup.c 8.10 (Berkeley) 5/9/95 * $FreeBSD: src/sbin/fsck/setup.c,v 1.17.2.4 2002/06/24 05:10:41 dillon Exp $ - * $DragonFly: src/sbin/fsck/setup.c,v 1.8 2007/05/20 20:29:01 dillon Exp $ */ #define DKTYPENAMES @@ -62,11 +61,10 @@ static int readsb(int listerr); int setup(char *dev) { - long cg, size, asked, i, j; + long size, asked, i, j; long skipclean, bmapsize; off_t sizepb; struct stat statb; - struct fs proto; havesb = 0; fswritefd = -1; diff --git a/sbin/fsck/utilities.c b/sbin/fsck/utilities.c index 76d260dd6d..e0fa73ef98 100644 --- a/sbin/fsck/utilities.c +++ b/sbin/fsck/utilities.c @@ -235,7 +235,7 @@ rwerror(char *mesg, ufs_daddr_t blk) if (preen == 0) printf("\n"); - pfatal("CANNOT %s: BLK %ld", mesg, blk); + pfatal("CANNOT %s: BLK %d", mesg, blk); if (reply("CONTINUE") == 0) exit(EEXIT); } diff --git a/sys/vfs/ufs/ffs_subr.c b/sys/vfs/ufs/ffs_subr.c index fb66c9a392..0148b0fb12 100644 --- a/sys/vfs/ufs/ffs_subr.c +++ b/sys/vfs/ufs/ffs_subr.c @@ -35,7 +35,7 @@ #ifndef _KERNEL #include "dinode.h" #include "fs.h" -extern void panic(const char *, ...); +extern void panic(const char *, ...) __printflike(1, 2) __dead2; #else #include #include -- 2.41.0