diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-29 22:47:42 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-29 22:47:42 +0000 |
commit | 016a82e279f135e9c385f0d2a73eafcc63bed5c3 (patch) | |
tree | 6ef32fc33750e6aa4fe008356903410fb70e2684 /util-linux/mkfs_minix.c | |
parent | 66b86c690245714d9c59bf4487d081115f2d820b (diff) | |
download | busybox-w32-016a82e279f135e9c385f0d2a73eafcc63bed5c3.tar.gz busybox-w32-016a82e279f135e9c385f0d2a73eafcc63bed5c3.tar.bz2 busybox-w32-016a82e279f135e9c385f0d2a73eafcc63bed5c3.zip |
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) | |||
503 | 503 | ||
504 | static void setup_tables(void) | 504 | static void setup_tables(void) |
505 | { | 505 | { |
506 | int i; | ||
507 | unsigned long inodes; | 506 | unsigned long inodes; |
507 | unsigned norm_firstzone; | ||
508 | uint16_t sb_zmaps; | ||
509 | int i; | ||
508 | 510 | ||
509 | memset(super_block_buffer, 0, BLOCK_SIZE); | 511 | memset(super_block_buffer, 0, BLOCK_SIZE); |
510 | memset(boot_block_buffer, 0, 512); | 512 | memset(boot_block_buffer, 0, 512); |
@@ -539,19 +541,21 @@ static void setup_tables(void) | |||
539 | * dd if=/dev/zero of=test.fs count=10 bs=1024 | 541 | * dd if=/dev/zero of=test.fs count=10 bs=1024 |
540 | * mkfs.minix -i 200 test.fs | 542 | * mkfs.minix -i 200 test.fs |
541 | */ | 543 | */ |
542 | /* This code is not insane: NORM_FIRSTZONE is not a constant, */ | 544 | /* This code is not insane: NORM_FIRSTZONE is not a constant, |
543 | /* it uses previous value of SB_ZMAPS inside */ | 545 | * it is calculated from SB_INODES, SB_IMAPS and SB_ZMAPS */ |
544 | i = 999; | 546 | i = 999; |
545 | SB_ZMAPS = 0; | 547 | SB_ZMAPS = 0; |
546 | do { | 548 | do { |
547 | uint16_t t = div_roundup(total_blocks - NORM_FIRSTZONE + 1, BITS_PER_BLOCK); | 549 | norm_firstzone = NORM_FIRSTZONE; |
548 | if (SB_ZMAPS == t) goto got_it; | 550 | sb_zmaps = div_roundup(total_blocks - norm_firstzone + 1, BITS_PER_BLOCK); |
549 | SB_ZMAPS = t; | 551 | if (SB_ZMAPS == sb_zmaps) goto got_it; |
552 | SB_ZMAPS = sb_zmaps; | ||
553 | /* new SB_ZMAPS, need to recalc NORM_FIRSTZONE */ | ||
550 | } while (--i); | 554 | } while (--i); |
551 | bb_error_msg_and_die("incompatible size/inode count, try different -i N"); | 555 | bb_error_msg_and_die("incompatible size/inode count, try different -i N"); |
552 | got_it: | 556 | got_it: |
553 | 557 | ||
554 | SB_FIRSTZONE = NORM_FIRSTZONE; | 558 | SB_FIRSTZONE = norm_firstzone; |
555 | inode_map = xmalloc(SB_IMAPS * BLOCK_SIZE); | 559 | inode_map = xmalloc(SB_IMAPS * BLOCK_SIZE); |
556 | zone_map = xmalloc(SB_ZMAPS * BLOCK_SIZE); | 560 | zone_map = xmalloc(SB_ZMAPS * BLOCK_SIZE); |
557 | memset(inode_map, 0xff, SB_IMAPS * BLOCK_SIZE); | 561 | memset(inode_map, 0xff, SB_IMAPS * BLOCK_SIZE); |
@@ -563,7 +567,7 @@ static void setup_tables(void) | |||
563 | inode_buffer = xzalloc(INODE_BUFFER_SIZE); | 567 | inode_buffer = xzalloc(INODE_BUFFER_SIZE); |
564 | printf("%ld inodes\n", (long)SB_INODES); | 568 | printf("%ld inodes\n", (long)SB_INODES); |
565 | printf("%ld blocks\n", (long)SB_ZONES); | 569 | printf("%ld blocks\n", (long)SB_ZONES); |
566 | printf("Firstdatazone=%ld (%ld)\n", (long)SB_FIRSTZONE, (long)NORM_FIRSTZONE); | 570 | printf("Firstdatazone=%ld (%ld)\n", (long)SB_FIRSTZONE, (long)norm_firstzone); |
567 | printf("Zonesize=%d\n", BLOCK_SIZE << SB_ZONE_SIZE); | 571 | printf("Zonesize=%d\n", BLOCK_SIZE << SB_ZONE_SIZE); |
568 | printf("Maxsize=%ld\n", (long)SB_MAXSIZE); | 572 | printf("Maxsize=%ld\n", (long)SB_MAXSIZE); |
569 | } | 573 | } |