From: David van Moolenbroek Date: Tue, 21 Dec 2010 10:44:45 +0000 (+0000) Subject: change bitchunk_t from 16-bit to 32-bit X-Git-Tag: v3.2.0~710 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch07.html?a=commitdiff_plain;h=5d8d5e0c3a6940e40760cbeada5fa5ff0d21224e;p=minix.git change bitchunk_t from 16-bit to 32-bit --- diff --git a/commands/fsck.mfs/fsck.c b/commands/fsck.mfs/fsck.c index f2eccc536..4eaf55ac8 100644 --- a/commands/fsck.mfs/fsck.c +++ b/commands/fsck.mfs/fsck.c @@ -62,7 +62,7 @@ unsigned int fs_version = 2, block_size = 0; -#define BITSHIFT 4 /* = log2(#bits(int)) */ +#define BITSHIFT 5 /* = log2(#bits(int)) */ #define MAXPRINT 80 /* max. number of error lines in chkmap */ #define CINDIR 128 /* number of indirect zno's read at a time */ diff --git a/commands/fsck1/fsck1.c b/commands/fsck1/fsck1.c index 6fce5421c..daf278e0d 100644 --- a/commands/fsck1/fsck1.c +++ b/commands/fsck1/fsck1.c @@ -56,7 +56,7 @@ #define BLOCK_SIZE _STATIC_BLOCK_SIZE -#define BITSHIFT 4 /* = log2(#bits(int)) */ +#define BITSHIFT 5 /* = log2(#bits(int)) */ #define MAXPRINT 8 /* max. number of error lines in chkmap */ #define CINDIR 128 /* number of indirect zno's read at a time */ diff --git a/include/minix/types.h b/include/minix/types.h index 878175e6c..6a4f46fe5 100644 --- a/include/minix/types.h +++ b/include/minix/types.h @@ -44,7 +44,7 @@ typedef u32_t zone_t; /* zone number */ typedef u32_t block_t; /* block number */ typedef u32_t bit_t; /* bit number in a bit map */ typedef u16_t zone1_t; /* zone number for V1 file systems */ -typedef u16_t bitchunk_t; /* collection of bits in a bitmap */ +typedef u32_t bitchunk_t; /* collection of bits in a bitmap */ /* ANSI C makes writing down the promotion of unsigned types very messy. When * sizeof(short) == sizeof(int), there is no promotion, so the type stays diff --git a/kernel/system/do_privctl.c b/kernel/system/do_privctl.c index d8703063e..9bdfe8425 100644 --- a/kernel/system/do_privctl.c +++ b/kernel/system/do_privctl.c @@ -363,7 +363,7 @@ PRIVATE int update_priv(struct proc *rp, struct priv *priv) #if PRIV_DEBUG printf("do_privctl: Setting ipc target mask for %d:"); for (i=0; i < NR_SYS_PROCS; i += BITCHUNK_BITS) { - printf(" %04x", get_sys_bits(priv->s_ipc_to, i)); + printf(" %08x", get_sys_bits(priv->s_ipc_to, i)); } printf("\n"); #endif @@ -373,7 +373,7 @@ PRIVATE int update_priv(struct proc *rp, struct priv *priv) #if PRIV_DEBUG printf("do_privctl: Set ipc target mask for %d:"); for (i=0; i < NR_SYS_PROCS; i += BITCHUNK_BITS) { - printf(" %04x", get_sys_bits(priv(rp)->s_ipc_to, i)); + printf(" %08x", get_sys_bits(priv(rp)->s_ipc_to, i)); } printf("\n"); #endif diff --git a/kernel/table.c b/kernel/table.c index 98f955111..23d046da7 100644 --- a/kernel/table.c +++ b/kernel/table.c @@ -90,13 +90,10 @@ PUBLIC struct boot_image image[] = { {INIT_PROC_NR, BVM_F, 0, "init" }, }; -/* Verify the size of the system image table at compile time. Also verify that - * the first chunk of the ipc mask has enough bits to accommodate the processes - * in the image. +/* Verify the size of the system image table at compile time. * If a problem is detected, the size of the 'dummy' array will be negative, * causing a compile time error. Note that no space is actually allocated * because 'dummy' is declared extern. */ extern int dummy[(NR_BOOT_PROCS==sizeof(image)/ sizeof(struct boot_image))?1:-1]; -extern int dummy[(BITCHUNK_BITS > NR_BOOT_PROCS - 1) ? 1 : -1]; diff --git a/servers/is/dmp_kernel.c b/servers/is/dmp_kernel.c index 3b92ffde7..8fd66b41b 100644 --- a/servers/is/dmp_kernel.c +++ b/servers/is/dmp_kernel.c @@ -327,7 +327,7 @@ PUBLIC void privileges_dmp() } printf("-nr- -id- -name-- -flags- traps grants -ipc_to--" - " -kernel calls-\n"); + " -kernel calls-\n"); PROCLOOP(rp, oldrp) r = -1; @@ -341,12 +341,12 @@ PUBLIC void privileges_dmp() s_flags_str(sp->s_flags), s_traps_str(sp->s_trap_mask), sp->s_grant_entries); for (i=0; i < NR_SYS_PROCS; i += BITCHUNK_BITS) { - printf(" %04x", get_sys_bits(sp->s_ipc_to, i)); + printf(" %08x", get_sys_bits(sp->s_ipc_to, i)); } printf(" "); for (i=0; i < NR_SYS_CALLS; i += BITCHUNK_BITS) { - printf(" %04x", sp->s_k_call_mask[i/BITCHUNK_BITS]); + printf(" %08x", sp->s_k_call_mask[i/BITCHUNK_BITS]); } printf("\n"); diff --git a/servers/mfs/stats.c b/servers/mfs/stats.c index f48fee317..ebae236eb 100644 --- a/servers/mfs/stats.c +++ b/servers/mfs/stats.c @@ -57,11 +57,10 @@ int map; /* IMAP (inode map) or ZMAP (zone map) */ /* Iterate over the words in block. */ for (wptr = &bp->b_bitmap[word]; wptr < wlim; wptr++) { - /* Does this word contain a free bit? */ + /* Does this word contain a free bit? */ if (*wptr == (bitchunk_t) ~0) continue; - /* Find and allocate the free bit. */ - k = (bitchunk_t) conv2(sp->s_native, (int) *wptr); + k = (bitchunk_t) conv4(sp->s_native, (int) *wptr); for (i = 0; i < 8*sizeof(k); ++i) { /* Bit number from the start of the bit map. */ diff --git a/servers/mfs/super.c b/servers/mfs/super.c index 48516116f..d0e6d05dc 100644 --- a/servers/mfs/super.c +++ b/servers/mfs/super.c @@ -73,7 +73,7 @@ bit_t origin; /* number of bit to start searching at */ if (*wptr == (bitchunk_t) ~0) continue; /* Find and allocate the free bit. */ - k = (bitchunk_t) conv2(sp->s_native, (int) *wptr); + k = (bitchunk_t) conv4(sp->s_native, (int) *wptr); for (i = 0; (k & (1 << i)) != 0; ++i) {} /* Bit number from the start of the bit map. */ @@ -86,7 +86,7 @@ bit_t origin; /* number of bit to start searching at */ /* Allocate and return bit number. */ k |= 1 << i; - *wptr = (bitchunk_t) conv2(sp->s_native, (int) k); + *wptr = (bitchunk_t) conv4(sp->s_native, (int) k); bp->b_dirt = DIRTY; put_block(bp, MAP_BLOCK); return(b); @@ -131,14 +131,14 @@ bit_t bit_returned; /* number of bit to insert into the map */ bp = get_block(sp->s_dev, start_block + block, NORMAL); - k = (bitchunk_t) conv2(sp->s_native, (int) bp->b_bitmap[word]); + k = (bitchunk_t) conv4(sp->s_native, (int) bp->b_bitmap[word]); if (!(k & mask)) { if (map == IMAP) panic("tried to free unused inode"); else panic("tried to free unused block: %u", bit_returned); } k &= ~mask; - bp->b_bitmap[word] = (bitchunk_t) conv2(sp->s_native, (int) k); + bp->b_bitmap[word] = (bitchunk_t) conv4(sp->s_native, (int) k); bp->b_dirt = DIRTY; put_block(bp, MAP_BLOCK);