Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck_ffs WARNS=4



details:   https://anonhg.NetBSD.org/src/rev/526e06ac63cb
branches:  trunk
changeset: 768312:526e06ac63cb
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Aug 14 12:32:01 2011 +0000

description:
WARNS=4

diffstat:

 sbin/fsck_ffs/Makefile |   4 +---
 sbin/fsck_ffs/pass1.c  |  14 +++++++-------
 sbin/fsck_ffs/pass2.c  |  13 +++++++------
 sbin/fsck_ffs/pass5.c  |  16 ++++++++--------
 sbin/fsck_ffs/quota2.c |   8 ++++----
 sbin/fsck_ffs/setup.c  |  15 +++++++--------
 6 files changed, 34 insertions(+), 36 deletions(-)

diffs (268 lines):

diff -r 3544f53ece7d -r 526e06ac63cb sbin/fsck_ffs/Makefile
--- a/sbin/fsck_ffs/Makefile    Sun Aug 14 12:30:04 2011 +0000
+++ b/sbin/fsck_ffs/Makefile    Sun Aug 14 12:32:01 2011 +0000
@@ -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
diff -r 3544f53ece7d -r 526e06ac63cb sbin/fsck_ffs/pass1.c
--- a/sbin/fsck_ffs/pass1.c     Sun Aug 14 12:30:04 2011 +0000
+++ b/sbin/fsck_ffs/pass1.c     Sun Aug 14 12:32:01 2011 +0000
@@ -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)
diff -r 3544f53ece7d -r 526e06ac63cb sbin/fsck_ffs/pass2.c
--- a/sbin/fsck_ffs/pass2.c     Sun Aug 14 12:30:04 2011 +0000
+++ b/sbin/fsck_ffs/pass2.c     Sun Aug 14 12:32:01 2011 +0000
@@ -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;
diff -r 3544f53ece7d -r 526e06ac63cb sbin/fsck_ffs/pass5.c
--- a/sbin/fsck_ffs/pass5.c     Sun Aug 14 12:30:04 2011 +0000
+++ b/sbin/fsck_ffs/pass5.c     Sun Aug 14 12:32:01 2011 +0000
@@ -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) {
diff -r 3544f53ece7d -r 526e06ac63cb sbin/fsck_ffs/quota2.c
--- a/sbin/fsck_ffs/quota2.c    Sun Aug 14 12:30:04 2011 +0000
+++ b/sbin/fsck_ffs/quota2.c    Sun Aug 14 12:32:01 2011 +0000
@@ -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",
diff -r 3544f53ece7d -r 526e06ac63cb sbin/fsck_ffs/setup.c
--- a/sbin/fsck_ffs/setup.c     Sun Aug 14 12:30:04 2011 +0000
+++ b/sbin/fsck_ffs/setup.c     Sun Aug 14 12:32:01 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index