summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkfs.minix.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:41 +0100
committerKarel Zak2006-12-07 00:25:41 +0100
commiteb63b9b8f4cecb34c2478282567862bc48ef256d (patch)
tree99243f8eecb44c2bb6a559982b99c680fcb649e7 /disk-utils/mkfs.minix.c
parentImported from util-linux-2.9v tarball. (diff)
downloadkernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.tar.gz
kernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.tar.xz
kernel-qcow2-util-linux-eb63b9b8f4cecb34c2478282567862bc48ef256d.zip
Imported from util-linux-2.10f tarball.
Diffstat (limited to 'disk-utils/mkfs.minix.c')
-rw-r--r--disk-utils/mkfs.minix.c26
1 files changed, 22 insertions, 4 deletions
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 <linux/minix_fs.h>
#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