summaryrefslogtreecommitdiff
path: root/util-linux/mkfs_minix.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-02-06 00:36:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-02-06 00:36:53 +0000
commitdc485c9da66192a705e4d4a1ea0f8301d72906d6 (patch)
tree54b5747a29a75676ec4ef5bccc37f7df4c6b7aae /util-linux/mkfs_minix.c
parentf885c543da79845113d23e9eb78798988cc0a6b6 (diff)
downloadbusybox-w32-dc485c9da66192a705e4d4a1ea0f8301d72906d6.tar.gz
busybox-w32-dc485c9da66192a705e4d4a1ea0f8301d72906d6.tar.bz2
busybox-w32-dc485c9da66192a705e4d4a1ea0f8301d72906d6.zip
minix utils: make a message easier to understand; small tweaks
Diffstat (limited to 'util-linux/mkfs_minix.c')
-rw-r--r--util-linux/mkfs_minix.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 7257ddb87..e214d288a 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -147,9 +147,11 @@ static int bit(const char* a, unsigned i)
147 return a[i >> 3] & (1<<(i & 7)); 147 return a[i >> 3] & (1<<(i & 7));
148} 148}
149 149
150/* setbit/clrbit are supplied by sys/param.h */
151
150/* Note: do not assume 0/1, it is 0/nonzero */ 152/* Note: do not assume 0/1, it is 0/nonzero */
151#define inode_in_use(x) bit(inode_map,(x))
152#define zone_in_use(x) bit(zone_map,(x)-SB_FIRSTZONE+1) 153#define zone_in_use(x) bit(zone_map,(x)-SB_FIRSTZONE+1)
154/*#define inode_in_use(x) bit(inode_map,(x))*/
153 155
154#define mark_inode(x) setbit(inode_map,(x)) 156#define mark_inode(x) setbit(inode_map,(x))
155#define unmark_inode(x) clrbit(inode_map,(x)) 157#define unmark_inode(x) clrbit(inode_map,(x))
@@ -507,11 +509,11 @@ static void setup_tables(void)
507 509
508/* 510/*
509 * Perform a test of a block; return the number of 511 * Perform a test of a block; return the number of
510 * blocks readable/writable. 512 * blocks readable.
511 */ 513 */
512static long do_check(char *buffer, int try, unsigned current_block) 514static size_t do_check(char *buffer, size_t try, unsigned current_block)
513{ 515{
514 long got; 516 ssize_t got;
515 517
516 /* Seek to the correct loc. */ 518 /* Seek to the correct loc. */
517 msg_eol = "seek failed during testing of blocks"; 519 msg_eol = "seek failed during testing of blocks";
@@ -522,11 +524,11 @@ static long do_check(char *buffer, int try, unsigned current_block)
522 got = read(dev_fd, buffer, try * BLOCK_SIZE); 524 got = read(dev_fd, buffer, try * BLOCK_SIZE);
523 if (got < 0) 525 if (got < 0)
524 got = 0; 526 got = 0;
525 if (got & (BLOCK_SIZE - 1)) { 527 try = ((size_t)got) / BLOCK_SIZE;
526 printf("Weird values in do_check: probably bugs\n"); 528
527 } 529 if (got & (BLOCK_SIZE - 1))
528 got /= BLOCK_SIZE; 530 fprintf(stderr, "Short read at block %u\n", current_block + try);
529 return got; 531 return try;
530} 532}
531 533
532static unsigned currently_testing; 534static unsigned currently_testing;
@@ -545,7 +547,7 @@ static void alarm_intr(int alnum)
545 547
546static void check_blocks(void) 548static void check_blocks(void)
547{ 549{
548 int try, got; 550 size_t try, got;
549 /* buffer[] was the biggest static in entire bbox */ 551 /* buffer[] was the biggest static in entire bbox */
550 char *buffer = xmalloc(BLOCK_SIZE * TEST_BUFFER_BLOCKS); 552 char *buffer = xmalloc(BLOCK_SIZE * TEST_BUFFER_BLOCKS);
551 553
@@ -620,8 +622,7 @@ int mkfs_minix_main(int argc, char **argv)
620#if ENABLE_FEATURE_MINIX2 622#if ENABLE_FEATURE_MINIX2
621 version2 = 1; 623 version2 = 1;
622#else 624#else
623 bb_error_msg_and_die("%s: not compiled with minix v2 support", 625 bb_error_msg_and_die("not compiled with minix v2 support");
624 device_name);
625#endif 626#endif
626 } 627 }
627 628