diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index aa9c1f7f2f3b..def7915f025a 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.90 2022/11/17 06:40:38 chs Exp $ */ +/* $NetBSD: main.c,v 1.91 2023/01/07 19:41:29 chs Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\ #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; #else -__RCSID("$NetBSD: main.c,v 1.90 2022/11/17 06:40:38 chs Exp $"); +__RCSID("$NetBSD: main.c,v 1.91 2023/01/07 19:41:29 chs Exp $"); #endif #endif /* not lint */ @@ -368,7 +368,7 @@ checkfilesys(const char *filesys, const char *origfs, int child) daddr_t n_ffree, n_bfree; struct dups *dp; struct zlncnt *zlnp; - int cylno; + uint32_t cylno; #ifdef LITE2BORKEN int flags; #endif diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index dd1a0e17662e..54799d6241d4 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.62 2022/11/18 07:41:31 martin Exp $ */ +/* $NetBSD: pass1.c,v 1.63 2023/01/07 19:41:29 chs 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.62 2022/11/18 07:41:31 martin Exp $"); +__RCSID("$NetBSD: pass1.c,v 1.63 2023/01/07 19:41:29 chs Exp $"); #endif #endif /* not lint */ @@ -68,7 +68,7 @@ pass1(void) { ino_t inumber, inosused, ninosused, ii; size_t inospace; - int c; + uint32_t c; daddr_t i, cgd; struct inodesc idesc; struct cg *cgp = cgrp; diff --git a/sbin/fsck_ffs/pass1b.c b/sbin/fsck_ffs/pass1b.c index 2175bcb55aff..f7cb4d984702 100644 --- a/sbin/fsck_ffs/pass1b.c +++ b/sbin/fsck_ffs/pass1b.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass1b.c,v 1.23 2013/01/22 09:39:12 dholland Exp $ */ +/* $NetBSD: pass1b.c,v 1.24 2023/01/07 19:41:29 chs Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass1b.c,v 1.23 2013/01/22 09:39:12 dholland Exp $"); +__RCSID("$NetBSD: pass1b.c,v 1.24 2023/01/07 19:41:29 chs Exp $"); #endif #endif /* not lint */ @@ -56,7 +56,7 @@ static int pass1bcheck(struct inodesc *); void pass1b(void) { - int c, i; + uint32_t c, i; union dinode *dp; struct inodesc idesc; ino_t inumber; diff --git a/sbin/fsck_ffs/pass4.c b/sbin/fsck_ffs/pass4.c index 2e848ecc774c..2feb5ed21ff5 100644 --- a/sbin/fsck_ffs/pass4.c +++ b/sbin/fsck_ffs/pass4.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass4.c,v 1.28 2013/06/23 22:03:34 dholland Exp $ */ +/* $NetBSD: pass4.c,v 1.29 2023/01/07 19:41:29 chs Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass4.c,v 1.28 2013/06/23 22:03:34 dholland Exp $"); +__RCSID("$NetBSD: pass4.c,v 1.29 2023/01/07 19:41:29 chs Exp $"); #endif #endif /* not lint */ @@ -62,7 +62,8 @@ pass4(void) struct zlncnt *zlnp; union dinode *dp; struct inodesc idesc; - int n, i, cg; + int n, i; + uint32_t cg; struct inostat *info; memset(&idesc, 0, sizeof(struct inodesc)); diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index 7b9a6946b72c..4e877e0e4d78 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass5.c,v 1.55 2022/11/17 06:40:38 chs Exp $ */ +/* $NetBSD: pass5.c,v 1.56 2023/01/07 19:41:29 chs 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.55 2022/11/17 06:40:38 chs Exp $"); +__RCSID("$NetBSD: pass5.c,v 1.56 2023/01/07 19:41:29 chs Exp $"); #endif #endif /* not lint */ @@ -59,8 +59,9 @@ void print_bmap(u_char *,u_int32_t); void pass5(void) { - int c, blk, frags, basesize, sumsize, mapsize, cssize; + int blk, frags, basesize, sumsize, mapsize, cssize; int inomapsize, blkmapsize; + uint32_t c; struct fs *fs = sblock; daddr_t dbase, dmax; daddr_t d; @@ -290,15 +291,15 @@ pass5(void) newcg->cg_cs.cs_nffree = 0; newcg->cg_cs.cs_nbfree = 0; newcg->cg_cs.cs_nifree = fs->fs_ipg; - if (cg->cg_rotor >= 0 && cg->cg_rotor < newcg->cg_ndblk) + if (cg->cg_rotor < newcg->cg_ndblk) newcg->cg_rotor = cg->cg_rotor; else newcg->cg_rotor = 0; - if (cg->cg_frotor >= 0 && cg->cg_frotor < newcg->cg_ndblk) + if (cg->cg_frotor < newcg->cg_ndblk) newcg->cg_frotor = cg->cg_frotor; else newcg->cg_frotor = 0; - if (cg->cg_irotor >= 0 && cg->cg_irotor < fs->fs_ipg) + if (cg->cg_irotor < fs->fs_ipg) newcg->cg_irotor = cg->cg_irotor; else newcg->cg_irotor = 0; diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 2ccbe0d8beae..75a26e183b2d 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.104 2022/11/17 06:40:38 chs Exp $ */ +/* $NetBSD: setup.c,v 1.105 2023/01/07 19:41:29 chs 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.104 2022/11/17 06:40:38 chs Exp $"); +__RCSID("$NetBSD: setup.c,v 1.105 2023/01/07 19:41:29 chs Exp $"); #endif #endif /* not lint */ @@ -1150,7 +1150,7 @@ static int check_snapinum(void) { int loc, loc2, res; - int *snapinum = &sblock->fs_snapinum[0]; + uint32_t *snapinum = &sblock->fs_snapinum[0]; res = 0; diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index bb2628b52eda..94d58fc07c2c 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -1,4 +1,4 @@ -/* $NetBSD: fsdb.c,v 1.53 2022/11/17 06:40:38 chs Exp $ */ +/* $NetBSD: fsdb.c,v 1.54 2023/01/07 19:41:29 chs Exp $ */ /*- * Copyright (c) 1996, 2017 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fsdb.c,v 1.53 2022/11/17 06:40:38 chs Exp $"); +__RCSID("$NetBSD: fsdb.c,v 1.54 2023/01/07 19:41:29 chs Exp $"); #endif /* not lint */ #include @@ -620,7 +620,8 @@ CMDFUNC(findblk) uint32_t *wantedblk32 = NULL; uint64_t *wantedblk64 = NULL; struct cg *cgp = cgrp; - int i, c; + int i; + uint32_t c; ocurrent = curinum; wantedblksize = (argc - 1); diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index e7064447a9ec..c5c4858e5e88 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.132 2022/11/17 06:40:39 chs Exp $ */ +/* $NetBSD: mkfs.c,v 1.133 2023/01/07 19:41:29 chs Exp $ */ /* * Copyright (c) 1980, 1989, 1993 @@ -73,7 +73,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: mkfs.c,v 1.132 2022/11/17 06:40:39 chs Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.133 2023/01/07 19:41:29 chs Exp $"); #endif #endif /* not lint */ @@ -108,7 +108,7 @@ union dinode { struct ufs2_dinode dp2; }; -static void initcg(int, const struct timeval *); +static void initcg(uint32_t, const struct timeval *); static int fsinit(const struct timeval *, mode_t, uid_t, gid_t); union Buffer; static int makedir(union Buffer *, struct direct *, int); @@ -184,7 +184,8 @@ mkfs(const char *fsys, int fi, int fo, uint fragsperinodeblk, ncg, u; uint cgzero; uint64_t inodeblks, cgall; - int32_t cylno, i, csfrags; + uint32_t cylno; + int i, csfrags; int inodes_per_cg; struct timeval tv; long long sizepb; @@ -773,11 +774,10 @@ mkfs(const char *fsys, int fi, int fo, * Initialize a cylinder group. */ void -initcg(int cylno, const struct timeval *tv) +initcg(uint32_t cylno, const struct timeval *tv) { daddr_t cbase, dmax; - int32_t i, d, dlower, dupper, blkno; - uint32_t u; + uint32_t i, d, dlower, dupper, blkno, u; struct ufs1_dinode *dp1; struct ufs2_dinode *dp2; int start; @@ -849,7 +849,7 @@ initcg(int cylno, const struct timeval *tv) acg.cg_nextfreeoff = acg.cg_clusteroff + howmany(ffs_fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - if (acg.cg_nextfreeoff > sblock.fs_cgsize) { + if (acg.cg_nextfreeoff > (unsigned)sblock.fs_cgsize) { printf("Panic: cylinder group too big\n"); fserr(37); } diff --git a/sbin/resize_ffs/resize_ffs.c b/sbin/resize_ffs/resize_ffs.c index 99be25b6715b..4f04f469fb78 100644 --- a/sbin/resize_ffs/resize_ffs.c +++ b/sbin/resize_ffs/resize_ffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: resize_ffs.c,v 1.57 2022/11/17 06:40:39 chs Exp $ */ +/* $NetBSD: resize_ffs.c,v 1.58 2023/01/07 19:41:30 chs Exp $ */ /* From sources sent on February 17, 2003 */ /*- * As its sole author, I explicitly place this code in the public @@ -36,7 +36,7 @@ */ #include -__RCSID("$NetBSD: resize_ffs.c,v 1.57 2022/11/17 06:40:39 chs Exp $"); +__RCSID("$NetBSD: resize_ffs.c,v 1.58 2023/01/07 19:41:30 chs Exp $"); #include #include @@ -327,7 +327,7 @@ alloconce(size_t nb, const char *tag) static void loadcgs(void) { - int cg; + uint32_t cg; char *cgp; cgblksz = roundup(oldsb->fs_cgsize, oldsb->fs_fsize); @@ -460,7 +460,7 @@ blk_is_clr(unsigned char *bitvec, int blkbase, int blkfrags) * bit simpler than it would otherwise be. */ static void -initcg(int cgn) +initcg(uint32_t cgn) { struct cg *cg; /* The in-core cg, of course */ int64_t base; /* Disk address of cg base */ @@ -658,7 +658,7 @@ find_freespace(unsigned int nfrags) { static int hand = 0; /* hand rotates through all frags in the fs */ int cgsize; /* size of the cg hand currently points into */ - int cgn; /* number of cg hand currently points into */ + uint32_t cgn; /* number of cg hand currently points into */ int fwc; /* frag-within-cg number of frag hand points * to */ unsigned int run; /* length of run of free frags seen so far */ @@ -711,7 +711,7 @@ static int find_freeblock(void) { static int hand = 0; /* hand rotates through all frags in fs */ - int cgn; /* cg number of cg hand points into */ + uint32_t cgn; /* cg number of cg hand points into */ int fwc; /* frag-within-cg number of frag hand points * to */ int cgsize; /* size of cg hand points into */ @@ -754,8 +754,8 @@ static int find_freeinode(void) { static int hand = 0; /* hand rotates through all inodes in fs */ - int cgn; /* cg number of cg hand points into */ - int iwc; /* inode-within-cg number of inode hand points + uint32_t cgn; /* cg number of cg hand points into */ + uint32_t iwc; /* inode-within-cg number of inode hand points * to */ int secondpass; /* have we wrapped from end to beginning? */ unsigned char *bits; /* cg_inosused()[] for cg hand points into */ @@ -895,7 +895,7 @@ csum_fixup(void) static void recompute_fs_dsize(void) { - int i; + uint32_t i; newsb->fs_dsize = 0; for (i = 0; i < newsb->fs_ncg; i++) { @@ -986,7 +986,7 @@ makegeometry(int chatter) static void grow(void) { - int i; + uint32_t i; if (makegeometry(1)) { printf("New fs size %"PRIu64" = old fs size %"PRIu64 @@ -1252,7 +1252,8 @@ blkmove_init(void) static void loadinodes(void) { - int imax, ino, i, j; + int imax, ino, j; + uint32_t i; struct ufs1_dinode *dp1 = NULL; struct ufs2_dinode *dp2 = NULL; @@ -1641,8 +1642,8 @@ static void evict_inodes(struct cg * cg) { int inum; - int i; int fi; + uint32_t i; inum = newsb->fs_ipg * cg->cg_cgx; for (i = 0; i < newsb->fs_ipg; i++, inum++) { @@ -1751,7 +1752,7 @@ update_for_inode_move(void) static void shrink(void) { - int i; + uint32_t i; if (makegeometry(1)) { printf("New fs size %"PRIu64" = old fs size %"PRIu64 @@ -1864,7 +1865,7 @@ static void rescan_blkmaps(int cgn) { struct cg *cg; - int f; + uint32_t f; int b; int blkfree; int blkrun; @@ -1983,7 +1984,7 @@ rescan_inomaps(int cgn) { struct cg *cg; int inum; - int iwc; + uint32_t iwc; cg = cgs[cgn]; newsb->fs_cstotal.cs_ndir -= cg->cg_cs.cs_ndir; @@ -2023,7 +2024,7 @@ rescan_inomaps(int cgn) static void flush_cgs(void) { - int i; + uint32_t i; for (i = 0; i < newsb->fs_ncg; i++) { progress_bar(special, "flush cg", @@ -2057,7 +2058,7 @@ flush_cgs(void) static void write_sbs(void) { - int i; + uint32_t i; if (newsb->fs_magic == FS_UFS1_MAGIC && (newsb->fs_old_flags & FS_FLAGS_UPDATED) == 0) { diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index f1c7d764b988..97c7a2852714 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -1,4 +1,4 @@ -/* $NetBSD: tunefs.c,v 1.57 2022/12/19 21:13:16 chs Exp $ */ +/* $NetBSD: tunefs.c,v 1.58 2023/01/07 19:41:30 chs Exp $ */ /* * Copyright (c) 1983, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\ #if 0 static char sccsid[] = "@(#)tunefs.c 8.3 (Berkeley) 5/3/95"; #else -__RCSID("$NetBSD: tunefs.c,v 1.57 2022/12/19 21:13:16 chs Exp $"); +__RCSID("$NetBSD: tunefs.c,v 1.58 2023/01/07 19:41:30 chs Exp $"); #endif #endif /* not lint */ @@ -62,6 +62,7 @@ __RCSID("$NetBSD: tunefs.c,v 1.57 2022/12/19 21:13:16 chs Exp $"); #include #include #include +#include #include #include #include @@ -103,11 +104,12 @@ __dead static void usage(void); int main(int argc, char *argv[]) { - int i, ch, aflag, pflag, Aflag, Fflag, Nflag, openflags; + int ch, aflag, pflag, Aflag, Fflag, Nflag, openflags; const char *special, *chg[2]; char device[MAXPATHLEN]; int maxbpg, minfree, optim, secsize; - int avgfilesize, avgfpdir, active; + uint32_t i, avgfilesize, avgfpdir; + bool active; long long logfilesize; int secshift, fsbtodb; const char *avalue, *pvalue, *name; @@ -241,7 +243,7 @@ main(int argc, char *argv[]) getsb(&sblock, special); #define CHANGEVAL(old, new, type, suffix) do \ - if ((new) != -1) { \ + if ((uint32_t)(new) != (uint32_t)-1) { \ if ((new) == (old)) \ warnx("%s remains unchanged at %d%s", \ (type), (old), (suffix)); \ diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 56f2245d2076..2131e9f2af49 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.171 2022/04/23 16:22:23 hannken Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.172 2023/01/07 19:41:30 chs Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.171 2022/04/23 16:22:23 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.172 2023/01/07 19:41:30 chs Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -107,14 +107,14 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.171 2022/04/23 16:22:23 hannken Exp #include #endif -static daddr_t ffs_alloccg(struct inode *, int, daddr_t, int, int, int); +static daddr_t ffs_alloccg(struct inode *, u_int, daddr_t, int, int, int); static daddr_t ffs_alloccgblk(struct inode *, struct buf *, daddr_t, int, int); static ino_t ffs_dirpref(struct inode *); -static daddr_t ffs_fragextend(struct inode *, int, daddr_t, int, int); +static daddr_t ffs_fragextend(struct inode *, u_int, daddr_t, int, int); static void ffs_fserr(struct fs *, kauth_cred_t, const char *); -static daddr_t ffs_hashalloc(struct inode *, int, daddr_t, int, int, int, - daddr_t (*)(struct inode *, int, daddr_t, int, int, int)); -static daddr_t ffs_nodealloccg(struct inode *, int, daddr_t, int, int, int); +static daddr_t ffs_hashalloc(struct inode *, u_int, daddr_t, int, int, int, + daddr_t (*)(struct inode *, u_int, daddr_t, int, int, int)); +static daddr_t ffs_nodealloccg(struct inode *, u_int, daddr_t, int, int, int); static int32_t ffs_mapsearch(struct fs *, struct cg *, daddr_t, int); static void ffs_blkfree_common(struct ufsmount *, struct fs *, dev_t, struct buf *, @@ -179,7 +179,7 @@ ffs_alloc(struct inode *ip, daddr_t lbn, daddr_t bpref, int size, struct ufsmount *ump; struct fs *fs; daddr_t bno; - int cg; + u_int cg; #if defined(QUOTA) || defined(QUOTA2) int error; #endif @@ -311,7 +311,8 @@ ffs_realloccg(struct inode *ip, daddr_t lbprev, daddr_t bprev, daddr_t bpref, struct ufsmount *ump; struct fs *fs; struct buf *bp; - int cg, request, error; + u_int cg, request; + int error; daddr_t bno; fs = ip->i_fs; @@ -571,7 +572,8 @@ ffs_valloc(struct vnode *pvp, int mode, kauth_cred_t cred, ino_t *inop) struct inode *pip; struct fs *fs; ino_t ino, ipref; - int cg, error; + u_int cg; + int error; UFS_WAPBL_JUNLOCK_ASSERT(pvp->v_mount); @@ -637,12 +639,12 @@ static ino_t ffs_dirpref(struct inode *pip) { register struct fs *fs; - int cg, prefcg; - int64_t dirsize, cgsize, curdsz; - int avgifree, avgbfree, avgndir; - int minifree, minbfree, maxndir; - int mincg, minndir; - int maxcontigdirs; + u_int cg, prefcg; + uint64_t dirsize, cgsize, curdsz; + u_int avgifree, avgbfree, avgndir; + u_int minifree, minbfree, maxndir; + u_int mincg, minndir; + u_int maxcontigdirs; KASSERT(mutex_owned(&pip->i_ump->um_lock)); @@ -770,8 +772,8 @@ ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int flags, int32_t *bap /* XXX ondisk32 */) { struct fs *fs; - int cg; - int avgbfree, startcg; + u_int cg; + u_int avgbfree, startcg; KASSERT(mutex_owned(&ip->i_ump->um_lock)); @@ -834,8 +836,8 @@ ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int flags, int64_t *bap) { struct fs *fs; - int cg; - int avgbfree, startcg; + u_int cg; + u_int avgbfree, startcg; KASSERT(mutex_owned(&ip->i_ump->um_lock)); @@ -908,15 +910,15 @@ ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int flags, */ /*VARARGS5*/ static daddr_t -ffs_hashalloc(struct inode *ip, int cg, daddr_t pref, +ffs_hashalloc(struct inode *ip, u_int cg, daddr_t pref, int size /* size for data blocks, mode for inodes */, int realsize, int flags, - daddr_t (*allocator)(struct inode *, int, daddr_t, int, int, int)) + daddr_t (*allocator)(struct inode *, u_int, daddr_t, int, int, int)) { struct fs *fs; daddr_t result; - int i, icg = cg; + u_int i, icg = cg; fs = ip->i_fs; /* @@ -966,7 +968,7 @@ ffs_hashalloc(struct inode *ip, int cg, daddr_t pref, * => returns with um_lock released on success, held on failure */ static daddr_t -ffs_fragextend(struct inode *ip, int cg, daddr_t bprev, int osize, int nsize) +ffs_fragextend(struct inode *ip, u_int cg, daddr_t bprev, int osize, int nsize) { struct ufsmount *ump; struct fs *fs; @@ -1046,7 +1048,7 @@ ffs_fragextend(struct inode *ip, int cg, daddr_t bprev, int osize, int nsize) * and if it is, allocate it. */ static daddr_t -ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size, int realsize, +ffs_alloccg(struct inode *ip, u_int cg, daddr_t bpref, int size, int realsize, int flags) { struct ufsmount *ump; @@ -1257,7 +1259,7 @@ gotit: * inode in the specified cylinder group. */ static daddr_t -ffs_nodealloccg(struct inode *ip, int cg, daddr_t ipref, int mode, int realsize, +ffs_nodealloccg(struct inode *ip, u_int cg, daddr_t ipref, int mode, int realsize, int flags) { struct ufsmount *ump = ip->i_ump; @@ -1416,7 +1418,7 @@ gotit: bwrite(bp); } else bdwrite(bp); - return (cg * fs->fs_ipg + ipref); + return ((ino_t)(cg * fs->fs_ipg + ipref)); fail: if (bp != NULL) brelse(bp, 0); @@ -1456,7 +1458,8 @@ ffs_blkalloc_ump(struct ufsmount *ump, daddr_t bno, long size) struct cg *cgp; struct buf *bp; int32_t fragno, cgbno; - int i, error, cg, blk, frags, bbase; + int i, error, blk, frags, bbase; + u_int cg; u_int8_t *blksfree; const int needswap = UFS_FSNEEDSWAP(fs); @@ -1560,7 +1563,8 @@ ffs_blkfree_cg(struct fs *fs, struct vnode *devvp, daddr_t bno, long size) struct buf *bp; struct ufsmount *ump; daddr_t cgblkno; - int error, cg; + int error; + u_int cg; dev_t dev; const bool devvp_is_snapshot = (devvp->v_type != VBLK); const int needswap = UFS_FSNEEDSWAP(fs); @@ -1870,7 +1874,8 @@ ffs_blkfree_common(struct ufsmount *ump, struct fs *fs, dev_t dev, { struct cg *cgp; int32_t fragno, cgbno; - int i, cg, blk, frags, bbase; + int i, blk, frags, bbase; + u_int cg; u_int8_t *blksfree; const int needswap = UFS_FSNEEDSWAP(fs); @@ -1993,7 +1998,8 @@ ffs_freefile(struct mount *mp, ino_t ino, int mode) struct vnode *devvp; struct cg *cgp; struct buf *bp; - int error, cg; + int error; + u_int cg; daddr_t cgbno; dev_t dev; const int needswap = UFS_FSNEEDSWAP(fs); @@ -2003,7 +2009,7 @@ ffs_freefile(struct mount *mp, ino_t ino, int mode) dev = devvp->v_rdev; cgbno = FFS_FSBTODB(fs, cgtod(fs, cg)); - if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) + if (ino >= fs->fs_ipg * fs->fs_ncg) panic("%s: range: dev = 0x%llx, ino = %llu, fs = %s", __func__, (long long)dev, (unsigned long long)ino, fs->fs_fsmnt); error = bread(devvp, cgbno, (int)fs->fs_cgsize, @@ -2041,7 +2047,7 @@ ffs_freefile_snap(struct fs *fs, struct vnode *devvp, ino_t ino, int mode) dev = VTOI(devvp)->i_devvp->v_rdev; ump = VFSTOUFS(devvp->v_mount); cgbno = ffs_fragstoblks(fs, cgtod(fs, cg)); - if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) + if (ino >= fs->fs_ipg * fs->fs_ncg) panic("%s: range: dev = 0x%llx, ino = %llu, fs = %s", __func__, (unsigned long long)dev, (unsigned long long)ino, fs->fs_fsmnt); @@ -2066,10 +2072,11 @@ static void ffs_freefile_common(struct ufsmount *ump, struct fs *fs, dev_t dev, struct buf *bp, ino_t ino, int mode, bool devvp_is_snapshot) { - int cg; + u_int cg; struct cg *cgp; u_int8_t *inosused; const int needswap = UFS_FSNEEDSWAP(fs); + ino_t cgino; cg = ino_to_cg(fs, ino); cgp = (struct cg *)bp->b_data; @@ -2078,20 +2085,19 @@ ffs_freefile_common(struct ufsmount *ump, struct fs *fs, dev_t dev, (fs->fs_old_flags & FS_FLAGS_UPDATED)) cgp->cg_time = ufs_rw64(time_second, needswap); inosused = cg_inosused(cgp, needswap); - ino %= fs->fs_ipg; - if (isclr(inosused, ino)) { + cgino = ino % fs->fs_ipg; + if (isclr(inosused, cgino)) { printf("ifree: dev = 0x%llx, ino = %llu, fs = %s\n", - (unsigned long long)dev, (unsigned long long)ino + - cg * fs->fs_ipg, fs->fs_fsmnt); + (unsigned long long)dev, (unsigned long long)ino, + fs->fs_fsmnt); if (fs->fs_ronly == 0) panic("%s: freeing free inode", __func__); } - clrbit(inosused, ino); + clrbit(inosused, cgino); if (!devvp_is_snapshot) - UFS_WAPBL_UNREGISTER_INODE(ump->um_mountp, - ino + cg * fs->fs_ipg, mode); - if (ino < ufs_rw32(cgp->cg_irotor, needswap)) - cgp->cg_irotor = ufs_rw32(ino, needswap); + UFS_WAPBL_UNREGISTER_INODE(ump->um_mountp, ino, mode); + if (cgino < ufs_rw32(cgp->cg_irotor, needswap)) + cgp->cg_irotor = ufs_rw32(cgino, needswap); ufs_add32(cgp->cg_cs.cs_nifree, 1, needswap); mutex_enter(&ump->um_lock); fs->fs_cstotal.cs_nifree++; @@ -2115,7 +2121,8 @@ ffs_checkfreefile(struct fs *fs, struct vnode *devvp, ino_t ino) struct cg *cgp; struct buf *bp; daddr_t cgbno; - int ret, cg; + int ret; + u_int cg; u_int8_t *inosused; const bool devvp_is_snapshot = (devvp->v_type != VBLK); @@ -2126,7 +2133,7 @@ ffs_checkfreefile(struct fs *fs, struct vnode *devvp, ino_t ino) cgbno = ffs_fragstoblks(fs, cgtod(fs, cg)); else cgbno = FFS_FSBTODB(fs, cgtod(fs, cg)); - if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) + if (ino >= fs->fs_ipg * fs->fs_ncg) return 1; if (bread(devvp, cgbno, (int)fs->fs_cgsize, 0, &bp)) { return 1; diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 8897132087ab..90a31d21d8b5 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_extern.h,v 1.87 2022/11/28 04:52:04 chs Exp $ */ +/* $NetBSD: ffs_extern.h,v 1.88 2023/01/07 19:41:30 chs Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -202,7 +202,7 @@ void ffs_cg_swap(struct cg *, struct cg *, struct fs *); void ffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t); int ffs_getblk(struct vnode *, daddr_t, daddr_t, int, bool, buf_t **); #endif /* defined(_KERNEL) */ -void ffs_fragacct(struct fs *, int, int32_t[], int, int); +void ffs_fragacct(struct fs *, int, uint32_t[], int, int); int ffs_isblock(struct fs *, u_char *, int32_t); int ffs_isfreeblock(struct fs *, u_char *, int32_t); void ffs_clrblock(struct fs *, u_char *, int32_t); diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index b824b9420070..df4300e37b25 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_subr.c,v 1.53 2022/05/24 06:28:02 andvar Exp $ */ +/* $NetBSD: ffs_subr.c,v 1.54 2023/01/07 19:41:30 chs Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -36,7 +36,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ffs_subr.c,v 1.53 2022/05/24 06:28:02 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_subr.c,v 1.54 2023/01/07 19:41:30 chs Exp $"); #include @@ -141,7 +141,7 @@ ffs_getblk(struct vnode *vp, daddr_t lblkno, daddr_t blkno, int size, * of some frags. */ void -ffs_fragacct(struct fs *fs, int fragmap, int32_t fraglist[], int cnt, +ffs_fragacct(struct fs *fs, int fragmap, uint32_t fraglist[], int cnt, int needswap) { int inblk; diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h index da0bf60cd1ae..5c26b259d9f0 100644 --- a/sys/ufs/ffs/fs.h +++ b/sys/ufs/ffs/fs.h @@ -1,4 +1,4 @@ -/* $NetBSD: fs.h,v 1.70 2022/11/17 06:40:40 chs Exp $ */ +/* $NetBSD: fs.h,v 1.71 2023/01/07 19:41:30 chs Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -265,7 +265,7 @@ struct fs { int32_t fs_old_time; /* last time written */ int32_t fs_old_size; /* number of blocks in fs */ int32_t fs_old_dsize; /* number of data blocks in fs */ - int32_t fs_ncg; /* number of cylinder groups */ + u_int32_t fs_ncg; /* number of cylinder groups */ int32_t fs_bsize; /* size of basic blocks in fs */ int32_t fs_fsize; /* size of frag blocks in fs */ int32_t fs_frag; /* number of frags in a block in fs */ @@ -288,7 +288,7 @@ struct fs { int32_t fs_spare1[2]; /* old fs_csmask */ /* old fs_csshift */ int32_t fs_nindir; /* value of FFS_NINDIR */ - int32_t fs_inopb; /* value of FFS_INOPB */ + u_int32_t fs_inopb; /* value of FFS_INOPB */ int32_t fs_old_nspf; /* value of NSPF */ /* yet another configuration parameter */ int32_t fs_optim; /* optimization preference, see below */ @@ -308,7 +308,7 @@ struct fs { int32_t fs_old_spc; /* sectors per cylinder */ int32_t fs_old_ncyl; /* cylinders in file system */ int32_t fs_old_cpg; /* cylinders per group */ - int32_t fs_ipg; /* inodes per group */ + u_int32_t fs_ipg; /* inodes per group */ int32_t fs_fpg; /* blocks per group * fs_frag */ /* this data must be re-computed after crashes */ struct csum fs_old_cstotal; /* cylinder summary information */ @@ -348,11 +348,11 @@ struct fs { int64_t fs_dsize; /* number of data blocks in fs */ int64_t fs_csaddr; /* blk addr of cyl grp summary area */ int64_t fs_pendingblocks; /* blocks in process of being freed */ - int32_t fs_pendinginodes; /* inodes in process of being freed */ - int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ + u_int32_t fs_pendinginodes; /* inodes in process of being freed */ + uint32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ /* back to stuff that has been around a while */ - int32_t fs_avgfilesize; /* expected average file size */ - int32_t fs_avgfpdir; /* expected # of files per directory */ + u_int32_t fs_avgfilesize; /* expected average file size */ + u_int32_t fs_avgfpdir; /* expected # of files per directory */ int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */ int32_t fs_sparecon32[26]; /* reserved for future constants */ uint32_t fs_flags; /* see FS_ flags below */ @@ -507,25 +507,25 @@ struct cg { int32_t cg_firstfield; /* historic cyl groups linked list */ int32_t cg_magic; /* magic number */ int32_t cg_old_time; /* time last written */ - int32_t cg_cgx; /* we are the cgx'th cylinder group */ + u_int32_t cg_cgx; /* we are the cgx'th cylinder group */ int16_t cg_old_ncyl; /* number of cyl's this cg */ int16_t cg_old_niblk; /* number of inode blocks this cg */ - int32_t cg_ndblk; /* number of data blocks this cg */ - struct csum cg_cs; /* cylinder summary information */ - int32_t cg_rotor; /* position of last used block */ - int32_t cg_frotor; /* position of last used frag */ - int32_t cg_irotor; /* position of last used inode */ - int32_t cg_frsum[MAXFRAG]; /* counts of available frags */ + u_int32_t cg_ndblk; /* number of data blocks this cg */ + struct csum cg_cs; /* cylinder summary information */ + u_int32_t cg_rotor; /* position of last used block */ + u_int32_t cg_frotor; /* position of last used frag */ + u_int32_t cg_irotor; /* position of last used inode */ + u_int32_t cg_frsum[MAXFRAG]; /* counts of available frags */ int32_t cg_old_btotoff; /* (int32) block totals per cylinder */ int32_t cg_old_boff; /* (u_int16) free block positions */ - int32_t cg_iusedoff; /* (u_int8) used inode map */ - int32_t cg_freeoff; /* (u_int8) free block map */ - int32_t cg_nextfreeoff; /* (u_int8) next available space */ - int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */ - int32_t cg_clusteroff; /* (u_int8) free cluster map */ - int32_t cg_nclusterblks; /* number of clusters this cg */ - int32_t cg_niblk; /* number of inode blocks this cg */ - int32_t cg_initediblk; /* last initialized inode */ + u_int32_t cg_iusedoff; /* (u_int8) used inode map */ + u_int32_t cg_freeoff; /* (u_int8) free block map */ + u_int32_t cg_nextfreeoff; /* (u_int8) next available space */ + u_int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */ + u_int32_t cg_clusteroff; /* (u_int8) free cluster map */ + u_int32_t cg_nclusterblks; /* number of clusters this cg */ + u_int32_t cg_niblk; /* number of inode blocks this cg */ + u_int32_t cg_initediblk; /* last initialized inode */ int32_t cg_sparecon32[3]; /* reserved for future use */ int64_t cg_time; /* time last written */ int64_t cg_sparecon64[3]; /* reserved for future use */ @@ -647,11 +647,11 @@ struct ocg { * inode number to cylinder group number. * inode number to file system block address. */ -#define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg) +#define ino_to_cg(fs, x) (((ino_t)(x)) / (fs)->fs_ipg) #define ino_to_fsba(fs, x) \ - ((daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \ - (ffs_blkstofrags((fs), (((x) % (fs)->fs_ipg) / FFS_INOPB(fs)))))) -#define ino_to_fsbo(fs, x) ((x) % FFS_INOPB(fs)) + ((daddr_t)(cgimin(fs, ino_to_cg(fs, (ino_t)(x))) + \ + (ffs_blkstofrags((fs), ((((ino_t)(x)) % (fs)->fs_ipg) / FFS_INOPB(fs)))))) +#define ino_to_fsbo(fs, x) (((ino_t)(x)) % FFS_INOPB(fs)) /* * Give cylinder group number for a file system block. diff --git a/usr.sbin/dumpfs/dumpfs.c b/usr.sbin/dumpfs/dumpfs.c index 80baa416a680..89999b065b58 100644 --- a/usr.sbin/dumpfs/dumpfs.c +++ b/usr.sbin/dumpfs/dumpfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: dumpfs.c,v 1.67 2022/12/19 18:51:42 chs Exp $ */ +/* $NetBSD: dumpfs.c,v 1.68 2023/01/07 19:41:30 chs Exp $ */ /* * Copyright (c) 1983, 1992, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1992, 1993\ #if 0 static char sccsid[] = "@(#)dumpfs.c 8.5 (Berkeley) 4/29/95"; #else -__RCSID("$NetBSD: dumpfs.c,v 1.67 2022/12/19 18:51:42 chs Exp $"); +__RCSID("$NetBSD: dumpfs.c,v 1.68 2023/01/07 19:41:30 chs Exp $"); #endif #endif /* not lint */ @@ -493,6 +493,7 @@ print_cgsum(const char *name, int fd) { struct csum *ccsp; int i, j, size; + uint32_t cgnum; afs.fs_csp = calloc(1, afs.fs_cssize); for (i = 0, j = 0; i < afs.fs_cssize; i += afs.fs_bsize, j++) { @@ -510,8 +511,8 @@ print_cgsum(const char *name, int fd) } printf("cs[].cs_(nbfree,ndir,nifree,nffree):\n\t"); - for (i = 0; i < afs.fs_ncg; i++) { - struct csum *cs = &afs.fs_cs(&afs, i); + for (cgnum = 0; cgnum < afs.fs_ncg; cgnum++) { + struct csum *cs = &afs.fs_cs(&afs, cgnum); if (i && i % 4 == 0) printf("\n\t"); printf("(%d,%d,%d,%d) ", @@ -534,7 +535,7 @@ static int print_alt_super(const char *name, int fd) { union fsun alt; - int i; + uint32_t i; off_t loc; uint16_t alt_opostblsave[32*8]; int save_printold; @@ -560,7 +561,7 @@ print_alt_super(const char *name, int fd) static int print_cginfo(const char *name, int fd) { - int i; + uint32_t i; printf("\n"); for (i = 0; i < afs.fs_ncg; i++) { @@ -578,7 +579,8 @@ print_inodes(const char *name, int fd, int c, int n) { void *ino_buf = malloc(afs.fs_bsize); void (*print_inode)(int, int, void *); - int i, inum; + ino_t inum; + uint32_t i; if (ino_buf == 0) return 1; diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile index 3326b7ef5564..6da00e8d7e5f 100644 --- a/usr.sbin/makefs/Makefile +++ b/usr.sbin/makefs/Makefile @@ -1,8 +1,6 @@ -# $NetBSD: Makefile,v 1.39 2022/04/09 14:38:47 riastradh Exp $ +# $NetBSD: Makefile,v 1.40 2023/01/07 19:41:30 chs Exp $ # -WARNS?= 5 - .include PROG= makefs diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index 333d508ab3d0..bf172189840d 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.c,v 1.73 2022/11/17 06:40:41 chs Exp $ */ +/* $NetBSD: ffs.c,v 1.74 2023/01/07 19:41:30 chs Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -71,7 +71,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs.c,v 1.73 2022/11/17 06:40:41 chs Exp $"); +__RCSID("$NetBSD: ffs.c,v 1.74 2023/01/07 19:41:30 chs Exp $"); #endif /* !__lint */ #include @@ -1067,7 +1067,7 @@ 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; + uint32_t cg, cgino, i; daddr_t d; char sbbuf[FFS_MAXBSIZE]; uint32_t initediblk; diff --git a/usr.sbin/makefs/ffs/ffs_alloc.c b/usr.sbin/makefs/ffs/ffs_alloc.c index fd2d179ac504..1bda5e1e93c6 100644 --- a/usr.sbin/makefs/ffs/ffs_alloc.c +++ b/usr.sbin/makefs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.30 2022/04/09 10:05:35 riastradh Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.31 2023/01/07 19:41:30 chs Exp $ */ /* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */ /* @@ -47,7 +47,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs_alloc.c,v 1.30 2022/04/09 10:05:35 riastradh Exp $"); +__RCSID("$NetBSD: ffs_alloc.c,v 1.31 2023/01/07 19:41:30 chs Exp $"); #endif /* !__lint */ #include @@ -70,7 +70,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 *, uint32_t, daddr_t, int, daddr_t (*)(struct inode *, int, daddr_t, int)); static int32_t ffs_mapsearch(struct fs *, struct cg *, daddr_t, int); @@ -159,8 +159,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; + uint32_t cg, startcg; + int avgbfree; fs = ip->i_fs; if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { @@ -198,8 +198,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; + uint32_t cg, startcg; + int avgbfree; fs = ip->i_fs; if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) { @@ -247,12 +247,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, uint32_t 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; + uint32_t i, icg = cg; fs = ip->i_fs; /* diff --git a/usr.sbin/makefs/ffs/ffs_extern.h b/usr.sbin/makefs/ffs/ffs_extern.h index 1b1750b4965f..f1be25fc3e66 100644 --- a/usr.sbin/makefs/ffs/ffs_extern.h +++ b/usr.sbin/makefs/ffs/ffs_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_extern.h,v 1.8 2022/04/09 10:05:35 riastradh Exp $ */ +/* $NetBSD: ffs_extern.h,v 1.9 2023/01/07 19:41:30 chs Exp $ */ /* From: NetBSD: ffs_extern.h,v 1.19 2001/08/17 02:18:48 lukem Exp */ /*- @@ -66,7 +66,7 @@ void ffs_csum_swap(struct csum *, struct csum *, int); void ffs_cg_swap(struct cg *, struct cg *, struct fs *); /* ffs_subr.c */ -void ffs_fragacct(struct fs *, int, int32_t[], int, int); +void ffs_fragacct(struct fs *, int, uint32_t[], int, int); int ffs_isblock(struct fs *, u_char *, int32_t); int ffs_isfreeblock(struct fs *, u_char *, int32_t); void ffs_clrblock(struct fs *, u_char *, int32_t); diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index 95e61dfb880c..08863ea41f15 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.41 2022/11/17 06:40:41 chs Exp $ */ +/* $NetBSD: mkfs.c,v 1.42 2023/01/07 19:41:30 chs Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else #ifdef __RCSID -__RCSID("$NetBSD: mkfs.c,v 1.41 2022/11/17 06:40:41 chs Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.42 2023/01/07 19:41:30 chs Exp $"); #endif #endif #endif /* not lint */ @@ -75,7 +75,7 @@ __RCSID("$NetBSD: mkfs.c,v 1.41 2022/11/17 06:40:41 chs Exp $"); #include "ffs/ffs_extern.h" #include "ffs/newfs_extern.h" -static void initcg(int, time_t, const fsinfo_t *); +static void initcg(uint32_t, time_t, const fsinfo_t *); static int ilog2(int); static int count_digits(int); @@ -141,7 +141,8 @@ struct fs * ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) { int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg; - int32_t cylno, i, csfrags; + uint32_t cylno, i; + int32_t csfrags; long long sizepb; void *space; int size; @@ -443,7 +444,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) sblock.fs_maxcluster = lp = space; for (i = 0; i < sblock.fs_ncg; i++) - *lp++ = sblock.fs_contigsumsize; + *lp++ = sblock.fs_contigsumsize; } sblock.fs_sbsize = ffs_fragroundup(&sblock, sizeof(struct fs)); @@ -566,7 +567,8 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) void ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts) { - int cylno, size, blks, i, saveflag; + int size, blks, i, saveflag; + uint32_t cylno; void *space; char *wrbuf; @@ -606,10 +608,10 @@ ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts) * Initialize a cylinder group. */ static void -initcg(int cylno, time_t utime, const fsinfo_t *fsopts) +initcg(uint32_t cylno, time_t utime, const fsinfo_t *fsopts) { daddr_t cbase, dmax; - int i, j, d, dlower, dupper, blkno; + uint32_t i, j, d, dlower, dupper, blkno; struct ufs1_dinode *dp1; struct ufs2_dinode *dp2; int start; @@ -671,7 +673,7 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts) acg.cg_nextfreeoff = acg.cg_clusteroff + howmany(ffs_fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - if (acg.cg_nextfreeoff > sblock.fs_cgsize) { + if (acg.cg_nextfreeoff > (unsigned)sblock.fs_cgsize) { printf("Panic: cylinder group too big\n"); exit(37); } diff --git a/usr.sbin/quotacheck/quotacheck.c b/usr.sbin/quotacheck/quotacheck.c index db221f99385c..de82dff49920 100644 --- a/usr.sbin/quotacheck/quotacheck.c +++ b/usr.sbin/quotacheck/quotacheck.c @@ -1,4 +1,4 @@ -/* $NetBSD: quotacheck.c,v 1.50 2022/11/17 06:40:41 chs Exp $ */ +/* $NetBSD: quotacheck.c,v 1.51 2023/01/07 19:41:30 chs Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\ #if 0 static char sccsid[] = "@(#)quotacheck.c 8.6 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: quotacheck.c,v 1.50 2022/11/17 06:40:41 chs Exp $"); +__RCSID("$NetBSD: quotacheck.c,v 1.51 2023/01/07 19:41:30 chs Exp $"); #endif #endif /* not lint */ @@ -319,7 +319,8 @@ chkquota(const char *type, const char *fsname, const char *mntpt, void *v, struct quotaname *qnp = v; struct fileusage *fup; union comb_dinode *dp; - int cg, i, mode, errs = 0, inosused; + int i, mode, errs = 0, inosused; + uint32_t cg; ino_t ino; struct cg *cgp; char msgbuf[4096];