diff options
author | Mike Barcroft <mike@FreeBSD.org> | 2002-09-25 04:06:37 +0000 |
---|---|---|
committer | Mike Barcroft <mike@FreeBSD.org> | 2002-09-25 04:06:37 +0000 |
commit | 89fdc4e117285d001665922c93080c804a8f8810 (patch) | |
tree | 2295edf76df9065e84ea0b415c9c13ecf434f1fa /sbin | |
parent | df93d794dccd272ca6d809e325cd381faeb6a4df (diff) | |
download | src-89fdc4e117285d001665922c93080c804a8f8810.tar.gz src-89fdc4e117285d001665922c93080c804a8f8810.zip |
Use the standardized CHAR_BIT constant instead of NBBY in userland.
Notes
Notes:
svn path=/head/; revision=103949
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dump/dump.h | 9 | ||||
-rw-r--r-- | sbin/dump/dumprmt.c | 1 | ||||
-rw-r--r-- | sbin/dump/itime.c | 1 | ||||
-rw-r--r-- | sbin/dump/main.c | 7 | ||||
-rw-r--r-- | sbin/dump/optr.c | 1 | ||||
-rw-r--r-- | sbin/dump/tape.c | 1 | ||||
-rw-r--r-- | sbin/dump/traverse.c | 3 | ||||
-rw-r--r-- | sbin/fsck_ffs/pass1.c | 7 | ||||
-rw-r--r-- | sbin/fsck_ffs/pass5.c | 13 | ||||
-rw-r--r-- | sbin/fsck_ffs/setup.c | 3 | ||||
-rw-r--r-- | sbin/growfs/debug.c | 5 | ||||
-rw-r--r-- | sbin/growfs/growfs.c | 9 | ||||
-rw-r--r-- | sbin/newfs/mkfs.c | 11 | ||||
-rw-r--r-- | sbin/restore/dirs.c | 1 | ||||
-rw-r--r-- | sbin/restore/interactive.c | 1 | ||||
-rw-r--r-- | sbin/restore/main.c | 1 | ||||
-rw-r--r-- | sbin/restore/restore.c | 1 | ||||
-rw-r--r-- | sbin/restore/restore.h | 6 | ||||
-rw-r--r-- | sbin/restore/symtab.c | 1 | ||||
-rw-r--r-- | sbin/restore/tape.c | 1 | ||||
-rw-r--r-- | sbin/restore/utilities.c | 1 |
21 files changed, 54 insertions, 30 deletions
diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h index e2003476afe4..a148c6ba8cbe 100644 --- a/sbin/dump/dump.h +++ b/sbin/dump/dump.h @@ -46,11 +46,14 @@ char *dumpinomap; /* map of files to be dumped */ * Map manipulation macros. */ #define SETINO(ino, map) \ - map[(u_int)((ino) - 1) / NBBY] |= 1 << ((u_int)((ino) - 1) % NBBY) + map[(u_int)((ino) - 1) / CHAR_BIT] |= \ + 1 << ((u_int)((ino) - 1) % CHAR_BIT) #define CLRINO(ino, map) \ - map[(u_int)((ino) - 1) / NBBY] &= ~(1 << ((u_int)((ino) - 1) % NBBY)) + map[(u_int)((ino) - 1) / CHAR_BIT] &= \ + ~(1 << ((u_int)((ino) - 1) % CHAR_BIT)) #define TSTINO(ino, map) \ - (map[(u_int)((ino) - 1) / NBBY] & (1 << ((u_int)((ino) - 1) % NBBY))) + (map[(u_int)((ino) - 1) / CHAR_BIT] & \ + (1 << ((u_int)((ino) - 1) % CHAR_BIT))) /* * All calculations done in 0.1" units! diff --git a/sbin/dump/dumprmt.c b/sbin/dump/dumprmt.c index 11531fbe7d4a..1e37d06cb116 100644 --- a/sbin/dump/dumprmt.c +++ b/sbin/dump/dumprmt.c @@ -57,6 +57,7 @@ static const char rcsid[] = #include <netdb.h> #include <pwd.h> #include <stdio.h> +#include <limits.h> #include <errno.h> #include <stdlib.h> #include <string.h> diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c index dd273ea71685..55af65cbb96c 100644 --- a/sbin/dump/itime.c +++ b/sbin/dump/itime.c @@ -49,6 +49,7 @@ static const char rcsid[] = #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/sbin/dump/main.c b/sbin/dump/main.c index cc4f80dd4f9b..de6ecf764dfc 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -60,6 +60,7 @@ static const char rcsid[] = #include <fcntl.h> #include <fstab.h> #include <inttypes.h> +#include <limits.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -365,7 +366,7 @@ main(int argc, char *argv[]) if (TP_BSIZE != (1 << tp_bshift)) quit("TP_BSIZE (%d) is not a power of 2", TP_BSIZE); maxino = sblock->fs_ipg * sblock->fs_ncg; - mapsize = roundup(howmany(maxino, NBBY), TP_BSIZE); + mapsize = roundup(howmany(maxino, CHAR_BIT), TP_BSIZE); usedinomap = (char *)calloc((unsigned) mapsize, sizeof(char)); dumpdirmap = (char *)calloc((unsigned) mapsize, sizeof(char)); dumpinomap = (char *)calloc((unsigned) mapsize, sizeof(char)); @@ -454,7 +455,7 @@ main(int argc, char *argv[]) msg("dumping (Pass III) [directories]\n"); dirty = 0; /* XXX just to get gcc to shut up */ for (map = dumpdirmap, ino = 1; ino < maxino; ino++) { - if (((ino - 1) % NBBY) == 0) /* map is offset by 1 */ + if (((ino - 1) % CHAR_BIT) == 0) /* map is offset by 1 */ dirty = *map++; else dirty >>= 1; @@ -473,7 +474,7 @@ main(int argc, char *argv[]) setproctitle("%s: pass 4: regular files", disk); msg("dumping (Pass IV) [regular files]\n"); for (map = dumpinomap, ino = 1; ino < maxino; ino++) { - if (((ino - 1) % NBBY) == 0) /* map is offset by 1 */ + if (((ino - 1) % CHAR_BIT) == 0) /* map is offset by 1 */ dirty = *map++; else dirty >>= 1; diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c index a28d5228bfbe..09333c88d10f 100644 --- a/sbin/dump/optr.c +++ b/sbin/dump/optr.c @@ -49,6 +49,7 @@ static const char rcsid[] = #include <errno.h> #include <fstab.h> #include <grp.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c index 4a3b8105cd8f..00bb5c39d174 100644 --- a/sbin/dump/tape.c +++ b/sbin/dump/tape.c @@ -52,6 +52,7 @@ static const char rcsid[] = #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <setjmp.h> #include <signal.h> #include <stdio.h> diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index 9baec8807972..612f97016eae 100644 --- a/sbin/dump/traverse.c +++ b/sbin/dump/traverse.c @@ -51,6 +51,7 @@ static const char rcsid[] = #include <ctype.h> #include <errno.h> #include <inttypes.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -203,7 +204,7 @@ mapdirs(ino_t maxino, long *tapesize) isdir = 0; /* XXX just to get gcc to shut up */ for (map = dumpdirmap, ino = 1; ino < maxino; ino++) { - if (((ino - 1) % NBBY) == 0) /* map is offset by 1 */ + if (((ino - 1) % CHAR_BIT) == 0) /* map is offset by 1 */ isdir = *map++; else isdir >>= 1; diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 87cc46488d45..5a18abd5d436 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -48,6 +48,7 @@ static const char rcsid[] = #include <ufs/ffs/fs.h> #include <err.h> +#include <limits.h> #include <stdint.h> #include <string.h> @@ -116,11 +117,11 @@ pass1(void) if (preen && usedsoftdep) { if (!cg_chkmagic(&cgrp)) pfatal("CG %d: BAD MAGIC NUMBER\n", c); - cp = &cg_inosused(&cgrp)[(inosused - 1) / NBBY]; - for ( ; inosused > 0; inosused -= NBBY, cp--) { + cp = &cg_inosused(&cgrp)[(inosused - 1) / CHAR_BIT]; + for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) { if (*cp == 0) continue; - for (i = 1 << (NBBY - 1); i > 0; i >>= 1) { + for (i = 1 << (CHAR_BIT - 1); i > 0; i >>= 1) { if (*cp & i) break; inosused--; diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index 6685e395e926..c3f6c3d0bd80 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <ufs/ffs/fs.h> #include <err.h> +#include <limits.h> #include <string.h> #include "fsck.h" @@ -127,9 +128,9 @@ pass5(void) fs->fs_old_cpg * fs->fs_old_nrpos * sizeof(u_int16_t); memset(&newcg->cg_space[0], 0, newcg->cg_iusedoff - basesize); } - inomapsize = howmany(fs->fs_ipg, NBBY); + inomapsize = howmany(fs->fs_ipg, CHAR_BIT); newcg->cg_freeoff = newcg->cg_iusedoff + inomapsize; - blkmapsize = howmany(fs->fs_fpg, NBBY); + blkmapsize = howmany(fs->fs_fpg, CHAR_BIT); newcg->cg_nextfreeoff = newcg->cg_freeoff + blkmapsize; if (fs->fs_contigsumsize > 0) { newcg->cg_clustersumoff = newcg->cg_nextfreeoff - @@ -139,7 +140,7 @@ pass5(void) newcg->cg_clusteroff = newcg->cg_clustersumoff + (fs->fs_contigsumsize + 1) * sizeof(u_int32_t); newcg->cg_nextfreeoff = newcg->cg_clusteroff + - howmany(fragstoblks(fs, fs->fs_fpg), NBBY); + howmany(fragstoblks(fs, fs->fs_fpg), CHAR_BIT); } newcg->cg_magic = CG_MAGIC; mapsize = newcg->cg_nextfreeoff - newcg->cg_iusedoff; @@ -273,7 +274,7 @@ pass5(void) sump[run]++; run = 0; } - if ((i & (NBBY - 1)) != (NBBY - 1)) { + if ((i & (CHAR_BIT - 1)) != (CHAR_BIT - 1)) { bit <<= 1; } else { map = *mapp++; @@ -370,10 +371,10 @@ check_maps( k = *map2++; if (j == k) continue; - for (m = 0, l = 1; m < NBBY; m++, l <<= 1) { + for (m = 0, l = 1; m < CHAR_BIT; m++, l <<= 1) { if ((j & l) == (k & l)) continue; - n = startvalue + i * NBBY + m; + n = startvalue + i * CHAR_BIT + m; if ((j & l) != 0) { if (astart == -1) { astart = aend = n; diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 5bfae4de64b5..db3fc3f5b779 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -52,6 +52,7 @@ static const char rcsid[] = #include <ctype.h> #include <err.h> #include <errno.h> +#include <limits.h> #include <stdint.h> #include <string.h> @@ -243,7 +244,7 @@ setup(char *dev) /* * allocate and initialize the necessary maps */ - bmapsize = roundup(howmany(maxfsblock, NBBY), sizeof(short)); + bmapsize = roundup(howmany(maxfsblock, CHAR_BIT), sizeof(short)); blockmap = calloc((unsigned)bmapsize, sizeof (char)); if (blockmap == NULL) { printf("cannot alloc %u bytes for blockmap\n", diff --git a/sbin/growfs/debug.c b/sbin/growfs/debug.c index 3fe263f7d6b9..5b62bddeabb9 100644 --- a/sbin/growfs/debug.c +++ b/sbin/growfs/debug.c @@ -47,6 +47,7 @@ static const char rcsid[] = /* ********************************************************** INCLUDES ***** */ #include <sys/param.h> +#include <limits.h> #include <stdio.h> #include <ufs/ufs/dinode.h> #include <ufs/ffs/fs.h> @@ -456,7 +457,7 @@ dbg_dump_frmap(struct fs *sb, const char *comment, struct cg *cgr) indent++; cp=(unsigned char *)cg_blksfree(cgr); - e=howmany((sb->fs_cpg * sb->fs_spc / NSPF(sb)), NBBY); + e=howmany((sb->fs_cpg * sb->fs_spc / NSPF(sb)), CHAR_BIT); for(j=0; j<e; j+=32) { fprintf(dbg_log, "%08x: ", j); for(k=0; k<32; k+=8) { @@ -500,7 +501,7 @@ dbg_dump_clmap(struct fs *sb, const char *comment, struct cg *cgr) indent++; cp=(unsigned char *)cg_clustersfree(cgr); - e=howmany(sb->fs_cpg * sb->fs_spc / NSPB(sb), NBBY); + e=howmany(sb->fs_cpg * sb->fs_spc / NSPB(sb), CHAR_BIT); for(j=0; j<e; j+=32) { fprintf(dbg_log, "%08x: ", j); for(k=0; k<32; k+=8) { diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index 2db3430911eb..368fa99b54ad 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -62,6 +62,7 @@ static const char rcsid[] = #include <ctype.h> #include <err.h> #include <fcntl.h> +#include <limits.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -410,8 +411,8 @@ initcg(int cylno, time_t utime, int fso, unsigned int Nflag) acg.cg_iusedoff = acg.cg_old_boff + sblock.fs_old_cpg * sizeof(u_int16_t); } - acg.cg_freeoff = acg.cg_iusedoff + howmany(sblock.fs_ipg, NBBY); - acg.cg_nextfreeoff = acg.cg_freeoff + howmany(sblock.fs_fpg, NBBY); + acg.cg_freeoff = acg.cg_iusedoff + howmany(sblock.fs_ipg, CHAR_BIT); + acg.cg_nextfreeoff = acg.cg_freeoff + howmany(sblock.fs_fpg, CHAR_BIT); if (sblock.fs_contigsumsize > 0) { acg.cg_clustersumoff = roundup(acg.cg_nextfreeoff, sizeof(u_int32_t)); @@ -419,7 +420,7 @@ initcg(int cylno, time_t utime, int fso, unsigned int Nflag) acg.cg_clusteroff = acg.cg_clustersumoff + (sblock.fs_contigsumsize + 1) * sizeof(u_int32_t); acg.cg_nextfreeoff = acg.cg_clusteroff + - howmany(fragstoblks(&sblock, sblock.fs_fpg), NBBY); + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } if (acg.cg_nextfreeoff > sblock.fs_cgsize) { /* @@ -504,7 +505,7 @@ initcg(int cylno, time_t utime, int fso, unsigned int Nflag) sump[run]++; run = 0; } - if ((i & (NBBY - 1)) != NBBY - 1) + if ((i & (CHAR_BIT - 1)) != CHAR_BIT - 1) bit <<= 1; else { map = *mapp++; diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 39575efa2770..90561ef02d56 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -52,6 +52,7 @@ static const char rcsid[] = #endif /* not lint */ #include <err.h> +#include <limits.h> #include <signal.h> #include <stdlib.h> #include <string.h> @@ -544,8 +545,8 @@ initcg(int cylno, time_t utime) acg.cg_iusedoff = acg.cg_old_boff + sblock.fs_old_cpg * sizeof(u_int16_t); } - acg.cg_freeoff = acg.cg_iusedoff + howmany(sblock.fs_ipg, NBBY); - acg.cg_nextfreeoff = acg.cg_freeoff + howmany(sblock.fs_fpg, NBBY); + acg.cg_freeoff = acg.cg_iusedoff + howmany(sblock.fs_ipg, CHAR_BIT); + acg.cg_nextfreeoff = acg.cg_freeoff + howmany(sblock.fs_fpg, CHAR_BIT); if (sblock.fs_contigsumsize > 0) { acg.cg_clustersumoff = roundup(acg.cg_nextfreeoff, sizeof(u_int32_t)); @@ -553,7 +554,7 @@ initcg(int cylno, time_t utime) acg.cg_clusteroff = acg.cg_clustersumoff + (sblock.fs_contigsumsize + 1) * sizeof(u_int32_t); acg.cg_nextfreeoff = acg.cg_clusteroff + - howmany(fragstoblks(&sblock, sblock.fs_fpg), NBBY); + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } if (acg.cg_nextfreeoff > sblock.fs_cgsize) { printf("Panic: cylinder group too big\n"); @@ -616,7 +617,7 @@ initcg(int cylno, time_t utime) sump[run]++; run = 0; } - if ((i & (NBBY - 1)) != NBBY - 1) + if ((i & (CHAR_BIT - 1)) != CHAR_BIT - 1) bit <<= 1; else { map = *mapp++; @@ -1024,7 +1025,7 @@ ilog2(int val) { u_int n; - for (n = 0; n < sizeof(n) * NBBY; n++) + for (n = 0; n < sizeof(n) * CHAR_BIT; n++) if (1 << n == val) return (n); errx(1, "ilog2: %d is not a power of 2\n", val); diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c index dba573803684..313b87bf19cb 100644 --- a/sbin/restore/dirs.c +++ b/sbin/restore/dirs.c @@ -55,6 +55,7 @@ static const char rcsid[] = #include <err.h> #include <errno.h> +#include <limits.h> #include <paths.h> #include <stdio.h> #include <stdlib.h> diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index 5bfe82132f94..ec49c36fa082 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -48,6 +48,7 @@ static const char rcsid[] = #include <setjmp.h> #include <glob.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/sbin/restore/main.c b/sbin/restore/main.c index 2d316c02a368..e6124369873b 100644 --- a/sbin/restore/main.c +++ b/sbin/restore/main.c @@ -52,6 +52,7 @@ static const char rcsid[] = #include <protocols/dumprestore.h> #include <err.h> +#include <limits.h> #include <paths.h> #include <stdio.h> #include <stdlib.h> diff --git a/sbin/restore/restore.c b/sbin/restore/restore.c index 8b463a70b9e0..a9eb31ee6233 100644 --- a/sbin/restore/restore.c +++ b/sbin/restore/restore.c @@ -41,6 +41,7 @@ static const char rcsid[] = #include <sys/types.h> +#include <limits.h> #include <stdio.h> #include <string.h> diff --git a/sbin/restore/restore.h b/sbin/restore/restore.h index 8d7206dfc78d..d00c3b3a7e5d 100644 --- a/sbin/restore/restore.h +++ b/sbin/restore/restore.h @@ -139,9 +139,11 @@ typedef struct rstdirdesc RST_DIR; * Useful macros */ #define TSTINO(ino, map) \ - (map[(u_int)((ino) - 1) / NBBY] & (1 << ((u_int)((ino) - 1) % NBBY))) + (map[(u_int)((ino) - 1) / CHAR_BIT] & \ + (1 << ((u_int)((ino) - 1) % CHAR_BIT))) #define SETINO(ino, map) \ - map[(u_int)((ino) - 1) / NBBY] |= 1 << ((u_int)((ino) - 1) % NBBY) + map[(u_int)((ino) - 1) / CHAR_BIT] |= \ + 1 << ((u_int)((ino) - 1) % CHAR_BIT) #define dprintf if (dflag) fprintf #define vprintf if (vflag) fprintf diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c index 3dd55f84be06..ffda3fc57d32 100644 --- a/sbin/restore/symtab.c +++ b/sbin/restore/symtab.c @@ -55,6 +55,7 @@ static const char rcsid[] = #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index 1392f59e8a04..70ff44ab998a 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -54,6 +54,7 @@ static const char rcsid[] = #include <protocols/dumprestore.h> #include <errno.h> +#include <limits.h> #include <paths.h> #include <setjmp.h> #include <stdio.h> diff --git a/sbin/restore/utilities.c b/sbin/restore/utilities.c index 3901ad33f8b8..e42465d71c63 100644 --- a/sbin/restore/utilities.c +++ b/sbin/restore/utilities.c @@ -46,6 +46,7 @@ static const char rcsid[] = #include <ufs/ufs/dir.h> #include <errno.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> |