diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-30 01:47:42 +0300 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-30 01:47:42 +0300 |
commit | 016a82e279f135e9c385f0d2a73eafcc63bed5c3 (patch) | |
tree | 6ef32fc33750e6aa4fe008356903410fb70e2684 /util-linux/mkfs_minix.c | |
parent | 66b86c690245714d9c59bf4487d081115f2d820b (diff) |
another -90 bytes. That #define is **evil**
Diffstat (limited to 'util-linux/mkfs_minix.c')
-rw-r--r-- | util-linux/mkfs_minix.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 687cf675f..981c2f913 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -503,8 +503,10 @@ static void make_root_inode2(void) static void setup_tables(void) { - int i; unsigned long inodes; + unsigned norm_firstzone; + uint16_t sb_zmaps; + int i; memset(super_block_buffer, 0, BLOCK_SIZE); memset(boot_block_buffer, 0, 512); @@ -539,19 +541,21 @@ static void setup_tables(void) * dd if=/dev/zero of=test.fs count=10 bs=1024 * mkfs.minix -i 200 test.fs */ - /* This code is not insane: NORM_FIRSTZONE is not a constant, */ - /* it uses previous value of SB_ZMAPS inside */ + /* This code is not insane: NORM_FIRSTZONE is not a constant, + * it is calculated from SB_INODES, SB_IMAPS and SB_ZMAPS */ i = 999; SB_ZMAPS = 0; do { - uint16_t t = div_roundup(total_blocks - NORM_FIRSTZONE + 1, BITS_PER_BLOCK); - if (SB_ZMAPS == t) goto got_it; - SB_ZMAPS = t; + norm_firstzone = NORM_FIRSTZONE; + sb_zmaps = div_roundup(total_blocks - norm_firstzone + 1, BITS_PER_BLOCK); + if (SB_ZMAPS == sb_zmaps) goto got_it; + SB_ZMAPS = sb_zmaps; + /* new SB_ZMAPS, need to recalc NORM_FIRSTZONE */ } while (--i); bb_error_msg_and_die("incompatible size/inode count, try different -i N"); got_it: - SB_FIRSTZONE = NORM_FIRSTZONE; + SB_FIRSTZONE = norm_firstzone; inode_map = xmalloc(SB_IMAPS * BLOCK_SIZE); zone_map = xmalloc(SB_ZMAPS * BLOCK_SIZE); memset(inode_map, 0xff, SB_IMAPS * BLOCK_SIZE); @@ -563,7 +567,7 @@ static void setup_tables(void) inode_buffer = xzalloc(INODE_BUFFER_SIZE); printf("%ld inodes\n", (long)SB_INODES); printf("%ld blocks\n", (long)SB_ZONES); - printf("Firstdatazone=%ld (%ld)\n", (long)SB_FIRSTZONE, (long)NORM_FIRSTZONE); + printf("Firstdatazone=%ld (%ld)\n", (long)SB_FIRSTZONE, (long)norm_firstzone); printf("Zonesize=%d\n", BLOCK_SIZE << SB_ZONE_SIZE); printf("Maxsize=%ld\n", (long)SB_MAXSIZE); } |