* 01.07.96 - Fixed the v2 fs stuff to use the right #defines and such
* for modern libcs (janl@math.uio.no, Nicolai Langfeldt)
*
- * 02.07.96 - Added C bit fiddling routines from rmk@ecs.soton.ac.uk
+ * 02.07.96 - Added C bit fiddling routines from rmk@ecs.soton.ac.uk
* (Russell King). He made them for ARM. It would seem
* that the ARM is powerful enough to do this in C whereas
* i386 and m64k must use assembly to get it fast >:-)
* (janl@math.uio.no, Nicolai Langfeldt)
*
* 04.11.96 - Added minor fixes from Andreas Schwab to avoid compiler
- * warnings. Added mc68k bitops from
+ * warnings. Added mc68k bitops from
* Joerg Dorchain <dorchain@mpi-sb.mpg.de>.
*
* 06.11.96 - Added v2 code submitted by Joerg Dorchain, but written by
* -f force filesystem check even if filesystem marked as valid
*
* The device may be a block device or a image of one, but this isn't
- * enforced (but it's not much fun on a character device :-).
+ * enforced (but it's not much fun on a character device :-).
*/
#include <stdio.h>
#include <sys/stat.h>
#include <signal.h>
-#include "minix.h"
+#include "exitcodes.h"
+#include "minix_programs.h"
#include "nls.h"
#include "pathnames.h"
#include "bitops.h"
#include "ismounted.h"
+#include "writeall.h"
#define ROOT_INO 1
+#define YESNO_LENGTH 64
-static char * program_name = "fsck.minix";
-static char * device_name = NULL;
+/*
+ * Global variables used in minix_programs.h inline fuctions
+ */
+int fs_version = 1;
+char *super_block_buffer;
+
+
+static char *inode_buffer;
+
+#define Inode (((struct minix_inode *) inode_buffer) - 1)
+#define Inode2 (((struct minix2_inode *) inode_buffer) - 1)
+
+static char *program_name = "fsck.minix";
+static char *device_name;
static int IN;
-static int repair=0, automatic=0, verbose=0, list=0, show=0, warn_mode=0,
- force=0;
-static int directory=0, regular=0, blockdev=0, chardev=0, links=0,
- symlinks=0, total=0;
-
-static int changed = 0; /* flags if the filesystem has been changed */
-static int errors_uncorrected = 0; /* flag if some error was not corrected */
-static int dirsize = 16;
-static int namelen = 14;
+static int repair, automatic, verbose, list, show, warn_mode, force;
+static int directory, regular, blockdev, chardev, links, symlinks, total;
+
+static int changed; /* flags if the filesystem has been changed */
+static int errors_uncorrected; /* flag if some error was not corrected */
+static size_t dirsize = 16;
+static size_t namelen = 14;
static struct termios termios;
-static volatile sig_atomic_t termios_set = 0;
+static volatile sig_atomic_t termios_set;
/* File-name data */
#define MAX_DEPTH 50
-static int name_depth = 0;
-static char name_list[MAX_DEPTH][NAME_MAX+1];
+static int name_depth;
+static char name_list[MAX_DEPTH][MINIX_NAME_MAX + 1];
+
/* Copy of the previous, just for error reporting - see get_current_name */
/* This is a waste of 12kB or so. */
-static char current_name[MAX_DEPTH*(NAME_MAX+1)+1];
+static char current_name[MAX_DEPTH * (MINIX_NAME_MAX + 1) + 1];
#define MAGIC (Super.s_magic)
-static unsigned char * inode_count = NULL;
-static unsigned char * zone_count = NULL;
+static unsigned char *inode_count = NULL;
+static unsigned char *zone_count = NULL;
static void recursive_check(unsigned int ino);
static void recursive_check2(unsigned int ino);
+static char *inode_map;
+static char *zone_map;
+
#define inode_in_use(x) (isset(inode_map,(x)) != 0)
#define zone_in_use(x) (isset(zone_map,(x)-get_first_zone()+1) != 0)
fprintf(stderr,
_("Usage: %s [-larvsmf] /dev/name\n"),
program_name);
- leave(16);
+ leave(FSCK_EX_USAGE);
}
static void die(const char *fmt, ...)
vfprintf(stderr, fmt, ap);
va_end (ap);
fputc('\n', stderr);
- leave(8);
+ leave(FSCK_EX_ERROR);
}
/*
static int
ask(const char * string, int def) {
- int c;
+ int resp;
+ char input[YESNO_LENGTH];
if (!repair) {
printf("\n");
errors_uncorrected = 1;
return def;
}
- printf(def?"%s (y/n)? ":"%s (n/y)? ",string);
- for (;;) {
- fflush(stdout);
- if ((c=getchar())==EOF) {
- if (!def)
- errors_uncorrected = 1;
- return def;
- }
- c=toupper(c);
- if (c == 'Y') {
- def = 1;
- break;
- } else if (c == 'N') {
- def = 0;
- break;
- } else if (c == ' ' || c == '\n')
- break;
+ /* TRANSLATORS: these yes no questions uses rpmatch(), and should be
+ * translated. */
+ printf(def ? _("%s (y/n)? ") : _("%s (n/y)? "), string);
+ fflush(stdout);
+ fgets(input, YESNO_LENGTH, stdin);
+ resp = rpmatch(input);
+ switch (resp) {
+ case -1:
+ /* def = def */
+ break;
+ case 0:
+ case 1:
+ def = resp;
+ break;
+ default:
+ /* rpmatch bug? */
+ abort();
}
if (def)
- printf("y\n");
+ printf(_("y\n"));
else {
- printf("n\n");
+ printf(_("n\n"));
errors_uncorrected = 1;
- }
+ }
return def;
}
cont = 0;
if (!cont) {
printf (_("check aborted.\n"));
- exit (0);
+ exit (FSCK_EX_OK);
}
return;
}
static void
read_block(unsigned int nr, char * addr) {
if (!nr) {
- memset(addr,0,BLOCK_SIZE);
+ memset(addr,0,MINIX_BLOCK_SIZE);
return;
}
- if (BLOCK_SIZE*nr != lseek(IN, BLOCK_SIZE*nr, SEEK_SET)) {
+ if (MINIX_BLOCK_SIZE*nr != lseek(IN, MINIX_BLOCK_SIZE*nr, SEEK_SET)) {
get_current_name();
printf(_("Read error: unable to seek to block in file '%s'\n"),
current_name);
- memset(addr,0,BLOCK_SIZE);
+ memset(addr,0,MINIX_BLOCK_SIZE);
errors_uncorrected = 1;
- } else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) {
+ } else if (MINIX_BLOCK_SIZE != read(IN, addr, MINIX_BLOCK_SIZE)) {
get_current_name();
printf(_("Read error: bad block in file '%s'\n"),
current_name);
- memset(addr,0,BLOCK_SIZE);
+ memset(addr,0,MINIX_BLOCK_SIZE);
errors_uncorrected = 1;
}
}
errors_uncorrected = 1;
return;
}
- if (BLOCK_SIZE*nr != lseek(IN, BLOCK_SIZE*nr, SEEK_SET))
+ if (MINIX_BLOCK_SIZE*nr != lseek(IN, MINIX_BLOCK_SIZE*nr, SEEK_SET))
die(_("seek failed in write_block"));
- if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) {
+ if (MINIX_BLOCK_SIZE != write(IN, addr, MINIX_BLOCK_SIZE)) {
get_current_name();
printf(_("Write error: bad block in file '%s'\n"),
current_name);
*/
static int
map_block(struct minix_inode * inode, unsigned int blknr) {
- unsigned short ind[BLOCK_SIZE>>1];
- unsigned short dind[BLOCK_SIZE>>1];
+ unsigned short ind[MINIX_BLOCK_SIZE>>1];
+ unsigned short dind[MINIX_BLOCK_SIZE>>1];
int blk_chg, block, result;
if (blknr<7)
static int
map_block2 (struct minix2_inode *inode, unsigned int blknr) {
- unsigned int ind[BLOCK_SIZE >> 2];
- unsigned int dind[BLOCK_SIZE >> 2];
- unsigned int tind[BLOCK_SIZE >> 2];
+ unsigned int ind[MINIX_BLOCK_SIZE >> 2];
+ unsigned int dind[MINIX_BLOCK_SIZE >> 2];
+ unsigned int tind[MINIX_BLOCK_SIZE >> 2];
int blk_chg, block, result;
if (blknr < 7)
return result;
}
blknr -= 256;
- if (blknr >= 256 * 256) {
+ if (blknr < 256 * 256) {
block = check_zone_nr2 (inode->i_zone + 8, &changed);
read_block (block, (char *) dind);
blk_chg = 0;
Super.s_state |= MINIX_ERROR_FS;
else
Super.s_state &= ~MINIX_ERROR_FS;
-
- if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET))
+
+ if (MINIX_BLOCK_SIZE != lseek(IN, MINIX_BLOCK_SIZE, SEEK_SET))
die(_("seek failed in write_super_block"));
- if (BLOCK_SIZE != write(IN, super_block_buffer, BLOCK_SIZE))
+ if (MINIX_BLOCK_SIZE != write(IN, super_block_buffer, MINIX_BLOCK_SIZE))
die(_("unable to write super-block"));
return;
unsigned long imaps = get_nimaps();
unsigned long zmaps = get_nzmaps();
- if (imaps*BLOCK_SIZE != write(IN,inode_map, imaps*BLOCK_SIZE))
+ if (write_all(IN, inode_map, imaps * MINIX_BLOCK_SIZE))
die(_("Unable to write inode map"));
- if (zmaps*BLOCK_SIZE != write(IN,zone_map, zmaps*BLOCK_SIZE))
+
+ if (write_all(IN, zone_map, zmaps * MINIX_BLOCK_SIZE))
die(_("Unable to write zone map"));
- if (buffsz != write(IN,inode_buffer, buffsz))
+
+ if (write_all(IN, inode_buffer, buffsz))
die(_("Unable to write inodes"));
}
static void
get_dirsize (void) {
int block;
- char blk[BLOCK_SIZE];
- int size;
+ char blk[MINIX_BLOCK_SIZE];
+ size_t size;
if (fs_version == 2)
block = Inode2[ROOT_INO].i_zone[0];
else
block = Inode[ROOT_INO].i_zone[0];
read_block (block, blk);
- for (size = 16; size < BLOCK_SIZE; size <<= 1) {
- if (strcmp (blk + size + 2, "..") == 0) {
+
+ for (size = 16; size < MINIX_BLOCK_SIZE; size <<= 1) {
+ if (strcmp(blk + size + 2, "..") == 0) {
dirsize = size;
namelen = size - 2;
return;
static void
read_superblock(void) {
- if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET))
+ if (MINIX_BLOCK_SIZE != lseek(IN, MINIX_BLOCK_SIZE, SEEK_SET))
die(_("seek failed"));
- super_block_buffer = calloc(1, BLOCK_SIZE);
+ super_block_buffer = calloc(1, MINIX_BLOCK_SIZE);
if (!super_block_buffer)
die(_("unable to alloc buffer for superblock"));
- if (BLOCK_SIZE != read(IN, super_block_buffer, BLOCK_SIZE))
+ if (MINIX_BLOCK_SIZE != read(IN, super_block_buffer, MINIX_BLOCK_SIZE))
die(_("unable to read super block"));
if (MAGIC == MINIX_SUPER_MAGIC) {
namelen = 14;
fs_version = 2;
} else
die(_("bad magic number in super-block"));
- if (get_zone_size() != 0 || BLOCK_SIZE != 1024)
+ if (get_zone_size() != 0 || MINIX_BLOCK_SIZE != 1024)
die(_("Only 1k blocks/zones supported"));
- if (get_nimaps() * BLOCK_SIZE * 8 < get_ninodes() + 1)
+ if (get_nimaps() * MINIX_BLOCK_SIZE * 8 < get_ninodes() + 1)
die(_("bad s_imap_blocks field in super-block"));
- if (get_nzmaps() * BLOCK_SIZE * 8 < get_nzones() - get_first_zone() + 1)
+ if (get_nzmaps() * MINIX_BLOCK_SIZE * 8 < get_nzones() - get_first_zone() + 1)
die(_("bad s_zmap_blocks field in super-block"));
}
unsigned long zones = get_nzones();
unsigned long imaps = get_nimaps();
unsigned long zmaps = get_nzmaps();
+ ssize_t rc;
- inode_map = malloc(imaps * BLOCK_SIZE);
+ inode_map = malloc(imaps * MINIX_BLOCK_SIZE);
if (!inode_map)
die(_("Unable to allocate buffer for inode map"));
- zone_map = malloc(zmaps * BLOCK_SIZE);
- if (!inode_map)
+ zone_map = malloc(zmaps * MINIX_BLOCK_SIZE);
+ if (!zone_map)
die(_("Unable to allocate buffer for zone map"));
- memset(inode_map,0,sizeof(inode_map));
- memset(zone_map,0,sizeof(zone_map));
inode_buffer = malloc(buffsz);
if (!inode_buffer)
die(_("Unable to allocate buffer for inodes"));
- inode_count = malloc(inodes + 1);
+ inode_count = calloc(1, inodes + 1);
if (!inode_count)
die(_("Unable to allocate buffer for inode count"));
- zone_count = malloc(zones);
+ zone_count = calloc(1, zones);
if (!zone_count)
die(_("Unable to allocate buffer for zone count"));
- if (imaps*BLOCK_SIZE != read(IN,inode_map,imaps*BLOCK_SIZE))
+
+ rc = read(IN, inode_map, imaps * MINIX_BLOCK_SIZE);
+ if (rc < 0 || imaps * MINIX_BLOCK_SIZE != (size_t) rc)
die(_("Unable to read inode map"));
- if (zmaps*BLOCK_SIZE != read(IN,zone_map, zmaps*BLOCK_SIZE))
+
+ rc = read(IN, zone_map, zmaps * MINIX_BLOCK_SIZE);
+ if (rc < 0 || zmaps * MINIX_BLOCK_SIZE != (size_t) rc)
die(_("Unable to read zone map"));
- if (buffsz != read(IN,inode_buffer, buffsz))
+
+ rc = read(IN,inode_buffer, buffsz);
+ if (rc < 0 || buffsz != (size_t) rc)
die(_("Unable to read inodes"));
if (norm_first_zone != first_zone) {
printf(_("Warning: Firstzone != Norm_firstzone\n"));
printf(_("%ld inodes\n"), inodes);
printf(_("%ld blocks\n"), zones);
printf(_("Firstdatazone=%ld (%ld)\n"), first_zone, norm_first_zone);
- printf(_("Zonesize=%d\n"),BLOCK_SIZE<<get_zone_size());
+ printf(_("Zonesize=%d\n"),MINIX_BLOCK_SIZE<<get_zone_size());
printf(_("Maxsize=%ld\n"), get_max_size());
printf(_("Filesystem state=%d\n"), Super.s_state);
- printf(_("namelen=%d\n\n"),namelen);
+ printf(_("namelen=%zd\n\n"),namelen);
}
}
static void
add_zone_ind(unsigned short * znr, int * corrected) {
- static char blk[BLOCK_SIZE];
+ static char blk[MINIX_BLOCK_SIZE];
int i, chg_blk=0;
int block;
if (!block)
return;
read_block(block, blk);
- for (i=0 ; i < (BLOCK_SIZE>>1) ; i++)
+ for (i=0 ; i < (MINIX_BLOCK_SIZE>>1) ; i++)
add_zone(i + (unsigned short *) blk, &chg_blk);
if (chg_blk)
write_block(block, blk);
static void
add_zone_ind2 (unsigned int *znr, int *corrected) {
- static char blk[BLOCK_SIZE];
+ static char blk[MINIX_BLOCK_SIZE];
int i, chg_blk = 0;
int block;
if (!block)
return;
read_block (block, blk);
- for (i = 0; i < BLOCK_SIZE >> 2; i++)
+ for (i = 0; i < MINIX_BLOCK_SIZE >> 2; i++)
add_zone2 (i + (unsigned int *) blk, &chg_blk);
if (chg_blk)
write_block (block, blk);
static void
add_zone_dind(unsigned short * znr, int * corrected) {
- static char blk[BLOCK_SIZE];
+ static char blk[MINIX_BLOCK_SIZE];
int i, blk_chg=0;
int block;
if (!block)
return;
read_block(block, blk);
- for (i=0 ; i < (BLOCK_SIZE>>1) ; i++)
+ for (i=0 ; i < (MINIX_BLOCK_SIZE>>1) ; i++)
add_zone_ind(i + (unsigned short *) blk, &blk_chg);
if (blk_chg)
write_block(block, blk);
static void
add_zone_dind2 (unsigned int *znr, int *corrected) {
- static char blk[BLOCK_SIZE];
+ static char blk[MINIX_BLOCK_SIZE];
int i, blk_chg = 0;
int block;
if (!block)
return;
read_block (block, blk);
- for (i = 0; i < BLOCK_SIZE >> 2; i++)
+ for (i = 0; i < MINIX_BLOCK_SIZE >> 2; i++)
add_zone_ind2 (i + (unsigned int *) blk, &blk_chg);
if (blk_chg)
write_block (block, blk);
static void
add_zone_tind2 (unsigned int *znr, int *corrected) {
- static char blk[BLOCK_SIZE];
+ static char blk[MINIX_BLOCK_SIZE];
int i, blk_chg = 0;
int block;
if (!block)
return;
read_block (block, blk);
- for (i = 0; i < BLOCK_SIZE >> 2; i++)
+ for (i = 0; i < MINIX_BLOCK_SIZE >> 2; i++)
add_zone_dind2 (i + (unsigned int *) blk, &blk_chg);
if (blk_chg)
write_block (block, blk);
static void
check_file(struct minix_inode * dir, unsigned int offset) {
- static char blk[BLOCK_SIZE];
+ static char blk[MINIX_BLOCK_SIZE];
struct minix_inode * inode;
- int ino;
+ unsigned int ino;
char * name;
int block;
- block = map_block(dir,offset/BLOCK_SIZE);
+ block = map_block(dir,offset/MINIX_BLOCK_SIZE);
read_block(block, blk);
- name = blk + (offset % BLOCK_SIZE) + 2;
+ name = blk + (offset % MINIX_BLOCK_SIZE) + 2;
ino = * (unsigned short *) (name-2);
if (ino > get_ninodes()) {
get_current_name();
printf(_("The directory '%s' contains a bad inode number "
"for file '%.*s'."),
- current_name, namelen, name);
+ current_name, (int) namelen, name);
if (ask(_(" Remove"),1)) {
*(unsigned short *)(name-2) = 0;
write_block(block, blk);
static void
check_file2 (struct minix2_inode *dir, unsigned int offset) {
- static char blk[BLOCK_SIZE];
+ static char blk[MINIX_BLOCK_SIZE];
struct minix2_inode *inode;
- int ino;
+ unsigned long ino;
char *name;
int block;
- block = map_block2 (dir, offset / BLOCK_SIZE);
+ block = map_block2 (dir, offset / MINIX_BLOCK_SIZE);
read_block (block, blk);
- name = blk + (offset % BLOCK_SIZE) + 2;
+ name = blk + (offset % MINIX_BLOCK_SIZE) + 2;
ino = *(unsigned short *) (name - 2);
if (ino > get_ninodes()) {
get_current_name();
printf(_("The directory '%s' contains a bad inode number "
"for file '%.*s'."),
- current_name, namelen, name);
+ current_name, (int) namelen, name);
if (ask (_(" Remove"), 1)) {
*(unsigned short *) (name - 2) = 0;
write_block (block, blk);
name_depth++;
if (list) {
if (verbose)
- printf ("%6d %07o %3d ", ino, inode->i_mode,
+ printf ("%6zd %07o %3d ", ino, inode->i_mode,
inode->i_nlinks);
get_current_name ();
printf("%s", current_name);
bad_zone(int i) {
char buffer[1024];
- if (BLOCK_SIZE*i != lseek(IN, BLOCK_SIZE*i, SEEK_SET))
+ if (MINIX_BLOCK_SIZE*i != lseek(IN, MINIX_BLOCK_SIZE*i, SEEK_SET))
die(_("seek failed in bad_zone"));
- return (BLOCK_SIZE != read(IN, buffer, BLOCK_SIZE));
+ return (MINIX_BLOCK_SIZE != read(IN, buffer, MINIX_BLOCK_SIZE));
}
static void
check_counts(void) {
- int i;
+ unsigned long i;
for (i=1 ; i <= get_ninodes(); i++) {
if (!inode_in_use(i) && Inode[i].i_mode && warn_mode) {
- printf(_("Inode %d mode not cleared."),i);
+ printf(_("Inode %lu mode not cleared."), i);
if (ask(_("Clear"),1)) {
Inode[i].i_mode = 0;
changed = 1;
if (!inode_count[i]) {
if (!inode_in_use(i))
continue;
- printf(_("Inode %d not used, marked used in the bitmap."),i);
+ printf(_("Inode %lu not used, marked used in the bitmap."),
+ i);
if (ask(_("Clear"),1))
unmark_inode(i);
continue;
}
if (!inode_in_use(i)) {
- printf(_("Inode %d used, marked unused in the bitmap."),
+ printf(_("Inode %lu used, marked unused in the bitmap."),
i);
if (ask(_("Set"),1))
mark_inode(i);
}
if (Inode[i].i_nlinks != inode_count[i]) {
- printf(_("Inode %d (mode = %07o), i_nlinks=%d, counted=%d."),
+ printf(_("Inode %lu (mode = %07o), i_nlinks=%d, counted=%d."),
i,Inode[i].i_mode,Inode[i].i_nlinks,inode_count[i]);
if (ask(_("Set i_nlinks to count"),1)) {
Inode[i].i_nlinks=inode_count[i];
if (!zone_count[i]) {
if (bad_zone(i))
continue;
- printf(_("Zone %d: marked in use, no file uses it."),i);
+ printf(_("Zone %lu: marked in use, no file uses it."),i);
if (ask(_("Unmark"),1))
unmark_zone(i);
continue;
}
if (zone_in_use(i))
- printf(_("Zone %d: in use, counted=%d\n"),
+ printf(_("Zone %lu: in use, counted=%d\n"),
i, zone_count[i]);
else
- printf(_("Zone %d: not in use, counted=%d\n"),
+ printf(_("Zone %lu: not in use, counted=%d\n"),
i, zone_count[i]);
}
}
static void
check_counts2 (void) {
- int i;
+ unsigned long i;
for (i = 1; i <= get_ninodes(); i++) {
if (!inode_in_use (i) && Inode2[i].i_mode && warn_mode) {
- printf (_("Inode %d mode not cleared."), i);
+ printf (_("Inode %lu mode not cleared."), i);
if (ask (_("Clear"), 1)) {
Inode2[i].i_mode = 0;
changed = 1;
if (!inode_count[i]) {
if (!inode_in_use (i))
continue;
- printf (_("Inode %d not used, marked used in the bitmap."), i);
+ printf (_("Inode %lu not used, marked used in the bitmap."), i);
if (ask (_("Clear"), 1))
unmark_inode (i);
continue;
}
if (!inode_in_use (i)) {
- printf (_("Inode %d used, marked unused in the bitmap."), i);
+ printf (_("Inode %lu used, marked unused in the bitmap."), i);
if (ask (_("Set"), 1))
mark_inode (i);
}
if (Inode2[i].i_nlinks != inode_count[i]) {
- printf (_("Inode %d (mode = %07o), i_nlinks=%d, counted=%d."),
+ printf (_("Inode %lu (mode = %07o), i_nlinks=%d, counted=%d."),
i, Inode2[i].i_mode, Inode2[i].i_nlinks, inode_count[i]);
if (ask (_("Set i_nlinks to count"), 1)) {
Inode2[i].i_nlinks = inode_count[i];
if (!zone_count[i]) {
if (bad_zone (i))
continue;
- printf (_("Zone %d: marked in use, no file uses it."),
+ printf (_("Zone %lu: marked in use, no file uses it."),
i);
if (ask (_("Unmark"), 1))
unmark_zone (i);
continue;
}
if (zone_in_use (i))
- printf (_("Zone %d: in use, counted=%d\n"),
+ printf (_("Zone %lu: in use, counted=%d\n"),
i, zone_count[i]);
else
- printf (_("Zone %d: not in use, counted=%d\n"),
+ printf (_("Zone %lu: not in use, counted=%d\n"),
i, zone_count[i]);
}
}
if (argc == 2 &&
(!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) {
printf(_("%s (%s)\n"), program_name, PACKAGE_STRING);
- exit(0);
+ exit(FSCK_EX_OK);
}
- if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
+ if (INODE_SIZE * MINIX_INODES_PER_BLOCK != MINIX_BLOCK_SIZE)
die(_("bad inode size"));
- if (INODE2_SIZE * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
+ if (INODE2_SIZE * MINIX2_INODES_PER_BLOCK != MINIX_BLOCK_SIZE)
die(_("bad v2 inode size"));
while (argc-- > 1) {
}
IN = open(device_name,repair?O_RDWR:O_RDONLY);
if (IN < 0)
- die(_("unable to open '%s': %s"), device_name, strerror(errno));
+ die(_("unable to open '%s': %m"), device_name);
for (count=0 ; count<3 ; count++)
sync();
read_superblock();
check();
}
if (verbose) {
- int i, free;
+ unsigned long i, free;
for (i=1,free=0 ; i <= get_ninodes() ; i++)
if (!inode_in_use(i))