aboutsummaryrefslogtreecommitdiff
path: root/fsck_minix.c
diff options
context:
space:
mode:
Diffstat (limited to 'fsck_minix.c')
-rw-r--r--fsck_minix.c302
1 files changed, 146 insertions, 156 deletions
diff --git a/fsck_minix.c b/fsck_minix.c
index e4b14d705..125274734 100644
--- a/fsck_minix.c
+++ b/fsck_minix.c
@@ -85,6 +85,7 @@
85 * enforced (but it's not much fun on a character device :-). 85 * enforced (but it's not much fun on a character device :-).
86 */ 86 */
87 87
88#include "internal.h"
88#include <stdio.h> 89#include <stdio.h>
89#include <errno.h> 90#include <errno.h>
90#include <unistd.h> 91#include <unistd.h>
@@ -98,8 +99,6 @@
98 99
99#include <linux/fs.h> 100#include <linux/fs.h>
100#include <linux/minix_fs.h> 101#include <linux/minix_fs.h>
101#include "../version.h"
102#include "nls.h"
103 102
104#ifdef MINIX2_SUPER_MAGIC2 103#ifdef MINIX2_SUPER_MAGIC2
105#define HAVE_MINIX2 1 104#define HAVE_MINIX2 1
@@ -171,10 +170,8 @@ static char *zone_map;
171static unsigned char * inode_count = NULL; 170static unsigned char * inode_count = NULL;
172static unsigned char * zone_count = NULL; 171static unsigned char * zone_count = NULL;
173 172
174void recursive_check(unsigned int ino); 173static void recursive_check(unsigned int ino);
175void recursive_check2(unsigned int ino); 174static void recursive_check2(unsigned int ino);
176
177#include "bitops.h"
178 175
179#define inode_in_use(x) (bit(inode_map,(x))) 176#define inode_in_use(x) (bit(inode_map,(x)))
180#define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) 177#define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1))
@@ -185,22 +182,22 @@ void recursive_check2(unsigned int ino);
185#define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1),changed=1) 182#define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1),changed=1)
186#define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1),changed=1) 183#define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1),changed=1)
187 184
188void leave(int) __attribute__ ((noreturn)); 185static void leave(int) __attribute__ ((noreturn));
189void leave(int status) 186static void leave(int status)
190{ 187{
191 if (termios_set) 188 if (termios_set)
192 tcsetattr(0, TCSANOW, &termios); 189 tcsetattr(0, TCSANOW, &termios);
193 exit(status); 190 exit(status);
194} 191}
195 192
196void usage(void) { 193static void show_usage(void) {
197 fprintf(stderr, 194 fprintf(stderr,
198 _("Usage: %s [-larvsmf] /dev/name\n"), 195 "Usage: %s [-larvsmf] /dev/name\n",
199 program_name); 196 program_name);
200 leave(16); 197 leave(16);
201} 198}
202 199
203void die(const char *str) { 200static void die(const char *str) {
204 fprintf(stderr, "%s: %s\n", program_name, str); 201 fprintf(stderr, "%s: %s\n", program_name, str);
205 leave(8); 202 leave(8);
206} 203}
@@ -209,7 +206,7 @@ void die(const char *str) {
209 * This simply goes through the file-name data and prints out the 206 * This simply goes through the file-name data and prints out the
210 * current file. 207 * current file.
211 */ 208 */
212void print_current_name(void) 209static void print_current_name(void)
213{ 210{
214 int i=0; 211 int i=0;
215 212
@@ -219,7 +216,7 @@ void print_current_name(void)
219 printf ("/"); 216 printf ("/");
220} 217}
221 218
222int ask(const char * string, int def) 219static int ask(const char * string, int def)
223{ 220{
224 int c; 221 int c;
225 222
@@ -293,13 +290,13 @@ static void check_mount(void)
293 else 290 else
294 close(fd); 291 close(fd);
295 292
296 printf (_("%s is mounted. "), device_name); 293 printf ("%s is mounted. ", device_name);
297 if (isatty(0) && isatty(1)) 294 if (isatty(0) && isatty(1))
298 cont = ask(_("Do you really want to continue"), 0); 295 cont = ask("Do you really want to continue", 0);
299 else 296 else
300 cont = 0; 297 cont = 0;
301 if (!cont) { 298 if (!cont) {
302 printf (_("check aborted.\n")); 299 printf ("check aborted.\n");
303 exit (0); 300 exit (0);
304 } 301 }
305 return; 302 return;
@@ -311,19 +308,19 @@ static void check_mount(void)
311 * if an error was corrected, and returns the zone (0 for no zone 308 * if an error was corrected, and returns the zone (0 for no zone
312 * or a bad zone-number). 309 * or a bad zone-number).
313 */ 310 */
314int check_zone_nr(unsigned short * nr, int * corrected) 311static int check_zone_nr(unsigned short * nr, int * corrected)
315{ 312{
316 if (!*nr) 313 if (!*nr)
317 return 0; 314 return 0;
318 if (*nr < FIRSTZONE) 315 if (*nr < FIRSTZONE)
319 printf(_("Zone nr < FIRSTZONE in file `")); 316 printf("Zone nr < FIRSTZONE in file `");
320 else if (*nr >= ZONES) 317 else if (*nr >= ZONES)
321 printf(_("Zone nr >= ZONES in file `")); 318 printf("Zone nr >= ZONES in file `");
322 else 319 else
323 return *nr; 320 return *nr;
324 print_current_name(); 321 print_current_name();
325 printf("'."); 322 printf("'.");
326 if (ask(_("Remove block"),1)) { 323 if (ask("Remove block",1)) {
327 *nr = 0; 324 *nr = 0;
328 *corrected = 1; 325 *corrected = 1;
329 } 326 }
@@ -331,19 +328,19 @@ int check_zone_nr(unsigned short * nr, int * corrected)
331} 328}
332 329
333#ifdef HAVE_MINIX2 330#ifdef HAVE_MINIX2
334int check_zone_nr2 (unsigned int *nr, int *corrected) 331static int check_zone_nr2 (unsigned int *nr, int *corrected)
335{ 332{
336 if (!*nr) 333 if (!*nr)
337 return 0; 334 return 0;
338 if (*nr < FIRSTZONE) 335 if (*nr < FIRSTZONE)
339 printf (_("Zone nr < FIRSTZONE in file `")); 336 printf ("Zone nr < FIRSTZONE in file `");
340 else if (*nr >= ZONES) 337 else if (*nr >= ZONES)
341 printf (_("Zone nr >= ZONES in file `")); 338 printf ("Zone nr >= ZONES in file `");
342 else 339 else
343 return *nr; 340 return *nr;
344 print_current_name (); 341 print_current_name ();
345 printf ("'."); 342 printf ("'.");
346 if (ask (_("Remove block"), 1)) { 343 if (ask ("Remove block", 1)) {
347 *nr = 0; 344 *nr = 0;
348 *corrected = 1; 345 *corrected = 1;
349 } 346 }
@@ -354,20 +351,20 @@ int check_zone_nr2 (unsigned int *nr, int *corrected)
354/* 351/*
355 * read-block reads block nr into the buffer at addr. 352 * read-block reads block nr into the buffer at addr.
356 */ 353 */
357void read_block(unsigned int nr, char * addr) 354static void read_block(unsigned int nr, char * addr)
358{ 355{
359 if (!nr) { 356 if (!nr) {
360 memset(addr,0,BLOCK_SIZE); 357 memset(addr,0,BLOCK_SIZE);
361 return; 358 return;
362 } 359 }
363 if (BLOCK_SIZE*nr != lseek(IN, BLOCK_SIZE*nr, SEEK_SET)) { 360 if (BLOCK_SIZE*nr != lseek(IN, BLOCK_SIZE*nr, SEEK_SET)) {
364 printf(_("Read error: unable to seek to block in file '")); 361 printf("Read error: unable to seek to block in file '");
365 print_current_name(); 362 print_current_name();
366 printf("'\n"); 363 printf("'\n");
367 memset(addr,0,BLOCK_SIZE); 364 memset(addr,0,BLOCK_SIZE);
368 errors_uncorrected = 1; 365 errors_uncorrected = 1;
369 } else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) { 366 } else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) {
370 printf(_("Read error: bad block in file '")); 367 printf("Read error: bad block in file '");
371 print_current_name(); 368 print_current_name();
372 printf("'\n"); 369 printf("'\n");
373 memset(addr,0,BLOCK_SIZE); 370 memset(addr,0,BLOCK_SIZE);
@@ -378,20 +375,20 @@ void read_block(unsigned int nr, char * addr)
378/* 375/*
379 * write_block writes block nr to disk. 376 * write_block writes block nr to disk.
380 */ 377 */
381void write_block(unsigned int nr, char * addr) 378static void write_block(unsigned int nr, char * addr)
382{ 379{
383 if (!nr) 380 if (!nr)
384 return; 381 return;
385 if (nr < FIRSTZONE || nr >= ZONES) { 382 if (nr < FIRSTZONE || nr >= ZONES) {
386 printf(_("Internal error: trying to write bad block\n" 383 printf("Internal error: trying to write bad block\n"
387 "Write request ignored\n")); 384 "Write request ignored\n");
388 errors_uncorrected = 1; 385 errors_uncorrected = 1;
389 return; 386 return;
390 } 387 }
391 if (BLOCK_SIZE*nr != lseek(IN, BLOCK_SIZE*nr, SEEK_SET)) 388 if (BLOCK_SIZE*nr != lseek(IN, BLOCK_SIZE*nr, SEEK_SET))
392 die(_("seek failed in write_block")); 389 die("seek failed in write_block");
393 if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) { 390 if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) {
394 printf(_("Write error: bad block in file '")); 391 printf("Write error: bad block in file '");
395 print_current_name(); 392 print_current_name();
396 printf("'\n"); 393 printf("'\n");
397 errors_uncorrected = 1; 394 errors_uncorrected = 1;
@@ -403,7 +400,7 @@ void write_block(unsigned int nr, char * addr)
403 * It sets 'changed' if the inode has needed changing, and re-writes 400 * It sets 'changed' if the inode has needed changing, and re-writes
404 * any indirect blocks with errors. 401 * any indirect blocks with errors.
405 */ 402 */
406int map_block(struct minix_inode * inode, unsigned int blknr) 403static int map_block(struct minix_inode * inode, unsigned int blknr)
407{ 404{
408 unsigned short ind[BLOCK_SIZE>>1]; 405 unsigned short ind[BLOCK_SIZE>>1];
409 unsigned short dind[BLOCK_SIZE>>1]; 406 unsigned short dind[BLOCK_SIZE>>1];
@@ -438,7 +435,7 @@ int map_block(struct minix_inode * inode, unsigned int blknr)
438} 435}
439 436
440#ifdef HAVE_MINIX2 437#ifdef HAVE_MINIX2
441int map_block2 (struct minix2_inode *inode, unsigned int blknr) 438static int map_block2 (struct minix2_inode *inode, unsigned int blknr)
442{ 439{
443 unsigned int ind[BLOCK_SIZE >> 2]; 440 unsigned int ind[BLOCK_SIZE >> 2];
444 unsigned int dind[BLOCK_SIZE >> 2]; 441 unsigned int dind[BLOCK_SIZE >> 2];
@@ -496,7 +493,7 @@ int map_block2 (struct minix2_inode *inode, unsigned int blknr)
496} 493}
497#endif 494#endif
498 495
499void write_super_block(void) 496static void write_super_block(void)
500{ 497{
501 /* 498 /*
502 * Set the state of the filesystem based on whether or not there 499 * Set the state of the filesystem based on whether or not there
@@ -510,26 +507,26 @@ void write_super_block(void)
510 Super.s_state &= ~MINIX_ERROR_FS; 507 Super.s_state &= ~MINIX_ERROR_FS;
511 508
512 if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET)) 509 if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET))
513 die(_("seek failed in write_super_block")); 510 die("seek failed in write_super_block");
514 if (BLOCK_SIZE != write(IN, super_block_buffer, BLOCK_SIZE)) 511 if (BLOCK_SIZE != write(IN, super_block_buffer, BLOCK_SIZE))
515 die(_("unable to write super-block")); 512 die("unable to write super-block");
516 513
517 return; 514 return;
518} 515}
519 516
520void write_tables(void) 517static void write_tables(void)
521{ 518{
522 write_super_block(); 519 write_super_block();
523 520
524 if (IMAPS*BLOCK_SIZE != write(IN,inode_map,IMAPS*BLOCK_SIZE)) 521 if (IMAPS*BLOCK_SIZE != write(IN,inode_map,IMAPS*BLOCK_SIZE))
525 die(_("Unable to write inode map")); 522 die("Unable to write inode map");
526 if (ZMAPS*BLOCK_SIZE != write(IN,zone_map,ZMAPS*BLOCK_SIZE)) 523 if (ZMAPS*BLOCK_SIZE != write(IN,zone_map,ZMAPS*BLOCK_SIZE))
527 die(_("Unable to write zone map")); 524 die("Unable to write zone map");
528 if (INODE_BUFFER_SIZE != write(IN,inode_buffer,INODE_BUFFER_SIZE)) 525 if (INODE_BUFFER_SIZE != write(IN,inode_buffer,INODE_BUFFER_SIZE))
529 die(_("Unable to write inodes")); 526 die("Unable to write inodes");
530} 527}
531 528
532void get_dirsize (void) 529static void get_dirsize (void)
533{ 530{
534 int block; 531 int block;
535 char blk[BLOCK_SIZE]; 532 char blk[BLOCK_SIZE];
@@ -552,12 +549,12 @@ void get_dirsize (void)
552 /* use defaults */ 549 /* use defaults */
553} 550}
554 551
555void read_superblock(void) 552static void read_superblock(void)
556{ 553{
557 if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET)) 554 if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET))
558 die(_("seek failed")); 555 die("seek failed");
559 if (BLOCK_SIZE != read(IN, super_block_buffer, BLOCK_SIZE)) 556 if (BLOCK_SIZE != read(IN, super_block_buffer, BLOCK_SIZE))
560 die(_("unable to read super block")); 557 die("unable to read super block");
561 if (MAGIC == MINIX_SUPER_MAGIC) { 558 if (MAGIC == MINIX_SUPER_MAGIC) {
562 namelen = 14; 559 namelen = 14;
563 dirsize = 16; 560 dirsize = 16;
@@ -577,20 +574,20 @@ void read_superblock(void)
577 version2 = 1; 574 version2 = 1;
578#endif 575#endif
579 } else 576 } else
580 die(_("bad magic number in super-block")); 577 die("bad magic number in super-block");
581 if (ZONESIZE != 0 || BLOCK_SIZE != 1024) 578 if (ZONESIZE != 0 || BLOCK_SIZE != 1024)
582 die(_("Only 1k blocks/zones supported")); 579 die("Only 1k blocks/zones supported");
583 if (IMAPS * BLOCK_SIZE * 8 < INODES + 1) 580 if (IMAPS * BLOCK_SIZE * 8 < INODES + 1)
584 die(_("bad s_imap_blocks field in super-block")); 581 die("bad s_imap_blocks field in super-block");
585 if (ZMAPS * BLOCK_SIZE * 8 < ZONES - FIRSTZONE + 1) 582 if (ZMAPS * BLOCK_SIZE * 8 < ZONES - FIRSTZONE + 1)
586 die(_("bad s_zmap_blocks field in super-block")); 583 die("bad s_zmap_blocks field in super-block");
587} 584}
588 585
589void read_tables(void) 586static void read_tables(void)
590{ 587{
591 inode_map = malloc(IMAPS * BLOCK_SIZE); 588 inode_map = malloc(IMAPS * BLOCK_SIZE);
592 if (!inode_map) 589 if (!inode_map)
593 die(_("Unable to allocate buffer for inode map")); 590 die("Unable to allocate buffer for inode map");
594 zone_map = malloc(ZMAPS * BLOCK_SIZE); 591 zone_map = malloc(ZMAPS * BLOCK_SIZE);
595 if (!inode_map) 592 if (!inode_map)
596 die("Unable to allocate buffer for zone map"); 593 die("Unable to allocate buffer for zone map");
@@ -598,32 +595,32 @@ void read_tables(void)
598 memset(zone_map,0,sizeof(zone_map)); 595 memset(zone_map,0,sizeof(zone_map));
599 inode_buffer = malloc(INODE_BUFFER_SIZE); 596 inode_buffer = malloc(INODE_BUFFER_SIZE);
600 if (!inode_buffer) 597 if (!inode_buffer)
601 die(_("Unable to allocate buffer for inodes")); 598 die("Unable to allocate buffer for inodes");
602 inode_count = malloc(INODES + 1); 599 inode_count = malloc(INODES + 1);
603 if (!inode_count) 600 if (!inode_count)
604 die(_("Unable to allocate buffer for inode count")); 601 die("Unable to allocate buffer for inode count");
605 zone_count = malloc(ZONES); 602 zone_count = malloc(ZONES);
606 if (!zone_count) 603 if (!zone_count)
607 die(_("Unable to allocate buffer for zone count")); 604 die("Unable to allocate buffer for zone count");
608 if (IMAPS*BLOCK_SIZE != read(IN,inode_map,IMAPS*BLOCK_SIZE)) 605 if (IMAPS*BLOCK_SIZE != read(IN,inode_map,IMAPS*BLOCK_SIZE))
609 die(_("Unable to read inode map")); 606 die("Unable to read inode map");
610 if (ZMAPS*BLOCK_SIZE != read(IN,zone_map,ZMAPS*BLOCK_SIZE)) 607 if (ZMAPS*BLOCK_SIZE != read(IN,zone_map,ZMAPS*BLOCK_SIZE))
611 die(_("Unable to read zone map")); 608 die("Unable to read zone map");
612 if (INODE_BUFFER_SIZE != read(IN,inode_buffer,INODE_BUFFER_SIZE)) 609 if (INODE_BUFFER_SIZE != read(IN,inode_buffer,INODE_BUFFER_SIZE))
613 die(_("Unable to read inodes")); 610 die("Unable to read inodes");
614 if (NORM_FIRSTZONE != FIRSTZONE) { 611 if (NORM_FIRSTZONE != FIRSTZONE) {
615 printf(_("Warning: Firstzone != Norm_firstzone\n")); 612 printf("Warning: Firstzone != Norm_firstzone\n");
616 errors_uncorrected = 1; 613 errors_uncorrected = 1;
617 } 614 }
618 get_dirsize (); 615 get_dirsize ();
619 if (show) { 616 if (show) {
620 printf(_("%ld inodes\n"),INODES); 617 printf("%ld inodes\n",INODES);
621 printf(_("%ld blocks\n"),ZONES); 618 printf("%ld blocks\n",ZONES);
622 printf(_("Firstdatazone=%ld (%ld)\n"),FIRSTZONE,NORM_FIRSTZONE); 619 printf("Firstdatazone=%ld (%ld)\n",FIRSTZONE,NORM_FIRSTZONE);
623 printf(_("Zonesize=%d\n"),BLOCK_SIZE<<ZONESIZE); 620 printf("Zonesize=%d\n",BLOCK_SIZE<<ZONESIZE);
624 printf(_("Maxsize=%ld\n"),MAXSIZE); 621 printf("Maxsize=%ld\n",MAXSIZE);
625 printf(_("Filesystem state=%d\n"), Super.s_state); 622 printf("Filesystem state=%d\n", Super.s_state);
626 printf(_("namelen=%d\n\n"),namelen); 623 printf("namelen=%d\n\n",namelen);
627 } 624 }
628} 625}
629 626
@@ -637,12 +634,12 @@ struct minix_inode * get_inode(unsigned int nr)
637 inode = Inode + nr; 634 inode = Inode + nr;
638 if (!inode_count[nr]) { 635 if (!inode_count[nr]) {
639 if (!inode_in_use(nr)) { 636 if (!inode_in_use(nr)) {
640 printf(_("Inode %d marked not used, but used for file '"), 637 printf("Inode %d marked not used, but used for file '",
641 nr); 638 nr);
642 print_current_name(); 639 print_current_name();
643 printf("'\n"); 640 printf("'\n");
644 if (repair) { 641 if (repair) {
645 if (ask(_("Mark in use"),1)) 642 if (ask("Mark in use",1))
646 mark_inode(nr); 643 mark_inode(nr);
647 } else { 644 } else {
648 errors_uncorrected = 1; 645 errors_uncorrected = 1;
@@ -664,13 +661,13 @@ struct minix_inode * get_inode(unsigned int nr)
664 ; 661 ;
665 else { 662 else {
666 print_current_name(); 663 print_current_name();
667 printf(_(" has mode %05o\n"),inode->i_mode); 664 printf(" has mode %05o\n",inode->i_mode);
668 } 665 }
669 666
670 } else 667 } else
671 links++; 668 links++;
672 if (!++inode_count[nr]) { 669 if (!++inode_count[nr]) {
673 printf(_("Warning: inode count too big.\n")); 670 printf("Warning: inode count too big.\n");
674 inode_count[nr]--; 671 inode_count[nr]--;
675 errors_uncorrected = 1; 672 errors_uncorrected = 1;
676 } 673 }
@@ -689,11 +686,11 @@ get_inode2 (unsigned int nr)
689 inode = Inode2 + nr; 686 inode = Inode2 + nr;
690 if (!inode_count[nr]) { 687 if (!inode_count[nr]) {
691 if (!inode_in_use (nr)) { 688 if (!inode_in_use (nr)) {
692 printf (_("Inode %d marked not used, but used for file '"), nr); 689 printf ("Inode %d marked not used, but used for file '", nr);
693 print_current_name (); 690 print_current_name ();
694 printf ("'\n"); 691 printf ("'\n");
695 if (repair) { 692 if (repair) {
696 if (ask (_("Mark in use"), 1)) 693 if (ask ("Mark in use", 1))
697 mark_inode (nr); 694 mark_inode (nr);
698 else 695 else
699 errors_uncorrected = 1; 696 errors_uncorrected = 1;
@@ -713,12 +710,12 @@ get_inode2 (unsigned int nr)
713 else if (S_ISFIFO (inode->i_mode)); 710 else if (S_ISFIFO (inode->i_mode));
714 else { 711 else {
715 print_current_name (); 712 print_current_name ();
716 printf (_(" has mode %05o\n"), inode->i_mode); 713 printf (" has mode %05o\n", inode->i_mode);
717 } 714 }
718 } else 715 } else
719 links++; 716 links++;
720 if (!++inode_count[nr]) { 717 if (!++inode_count[nr]) {
721 printf (_("Warning: inode count too big.\n")); 718 printf ("Warning: inode count too big.\n");
722 inode_count[nr]--; 719 inode_count[nr]--;
723 errors_uncorrected = 1; 720 errors_uncorrected = 1;
724 } 721 }
@@ -726,16 +723,16 @@ get_inode2 (unsigned int nr)
726} 723}
727#endif 724#endif
728 725
729void check_root(void) 726static void check_root(void)
730{ 727{
731 struct minix_inode * inode = Inode + ROOT_INO; 728 struct minix_inode * inode = Inode + ROOT_INO;
732 729
733 if (!inode || !S_ISDIR(inode->i_mode)) 730 if (!inode || !S_ISDIR(inode->i_mode))
734 die(_("root inode isn't a directory")); 731 die("root inode isn't a directory");
735} 732}
736 733
737#ifdef HAVE_MINIX2 734#ifdef HAVE_MINIX2
738void check_root2 (void) 735static void check_root2 (void)
739{ 736{
740 struct minix2_inode *inode = Inode2 + ROOT_INO; 737 struct minix2_inode *inode = Inode2 + ROOT_INO;
741 738
@@ -754,10 +751,10 @@ static int add_zone(unsigned short * znr, int * corrected)
754 if (!block) 751 if (!block)
755 return 0; 752 return 0;
756 if (zone_count[block]) { 753 if (zone_count[block]) {
757 printf(_("Block has been used before. Now in file `")); 754 printf("Block has been used before. Now in file `");
758 print_current_name(); 755 print_current_name();
759 printf("'."); 756 printf("'.");
760 if (ask(_("Clear"),1)) { 757 if (ask("Clear",1)) {
761 *znr = 0; 758 *znr = 0;
762 block = 0; 759 block = 0;
763 *corrected = 1; 760 *corrected = 1;
@@ -766,10 +763,10 @@ static int add_zone(unsigned short * znr, int * corrected)
766 if (!block) 763 if (!block)
767 return 0; 764 return 0;
768 if (!zone_in_use(block)) { 765 if (!zone_in_use(block)) {
769 printf(_("Block %d in file `"),block); 766 printf("Block %d in file `",block);
770 print_current_name(); 767 print_current_name();
771 printf(_("' is marked not in use.")); 768 printf("' is marked not in use.");
772 if (ask(_("Correct"),1)) 769 if (ask("Correct",1))
773 mark_zone(block); 770 mark_zone(block);
774 } 771 }
775 if (!++zone_count[block]) 772 if (!++zone_count[block])
@@ -788,10 +785,10 @@ static int add_zone2 (unsigned int *znr, int *corrected)
788 if (!block) 785 if (!block)
789 return 0; 786 return 0;
790 if (zone_count[block]) { 787 if (zone_count[block]) {
791 printf (_("Block has been used before. Now in file `")); 788 printf ("Block has been used before. Now in file `");
792 print_current_name (); 789 print_current_name ();
793 printf ("'."); 790 printf ("'.");
794 if (ask (_("Clear"), 1)) { 791 if (ask ("Clear", 1)) {
795 *znr = 0; 792 *znr = 0;
796 block = 0; 793 block = 0;
797 *corrected = 1; 794 *corrected = 1;
@@ -800,10 +797,10 @@ static int add_zone2 (unsigned int *znr, int *corrected)
800 if (!block) 797 if (!block)
801 return 0; 798 return 0;
802 if (!zone_in_use (block)) { 799 if (!zone_in_use (block)) {
803 printf (_("Block %d in file `"), block); 800 printf ("Block %d in file `", block);
804 print_current_name (); 801 print_current_name ();
805 printf (_("' is marked not in use.")); 802 printf ("' is marked not in use.");
806 if (ask (_("Correct"), 1)) 803 if (ask ("Correct", 1))
807 mark_zone (block); 804 mark_zone (block);
808 } 805 }
809 if (!++zone_count[block]) 806 if (!++zone_count[block])
@@ -899,7 +896,7 @@ add_zone_tind2 (unsigned int *znr, int *corrected)
899} 896}
900#endif 897#endif
901 898
902void check_zones(unsigned int i) 899static void check_zones(unsigned int i)
903{ 900{
904 struct minix_inode * inode; 901 struct minix_inode * inode;
905 902
@@ -918,7 +915,7 @@ void check_zones(unsigned int i)
918} 915}
919 916
920#ifdef HAVE_MINIX2 917#ifdef HAVE_MINIX2
921void 918static void
922check_zones2 (unsigned int i) 919check_zones2 (unsigned int i)
923{ 920{
924 struct minix2_inode *inode; 921 struct minix2_inode *inode;
@@ -939,7 +936,7 @@ check_zones2 (unsigned int i)
939} 936}
940#endif 937#endif
941 938
942void check_file(struct minix_inode * dir, unsigned int offset) 939static void check_file(struct minix_inode * dir, unsigned int offset)
943{ 940{
944 static char blk[BLOCK_SIZE]; 941 static char blk[BLOCK_SIZE];
945 struct minix_inode * inode; 942 struct minix_inode * inode;
@@ -953,9 +950,9 @@ void check_file(struct minix_inode * dir, unsigned int offset)
953 ino = * (unsigned short *) (name-2); 950 ino = * (unsigned short *) (name-2);
954 if (ino > INODES) { 951 if (ino > INODES) {
955 print_current_name(); 952 print_current_name();
956 printf(_(" contains a bad inode number for file '")); 953 printf(" contains a bad inode number for file '");
957 printf("%.*s'.",namelen,name); 954 printf("%.*s'.",namelen,name);
958 if (ask(_(" Remove"),1)) { 955 if (ask(" Remove",1)) {
959 *(unsigned short *)(name-2) = 0; 956 *(unsigned short *)(name-2) = 0;
960 write_block(block, blk); 957 write_block(block, blk);
961 } 958 }
@@ -969,14 +966,14 @@ void check_file(struct minix_inode * dir, unsigned int offset)
969 if (!offset) { 966 if (!offset) {
970 if (!inode || strcmp(".",name)) { 967 if (!inode || strcmp(".",name)) {
971 print_current_name(); 968 print_current_name();
972 printf(_(": bad directory: '.' isn't first\n")); 969 printf(": bad directory: '.' isn't first\n");
973 errors_uncorrected = 1; 970 errors_uncorrected = 1;
974 } else return; 971 } else return;
975 } 972 }
976 if (offset == dirsize) { 973 if (offset == dirsize) {
977 if (!inode || strcmp("..",name)) { 974 if (!inode || strcmp("..",name)) {
978 print_current_name(); 975 print_current_name();
979 printf(_(": bad directory: '..' isn't second\n")); 976 printf(": bad directory: '..' isn't second\n");
980 errors_uncorrected = 1; 977 errors_uncorrected = 1;
981 } else return; 978 } else return;
982 } 979 }
@@ -1002,7 +999,7 @@ void check_file(struct minix_inode * dir, unsigned int offset)
1002} 999}
1003 1000
1004#ifdef HAVE_MINIX2 1001#ifdef HAVE_MINIX2
1005void 1002static void
1006check_file2 (struct minix2_inode *dir, unsigned int offset) 1003check_file2 (struct minix2_inode *dir, unsigned int offset)
1007{ 1004{
1008 static char blk[BLOCK_SIZE]; 1005 static char blk[BLOCK_SIZE];
@@ -1017,9 +1014,9 @@ check_file2 (struct minix2_inode *dir, unsigned int offset)
1017 ino = *(unsigned short *) (name - 2); 1014 ino = *(unsigned short *) (name - 2);
1018 if (ino > INODES) { 1015 if (ino > INODES) {
1019 print_current_name (); 1016 print_current_name ();
1020 printf (_(" contains a bad inode number for file '")); 1017 printf (" contains a bad inode number for file '");
1021 printf ("%.*s'.", namelen, name); 1018 printf ("%.*s'.", namelen, name);
1022 if (ask (_(" Remove"), 1)) { 1019 if (ask (" Remove", 1)) {
1023 *(unsigned short *) (name - 2) = 0; 1020 *(unsigned short *) (name - 2) = 0;
1024 write_block (block, blk); 1021 write_block (block, blk);
1025 } 1022 }
@@ -1033,7 +1030,7 @@ check_file2 (struct minix2_inode *dir, unsigned int offset)
1033 if (!offset) { 1030 if (!offset) {
1034 if (!inode || strcmp (".", name)) { 1031 if (!inode || strcmp (".", name)) {
1035 print_current_name (); 1032 print_current_name ();
1036 printf (_(": bad directory: '.' isn't first\n")); 1033 printf (": bad directory: '.' isn't first\n");
1037 errors_uncorrected = 1; 1034 errors_uncorrected = 1;
1038 } else 1035 } else
1039 return; 1036 return;
@@ -1041,7 +1038,7 @@ check_file2 (struct minix2_inode *dir, unsigned int offset)
1041 if (offset == dirsize) { 1038 if (offset == dirsize) {
1042 if (!inode || strcmp ("..", name)) { 1039 if (!inode || strcmp ("..", name)) {
1043 print_current_name (); 1040 print_current_name ();
1044 printf (_(": bad directory: '..' isn't second\n")); 1041 printf (": bad directory: '..' isn't second\n");
1045 errors_uncorrected = 1; 1042 errors_uncorrected = 1;
1046 } else 1043 } else
1047 return; 1044 return;
@@ -1066,17 +1063,17 @@ check_file2 (struct minix2_inode *dir, unsigned int offset)
1066} 1063}
1067#endif 1064#endif
1068 1065
1069void recursive_check(unsigned int ino) 1066static void recursive_check(unsigned int ino)
1070{ 1067{
1071 struct minix_inode * dir; 1068 struct minix_inode * dir;
1072 unsigned int offset; 1069 unsigned int offset;
1073 1070
1074 dir = Inode + ino; 1071 dir = Inode + ino;
1075 if (!S_ISDIR(dir->i_mode)) 1072 if (!S_ISDIR(dir->i_mode))
1076 die(_("internal error")); 1073 die("internal error");
1077 if (dir->i_size < 2 * dirsize) { 1074 if (dir->i_size < 2 * dirsize) {
1078 print_current_name(); 1075 print_current_name();
1079 printf(_(": bad directory: size<32")); 1076 printf(": bad directory: size<32");
1080 errors_uncorrected = 1; 1077 errors_uncorrected = 1;
1081 } 1078 }
1082 for (offset = 0 ; offset < dir->i_size ; offset += dirsize) 1079 for (offset = 0 ; offset < dir->i_size ; offset += dirsize)
@@ -1084,7 +1081,7 @@ void recursive_check(unsigned int ino)
1084} 1081}
1085 1082
1086#ifdef HAVE_MINIX2 1083#ifdef HAVE_MINIX2
1087void 1084static void
1088recursive_check2 (unsigned int ino) 1085recursive_check2 (unsigned int ino)
1089{ 1086{
1090 struct minix2_inode *dir; 1087 struct minix2_inode *dir;
@@ -1095,7 +1092,7 @@ recursive_check2 (unsigned int ino)
1095 die ("internal error"); 1092 die ("internal error");
1096 if (dir->i_size < 2 * dirsize) { 1093 if (dir->i_size < 2 * dirsize) {
1097 print_current_name (); 1094 print_current_name ();
1098 printf (_(": bad directory: size < 32")); 1095 printf (": bad directory: size < 32");
1099 errors_uncorrected = 1; 1096 errors_uncorrected = 1;
1100 } 1097 }
1101 for (offset = 0; offset < dir->i_size; offset += dirsize) 1098 for (offset = 0; offset < dir->i_size; offset += dirsize)
@@ -1103,23 +1100,23 @@ recursive_check2 (unsigned int ino)
1103} 1100}
1104#endif 1101#endif
1105 1102
1106int bad_zone(int i) 1103static int bad_zone(int i)
1107{ 1104{
1108 char buffer[1024]; 1105 char buffer[1024];
1109 1106
1110 if (BLOCK_SIZE*i != lseek(IN, BLOCK_SIZE*i, SEEK_SET)) 1107 if (BLOCK_SIZE*i != lseek(IN, BLOCK_SIZE*i, SEEK_SET))
1111 die(_("seek failed in bad_zone")); 1108 die("seek failed in bad_zone");
1112 return (BLOCK_SIZE != read(IN, buffer, BLOCK_SIZE)); 1109 return (BLOCK_SIZE != read(IN, buffer, BLOCK_SIZE));
1113} 1110}
1114 1111
1115void check_counts(void) 1112static void check_counts(void)
1116{ 1113{
1117 int i; 1114 int i;
1118 1115
1119 for (i=1 ; i <= INODES ; i++) { 1116 for (i=1 ; i <= INODES ; i++) {
1120 if (!inode_in_use(i) && Inode[i].i_mode && warn_mode) { 1117 if (!inode_in_use(i) && Inode[i].i_mode && warn_mode) {
1121 printf(_("Inode %d mode not cleared."),i); 1118 printf("Inode %d mode not cleared.",i);
1122 if (ask(_("Clear"),1)) { 1119 if (ask("Clear",1)) {
1123 Inode[i].i_mode = 0; 1120 Inode[i].i_mode = 0;
1124 changed = 1; 1121 changed = 1;
1125 } 1122 }
@@ -1127,21 +1124,20 @@ void check_counts(void)
1127 if (!inode_count[i]) { 1124 if (!inode_count[i]) {
1128 if (!inode_in_use(i)) 1125 if (!inode_in_use(i))
1129 continue; 1126 continue;
1130 printf(_("Inode %d not used, marked used in the bitmap."),i); 1127 printf("Inode %d not used, marked used in the bitmap.",i);
1131 if (ask(_("Clear"),1)) 1128 if (ask("Clear",1))
1132 unmark_inode(i); 1129 unmark_inode(i);
1133 continue; 1130 continue;
1134 } 1131 }
1135 if (!inode_in_use(i)) { 1132 if (!inode_in_use(i)) {
1136 printf(_("Inode %d used, marked unused in the bitmap."), 1133 printf("Inode %d used, marked unused in the bitmap.", i);
1137 i);
1138 if (ask("Set",1)) 1134 if (ask("Set",1))
1139 mark_inode(i); 1135 mark_inode(i);
1140 } 1136 }
1141 if (Inode[i].i_nlinks != inode_count[i]) { 1137 if (Inode[i].i_nlinks != inode_count[i]) {
1142 printf(_("Inode %d (mode = %07o), i_nlinks=%d, counted=%d."), 1138 printf("Inode %d (mode = %07o), i_nlinks=%d, counted=%d.",
1143 i,Inode[i].i_mode,Inode[i].i_nlinks,inode_count[i]); 1139 i,Inode[i].i_mode,Inode[i].i_nlinks,inode_count[i]);
1144 if (ask(_("Set i_nlinks to count"),1)) { 1140 if (ask("Set i_nlinks to count",1)) {
1145 Inode[i].i_nlinks=inode_count[i]; 1141 Inode[i].i_nlinks=inode_count[i];
1146 changed=1; 1142 changed=1;
1147 } 1143 }
@@ -1153,26 +1149,26 @@ void check_counts(void)
1153 if (!zone_count[i]) { 1149 if (!zone_count[i]) {
1154 if (bad_zone(i)) 1150 if (bad_zone(i))
1155 continue; 1151 continue;
1156 printf(_("Zone %d: marked in use, no file uses it."),i); 1152 printf("Zone %d: marked in use, no file uses it.",i);
1157 if (ask(_("Unmark"),1)) 1153 if (ask("Unmark",1))
1158 unmark_zone(i); 1154 unmark_zone(i);
1159 continue; 1155 continue;
1160 } 1156 }
1161 printf(_("Zone %d: %sin use, counted=%d\n"), 1157 printf("Zone %d: %sin use, counted=%d\n",
1162 i,zone_in_use(i)?"":_("not "),zone_count[i]); 1158 i,zone_in_use(i)?"":"not ",zone_count[i]);
1163 } 1159 }
1164} 1160}
1165 1161
1166#ifdef HAVE_MINIX2 1162#ifdef HAVE_MINIX2
1167void 1163static void
1168check_counts2 (void) 1164check_counts2 (void)
1169{ 1165{
1170 int i; 1166 int i;
1171 1167
1172 for (i = 1; i <= INODES; i++) { 1168 for (i = 1; i <= INODES; i++) {
1173 if (!inode_in_use (i) && Inode2[i].i_mode && warn_mode) { 1169 if (!inode_in_use (i) && Inode2[i].i_mode && warn_mode) {
1174 printf (_("Inode %d mode not cleared."), i); 1170 printf ("Inode %d mode not cleared.", i);
1175 if (ask (_("Clear"), 1)) { 1171 if (ask ("Clear", 1)) {
1176 Inode2[i].i_mode = 0; 1172 Inode2[i].i_mode = 0;
1177 changed = 1; 1173 changed = 1;
1178 } 1174 }
@@ -1180,20 +1176,20 @@ check_counts2 (void)
1180 if (!inode_count[i]) { 1176 if (!inode_count[i]) {
1181 if (!inode_in_use (i)) 1177 if (!inode_in_use (i))
1182 continue; 1178 continue;
1183 printf (_("Inode %d not used, marked used in the bitmap."), i); 1179 printf ("Inode %d not used, marked used in the bitmap.", i);
1184 if (ask (_("Clear"), 1)) 1180 if (ask ("Clear", 1))
1185 unmark_inode (i); 1181 unmark_inode (i);
1186 continue; 1182 continue;
1187 } 1183 }
1188 if (!inode_in_use (i)) { 1184 if (!inode_in_use (i)) {
1189 printf (_("Inode %d used, marked unused in the bitmap."), i); 1185 printf ("Inode %d used, marked unused in the bitmap.", i);
1190 if (ask (_("Set"), 1)) 1186 if (ask ("Set", 1))
1191 mark_inode (i); 1187 mark_inode (i);
1192 } 1188 }
1193 if (Inode2[i].i_nlinks != inode_count[i]) { 1189 if (Inode2[i].i_nlinks != inode_count[i]) {
1194 printf (_("Inode %d (mode = %07o), i_nlinks=%d, counted=%d."), 1190 printf ("Inode %d (mode = %07o), i_nlinks=%d, counted=%d.",
1195 i, Inode2[i].i_mode, Inode2[i].i_nlinks, inode_count[i]); 1191 i, Inode2[i].i_mode, Inode2[i].i_nlinks, inode_count[i]);
1196 if (ask (_("Set i_nlinks to count"), 1)) { 1192 if (ask ("Set i_nlinks to count", 1)) {
1197 Inode2[i].i_nlinks = inode_count[i]; 1193 Inode2[i].i_nlinks = inode_count[i];
1198 changed = 1; 1194 changed = 1;
1199 } 1195 }
@@ -1205,18 +1201,18 @@ check_counts2 (void)
1205 if (!zone_count[i]) { 1201 if (!zone_count[i]) {
1206 if (bad_zone (i)) 1202 if (bad_zone (i))
1207 continue; 1203 continue;
1208 printf (_("Zone %d: marked in use, no file uses it."), i); 1204 printf ("Zone %d: marked in use, no file uses it.", i);
1209 if (ask (_("Unmark"), 1)) 1205 if (ask ("Unmark", 1))
1210 unmark_zone (i); 1206 unmark_zone (i);
1211 continue; 1207 continue;
1212 } 1208 }
1213 printf (_("Zone %d: %sin use, counted=%d\n"), 1209 printf ("Zone %d: %sin use, counted=%d\n",
1214 i, zone_in_use (i) ? "" : _("not "), zone_count[i]); 1210 i, zone_in_use (i) ? "" : "not ", zone_count[i]);
1215 } 1211 }
1216} 1212}
1217#endif 1213#endif
1218 1214
1219void check(void) 1215static void check(void)
1220{ 1216{
1221 memset(inode_count,0,(INODES + 1) * sizeof(*inode_count)); 1217 memset(inode_count,0,(INODES + 1) * sizeof(*inode_count));
1222 memset(zone_count,0,ZONES*sizeof(*zone_count)); 1218 memset(zone_count,0,ZONES*sizeof(*zone_count));
@@ -1226,7 +1222,7 @@ void check(void)
1226} 1222}
1227 1223
1228#ifdef HAVE_MINIX2 1224#ifdef HAVE_MINIX2
1229void 1225static void
1230check2 (void) 1226check2 (void)
1231{ 1227{
1232 memset (inode_count, 0, (INODES + 1) * sizeof (*inode_count)); 1228 memset (inode_count, 0, (INODES + 1) * sizeof (*inode_count));
@@ -1244,24 +1240,19 @@ fsck_minix_main(int argc, char ** argv)
1244 int count; 1240 int count;
1245 int retcode = 0; 1241 int retcode = 0;
1246 1242
1247 setlocale(LC_ALL, "");
1248 bindtextdomain(PACKAGE, LOCALEDIR);
1249 textdomain(PACKAGE);
1250
1251
1252 if (argc && *argv) 1243 if (argc && *argv)
1253 program_name = *argv; 1244 program_name = *argv;
1254 if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) 1245 if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
1255 die(_("bad inode size")); 1246 die("bad inode size");
1256#ifdef HAVE_MINIX2 1247#ifdef HAVE_MINIX2
1257 if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) 1248 if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
1258 die(_("bad v2 inode size")); 1249 die("bad v2 inode size");
1259#endif 1250#endif
1260 while (argc-- > 1) { 1251 while (argc-- > 1) {
1261 argv++; 1252 argv++;
1262 if (argv[0][0] != '-') { 1253 if (argv[0][0] != '-') {
1263 if (device_name) 1254 if (device_name)
1264 usage(); 1255 show_usage();
1265 else 1256 else
1266 device_name = argv[0]; 1257 device_name = argv[0];
1267 } else while (*++argv[0]) 1258 } else while (*++argv[0])
@@ -1273,19 +1264,19 @@ fsck_minix_main(int argc, char ** argv)
1273 case 's': show=1; break; 1264 case 's': show=1; break;
1274 case 'm': warn_mode=1; break; 1265 case 'm': warn_mode=1; break;
1275 case 'f': force=1; break; 1266 case 'f': force=1; break;
1276 default: usage(); 1267 default: show_usage();
1277 } 1268 }
1278 } 1269 }
1279 if (!device_name) 1270 if (!device_name)
1280 usage(); 1271 show_usage();
1281 check_mount(); /* trying to check a mounted filesystem? */ 1272 check_mount(); /* trying to check a mounted filesystem? */
1282 if (repair && !automatic) { 1273 if (repair && !automatic) {
1283 if (!isatty(0) || !isatty(1)) 1274 if (!isatty(0) || !isatty(1))
1284 die(_("need terminal for interactive repairs")); 1275 die("need terminal for interactive repairs");
1285 } 1276 }
1286 IN = open(device_name,repair?O_RDWR:O_RDONLY); 1277 IN = open(device_name,repair?O_RDWR:O_RDONLY);
1287 if (IN < 0) 1278 if (IN < 0)
1288 die(_("unable to open '%s'")); 1279 die("unable to open '%s'");
1289 for (count=0 ; count<3 ; count++) 1280 for (count=0 ; count<3 ; count++)
1290 sync(); 1281 sync();
1291 read_superblock(); 1282 read_superblock();
@@ -1296,19 +1287,18 @@ fsck_minix_main(int argc, char ** argv)
1296 * flags and whether or not the -f switch was specified on the 1287 * flags and whether or not the -f switch was specified on the
1297 * command line. 1288 * command line.
1298 */ 1289 */
1299 printf("%s, %s / %s\n", program_name, program_version, 1290 printf("%s, %s\n", program_name, program_version);
1300 util_linux_version);
1301 if ( !(Super.s_state & MINIX_ERROR_FS) && 1291 if ( !(Super.s_state & MINIX_ERROR_FS) &&
1302 (Super.s_state & MINIX_VALID_FS) && 1292 (Super.s_state & MINIX_VALID_FS) &&
1303 !force ) { 1293 !force ) {
1304 if (repair) 1294 if (repair)
1305 printf(_("%s is clean, no check.\n"), device_name); 1295 printf("%s is clean, no check.\n", device_name);
1306 return retcode; 1296 return retcode;
1307 } 1297 }
1308 else if (force) 1298 else if (force)
1309 printf(_("Forcing filesystem check on %s.\n"), device_name); 1299 printf("Forcing filesystem check on %s.\n", device_name);
1310 else if (repair) 1300 else if (repair)
1311 printf(_("Filesystem on %s is dirty, needs checking.\n"),\ 1301 printf("Filesystem on %s is dirty, needs checking.\n",\
1312 device_name); 1302 device_name);
1313 1303
1314 read_tables(); 1304 read_tables();
@@ -1337,29 +1327,29 @@ fsck_minix_main(int argc, char ** argv)
1337 for (i=1,free=0 ; i <= INODES ; i++) 1327 for (i=1,free=0 ; i <= INODES ; i++)
1338 if (!inode_in_use(i)) 1328 if (!inode_in_use(i))
1339 free++; 1329 free++;
1340 printf(_("\n%6ld inodes used (%ld%%)\n"),(INODES-free), 1330 printf("\n%6ld inodes used (%ld%%)\n",(INODES-free),
1341 100*(INODES-free)/INODES); 1331 100*(INODES-free)/INODES);
1342 for (i=FIRSTZONE,free=0 ; i < ZONES ; i++) 1332 for (i=FIRSTZONE,free=0 ; i < ZONES ; i++)
1343 if (!zone_in_use(i)) 1333 if (!zone_in_use(i))
1344 free++; 1334 free++;
1345 printf(_("%6ld zones used (%ld%%)\n"),(ZONES-free), 1335 printf("%6ld zones used (%ld%%)\n",(ZONES-free),
1346 100*(ZONES-free)/ZONES); 1336 100*(ZONES-free)/ZONES);
1347 printf(_("\n%6d regular files\n" 1337 printf("\n%6d regular files\n"
1348 "%6d directories\n" 1338 "%6d directories\n"
1349 "%6d character device files\n" 1339 "%6d character device files\n"
1350 "%6d block device files\n" 1340 "%6d block device files\n"
1351 "%6d links\n" 1341 "%6d links\n"
1352 "%6d symbolic links\n" 1342 "%6d symbolic links\n"
1353 "------\n" 1343 "------\n"
1354 "%6d files\n"), 1344 "%6d files\n",
1355 regular,directory,chardev,blockdev, 1345 regular,directory,chardev,blockdev,
1356 links-2*directory+1,symlinks,total-2*directory+1); 1346 links-2*directory+1,symlinks,total-2*directory+1);
1357 } 1347 }
1358 if (changed) { 1348 if (changed) {
1359 write_tables(); 1349 write_tables();
1360 printf(_( "----------------------------\n" 1350 printf( "----------------------------\n"
1361 "FILE SYSTEM HAS BEEN CHANGED\n" 1351 "FILE SYSTEM HAS BEEN CHANGED\n"
1362 "----------------------------\n")); 1352 "----------------------------\n");
1363 for (count=0 ; count<3 ; count++) 1353 for (count=0 ; count<3 ; count++)
1364 sync(); 1354 sync();
1365 } 1355 }