diff options
author | mike <mike@FreeBSD.org> | 2002-09-25 04:06:37 +0000 |
---|---|---|
committer | mike <mike@FreeBSD.org> | 2002-09-25 04:06:37 +0000 |
commit | 86a758e51be945d9e690ee0802a21bf9a667b4e8 (patch) | |
tree | 2295edf76df9065e84ea0b415c9c13ecf434f1fa /sbin/fsck_ffs | |
parent | b9155304da025f935d34f191093267f40e40cdd2 (diff) | |
download | FreeBSD-src-86a758e51be945d9e690ee0802a21bf9a667b4e8.zip FreeBSD-src-86a758e51be945d9e690ee0802a21bf9a667b4e8.tar.gz |
Use the standardized CHAR_BIT constant instead of NBBY in userland.
Diffstat (limited to 'sbin/fsck_ffs')
-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 |
3 files changed, 13 insertions, 10 deletions
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 87cc464..5a18abd 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 6685e39..c3f6c3d 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 5bfae4d..db3fc3f 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", |