Module Name:    src
Committed By:   christos
Date:           Sun Aug 14 12:32:02 UTC 2011

Modified Files:
        src/sbin/fsck_ffs: Makefile pass1.c pass2.c pass5.c quota2.c setup.c

Log Message:
WARNS=4


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sbin/fsck_ffs/Makefile
cvs rdiff -u -r1.48 -r1.49 src/sbin/fsck_ffs/pass1.c \
    src/sbin/fsck_ffs/pass5.c
cvs rdiff -u -r1.47 -r1.48 src/sbin/fsck_ffs/pass2.c
cvs rdiff -u -r1.3 -r1.4 src/sbin/fsck_ffs/quota2.c
cvs rdiff -u -r1.93 -r1.94 src/sbin/fsck_ffs/setup.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/fsck_ffs/Makefile
diff -u src/sbin/fsck_ffs/Makefile:1.42 src/sbin/fsck_ffs/Makefile:1.43
--- src/sbin/fsck_ffs/Makefile:1.42	Mon Jun 20 03:44:00 2011
+++ src/sbin/fsck_ffs/Makefile	Sun Aug 14 08:32:01 2011
@@ -1,8 +1,6 @@
-#	$NetBSD: Makefile,v 1.42 2011/06/20 07:44:00 mrg Exp $
+#	$NetBSD: Makefile,v 1.43 2011/08/14 12:32:01 christos Exp $
 #	@(#)Makefile	8.2 (Berkeley) 4/27/95
 
-WARNS?=	3	# XXX: sign-compare issues
-
 .include <bsd.own.mk>
 
 PROG=	fsck_ffs

Index: src/sbin/fsck_ffs/pass1.c
diff -u src/sbin/fsck_ffs/pass1.c:1.48 src/sbin/fsck_ffs/pass1.c:1.49
--- src/sbin/fsck_ffs/pass1.c:1.48	Thu Jun  9 15:57:52 2011
+++ src/sbin/fsck_ffs/pass1.c	Sun Aug 14 08:32:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass1.c,v 1.48 2011/06/09 19:57:52 christos Exp $	*/
+/*	$NetBSD: pass1.c,v 1.49 2011/08/14 12:32:01 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)pass1.c	8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass1.c,v 1.48 2011/06/09 19:57:52 christos Exp $");
+__RCSID("$NetBSD: pass1.c,v 1.49 2011/08/14 12:32:01 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -66,7 +66,7 @@
 void
 pass1(void)
 {
-	ino_t inumber, inosused, ninosused;
+	ino_t inumber, inosused, ninosused, ii;
 	size_t inospace;
 	int c;
 	daddr_t i, cgd;
@@ -169,7 +169,7 @@
 		/*
 		 * Scan the allocated inodes.
 		 */
-		for (i = 0; i < inosused; i++, inumber++) {
+		for (ii = 0; ii < inosused; ii++, inumber++) {
 			if (inumber < ROOTINO) {
 				(void)getnextinode(inumber);
 				continue;
@@ -177,7 +177,7 @@
 			checkinode(inumber, &idesc);
 		}
 		lastino += 1;
-		if (inosused < sblock->fs_ipg || inumber == lastino)
+		if (inosused < (ino_t)sblock->fs_ipg || inumber == lastino)
 			continue;
 		/*
 		 * If we were not able to determine in advance which inodes
@@ -185,7 +185,7 @@
 		 * to the size necessary to describe the inodes that we
 		 * really found.
 		 */
-		if (lastino < (c * sblock->fs_ipg))
+		if (lastino < (c * (ino_t)sblock->fs_ipg))
 			ninosused = 0;
 		else
 			ninosused = lastino - (c * sblock->fs_ipg);
@@ -328,7 +328,7 @@
 		 * will detect any garbage after symlink string.
 		 */
 		if ((sblock->fs_maxsymlinklen < 0) ||
-		    (size < sblock->fs_maxsymlinklen) ||
+		    (size < (uint64_t)sblock->fs_maxsymlinklen) ||
 		    (isappleufs && (size < APPLEUFS_MAXSYMLINKLEN)) ||
 		    (sblock->fs_maxsymlinklen == 0 && DIP(dp, blocks) == 0)) {
 			if (is_ufs2)
Index: src/sbin/fsck_ffs/pass5.c
diff -u src/sbin/fsck_ffs/pass5.c:1.48 src/sbin/fsck_ffs/pass5.c:1.49
--- src/sbin/fsck_ffs/pass5.c:1.48	Sat Feb 23 16:41:48 2008
+++ src/sbin/fsck_ffs/pass5.c	Sun Aug 14 08:32:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass5.c,v 1.48 2008/02/23 21:41:48 christos Exp $	*/
+/*	$NetBSD: pass5.c,v 1.49 2011/08/14 12:32:01 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)pass5.c	8.9 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass5.c,v 1.48 2008/02/23 21:41:48 christos Exp $");
+__RCSID("$NetBSD: pass5.c,v 1.49 2011/08/14 12:32:01 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -101,7 +101,7 @@
 				i = fs->fs_contigsumsize;
 				fs->fs_contigsumsize =
 				    MIN(fs->fs_maxcontig, FS_MAXCONTIG);
-				if (CGSIZE(fs) > fs->fs_bsize) {
+				if (CGSIZE(fs) > (uint32_t)fs->fs_bsize) {
 					pwarn("CANNOT %s CLUSTER MAPS\n", doit);
 					fs->fs_contigsumsize = i;
 				} else if (preen ||
@@ -298,7 +298,7 @@
 		if (!is_ufs2) {
 			newcg->cg_initediblk = 0;
 		} else {
-			if ((unsigned)cg->cg_initediblk > fs->fs_ipg)
+			if ((unsigned)cg->cg_initediblk > (unsigned)fs->fs_ipg)
 				newcg->cg_initediblk = fs->fs_ipg;
 			else
 				newcg->cg_initediblk = cg->cg_initediblk;
@@ -330,14 +330,14 @@
 				break;
 
 			default:
-				if (j < ROOTINO)
+				if ((ino_t)j < ROOTINO)
 					break;
 				errexit("BAD STATE %d FOR INODE I=%ld",
 				    info->ino_state, (long)j);
 			}
 		}
 		if (c == 0)
-			for (i = 0; i < ROOTINO; i++) {
+			for (i = 0; i < (long)ROOTINO; i++) {
 				setbit(cg_inosused(newcg, 0), i);
 				newcg->cg_cs.cs_nifree--;
 			}
@@ -497,9 +497,9 @@
 }
 
 void 
-print_bmap(u_char *map, u_int32_t size)
+print_bmap(u_char *map, uint32_t size)
 {
-	int i, j;
+	uint32_t i, j;
 
 	i = 0;
 	while (i < size) {

Index: src/sbin/fsck_ffs/pass2.c
diff -u src/sbin/fsck_ffs/pass2.c:1.47 src/sbin/fsck_ffs/pass2.c:1.48
--- src/sbin/fsck_ffs/pass2.c:1.47	Thu Jun  9 15:57:52 2011
+++ src/sbin/fsck_ffs/pass2.c	Sun Aug 14 08:32:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass2.c,v 1.47 2011/06/09 19:57:52 christos Exp $	*/
+/*	$NetBSD: pass2.c,v 1.48 2011/08/14 12:32:01 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)pass2.c	8.9 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass2.c,v 1.47 2011/06/09 19:57:52 christos Exp $");
+__RCSID("$NetBSD: pass2.c,v 1.48 2011/08/14 12:32:01 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -70,6 +70,7 @@
 	struct inodesc curino;
 	union dinode dino;
 	int i, maxblk;
+	unsigned ii;
 	char pathbuf[MAXPATHLEN + 1];
 
 	rinfo = inoinfo(ROOTINO);
@@ -236,13 +237,13 @@
 			if (!is_ufs2) {
 				dino.dp1.di_mode = iswap16(IFDIR);
 				dino.dp1.di_size = iswap64(inp->i_isize);
-				for (i = 0; i < inp->i_numblks; i++)
-					dino.dp1.di_db[i] = inp->i_blks[i];
+				for (ii = 0; ii < inp->i_numblks; ii++)
+					dino.dp1.di_db[ii] = inp->i_blks[ii];
 			} else {
 				dino.dp2.di_mode = iswap16(IFDIR);
 				dino.dp2.di_size = iswap64(inp->i_isize);
-				for (i = 0; i < inp->i_numblks; i++)
-					dino.dp2.di_db[i] = inp->i_blks[i];
+				for (ii = 0; ii < inp->i_numblks; ii++)
+					dino.dp2.di_db[ii] = inp->i_blks[ii];
 			}
 			curino.id_number = inp->i_number;
 			curino.id_parent = inp->i_parent;

Index: src/sbin/fsck_ffs/quota2.c
diff -u src/sbin/fsck_ffs/quota2.c:1.3 src/sbin/fsck_ffs/quota2.c:1.4
--- src/sbin/fsck_ffs/quota2.c:1.3	Tue Jun  7 10:56:12 2011
+++ src/sbin/fsck_ffs/quota2.c	Sun Aug 14 08:32:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: quota2.c,v 1.3 2011/06/07 14:56:12 bouyer Exp $ */
+/* $NetBSD: quota2.c,v 1.4 2011/08/14 12:32:01 christos Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -98,7 +98,7 @@
 			errexit("INTERNAL ERROR: "
 			    "addfreeq2e didn't fill free list\n");
 	}
-	if (off < sblock->fs_bsize) {
+	if (off < (uint64_t)sblock->fs_bsize) {
 		/* in the header block */
 		bp = hbp;
 	} else {
@@ -162,7 +162,7 @@
 			dirty(bp);
 		if (ret & Q2WL_ABORT)
 			return FSCK_EXIT_CHECK_FAILED;
-		if (off != iswap64(*offp)) {
+		if ((uint64_t)off != iswap64(*offp)) {
 			/* callback changed parent's pointer, redo */
 			dirty(obp);
 			off = iswap64(*offp);
@@ -204,7 +204,7 @@
 		/* check that we're in the right hash entry */
 		if (*hash < 0)
 			return 0;
-		if (*hash == (iswap32(q2e->q2e_uid) & q2h_hash_mask))
+		if ((uint32_t)*hash == (iswap32(q2e->q2e_uid) & q2h_hash_mask))
 			return 0;
 
 		pwarn("QUOTA uid %d IN WRONG HASH LIST %d",

Index: src/sbin/fsck_ffs/setup.c
diff -u src/sbin/fsck_ffs/setup.c:1.93 src/sbin/fsck_ffs/setup.c:1.94
--- src/sbin/fsck_ffs/setup.c:1.93	Thu Jun  9 15:57:52 2011
+++ src/sbin/fsck_ffs/setup.c	Sun Aug 14 08:32:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: setup.c,v 1.93 2011/06/09 19:57:52 christos Exp $	*/
+/*	$NetBSD: setup.c,v 1.94 2011/08/14 12:32:01 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setup.c	8.10 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: setup.c,v 1.93 2011/06/09 19:57:52 christos Exp $");
+__RCSID("$NetBSD: setup.c,v 1.94 2011/08/14 12:32:01 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -503,15 +503,13 @@
 	numdirs = sblock->fs_cstotal.cs_ndir;
 	if (numdirs < 1024)
 		numdirs = 1024;
-	if (numdirs > maxino + 1)
+	if ((ino_t)numdirs > maxino + 1)
 		numdirs = maxino + 1;
 	dirhash = numdirs;
 	inplast = 0;
 	listmax = numdirs + 10;
-	inpsort = (struct inoinfo **)calloc((unsigned)listmax,
-	    sizeof(struct inoinfo *));
-	inphead = (struct inoinfo **)calloc((unsigned)numdirs,
-	    sizeof(struct inoinfo *));
+	inpsort = calloc((unsigned)listmax, sizeof(*inpsort));
+	inphead = calloc((unsigned)numdirs, sizeof(*inphead));
 	if (inpsort == NULL || inphead == NULL) {
 		pwarn("cannot alloc %u bytes for inphead\n", 
 		    (unsigned)(numdirs * sizeof(struct inoinfo *)));
@@ -555,7 +553,8 @@
 		    q2h_hash_shift < 15;
 		    q2h_hash_shift++) {
 			if ((sizeof(uint64_t) << (q2h_hash_shift + 1)) +
-			    sizeof(struct quota2_header) > sblock->fs_bsize)
+			    sizeof(struct quota2_header) >
+			    (size_t)sblock->fs_bsize)
 				break;
 		}
 		q2h_hash_mask = (1 << q2h_hash_shift) - 1;

Reply via email to