From 3afe6a68e0c9ed63a5101587e264657eb31102db Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 18 May 2017 14:05:29 +0000 Subject: [PATCH] makefs: clean up signedness warnings and bump WARNS to 3 Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10650 --- usr.sbin/makefs/Makefile | 2 +- usr.sbin/makefs/ffs.c | 5 +++-- usr.sbin/makefs/ffs/ffs_alloc.c | 14 +++++++------- usr.sbin/makefs/ffs/ffs_balloc.c | 10 ++++++---- usr.sbin/makefs/ffs/ffs_bswap.c | 2 +- usr.sbin/makefs/mtree.c | 3 ++- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile index ac59e3c58a3d..94dd2d4c9687 100644 --- a/usr.sbin/makefs/Makefile +++ b/usr.sbin/makefs/Makefile @@ -14,7 +14,7 @@ SRCS= cd9660.c ffs.c \ walk.c MAN= makefs.8 -WARNS?= 2 +WARNS?= 3 .include "${SRCDIR}/cd9660/Makefile.inc" .include "${SRCDIR}/ffs/Makefile.inc" diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index 49fadd3708e4..a6957edf5eff 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -1065,10 +1065,11 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts) struct ufs2_dinode *dp2, *dip; struct cg *cgp; struct fs *fs; - int cg, cgino, i; + int cg, cgino; + uint32_t i; daddr_t d; char sbbuf[FFS_MAXBSIZE]; - int32_t initediblk; + uint32_t initediblk; ffs_opt_t *ffs_opts = fsopts->fs_specific; assert (dp != NULL); diff --git a/usr.sbin/makefs/ffs/ffs_alloc.c b/usr.sbin/makefs/ffs/ffs_alloc.c index fb1b09d66451..e899ea22afed 100644 --- a/usr.sbin/makefs/ffs/ffs_alloc.c +++ b/usr.sbin/makefs/ffs/ffs_alloc.c @@ -64,7 +64,7 @@ static int scanc(u_int, const u_char *, const u_char *, int); static daddr_t ffs_alloccg(struct inode *, int, daddr_t, int); static daddr_t ffs_alloccgblk(struct inode *, struct buf *, daddr_t); -static daddr_t ffs_hashalloc(struct inode *, int, daddr_t, int, +static daddr_t ffs_hashalloc(struct inode *, u_int, daddr_t, int, daddr_t (*)(struct inode *, int, daddr_t, int)); static int32_t ffs_mapsearch(struct fs *, struct cg *, daddr_t, int); @@ -152,8 +152,8 @@ daddr_t ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int32_t *bap) { struct fs *fs; - int cg; - int avgbfree, startcg; + u_int cg, startcg; + int avgbfree; fs = ip->i_fs; if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { @@ -191,8 +191,8 @@ daddr_t ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int64_t *bap) { struct fs *fs; - int cg; - int avgbfree, startcg; + u_int cg, startcg; + int avgbfree; fs = ip->i_fs; if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { @@ -240,12 +240,12 @@ ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int64_t *bap) */ /*VARARGS5*/ static daddr_t -ffs_hashalloc(struct inode *ip, int cg, daddr_t pref, int size, +ffs_hashalloc(struct inode *ip, u_int cg, daddr_t pref, int size, daddr_t (*allocator)(struct inode *, int, daddr_t, int)) { struct fs *fs; daddr_t result; - int i, icg = cg; + u_int i, icg = cg; fs = ip->i_fs; /* diff --git a/usr.sbin/makefs/ffs/ffs_balloc.c b/usr.sbin/makefs/ffs/ffs_balloc.c index 46a20ba99e78..7c6a038b6a88 100644 --- a/usr.sbin/makefs/ffs/ffs_balloc.c +++ b/usr.sbin/makefs/ffs/ffs_balloc.c @@ -123,7 +123,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) if (lbn < UFS_NDADDR) { nb = ufs_rw32(ip->i_ffs1_db[lbn], needswap); - if (nb != 0 && ip->i_ffs1_size >= lblktosize(fs, lbn + 1)) { + if (nb != 0 && ip->i_ffs1_size >= + (uint64_t)lblktosize(fs, lbn + 1)) { /* * The block is an already-allocated direct block @@ -178,7 +179,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) * allocate a new block or fragment. */ - if (ip->i_ffs1_size < lblktosize(fs, lbn + 1)) + if (ip->i_ffs1_size < (uint64_t)lblktosize(fs, lbn + 1)) nsize = fragroundup(fs, size); else nsize = fs->fs_bsize; @@ -373,7 +374,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) if (lbn < UFS_NDADDR) { nb = ufs_rw64(ip->i_ffs2_db[lbn], needswap); - if (nb != 0 && ip->i_ffs2_size >= lblktosize(fs, lbn + 1)) { + if (nb != 0 && ip->i_ffs2_size >= + (uint64_t)lblktosize(fs, lbn + 1)) { /* * The block is an already-allocated direct block @@ -428,7 +430,7 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) * allocate a new block or fragment. */ - if (ip->i_ffs2_size < lblktosize(fs, lbn + 1)) + if (ip->i_ffs2_size < (uint64_t)lblktosize(fs, lbn + 1)) nsize = fragroundup(fs, size); else nsize = fs->fs_bsize; diff --git a/usr.sbin/makefs/ffs/ffs_bswap.c b/usr.sbin/makefs/ffs/ffs_bswap.c index 8cf8c50e5167..1f17e9bf9029 100644 --- a/usr.sbin/makefs/ffs/ffs_bswap.c +++ b/usr.sbin/makefs/ffs/ffs_bswap.c @@ -39,12 +39,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define panic(x) printf("%s\n", (x)), abort() #endif #include #include "ffs/ufs_bswap.h" #include +#include "ffs/ffs_extern.h" #define fs_old_postbloff fs_spare5[0] #define fs_old_rotbloff fs_spare5[1] diff --git a/usr.sbin/makefs/mtree.c b/usr.sbin/makefs/mtree.c index 76f1dac05613..0dcb45173123 100644 --- a/usr.sbin/makefs/mtree.c +++ b/usr.sbin/makefs/mtree.c @@ -505,7 +505,8 @@ read_mtree_keywords(FILE *fp, fsnode *node) struct stat *st, sb; intmax_t num; u_long flset, flclr; - int error, istemp, type; + int error, istemp; + uint32_t type; st = &node->inode->st; do {