diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-03 00:39:15 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-03 00:39:15 +0000 |
| commit | 24cfe8fe0c6a7b8b393a898ce5ec6195af17f7cd (patch) | |
| tree | 5dafc81bc7744f7482c3d214b76dc3850cc9aef4 /util-linux | |
| parent | 2a85676fa5b7884400d7c2cc2170e14f995cf73d (diff) | |
| download | busybox-w32-24cfe8fe0c6a7b8b393a898ce5ec6195af17f7cd.tar.gz busybox-w32-24cfe8fe0c6a7b8b393a898ce5ec6195af17f7cd.tar.bz2 busybox-w32-24cfe8fe0c6a7b8b393a898ce5ec6195af17f7cd.zip | |
introduce small[u]int
fsck_minix: use it for flag variables. 140 bytes saved
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/fsck_minix.c | 133 |
1 files changed, 69 insertions, 64 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 9c831bd59..9e885dc27 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
| @@ -175,10 +175,6 @@ struct minix_dir_entry { | |||
| 175 | #define BLKGETSIZE _IO(0x12,96) /* return device size */ | 175 | #define BLKGETSIZE _IO(0x12,96) /* return device size */ |
| 176 | #endif | 176 | #endif |
| 177 | 177 | ||
| 178 | #ifndef __linux__ | ||
| 179 | #define volatile | ||
| 180 | #endif | ||
| 181 | |||
| 182 | enum { ROOT_INO = 1 }; | 178 | enum { ROOT_INO = 1 }; |
| 183 | 179 | ||
| 184 | #define UPPER(size,n) ((size+((n)-1))/(n)) | 180 | #define UPPER(size,n) ((size+((n)-1))/(n)) |
| @@ -197,25 +193,28 @@ enum { ROOT_INO = 1 }; | |||
| 197 | static char *program_version = "1.2 - 11/11/96"; | 193 | static char *program_version = "1.2 - 11/11/96"; |
| 198 | static char *device_name; | 194 | static char *device_name; |
| 199 | static int IN; | 195 | static int IN; |
| 200 | static int repair, automatic, verbose, list, show, warn_mode, force; | 196 | static smallint repair, automatic, verbose, list, show, warn_mode, force; |
| 201 | static int directory, regular, blockdev, chardev, links, symlinks, total; | 197 | static int directory, regular, blockdev, chardev, links, symlinks, total; |
| 202 | 198 | ||
| 203 | static int changed; /* flags if the filesystem has been changed */ | 199 | static struct termios termios; |
| 204 | static int errors_uncorrected; /* flag if some error was not corrected */ | 200 | static smallint termios_set; |
| 201 | |||
| 202 | static smallint changed; /* flags if the filesystem has been changed */ | ||
| 203 | static smallint errors_uncorrected; /* flag if some error was not corrected */ | ||
| 204 | //also smallint? | ||
| 205 | static int dirsize = 16; | 205 | static int dirsize = 16; |
| 206 | static int namelen = 14; | 206 | static int namelen = 14; |
| 207 | static struct termios termios; | ||
| 208 | static int termios_set; | ||
| 209 | 207 | ||
| 210 | static char *inode_buffer; | 208 | static char *inode_buffer; |
| 211 | #define Inode (((struct minix_inode *) inode_buffer)-1) | 209 | #define Inode (((struct minix_inode *) inode_buffer)-1) |
| 212 | #define Inode2 (((struct minix2_inode *) inode_buffer)-1) | 210 | #define Inode2 (((struct minix2_inode *) inode_buffer)-1) |
| 211 | //xzalloc? | ||
| 213 | static char super_block_buffer[BLOCK_SIZE]; | 212 | static char super_block_buffer[BLOCK_SIZE]; |
| 214 | 213 | ||
| 215 | #define Super (*(struct minix_super_block *)super_block_buffer) | 214 | #define Super (*(struct minix_super_block *)super_block_buffer) |
| 216 | #define INODES ((unsigned long)Super.s_ninodes) | 215 | #define INODES ((unsigned long)Super.s_ninodes) |
| 217 | #ifdef CONFIG_FEATURE_MINIX2 | 216 | #ifdef CONFIG_FEATURE_MINIX2 |
| 218 | static int version2; | 217 | static smallint version2; |
| 219 | #define ZONES ((unsigned long)(version2 ? Super.s_zones : Super.s_nzones)) | 218 | #define ZONES ((unsigned long)(version2 ? Super.s_zones : Super.s_nzones)) |
| 220 | #else | 219 | #else |
| 221 | #define ZONES ((unsigned long)(Super.s_nzones)) | 220 | #define ZONES ((unsigned long)(Super.s_nzones)) |
| @@ -306,7 +305,8 @@ static void push_filename(const char *name) | |||
| 306 | name_depth++; | 305 | name_depth++; |
| 307 | } | 306 | } |
| 308 | 307 | ||
| 309 | static void pop_filename(void) { | 308 | static void pop_filename(void) |
| 309 | { | ||
| 310 | name_depth--; | 310 | name_depth--; |
| 311 | if (name_depth < MAX_DEPTH) { | 311 | if (name_depth < MAX_DEPTH) { |
| 312 | *name_component[name_depth] = '\0'; | 312 | *name_component[name_depth] = '\0'; |
| @@ -399,7 +399,6 @@ static void check_mount(void) | |||
| 399 | printf("Check aborted\n"); | 399 | printf("Check aborted\n"); |
| 400 | exit(0); | 400 | exit(0); |
| 401 | } | 401 | } |
| 402 | return; | ||
| 403 | } | 402 | } |
| 404 | 403 | ||
| 405 | /* | 404 | /* |
| @@ -408,7 +407,7 @@ static void check_mount(void) | |||
| 408 | * if an error was corrected, and returns the zone (0 for no zone | 407 | * if an error was corrected, and returns the zone (0 for no zone |
| 409 | * or a bad zone-number). | 408 | * or a bad zone-number). |
| 410 | */ | 409 | */ |
| 411 | static int check_zone_nr2(uint32_t *nr, int *corrected) | 410 | static int check_zone_nr2(uint32_t *nr, smallint *corrected) |
| 412 | { | 411 | { |
| 413 | const char *msg; | 412 | const char *msg; |
| 414 | if (!*nr) | 413 | if (!*nr) |
| @@ -427,7 +426,7 @@ static int check_zone_nr2(uint32_t *nr, int *corrected) | |||
| 427 | return 0; | 426 | return 0; |
| 428 | } | 427 | } |
| 429 | 428 | ||
| 430 | static int check_zone_nr(uint16_t *nr, int *corrected) | 429 | static int check_zone_nr(uint16_t *nr, smallint *corrected) |
| 431 | { | 430 | { |
| 432 | uint32_t nr32 = *nr; | 431 | uint32_t nr32 = *nr; |
| 433 | int r = check_zone_nr2(&nr32, corrected); | 432 | int r = check_zone_nr2(&nr32, corrected); |
| @@ -471,7 +470,7 @@ static void write_block(unsigned int nr, char *addr) | |||
| 471 | return; | 470 | return; |
| 472 | } | 471 | } |
| 473 | if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET)) | 472 | if (BLOCK_SIZE * nr != lseek(IN, BLOCK_SIZE * nr, SEEK_SET)) |
| 474 | die("Seek failed in write_block"); | 473 | die("seek failed in write_block"); |
| 475 | if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) { | 474 | if (BLOCK_SIZE != write(IN, addr, BLOCK_SIZE)) { |
| 476 | printf("%s: bad block in file '%s'\n", | 475 | printf("%s: bad block in file '%s'\n", |
| 477 | bb_msg_write_error, current_name); | 476 | bb_msg_write_error, current_name); |
| @@ -488,7 +487,8 @@ static int map_block(struct minix_inode *inode, unsigned int blknr) | |||
| 488 | { | 487 | { |
| 489 | uint16_t ind[BLOCK_SIZE >> 1]; | 488 | uint16_t ind[BLOCK_SIZE >> 1]; |
| 490 | uint16_t dind[BLOCK_SIZE >> 1]; | 489 | uint16_t dind[BLOCK_SIZE >> 1]; |
| 491 | int blk_chg, block, result; | 490 | int block, result; |
| 491 | smallint blk_chg; | ||
| 492 | 492 | ||
| 493 | if (blknr < 7) | 493 | if (blknr < 7) |
| 494 | return check_zone_nr(inode->i_zone + blknr, &changed); | 494 | return check_zone_nr(inode->i_zone + blknr, &changed); |
| @@ -524,7 +524,8 @@ static int map_block2(struct minix2_inode *inode, unsigned int blknr) | |||
| 524 | uint32_t ind[BLOCK_SIZE >> 2]; | 524 | uint32_t ind[BLOCK_SIZE >> 2]; |
| 525 | uint32_t dind[BLOCK_SIZE >> 2]; | 525 | uint32_t dind[BLOCK_SIZE >> 2]; |
| 526 | uint32_t tind[BLOCK_SIZE >> 2]; | 526 | uint32_t tind[BLOCK_SIZE >> 2]; |
| 527 | int blk_chg, block, result; | 527 | int block, result; |
| 528 | smallint blk_chg; | ||
| 528 | 529 | ||
| 529 | if (blknr < 7) | 530 | if (blknr < 7) |
| 530 | return check_zone_nr2(inode->i_zone + blknr, &changed); | 531 | return check_zone_nr2(inode->i_zone + blknr, &changed); |
| @@ -591,9 +592,9 @@ static void write_super_block(void) | |||
| 591 | Super.s_state &= ~MINIX_ERROR_FS; | 592 | Super.s_state &= ~MINIX_ERROR_FS; |
| 592 | 593 | ||
| 593 | if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET)) | 594 | if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET)) |
| 594 | die("Seek failed in write_super_block"); | 595 | die("seek failed in write_super_block"); |
| 595 | if (BLOCK_SIZE != write(IN, super_block_buffer, BLOCK_SIZE)) | 596 | if (BLOCK_SIZE != write(IN, super_block_buffer, BLOCK_SIZE)) |
| 596 | die("Unable to write super-block"); | 597 | die("unable to write super-block"); |
| 597 | } | 598 | } |
| 598 | 599 | ||
| 599 | static void write_tables(void) | 600 | static void write_tables(void) |
| @@ -601,11 +602,11 @@ static void write_tables(void) | |||
| 601 | write_super_block(); | 602 | write_super_block(); |
| 602 | 603 | ||
| 603 | if (IMAPS * BLOCK_SIZE != write(IN, inode_map, IMAPS * BLOCK_SIZE)) | 604 | if (IMAPS * BLOCK_SIZE != write(IN, inode_map, IMAPS * BLOCK_SIZE)) |
| 604 | die("Unable to write inode map"); | 605 | die("unable to write inode map"); |
| 605 | if (ZMAPS * BLOCK_SIZE != write(IN, zone_map, ZMAPS * BLOCK_SIZE)) | 606 | if (ZMAPS * BLOCK_SIZE != write(IN, zone_map, ZMAPS * BLOCK_SIZE)) |
| 606 | die("Unable to write zone map"); | 607 | die("unable to write zone map"); |
| 607 | if (INODE_BUFFER_SIZE != write(IN, inode_buffer, INODE_BUFFER_SIZE)) | 608 | if (INODE_BUFFER_SIZE != write(IN, inode_buffer, INODE_BUFFER_SIZE)) |
| 608 | die("Unable to write inodes"); | 609 | die("unable to write inodes"); |
| 609 | } | 610 | } |
| 610 | 611 | ||
| 611 | static void get_dirsize(void) | 612 | static void get_dirsize(void) |
| @@ -634,9 +635,9 @@ static void get_dirsize(void) | |||
| 634 | static void read_superblock(void) | 635 | static void read_superblock(void) |
| 635 | { | 636 | { |
| 636 | if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET)) | 637 | if (BLOCK_SIZE != lseek(IN, BLOCK_SIZE, SEEK_SET)) |
| 637 | die("Seek failed"); | 638 | die("seek failed"); |
| 638 | if (BLOCK_SIZE != read(IN, super_block_buffer, BLOCK_SIZE)) | 639 | if (BLOCK_SIZE != read(IN, super_block_buffer, BLOCK_SIZE)) |
| 639 | die("Unable to read super block"); | 640 | die("unable to read super block"); |
| 640 | /* already initialized to: | 641 | /* already initialized to: |
| 641 | namelen = 14; | 642 | namelen = 14; |
| 642 | dirsize = 16; | 643 | dirsize = 16; |
| @@ -655,13 +656,13 @@ static void read_superblock(void) | |||
| 655 | version2 = 1; | 656 | version2 = 1; |
| 656 | #endif | 657 | #endif |
| 657 | } else | 658 | } else |
| 658 | die("Bad magic number in super-block"); | 659 | die("bad magic number in super-block"); |
| 659 | if (ZONESIZE != 0 || BLOCK_SIZE != 1024) | 660 | if (ZONESIZE != 0 || BLOCK_SIZE != 1024) |
| 660 | die("Only 1k blocks/zones supported"); | 661 | die("only 1k blocks/zones supported"); |
| 661 | if (IMAPS * BLOCK_SIZE * 8 < INODES + 1) | 662 | if (IMAPS * BLOCK_SIZE * 8 < INODES + 1) |
| 662 | die("Bad s_imap_blocks field in super-block"); | 663 | die("bad s_imap_blocks field in super-block"); |
| 663 | if (ZMAPS * BLOCK_SIZE * 8 < ZONES - FIRSTZONE + 1) | 664 | if (ZMAPS * BLOCK_SIZE * 8 < ZONES - FIRSTZONE + 1) |
| 664 | die("Bad s_zmap_blocks field in super-block"); | 665 | die("bad s_zmap_blocks field in super-block"); |
| 665 | } | 666 | } |
| 666 | 667 | ||
| 667 | static void read_tables(void) | 668 | static void read_tables(void) |
| @@ -672,13 +673,13 @@ static void read_tables(void) | |||
| 672 | inode_count = xmalloc(INODES + 1); | 673 | inode_count = xmalloc(INODES + 1); |
| 673 | zone_count = xmalloc(ZONES); | 674 | zone_count = xmalloc(ZONES); |
| 674 | if (IMAPS * BLOCK_SIZE != read(IN, inode_map, IMAPS * BLOCK_SIZE)) | 675 | if (IMAPS * BLOCK_SIZE != read(IN, inode_map, IMAPS * BLOCK_SIZE)) |
| 675 | die("Unable to read inode map"); | 676 | die("unable to read inode map"); |
| 676 | if (ZMAPS * BLOCK_SIZE != read(IN, zone_map, ZMAPS * BLOCK_SIZE)) | 677 | if (ZMAPS * BLOCK_SIZE != read(IN, zone_map, ZMAPS * BLOCK_SIZE)) |
| 677 | die("Unable to read zone map"); | 678 | die("unable to read zone map"); |
| 678 | if (INODE_BUFFER_SIZE != read(IN, inode_buffer, INODE_BUFFER_SIZE)) | 679 | if (INODE_BUFFER_SIZE != read(IN, inode_buffer, INODE_BUFFER_SIZE)) |
| 679 | die("Unable to read inodes"); | 680 | die("unable to read inodes"); |
| 680 | if (NORM_FIRSTZONE != FIRSTZONE) { | 681 | if (NORM_FIRSTZONE != FIRSTZONE) { |
| 681 | printf("Warning: Firstzone!=Norm_firstzone\n"); | 682 | printf("warning: firstzone!=norm_firstzone\n"); |
| 682 | errors_uncorrected = 1; | 683 | errors_uncorrected = 1; |
| 683 | } | 684 | } |
| 684 | get_dirsize(); | 685 | get_dirsize(); |
| @@ -796,7 +797,7 @@ static void check_root(void) | |||
| 796 | struct minix_inode *inode = Inode + ROOT_INO; | 797 | struct minix_inode *inode = Inode + ROOT_INO; |
| 797 | 798 | ||
| 798 | if (!inode || !S_ISDIR(inode->i_mode)) | 799 | if (!inode || !S_ISDIR(inode->i_mode)) |
| 799 | die("Root inode isn't a directory"); | 800 | die("root inode isn't a directory"); |
| 800 | } | 801 | } |
| 801 | 802 | ||
| 802 | #ifdef CONFIG_FEATURE_MINIX2 | 803 | #ifdef CONFIG_FEATURE_MINIX2 |
| @@ -805,11 +806,11 @@ static void check_root2(void) | |||
| 805 | struct minix2_inode *inode = Inode2 + ROOT_INO; | 806 | struct minix2_inode *inode = Inode2 + ROOT_INO; |
| 806 | 807 | ||
| 807 | if (!inode || !S_ISDIR(inode->i_mode)) | 808 | if (!inode || !S_ISDIR(inode->i_mode)) |
| 808 | die("Root inode isn't a directory"); | 809 | die("root inode isn't a directory"); |
| 809 | } | 810 | } |
| 810 | #endif | 811 | #endif |
| 811 | 812 | ||
| 812 | static int add_zone(uint16_t *znr, int *corrected) | 813 | static int add_zone(uint16_t *znr, smallint *corrected) |
| 813 | { | 814 | { |
| 814 | int result; | 815 | int result; |
| 815 | int block; | 816 | int block; |
| @@ -840,7 +841,7 @@ static int add_zone(uint16_t *znr, int *corrected) | |||
| 840 | } | 841 | } |
| 841 | 842 | ||
| 842 | #ifdef CONFIG_FEATURE_MINIX2 | 843 | #ifdef CONFIG_FEATURE_MINIX2 |
| 843 | static int add_zone2(uint32_t *znr, int *corrected) | 844 | static int add_zone2(uint32_t *znr, smallint *corrected) |
| 844 | { | 845 | { |
| 845 | int result; | 846 | int result; |
| 846 | int block; | 847 | int block; |
| @@ -871,11 +872,12 @@ static int add_zone2(uint32_t *znr, int *corrected) | |||
| 871 | } | 872 | } |
| 872 | #endif | 873 | #endif |
| 873 | 874 | ||
| 874 | static void add_zone_ind(uint16_t *znr, int *corrected) | 875 | static void add_zone_ind(uint16_t *znr, smallint *corrected) |
| 875 | { | 876 | { |
| 876 | static char blk[BLOCK_SIZE]; | 877 | static char blk[BLOCK_SIZE]; |
| 877 | int i, chg_blk = 0; | 878 | int i; |
| 878 | int block; | 879 | int block; |
| 880 | smallint chg_blk = 0; | ||
| 879 | 881 | ||
| 880 | block = add_zone(znr, corrected); | 882 | block = add_zone(znr, corrected); |
| 881 | if (!block) | 883 | if (!block) |
| @@ -888,11 +890,12 @@ static void add_zone_ind(uint16_t *znr, int *corrected) | |||
| 888 | } | 890 | } |
| 889 | 891 | ||
| 890 | #ifdef CONFIG_FEATURE_MINIX2 | 892 | #ifdef CONFIG_FEATURE_MINIX2 |
| 891 | static void add_zone_ind2(uint32_t *znr, int *corrected) | 893 | static void add_zone_ind2(uint32_t *znr, smallint *corrected) |
| 892 | { | 894 | { |
| 893 | static char blk[BLOCK_SIZE]; | 895 | static char blk[BLOCK_SIZE]; |
| 894 | int i, chg_blk = 0; | 896 | int i; |
| 895 | int block; | 897 | int block; |
| 898 | smallint chg_blk = 0; | ||
| 896 | 899 | ||
| 897 | block = add_zone2(znr, corrected); | 900 | block = add_zone2(znr, corrected); |
| 898 | if (!block) | 901 | if (!block) |
| @@ -905,52 +908,55 @@ static void add_zone_ind2(uint32_t *znr, int *corrected) | |||
| 905 | } | 908 | } |
| 906 | #endif | 909 | #endif |
| 907 | 910 | ||
| 908 | static void add_zone_dind(uint16_t *znr, int *corrected) | 911 | static void add_zone_dind(uint16_t *znr, smallint *corrected) |
| 909 | { | 912 | { |
| 910 | static char blk[BLOCK_SIZE]; | 913 | static char blk[BLOCK_SIZE]; |
| 911 | int i, blk_chg = 0; | 914 | int i; |
| 912 | int block; | 915 | int block; |
| 916 | smallint chg_blk = 0; | ||
| 913 | 917 | ||
| 914 | block = add_zone(znr, corrected); | 918 | block = add_zone(znr, corrected); |
| 915 | if (!block) | 919 | if (!block) |
| 916 | return; | 920 | return; |
| 917 | read_block(block, blk); | 921 | read_block(block, blk); |
| 918 | for (i = 0; i < (BLOCK_SIZE >> 1); i++) | 922 | for (i = 0; i < (BLOCK_SIZE >> 1); i++) |
| 919 | add_zone_ind(i + (uint16_t *) blk, &blk_chg); | 923 | add_zone_ind(i + (uint16_t *) blk, &chg_blk); |
| 920 | if (blk_chg) | 924 | if (chg_blk) |
| 921 | write_block(block, blk); | 925 | write_block(block, blk); |
| 922 | } | 926 | } |
| 923 | 927 | ||
| 924 | #ifdef CONFIG_FEATURE_MINIX2 | 928 | #ifdef CONFIG_FEATURE_MINIX2 |
| 925 | static void add_zone_dind2(uint32_t *znr, int *corrected) | 929 | static void add_zone_dind2(uint32_t *znr, smallint *corrected) |
| 926 | { | 930 | { |
| 927 | static char blk[BLOCK_SIZE]; | 931 | static char blk[BLOCK_SIZE]; |
| 928 | int i, blk_chg = 0; | 932 | int i; |
| 929 | int block; | 933 | int block; |
| 934 | smallint chg_blk = 0; | ||
| 930 | 935 | ||
| 931 | block = add_zone2(znr, corrected); | 936 | block = add_zone2(znr, corrected); |
| 932 | if (!block) | 937 | if (!block) |
| 933 | return; | 938 | return; |
| 934 | read_block(block, blk); | 939 | read_block(block, blk); |
| 935 | for (i = 0; i < BLOCK_SIZE >> 2; i++) | 940 | for (i = 0; i < BLOCK_SIZE >> 2; i++) |
| 936 | add_zone_ind2(i + (uint32_t *) blk, &blk_chg); | 941 | add_zone_ind2(i + (uint32_t *) blk, &chg_blk); |
| 937 | if (blk_chg) | 942 | if (chg_blk) |
| 938 | write_block(block, blk); | 943 | write_block(block, blk); |
| 939 | } | 944 | } |
| 940 | 945 | ||
| 941 | static void add_zone_tind2(uint32_t *znr, int *corrected) | 946 | static void add_zone_tind2(uint32_t *znr, smallint *corrected) |
| 942 | { | 947 | { |
| 943 | static char blk[BLOCK_SIZE]; | 948 | static char blk[BLOCK_SIZE]; |
| 944 | int i, blk_chg = 0; | 949 | int i; |
| 945 | int block; | 950 | int block; |
| 951 | smallint chg_blk = 0; | ||
| 946 | 952 | ||
| 947 | block = add_zone2(znr, corrected); | 953 | block = add_zone2(znr, corrected); |
| 948 | if (!block) | 954 | if (!block) |
| 949 | return; | 955 | return; |
| 950 | read_block(block, blk); | 956 | read_block(block, blk); |
| 951 | for (i = 0; i < BLOCK_SIZE >> 2; i++) | 957 | for (i = 0; i < BLOCK_SIZE >> 2; i++) |
| 952 | add_zone_dind2(i + (uint32_t *) blk, &blk_chg); | 958 | add_zone_dind2(i + (uint32_t *) blk, &chg_blk); |
| 953 | if (blk_chg) | 959 | if (chg_blk) |
| 954 | write_block(block, blk); | 960 | write_block(block, blk); |
| 955 | } | 961 | } |
| 956 | #endif | 962 | #endif |
| @@ -1043,7 +1049,6 @@ static void check_file(struct minix_inode *dir, unsigned int offset) | |||
| 1043 | if (inode && S_ISDIR(inode->i_mode)) | 1049 | if (inode && S_ISDIR(inode->i_mode)) |
| 1044 | recursive_check(ino); | 1050 | recursive_check(ino); |
| 1045 | pop_filename(); | 1051 | pop_filename(); |
| 1046 | return; | ||
| 1047 | } | 1052 | } |
| 1048 | 1053 | ||
| 1049 | #ifdef CONFIG_FEATURE_MINIX2 | 1054 | #ifdef CONFIG_FEATURE_MINIX2 |
| @@ -1097,7 +1102,6 @@ static void check_file2(struct minix2_inode *dir, unsigned int offset) | |||
| 1097 | if (inode && S_ISDIR(inode->i_mode)) | 1102 | if (inode && S_ISDIR(inode->i_mode)) |
| 1098 | recursive_check2(ino); | 1103 | recursive_check2(ino); |
| 1099 | pop_filename(); | 1104 | pop_filename(); |
| 1100 | return; | ||
| 1101 | } | 1105 | } |
| 1102 | #endif | 1106 | #endif |
| 1103 | 1107 | ||
| @@ -1108,7 +1112,7 @@ static void recursive_check(unsigned int ino) | |||
| 1108 | 1112 | ||
| 1109 | dir = Inode + ino; | 1113 | dir = Inode + ino; |
| 1110 | if (!S_ISDIR(dir->i_mode)) | 1114 | if (!S_ISDIR(dir->i_mode)) |
| 1111 | die("Internal error"); | 1115 | die("internal error"); |
| 1112 | if (dir->i_size < 2 * dirsize) { | 1116 | if (dir->i_size < 2 * dirsize) { |
| 1113 | printf("%s: bad directory: size<32", current_name); | 1117 | printf("%s: bad directory: size<32", current_name); |
| 1114 | errors_uncorrected = 1; | 1118 | errors_uncorrected = 1; |
| @@ -1125,7 +1129,7 @@ static void recursive_check2(unsigned int ino) | |||
| 1125 | 1129 | ||
| 1126 | dir = Inode2 + ino; | 1130 | dir = Inode2 + ino; |
| 1127 | if (!S_ISDIR(dir->i_mode)) | 1131 | if (!S_ISDIR(dir->i_mode)) |
| 1128 | die("Internal error"); | 1132 | die("internal error"); |
| 1129 | if (dir->i_size < 2 * dirsize) { | 1133 | if (dir->i_size < 2 * dirsize) { |
| 1130 | printf("%s: bad directory: size<32", current_name); | 1134 | printf("%s: bad directory: size<32", current_name); |
| 1131 | errors_uncorrected = 1; | 1135 | errors_uncorrected = 1; |
| @@ -1140,7 +1144,7 @@ static int bad_zone(int i) | |||
| 1140 | char buffer[1024]; | 1144 | char buffer[1024]; |
| 1141 | 1145 | ||
| 1142 | if (BLOCK_SIZE * i != lseek(IN, BLOCK_SIZE * i, SEEK_SET)) | 1146 | if (BLOCK_SIZE * i != lseek(IN, BLOCK_SIZE * i, SEEK_SET)) |
| 1143 | die("Seek failed in bad_zone"); | 1147 | die("seek failed in bad_zone"); |
| 1144 | return (BLOCK_SIZE != read(IN, buffer, BLOCK_SIZE)); | 1148 | return (BLOCK_SIZE != read(IN, buffer, BLOCK_SIZE)); |
| 1145 | } | 1149 | } |
| 1146 | 1150 | ||
| @@ -1280,10 +1284,10 @@ int fsck_minix_main(int argc, char **argv) | |||
| 1280 | #endif | 1284 | #endif |
| 1281 | 1285 | ||
| 1282 | if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) | 1286 | if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) |
| 1283 | die("Bad inode size"); | 1287 | die("bad inode size"); |
| 1284 | #ifdef CONFIG_FEATURE_MINIX2 | 1288 | #ifdef CONFIG_FEATURE_MINIX2 |
| 1285 | if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) | 1289 | if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) |
| 1286 | die("Bad v2 inode size"); | 1290 | die("bad v2 inode size"); |
| 1287 | #endif | 1291 | #endif |
| 1288 | while (argc-- > 1) { | 1292 | while (argc-- > 1) { |
| 1289 | argv++; | 1293 | argv++; |
| @@ -1327,11 +1331,11 @@ int fsck_minix_main(int argc, char **argv) | |||
| 1327 | check_mount(); /* trying to check a mounted filesystem? */ | 1331 | check_mount(); /* trying to check a mounted filesystem? */ |
| 1328 | if (repair && !automatic) { | 1332 | if (repair && !automatic) { |
| 1329 | if (!isatty(0) || !isatty(1)) | 1333 | if (!isatty(0) || !isatty(1)) |
| 1330 | die("Need terminal for interactive repairs"); | 1334 | die("need terminal for interactive repairs"); |
| 1331 | } | 1335 | } |
| 1332 | IN = open(device_name, repair ? O_RDWR : O_RDONLY); | 1336 | IN = open(device_name, repair ? O_RDWR : O_RDONLY); |
| 1333 | if (IN < 0){ | 1337 | if (IN < 0) { |
| 1334 | printf("Unable to open device '%s'\n", device_name); | 1338 | printf("unable to open device '%s'\n", device_name); |
| 1335 | leave(8); | 1339 | leave(8); |
| 1336 | } | 1340 | } |
| 1337 | sync(); /* paranoia? */ | 1341 | sync(); /* paranoia? */ |
| @@ -1344,8 +1348,9 @@ int fsck_minix_main(int argc, char **argv) | |||
| 1344 | * command line. | 1348 | * command line. |
| 1345 | */ | 1349 | */ |
| 1346 | printf("%s, %s\n", applet_name, program_version); | 1350 | printf("%s, %s\n", applet_name, program_version); |
| 1347 | if (!(Super.s_state & MINIX_ERROR_FS) && | 1351 | if (!(Super.s_state & MINIX_ERROR_FS) |
| 1348 | (Super.s_state & MINIX_VALID_FS) && !force) { | 1352 | && (Super.s_state & MINIX_VALID_FS) && !force |
| 1353 | ) { | ||
| 1349 | if (repair) | 1354 | if (repair) |
| 1350 | printf("%s is clean, check is skipped\n", device_name); | 1355 | printf("%s is clean, check is skipped\n", device_name); |
| 1351 | return retcode; | 1356 | return retcode; |
