From eb63b9b8f4cecb34c2478282567862bc48ef256d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:41 +0100 Subject: Imported from util-linux-2.10f tarball. --- disk-utils/mkfs.minix.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'disk-utils/mkfs.minix.c') diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index b05960b23..4887f05d1 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -76,7 +76,6 @@ #include #include "nls.h" -#include "../version.h" #ifdef MINIX2_SUPER_MAGIC2 #define HAVE_MINIX2 1 @@ -489,6 +488,7 @@ void setup_tables(void) ZONESIZE = 0; MAXSIZE = version2 ? 0x7fffffff : (7+512+512*512)*1024; ZONES = BLOCKS; + /* some magic nrs: 1 inode / 3 blocks */ if ( req_nr_inodes == 0 ) inodes = BLOCKS/3; @@ -507,9 +507,13 @@ void setup_tables(void) inodes = 65535; INODES = inodes; IMAPS = UPPER(INODES + 1,BITS_PER_BLOCK); - ZMAPS = 0; - while (ZMAPS != UPPER(BLOCKS - NORM_FIRSTZONE + 1,BITS_PER_BLOCK)) - ZMAPS = UPPER(BLOCKS - NORM_FIRSTZONE + 1,BITS_PER_BLOCK); + ZMAPS = UPPER(BLOCKS - (1+IMAPS+INODE_BLOCKS), BITS_PER_BLOCK+1); + /* The old code here + * ZMAPS = 0; + * while (ZMAPS != UPPER(BLOCKS - NORM_FIRSTZONE + 1,BITS_PER_BLOCK)) + * ZMAPS = UPPER(BLOCKS - NORM_FIRSTZONE + 1,BITS_PER_BLOCK); + * was no good, since it may loop. - aeb + */ FIRSTZONE = NORM_FIRSTZONE; inode_map = malloc(IMAPS * BLOCK_SIZE); zone_map = malloc(ZMAPS * BLOCK_SIZE); @@ -630,9 +634,23 @@ int main(int argc, char ** argv) char * tmp; struct stat statbuf; char * listfile = NULL; + char * p; if (argc && *argv) program_name = *argv; + if ((p = strrchr(program_name, '/')) != NULL) + program_name = p+1; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + if (argc == 2 && + (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) { + printf(_("%s from %s\n"), program_name, util_linux_version); + exit(0); + } + if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) die(_("bad inode size")); #ifdef HAVE_MINIX2 -- cgit v1.2.3-55-g7522