change bitchunk_t from 16-bit to 32-bit
This commit is contained in:
parent
d23c3d110e
commit
5d8d5e0c3a
8 changed files with 15 additions and 19 deletions
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue