diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-03 00:43:19 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-03 00:43:19 +0000 |
| commit | aa95959cb81b72d37ce1f20606f97e064bbd2bfe (patch) | |
| tree | cdc5e820c8363c08e6950d2ebae5dae904b4d2ee /util-linux | |
| parent | 6dd392a2520ee226d8f8535c449454f4ed5a08a5 (diff) | |
| download | busybox-w32-aa95959cb81b72d37ce1f20606f97e064bbd2bfe.tar.gz busybox-w32-aa95959cb81b72d37ce1f20606f97e064bbd2bfe.tar.bz2 busybox-w32-aa95959cb81b72d37ce1f20606f97e064bbd2bfe.zip | |
factor out minix structures/constants into minix.h
fsck_minix: optimizations
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/fsck_minix.c | 322 | ||||
| -rw-r--r-- | util-linux/mkfs_minix.c | 75 |
2 files changed, 133 insertions, 264 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 44bcd332f..ebfd645f2 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
| @@ -90,146 +90,83 @@ | |||
| 90 | #include "busybox.h" | 90 | #include "busybox.h" |
| 91 | #include <mntent.h> | 91 | #include <mntent.h> |
| 92 | 92 | ||
| 93 | /* | 93 | #include "minix.h" |
| 94 | * This is the original minix inode layout on disk. | ||
| 95 | * Note the 8-bit gid and atime and ctime. | ||
| 96 | */ | ||
| 97 | struct minix_inode { | ||
| 98 | uint16_t i_mode; | ||
| 99 | uint16_t i_uid; | ||
| 100 | uint32_t i_size; | ||
| 101 | uint32_t i_time; | ||
| 102 | uint8_t i_gid; | ||
| 103 | uint8_t i_nlinks; | ||
| 104 | uint16_t i_zone[9]; | ||
| 105 | }; | ||
| 106 | 94 | ||
| 107 | /* | 95 | #ifndef BLKGETSIZE |
| 108 | * The new minix inode has all the time entries, as well as | 96 | #define BLKGETSIZE _IO(0x12,96) /* return device size */ |
| 109 | * long block numbers and a third indirect block (7+1+1+1 | 97 | #endif |
| 110 | * instead of 7+1+1). Also, some previously 8-bit values are | ||
| 111 | * now 16-bit. The inode is now 64 bytes instead of 32. | ||
| 112 | */ | ||
| 113 | struct minix2_inode { | ||
| 114 | uint16_t i_mode; | ||
| 115 | uint16_t i_nlinks; | ||
| 116 | uint16_t i_uid; | ||
| 117 | uint16_t i_gid; | ||
| 118 | uint32_t i_size; | ||
| 119 | uint32_t i_atime; | ||
| 120 | uint32_t i_mtime; | ||
| 121 | uint32_t i_ctime; | ||
| 122 | uint32_t i_zone[10]; | ||
| 123 | }; | ||
| 124 | 98 | ||
| 125 | /* Believe it or not, but mount.h has this one */ | 99 | #ifdef UNUSED |
| 126 | #undef BLOCK_SIZE | ||
| 127 | enum { | 100 | enum { |
| 128 | BLOCK_SIZE = 1024, | 101 | MINIX1_LINK_MAX = 250, |
| 129 | |||
| 130 | MINIX_ROOT_INO = 1, | ||
| 131 | MINIX_LINK_MAX = 250, | ||
| 132 | MINIX2_LINK_MAX = 65530, | 102 | MINIX2_LINK_MAX = 65530, |
| 133 | |||
| 134 | MINIX_I_MAP_SLOTS = 8, | 103 | MINIX_I_MAP_SLOTS = 8, |
| 135 | MINIX_Z_MAP_SLOTS = 64, | 104 | MINIX_Z_MAP_SLOTS = 64, |
| 136 | MINIX_SUPER_MAGIC = 0x137F, /* original minix fs */ | 105 | MINIX_V1 = 0x0001, /* original minix fs */ |
| 137 | MINIX_SUPER_MAGIC2 = 0x138F, /* minix fs, 30 char names */ | 106 | MINIX_V2 = 0x0002, /* minix V2 fs */ |
| 138 | MINIX2_SUPER_MAGIC = 0x2468, /* minix V2 fs */ | 107 | NAME_MAX = 255, /* # chars in a file name */ |
| 139 | MINIX2_SUPER_MAGIC2 = 0x2478, /* minix V2 fs, 30 char names */ | ||
| 140 | MINIX_VALID_FS = 0x0001, /* Clean fs. */ | ||
| 141 | MINIX_ERROR_FS = 0x0002, /* fs has errors. */ | ||
| 142 | |||
| 143 | MINIX_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix_inode))), | ||
| 144 | MINIX2_INODES_PER_BLOCK = ((BLOCK_SIZE)/(sizeof (struct minix2_inode))), | ||
| 145 | |||
| 146 | MINIX_V1 = 0x0001, /* original minix fs */ | ||
| 147 | MINIX_V2 = 0x0002 /* minix V2 fs */ | ||
| 148 | }; | ||
| 149 | |||
| 150 | #define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version | ||
| 151 | |||
| 152 | /* | ||
| 153 | * minix super-block data on disk | ||
| 154 | */ | ||
| 155 | struct minix_super_block { | ||
| 156 | uint16_t s_ninodes; | ||
| 157 | uint16_t s_nzones; | ||
| 158 | uint16_t s_imap_blocks; | ||
| 159 | uint16_t s_zmap_blocks; | ||
| 160 | uint16_t s_firstdatazone; | ||
| 161 | uint16_t s_log_zone_size; | ||
| 162 | uint32_t s_max_size; | ||
| 163 | uint16_t s_magic; | ||
| 164 | uint16_t s_state; | ||
| 165 | uint32_t s_zones; | ||
| 166 | }; | ||
| 167 | |||
| 168 | struct minix_dir_entry { | ||
| 169 | uint16_t inode; | ||
| 170 | char name[0]; | ||
| 171 | }; | 108 | }; |
| 172 | |||
| 173 | |||
| 174 | #define NAME_MAX 255 /* # chars in a file name */ | ||
| 175 | |||
| 176 | #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) | ||
| 177 | |||
| 178 | #ifndef BLKGETSIZE | ||
| 179 | #define BLKGETSIZE _IO(0x12,96) /* return device size */ | ||
| 180 | #endif | 109 | #endif |
| 181 | 110 | ||
| 182 | enum { ROOT_INO = 1 }; | 111 | #if ENABLE_FEATURE_MINIX2 |
| 183 | 112 | static smallint version2; | |
| 184 | #define UPPER(size,n) ((size+((n)-1))/(n)) | ||
| 185 | #define INODE_SIZE (sizeof(struct minix_inode)) | ||
| 186 | #ifdef CONFIG_FEATURE_MINIX2 | ||
| 187 | #define INODE_SIZE2 (sizeof(struct minix2_inode)) | ||
| 188 | #define INODE_BLOCKS UPPER(INODES, (version2 ? MINIX2_INODES_PER_BLOCK \ | ||
| 189 | : MINIX_INODES_PER_BLOCK)) | ||
| 190 | #else | 113 | #else |
| 191 | #define INODE_BLOCKS UPPER(INODES, (MINIX_INODES_PER_BLOCK)) | 114 | enum { version2 = 0 }; |
| 192 | #endif | 115 | #endif |
| 193 | #define INODE_BUFFER_SIZE (INODE_BLOCKS * BLOCK_SIZE) | ||
| 194 | |||
| 195 | #define BITS_PER_BLOCK (BLOCK_SIZE<<3) | ||
| 196 | 116 | ||
| 197 | #define PROGRAM_VERSION "1.2 - 11/11/96" | 117 | #define PROGRAM_VERSION "1.2 - 11/11/96" |
| 198 | static char *device_name; | ||
| 199 | static int IN; | ||
| 200 | static smallint repair, automatic, verbose, list, show, warn_mode, force; | 118 | static smallint repair, automatic, verbose, list, show, warn_mode, force; |
| 201 | static int directory, regular, blockdev, chardev, links, symlinks, total; | 119 | static smallint changed; /* is filesystem modified? */ |
| 120 | static smallint errors_uncorrected; /* flag if some error was not corrected */ | ||
| 202 | 121 | ||
| 203 | static struct termios termios; | ||
| 204 | static smallint termios_set; | 122 | static smallint termios_set; |
| 123 | static struct termios termios; | ||
| 124 | |||
| 125 | static char *device_name; | ||
| 126 | static int IN; | ||
| 127 | static int directory, regular, blockdev, chardev, links, symlinks, total; | ||
| 205 | 128 | ||
| 206 | static smallint changed; /* flags if the filesystem has been changed */ | ||
| 207 | static smallint errors_uncorrected; /* flag if some error was not corrected */ | ||
| 208 | //also smallint? | 129 | //also smallint? |
| 209 | static int dirsize = 16; | 130 | static int dirsize = 16; |
| 210 | static int namelen = 14; | 131 | static int namelen = 14; |
| 211 | 132 | ||
| 212 | static char *inode_buffer; | 133 | static char *inode_buffer; |
| 213 | #define Inode (((struct minix_inode *) inode_buffer)-1) | ||
| 214 | #define Inode2 (((struct minix2_inode *) inode_buffer)-1) | ||
| 215 | //xzalloc? | 134 | //xzalloc? |
| 216 | static char super_block_buffer[BLOCK_SIZE]; | 135 | static char super_block_buffer[BLOCK_SIZE]; |
| 217 | 136 | ||
| 137 | #define Inode1 (((struct minix1_inode *) inode_buffer)-1) | ||
| 138 | #define Inode2 (((struct minix2_inode *) inode_buffer)-1) | ||
| 139 | |||
| 218 | #define Super (*(struct minix_super_block *)super_block_buffer) | 140 | #define Super (*(struct minix_super_block *)super_block_buffer) |
| 219 | #define INODES ((unsigned long)Super.s_ninodes) | 141 | |
| 220 | #ifdef CONFIG_FEATURE_MINIX2 | 142 | #if ENABLE_FEATURE_MINIX2 |
| 221 | static smallint version2; | 143 | # define ZONES ((unsigned)(version2 ? Super.s_zones : Super.s_nzones)) |
| 222 | #define ZONES ((unsigned long)(version2 ? Super.s_zones : Super.s_nzones)) | ||
| 223 | #else | 144 | #else |
| 224 | #define ZONES ((unsigned long)(Super.s_nzones)) | 145 | # define ZONES ((unsigned)(Super.s_nzones)) |
| 146 | #endif | ||
| 147 | #define INODES ((unsigned)Super.s_ninodes) | ||
| 148 | #define IMAPS ((unsigned)Super.s_imap_blocks) | ||
| 149 | #define ZMAPS ((unsigned)Super.s_zmap_blocks) | ||
| 150 | #define FIRSTZONE ((unsigned)Super.s_firstdatazone) | ||
| 151 | #define ZONESIZE ((unsigned)Super.s_log_zone_size) | ||
| 152 | #define MAXSIZE ((unsigned)Super.s_max_size) | ||
| 153 | #define MAGIC (Super.s_magic) | ||
| 154 | |||
| 155 | /* gcc likes this more (code is smaller) than macro variant */ | ||
| 156 | static ATTRIBUTE_ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n) | ||
| 157 | { | ||
| 158 | return (size + n-1) / n; | ||
| 159 | } | ||
| 160 | |||
| 161 | #if ENABLE_FEATURE_MINIX2 | ||
| 162 | #define INODE_BLOCKS div_roundup(INODES, (version2 ? MINIX2_INODES_PER_BLOCK \ | ||
| 163 | : MINIX1_INODES_PER_BLOCK)) | ||
| 164 | #else | ||
| 165 | #define INODE_BLOCKS div_roundup(INODES, MINIX1_INODES_PER_BLOCK) | ||
| 225 | #endif | 166 | #endif |
| 226 | #define IMAPS ((unsigned long)Super.s_imap_blocks) | 167 | |
| 227 | #define ZMAPS ((unsigned long)Super.s_zmap_blocks) | 168 | #define INODE_BUFFER_SIZE (INODE_BLOCKS * BLOCK_SIZE) |
| 228 | #define FIRSTZONE ((unsigned long)Super.s_firstdatazone) | 169 | #define NORM_FIRSTZONE (2 + IMAPS + ZMAPS + INODE_BLOCKS) |
| 229 | #define ZONESIZE ((unsigned long)Super.s_log_zone_size) | ||
| 230 | #define MAXSIZE ((unsigned long)Super.s_max_size) | ||
| 231 | #define MAGIC (Super.s_magic) | ||
| 232 | #define NORM_FIRSTZONE (2+IMAPS+ZMAPS+INODE_BLOCKS) | ||
| 233 | 170 | ||
| 234 | static char *inode_map; | 171 | static char *inode_map; |
| 235 | static char *zone_map; | 172 | static char *zone_map; |
| @@ -237,15 +174,11 @@ static char *zone_map; | |||
| 237 | static unsigned char *inode_count; | 174 | static unsigned char *inode_count; |
| 238 | static unsigned char *zone_count; | 175 | static unsigned char *zone_count; |
| 239 | 176 | ||
| 240 | static void recursive_check(unsigned int ino); | ||
| 241 | #ifdef CONFIG_FEATURE_MINIX2 | ||
| 242 | static void recursive_check2(unsigned int ino); | ||
| 243 | #endif | ||
| 244 | |||
| 245 | static int bit(char *a, unsigned int i) | 177 | static int bit(char *a, unsigned int i) |
| 246 | { | 178 | { |
| 247 | return (a[i >> 3] & (1<<(i & 7))) != 0; | 179 | return (a[i >> 3] & (1<<(i & 7))) != 0; |
| 248 | } | 180 | } |
| 181 | |||
| 249 | #define inode_in_use(x) (bit(inode_map,(x))) | 182 | #define inode_in_use(x) (bit(inode_map,(x))) |
| 250 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) | 183 | #define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1)) |
| 251 | 184 | ||
| @@ -255,6 +188,12 @@ static int bit(char *a, unsigned int i) | |||
| 255 | #define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1),changed=1) | 188 | #define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1),changed=1) |
| 256 | #define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1),changed=1) | 189 | #define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1),changed=1) |
| 257 | 190 | ||
| 191 | |||
| 192 | static void recursive_check(unsigned int ino); | ||
| 193 | #if ENABLE_FEATURE_MINIX2 | ||
| 194 | static void recursive_check2(unsigned int ino); | ||
| 195 | #endif | ||
| 196 | |||
| 258 | static void leave(int) ATTRIBUTE_NORETURN; | 197 | static void leave(int) ATTRIBUTE_NORETURN; |
| 259 | static void leave(int status) | 198 | static void leave(int status) |
| 260 | { | 199 | { |
| @@ -285,7 +224,7 @@ static void alloc_current_name(void) | |||
| 285 | name_component[0] = ¤t_name[0]; | 224 | name_component[0] = ¤t_name[0]; |
| 286 | } | 225 | } |
| 287 | 226 | ||
| 288 | #ifdef CONFIG_FEATURE_CLEAN_UP | 227 | #if ENABLE_FEATURE_CLEAN_UP |
| 289 | /* execute this atexit() to deallocate name_list[] */ | 228 | /* execute this atexit() to deallocate name_list[] */ |
| 290 | /* piptigger was here */ | 229 | /* piptigger was here */ |
| 291 | static void free_current_name(void) | 230 | static void free_current_name(void) |
| @@ -488,7 +427,7 @@ static void write_block(unsigned int nr, char *addr) | |||
| 488 | * It sets 'changed' if the inode has needed changing, and re-writes | 427 | * It sets 'changed' if the inode has needed changing, and re-writes |
| 489 | * any indirect blocks with errors. | 428 | * any indirect blocks with errors. |
| 490 | */ | 429 | */ |
| 491 | static int map_block(struct minix_inode *inode, unsigned int blknr) | 430 | static int map_block(struct minix1_inode *inode, unsigned int blknr) |
| 492 | { | 431 | { |
| 493 | uint16_t ind[BLOCK_SIZE >> 1]; | 432 | uint16_t ind[BLOCK_SIZE >> 1]; |
| 494 | uint16_t dind[BLOCK_SIZE >> 1]; | 433 | uint16_t dind[BLOCK_SIZE >> 1]; |
| @@ -523,7 +462,7 @@ static int map_block(struct minix_inode *inode, unsigned int blknr) | |||
| 523 | return result; | 462 | return result; |
| 524 | } | 463 | } |
| 525 | 464 | ||
| 526 | #ifdef CONFIG_FEATURE_MINIX2 | 465 | #if ENABLE_FEATURE_MINIX2 |
| 527 | static int map_block2(struct minix2_inode *inode, unsigned int blknr) | 466 | static int map_block2(struct minix2_inode *inode, unsigned int blknr) |
| 528 | { | 467 | { |
| 529 | uint32_t ind[BLOCK_SIZE >> 2]; | 468 | uint32_t ind[BLOCK_SIZE >> 2]; |
| @@ -618,12 +557,12 @@ static void get_dirsize(void) | |||
| 618 | char blk[BLOCK_SIZE]; | 557 | char blk[BLOCK_SIZE]; |
| 619 | int size; | 558 | int size; |
| 620 | 559 | ||
| 621 | #ifdef CONFIG_FEATURE_MINIX2 | 560 | #if ENABLE_FEATURE_MINIX2 |
| 622 | if (version2) | 561 | if (version2) |
| 623 | block = Inode2[ROOT_INO].i_zone[0]; | 562 | block = Inode2[MINIX_ROOT_INO].i_zone[0]; |
| 624 | else | 563 | else |
| 625 | #endif | 564 | #endif |
| 626 | block = Inode[ROOT_INO].i_zone[0]; | 565 | block = Inode1[MINIX_ROOT_INO].i_zone[0]; |
| 627 | read_block(block, blk); | 566 | read_block(block, blk); |
| 628 | for (size = 16; size < BLOCK_SIZE; size <<= 1) { | 567 | for (size = 16; size < BLOCK_SIZE; size <<= 1) { |
| 629 | if (strcmp(blk + size + 2, "..") == 0) { | 568 | if (strcmp(blk + size + 2, "..") == 0) { |
| @@ -646,11 +585,11 @@ static void read_superblock(void) | |||
| 646 | dirsize = 16; | 585 | dirsize = 16; |
| 647 | version2 = 0; | 586 | version2 = 0; |
| 648 | */ | 587 | */ |
| 649 | if (MAGIC == MINIX_SUPER_MAGIC) { | 588 | if (MAGIC == MINIX1_SUPER_MAGIC) { |
| 650 | } else if (MAGIC == MINIX_SUPER_MAGIC2) { | 589 | } else if (MAGIC == MINIX1_SUPER_MAGIC2) { |
| 651 | namelen = 30; | 590 | namelen = 30; |
| 652 | dirsize = 32; | 591 | dirsize = 32; |
| 653 | #ifdef CONFIG_FEATURE_MINIX2 | 592 | #if ENABLE_FEATURE_MINIX2 |
| 654 | } else if (MAGIC == MINIX2_SUPER_MAGIC) { | 593 | } else if (MAGIC == MINIX2_SUPER_MAGIC) { |
| 655 | version2 = 1; | 594 | version2 = 1; |
| 656 | } else if (MAGIC == MINIX2_SUPER_MAGIC2) { | 595 | } else if (MAGIC == MINIX2_SUPER_MAGIC2) { |
| @@ -687,13 +626,13 @@ static void read_tables(void) | |||
| 687 | } | 626 | } |
| 688 | get_dirsize(); | 627 | get_dirsize(); |
| 689 | if (show) { | 628 | if (show) { |
| 690 | printf("%ld inodes\n" | 629 | printf("%u inodes\n" |
| 691 | "%ld blocks\n" | 630 | "%u blocks\n" |
| 692 | "Firstdatazone=%ld (%ld)\n" | 631 | "Firstdatazone=%u (%u)\n" |
| 693 | "Zonesize=%d\n" | 632 | "Zonesize=%u\n" |
| 694 | "Maxsize=%ld\n" | 633 | "Maxsize=%u\n" |
| 695 | "Filesystem state=%d\n" | 634 | "Filesystem state=%u\n" |
| 696 | "namelen=%d\n\n", | 635 | "namelen=%u\n\n", |
| 697 | INODES, | 636 | INODES, |
| 698 | ZONES, | 637 | ZONES, |
| 699 | FIRSTZONE, NORM_FIRSTZONE, | 638 | FIRSTZONE, NORM_FIRSTZONE, |
| @@ -704,17 +643,17 @@ static void read_tables(void) | |||
| 704 | } | 643 | } |
| 705 | } | 644 | } |
| 706 | 645 | ||
| 707 | static struct minix_inode *get_inode(unsigned int nr) | 646 | static struct minix1_inode *get_inode(unsigned int nr) |
| 708 | { | 647 | { |
| 709 | struct minix_inode *inode; | 648 | struct minix1_inode *inode; |
| 710 | 649 | ||
| 711 | if (!nr || nr > INODES) | 650 | if (!nr || nr > INODES) |
| 712 | return NULL; | 651 | return NULL; |
| 713 | total++; | 652 | total++; |
| 714 | inode = Inode + nr; | 653 | inode = Inode1 + nr; |
| 715 | if (!inode_count[nr]) { | 654 | if (!inode_count[nr]) { |
| 716 | if (!inode_in_use(nr)) { | 655 | if (!inode_in_use(nr)) { |
| 717 | printf("Inode %d is marked as 'unused', but it is used " | 656 | printf("Inode1 %d is marked as 'unused', but it is used " |
| 718 | "for file '%s'\n", nr, current_name); | 657 | "for file '%s'\n", nr, current_name); |
| 719 | if (repair) { | 658 | if (repair) { |
| 720 | if (ask("Mark as 'in use'", 1)) | 659 | if (ask("Mark as 'in use'", 1)) |
| @@ -749,7 +688,7 @@ static struct minix_inode *get_inode(unsigned int nr) | |||
| 749 | return inode; | 688 | return inode; |
| 750 | } | 689 | } |
| 751 | 690 | ||
| 752 | #ifdef CONFIG_FEATURE_MINIX2 | 691 | #if ENABLE_FEATURE_MINIX2 |
| 753 | static struct minix2_inode *get_inode2(unsigned int nr) | 692 | static struct minix2_inode *get_inode2(unsigned int nr) |
| 754 | { | 693 | { |
| 755 | struct minix2_inode *inode; | 694 | struct minix2_inode *inode; |
| @@ -760,7 +699,7 @@ static struct minix2_inode *get_inode2(unsigned int nr) | |||
| 760 | inode = Inode2 + nr; | 699 | inode = Inode2 + nr; |
| 761 | if (!inode_count[nr]) { | 700 | if (!inode_count[nr]) { |
| 762 | if (!inode_in_use(nr)) { | 701 | if (!inode_in_use(nr)) { |
| 763 | printf("Inode %d is marked as 'unused', but it is used " | 702 | printf("Inode1 %d is marked as 'unused', but it is used " |
| 764 | "for file '%s'\n", nr, current_name); | 703 | "for file '%s'\n", nr, current_name); |
| 765 | if (repair) { | 704 | if (repair) { |
| 766 | if (ask("Mark as 'in use'", 1)) | 705 | if (ask("Mark as 'in use'", 1)) |
| @@ -797,20 +736,22 @@ static struct minix2_inode *get_inode2(unsigned int nr) | |||
| 797 | 736 | ||
| 798 | static void check_root(void) | 737 | static void check_root(void) |
| 799 | { | 738 | { |
| 800 | struct minix_inode *inode = Inode + ROOT_INO; | 739 | struct minix1_inode *inode = Inode1 + MINIX_ROOT_INO; |
| 801 | 740 | ||
| 802 | if (!inode || !S_ISDIR(inode->i_mode)) | 741 | if (!inode || !S_ISDIR(inode->i_mode)) |
| 803 | die("root inode isn't a directory"); | 742 | die("root inode isn't a directory"); |
| 804 | } | 743 | } |
| 805 | 744 | ||
| 806 | #ifdef CONFIG_FEATURE_MINIX2 | 745 | #if ENABLE_FEATURE_MINIX2 |
| 807 | static void check_root2(void) | 746 | static void check_root2(void) |
| 808 | { | 747 | { |
| 809 | struct minix2_inode *inode = Inode2 + ROOT_INO; | 748 | struct minix2_inode *inode = Inode2 + MINIX_ROOT_INO; |
| 810 | 749 | ||
| 811 | if (!inode || !S_ISDIR(inode->i_mode)) | 750 | if (!inode || !S_ISDIR(inode->i_mode)) |
| 812 | die("root inode isn't a directory"); | 751 | die("root inode isn't a directory"); |
| 813 | } | 752 | } |
| 753 | #else | ||
| 754 | void check_root2(void); | ||
| 814 | #endif | 755 | #endif |
| 815 | 756 | ||
| 816 | static int add_zone(uint16_t *znr, smallint *corrected) | 757 | static int add_zone(uint16_t *znr, smallint *corrected) |
| @@ -843,7 +784,7 @@ static int add_zone(uint16_t *znr, smallint *corrected) | |||
| 843 | return block; | 784 | return block; |
| 844 | } | 785 | } |
| 845 | 786 | ||
| 846 | #ifdef CONFIG_FEATURE_MINIX2 | 787 | #if ENABLE_FEATURE_MINIX2 |
| 847 | static int add_zone2(uint32_t *znr, smallint *corrected) | 788 | static int add_zone2(uint32_t *znr, smallint *corrected) |
| 848 | { | 789 | { |
| 849 | int result; | 790 | int result; |
| @@ -892,7 +833,7 @@ static void add_zone_ind(uint16_t *znr, smallint *corrected) | |||
| 892 | write_block(block, blk); | 833 | write_block(block, blk); |
| 893 | } | 834 | } |
| 894 | 835 | ||
| 895 | #ifdef CONFIG_FEATURE_MINIX2 | 836 | #if ENABLE_FEATURE_MINIX2 |
| 896 | static void add_zone_ind2(uint32_t *znr, smallint *corrected) | 837 | static void add_zone_ind2(uint32_t *znr, smallint *corrected) |
| 897 | { | 838 | { |
| 898 | static char blk[BLOCK_SIZE]; | 839 | static char blk[BLOCK_SIZE]; |
| @@ -928,7 +869,7 @@ static void add_zone_dind(uint16_t *znr, smallint *corrected) | |||
| 928 | write_block(block, blk); | 869 | write_block(block, blk); |
| 929 | } | 870 | } |
| 930 | 871 | ||
| 931 | #ifdef CONFIG_FEATURE_MINIX2 | 872 | #if ENABLE_FEATURE_MINIX2 |
| 932 | static void add_zone_dind2(uint32_t *znr, smallint *corrected) | 873 | static void add_zone_dind2(uint32_t *znr, smallint *corrected) |
| 933 | { | 874 | { |
| 934 | static char blk[BLOCK_SIZE]; | 875 | static char blk[BLOCK_SIZE]; |
| @@ -966,13 +907,13 @@ static void add_zone_tind2(uint32_t *znr, smallint *corrected) | |||
| 966 | 907 | ||
| 967 | static void check_zones(unsigned int i) | 908 | static void check_zones(unsigned int i) |
| 968 | { | 909 | { |
| 969 | struct minix_inode *inode; | 910 | struct minix1_inode *inode; |
| 970 | 911 | ||
| 971 | if (!i || i > INODES) | 912 | if (!i || i > INODES) |
| 972 | return; | 913 | return; |
| 973 | if (inode_count[i] > 1) /* have we counted this file already? */ | 914 | if (inode_count[i] > 1) /* have we counted this file already? */ |
| 974 | return; | 915 | return; |
| 975 | inode = Inode + i; | 916 | inode = Inode1 + i; |
| 976 | if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) && | 917 | if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) && |
| 977 | !S_ISLNK(inode->i_mode)) return; | 918 | !S_ISLNK(inode->i_mode)) return; |
| 978 | for (i = 0; i < 7; i++) | 919 | for (i = 0; i < 7; i++) |
| @@ -981,7 +922,7 @@ static void check_zones(unsigned int i) | |||
| 981 | add_zone_dind(8 + inode->i_zone, &changed); | 922 | add_zone_dind(8 + inode->i_zone, &changed); |
| 982 | } | 923 | } |
| 983 | 924 | ||
| 984 | #ifdef CONFIG_FEATURE_MINIX2 | 925 | #if ENABLE_FEATURE_MINIX2 |
| 985 | static void check_zones2(unsigned int i) | 926 | static void check_zones2(unsigned int i) |
| 986 | { | 927 | { |
| 987 | struct minix2_inode *inode; | 928 | struct minix2_inode *inode; |
| @@ -1002,10 +943,10 @@ static void check_zones2(unsigned int i) | |||
| 1002 | } | 943 | } |
| 1003 | #endif | 944 | #endif |
| 1004 | 945 | ||
| 1005 | static void check_file(struct minix_inode *dir, unsigned int offset) | 946 | static void check_file(struct minix1_inode *dir, unsigned int offset) |
| 1006 | { | 947 | { |
| 1007 | static char blk[BLOCK_SIZE]; | 948 | static char blk[BLOCK_SIZE]; |
| 1008 | struct minix_inode *inode; | 949 | struct minix1_inode *inode; |
| 1009 | int ino; | 950 | int ino; |
| 1010 | char *name; | 951 | char *name; |
| 1011 | int block; | 952 | int block; |
| @@ -1052,7 +993,7 @@ static void check_file(struct minix_inode *dir, unsigned int offset) | |||
| 1052 | pop_filename(); | 993 | pop_filename(); |
| 1053 | } | 994 | } |
| 1054 | 995 | ||
| 1055 | #ifdef CONFIG_FEATURE_MINIX2 | 996 | #if ENABLE_FEATURE_MINIX2 |
| 1056 | static void check_file2(struct minix2_inode *dir, unsigned int offset) | 997 | static void check_file2(struct minix2_inode *dir, unsigned int offset) |
| 1057 | { | 998 | { |
| 1058 | static char blk[BLOCK_SIZE]; | 999 | static char blk[BLOCK_SIZE]; |
| @@ -1106,10 +1047,10 @@ static void check_file2(struct minix2_inode *dir, unsigned int offset) | |||
| 1106 | 1047 | ||
| 1107 | static void recursive_check(unsigned int ino) | 1048 | static void recursive_check(unsigned int ino) |
| 1108 | { | 1049 | { |
| 1109 | struct minix_inode *dir; | 1050 | struct minix1_inode *dir; |
| 1110 | unsigned int offset; | 1051 | unsigned int offset; |
| 1111 | 1052 | ||
| 1112 | dir = Inode + ino; | 1053 | dir = Inode1 + ino; |
| 1113 | if (!S_ISDIR(dir->i_mode)) | 1054 | if (!S_ISDIR(dir->i_mode)) |
| 1114 | die("internal error"); | 1055 | die("internal error"); |
| 1115 | if (dir->i_size < 2 * dirsize) { | 1056 | if (dir->i_size < 2 * dirsize) { |
| @@ -1120,7 +1061,7 @@ static void recursive_check(unsigned int ino) | |||
| 1120 | check_file(dir, offset); | 1061 | check_file(dir, offset); |
| 1121 | } | 1062 | } |
| 1122 | 1063 | ||
| 1123 | #ifdef CONFIG_FEATURE_MINIX2 | 1064 | #if ENABLE_FEATURE_MINIX2 |
| 1124 | static void recursive_check2(unsigned int ino) | 1065 | static void recursive_check2(unsigned int ino) |
| 1125 | { | 1066 | { |
| 1126 | struct minix2_inode *dir; | 1067 | struct minix2_inode *dir; |
| @@ -1152,10 +1093,10 @@ static void check_counts(void) | |||
| 1152 | int i; | 1093 | int i; |
| 1153 | 1094 | ||
| 1154 | for (i = 1; i <= INODES; i++) { | 1095 | for (i = 1; i <= INODES; i++) { |
| 1155 | if (warn_mode && Inode[i].i_mode && !inode_in_use(i)) { | 1096 | if (warn_mode && Inode1[i].i_mode && !inode_in_use(i)) { |
| 1156 | printf("Inode %d has non-zero mode. ", i); | 1097 | printf("Inode1 %d has non-zero mode. ", i); |
| 1157 | if (ask("Clear", 1)) { | 1098 | if (ask("Clear", 1)) { |
| 1158 | Inode[i].i_mode = 0; | 1099 | Inode1[i].i_mode = 0; |
| 1159 | changed = 1; | 1100 | changed = 1; |
| 1160 | } | 1101 | } |
| 1161 | } | 1102 | } |
| @@ -1168,15 +1109,15 @@ static void check_counts(void) | |||
| 1168 | continue; | 1109 | continue; |
| 1169 | } | 1110 | } |
| 1170 | if (!inode_in_use(i)) { | 1111 | if (!inode_in_use(i)) { |
| 1171 | printf("Inode %d is used, but marked as 'unused' in the bitmap. ", i); | 1112 | printf("Inode1 %d is used, but marked as 'unused' in the bitmap. ", i); |
| 1172 | if (ask("Set", 1)) | 1113 | if (ask("Set", 1)) |
| 1173 | mark_inode(i); | 1114 | mark_inode(i); |
| 1174 | } | 1115 | } |
| 1175 | if (Inode[i].i_nlinks != inode_count[i]) { | 1116 | if (Inode1[i].i_nlinks != inode_count[i]) { |
| 1176 | printf("Inode %d (mode=%07o), i_nlinks=%d, counted=%d. ", | 1117 | printf("Inode1 %d (mode=%07o), i_nlinks=%d, counted=%d. ", |
| 1177 | i, Inode[i].i_mode, Inode[i].i_nlinks, inode_count[i]); | 1118 | i, Inode1[i].i_mode, Inode1[i].i_nlinks, inode_count[i]); |
| 1178 | if (ask("Set i_nlinks to count", 1)) { | 1119 | if (ask("Set i_nlinks to count", 1)) { |
| 1179 | Inode[i].i_nlinks = inode_count[i]; | 1120 | Inode1[i].i_nlinks = inode_count[i]; |
| 1180 | changed = 1; | 1121 | changed = 1; |
| 1181 | } | 1122 | } |
| 1182 | } | 1123 | } |
| @@ -1197,14 +1138,14 @@ static void check_counts(void) | |||
| 1197 | } | 1138 | } |
| 1198 | } | 1139 | } |
| 1199 | 1140 | ||
| 1200 | #ifdef CONFIG_FEATURE_MINIX2 | 1141 | #if ENABLE_FEATURE_MINIX2 |
| 1201 | static void check_counts2(void) | 1142 | static void check_counts2(void) |
| 1202 | { | 1143 | { |
| 1203 | int i; | 1144 | int i; |
| 1204 | 1145 | ||
| 1205 | for (i = 1; i <= INODES; i++) { | 1146 | for (i = 1; i <= INODES; i++) { |
| 1206 | if (warn_mode && Inode2[i].i_mode && !inode_in_use(i)) { | 1147 | if (warn_mode && Inode2[i].i_mode && !inode_in_use(i)) { |
| 1207 | printf("Inode %d has non-zero mode. ", i); | 1148 | printf("Inode1 %d has non-zero mode. ", i); |
| 1208 | if (ask("Clear", 1)) { | 1149 | if (ask("Clear", 1)) { |
| 1209 | Inode2[i].i_mode = 0; | 1150 | Inode2[i].i_mode = 0; |
| 1210 | changed = 1; | 1151 | changed = 1; |
| @@ -1219,7 +1160,7 @@ static void check_counts2(void) | |||
| 1219 | continue; | 1160 | continue; |
| 1220 | } | 1161 | } |
| 1221 | if (!inode_in_use(i)) { | 1162 | if (!inode_in_use(i)) { |
| 1222 | printf("Inode %d is used, but marked as 'unused' in the bitmap. ", i); | 1163 | printf("Inode1 %d is used, but marked as 'unused' in the bitmap. ", i); |
| 1223 | if (ask("Set", 1)) | 1164 | if (ask("Set", 1)) |
| 1224 | mark_inode(i); | 1165 | mark_inode(i); |
| 1225 | } | 1166 | } |
| @@ -1254,20 +1195,22 @@ static void check(void) | |||
| 1254 | { | 1195 | { |
| 1255 | memset(inode_count, 0, (INODES + 1) * sizeof(*inode_count)); | 1196 | memset(inode_count, 0, (INODES + 1) * sizeof(*inode_count)); |
| 1256 | memset(zone_count, 0, ZONES * sizeof(*zone_count)); | 1197 | memset(zone_count, 0, ZONES * sizeof(*zone_count)); |
| 1257 | check_zones(ROOT_INO); | 1198 | check_zones(MINIX_ROOT_INO); |
| 1258 | recursive_check(ROOT_INO); | 1199 | recursive_check(MINIX_ROOT_INO); |
| 1259 | check_counts(); | 1200 | check_counts(); |
| 1260 | } | 1201 | } |
| 1261 | 1202 | ||
| 1262 | #ifdef CONFIG_FEATURE_MINIX2 | 1203 | #if ENABLE_FEATURE_MINIX2 |
| 1263 | static void check2(void) | 1204 | static void check2(void) |
| 1264 | { | 1205 | { |
| 1265 | memset(inode_count, 0, (INODES + 1) * sizeof(*inode_count)); | 1206 | memset(inode_count, 0, (INODES + 1) * sizeof(*inode_count)); |
| 1266 | memset(zone_count, 0, ZONES * sizeof(*zone_count)); | 1207 | memset(zone_count, 0, ZONES * sizeof(*zone_count)); |
| 1267 | check_zones2(ROOT_INO); | 1208 | check_zones2(MINIX_ROOT_INO); |
| 1268 | recursive_check2(ROOT_INO); | 1209 | recursive_check2(MINIX_ROOT_INO); |
| 1269 | check_counts2(); | 1210 | check_counts2(); |
| 1270 | } | 1211 | } |
| 1212 | #else | ||
| 1213 | void check2(void); | ||
| 1271 | #endif | 1214 | #endif |
| 1272 | 1215 | ||
| 1273 | int fsck_minix_main(int argc, char **argv) | 1216 | int fsck_minix_main(int argc, char **argv) |
| @@ -1275,18 +1218,18 @@ int fsck_minix_main(int argc, char **argv) | |||
| 1275 | struct termios tmp; | 1218 | struct termios tmp; |
| 1276 | int retcode = 0; | 1219 | int retcode = 0; |
| 1277 | 1220 | ||
| 1278 | xfunc_exitcode = 8; | 1221 | xfunc_error_retval = 8; |
| 1279 | 1222 | ||
| 1280 | alloc_current_name(); | 1223 | alloc_current_name(); |
| 1281 | #ifdef CONFIG_FEATURE_CLEAN_UP | 1224 | #if ENABLE_FEATURE_CLEAN_UP |
| 1282 | /* Don't bother to free memory. Exit does | 1225 | /* Don't bother to free memory. Exit does |
| 1283 | * that automagically, so we can save a few bytes */ | 1226 | * that automagically, so we can save a few bytes */ |
| 1284 | atexit(free_current_name); | 1227 | atexit(free_current_name); |
| 1285 | #endif | 1228 | #endif |
| 1286 | 1229 | ||
| 1287 | if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) | 1230 | if (INODE_SIZE1 * MINIX1_INODES_PER_BLOCK != BLOCK_SIZE) |
| 1288 | die("bad inode size"); | 1231 | die("bad inode size"); |
| 1289 | #ifdef CONFIG_FEATURE_MINIX2 | 1232 | #if ENABLE_FEATURE_MINIX2 |
| 1290 | if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) | 1233 | if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) |
| 1291 | die("bad v2 inode size"); | 1234 | die("bad v2 inode size"); |
| 1292 | #endif | 1235 | #endif |
| @@ -1336,10 +1279,8 @@ int fsck_minix_main(int argc, char **argv) | |||
| 1336 | if (!isatty(0) || !isatty(1)) | 1279 | if (!isatty(0) || !isatty(1)) |
| 1337 | die("need terminal for interactive repairs"); | 1280 | die("need terminal for interactive repairs"); |
| 1338 | } | 1281 | } |
| 1339 | IN = open(device_name, repair ? O_RDWR : O_RDONLY); | 1282 | IN = xopen(device_name, repair ? O_RDWR : O_RDONLY); |
| 1340 | if (IN < 0) { | 1283 | |
| 1341 | bb_error_msg_and_die("cannot open device '%s'", device_name); | ||
| 1342 | } | ||
| 1343 | /*sync(); paranoia? */ | 1284 | /*sync(); paranoia? */ |
| 1344 | read_superblock(); | 1285 | read_superblock(); |
| 1345 | 1286 | ||
| @@ -1372,36 +1313,35 @@ int fsck_minix_main(int argc, char **argv) | |||
| 1372 | tcsetattr(0, TCSANOW, &tmp); | 1313 | tcsetattr(0, TCSANOW, &tmp); |
| 1373 | termios_set = 1; | 1314 | termios_set = 1; |
| 1374 | } | 1315 | } |
| 1375 | #ifdef CONFIG_FEATURE_MINIX2 | 1316 | |
| 1376 | if (version2) { | 1317 | if (version2) { |
| 1377 | check_root2(); | 1318 | check_root2(); |
| 1378 | check2(); | 1319 | check2(); |
| 1379 | } else | 1320 | } else { |
| 1380 | #endif | ||
| 1381 | { | ||
| 1382 | check_root(); | 1321 | check_root(); |
| 1383 | check(); | 1322 | check(); |
| 1384 | } | 1323 | } |
| 1324 | |||
| 1385 | if (verbose) { | 1325 | if (verbose) { |
| 1386 | int i, free_cnt; | 1326 | int i, free_cnt; |
| 1387 | 1327 | ||
| 1388 | for (i = 1, free_cnt = 0; i <= INODES; i++) | 1328 | for (i = 1, free_cnt = 0; i <= INODES; i++) |
| 1389 | if (!inode_in_use(i)) | 1329 | if (!inode_in_use(i)) |
| 1390 | free_cnt++; | 1330 | free_cnt++; |
| 1391 | printf("\n%6ld inodes used (%ld%%)\n", (INODES - free_cnt), | 1331 | printf("\n%6u inodes used (%u%%)\n", (INODES - free_cnt), |
| 1392 | 100 * (INODES - free_cnt) / INODES); | 1332 | 100 * (INODES - free_cnt) / INODES); |
| 1393 | for (i = FIRSTZONE, free_cnt = 0; i < ZONES; i++) | 1333 | for (i = FIRSTZONE, free_cnt = 0; i < ZONES; i++) |
| 1394 | if (!zone_in_use(i)) | 1334 | if (!zone_in_use(i)) |
| 1395 | free_cnt++; | 1335 | free_cnt++; |
| 1396 | printf("%6ld zones used (%ld%%)\n\n" | 1336 | printf("%6u zones used (%u%%)\n\n" |
| 1397 | "%6d regular files\n" | 1337 | "%6u regular files\n" |
| 1398 | "%6d directories\n" | 1338 | "%6u directories\n" |
| 1399 | "%6d character device files\n" | 1339 | "%6u character device files\n" |
| 1400 | "%6d block device files\n" | 1340 | "%6u block device files\n" |
| 1401 | "%6d links\n" | 1341 | "%6u links\n" |
| 1402 | "%6d symbolic links\n" | 1342 | "%6u symbolic links\n" |
| 1403 | "------\n" | 1343 | "------\n" |
| 1404 | "%6d files\n", | 1344 | "%6u files\n", |
| 1405 | (ZONES - free_cnt), 100 * (ZONES - free_cnt) / ZONES, | 1345 | (ZONES - free_cnt), 100 * (ZONES - free_cnt) / ZONES, |
| 1406 | regular, directory, chardev, blockdev, | 1346 | regular, directory, chardev, blockdev, |
| 1407 | links - 2 * directory + 1, symlinks, | 1347 | links - 2 * directory + 1, symlinks, |
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 89874b6b8..e66ef7e17 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
| @@ -65,6 +65,8 @@ | |||
| 65 | #include "busybox.h" | 65 | #include "busybox.h" |
| 66 | #include <mntent.h> | 66 | #include <mntent.h> |
| 67 | 67 | ||
| 68 | #include "minix.h" | ||
| 69 | |||
| 68 | #define DEBUG 0 | 70 | #define DEBUG 0 |
| 69 | 71 | ||
| 70 | /* If debugging, store the very same times/uids/gids for image consistency */ | 72 | /* If debugging, store the very same times/uids/gids for image consistency */ |
| @@ -78,81 +80,8 @@ | |||
| 78 | # define GETGID getgid() | 80 | # define GETGID getgid() |
| 79 | #endif | 81 | #endif |
| 80 | 82 | ||
| 81 | /* | ||
| 82 | * This is the original minix inode layout on disk. | ||
| 83 | * Note the 8-bit gid and atime and ctime. | ||
| 84 | */ | ||
| 85 | struct minix1_inode { | ||
| 86 | uint16_t i_mode; | ||
| 87 | uint16_t i_uid; | ||
| 88 | uint32_t i_size; | ||
| 89 | uint32_t i_time; | ||
| 90 | uint8_t i_gid; | ||
| 91 | uint8_t i_nlinks; | ||
| 92 | uint16_t i_zone[9]; | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* | ||
| 96 | * The new minix inode has all the time entries, as well as | ||
| 97 | * long block numbers and a third indirect block (7+1+1+1 | ||
| 98 | * instead of 7+1+1). Also, some previously 8-bit values are | ||
| 99 | * now 16-bit. The inode is now 64 bytes instead of 32. | ||
| 100 | */ | ||
| 101 | struct minix2_inode { | ||
| 102 | uint16_t i_mode; | ||
| 103 | uint16_t i_nlinks; | ||
| 104 | uint16_t i_uid; | ||
| 105 | uint16_t i_gid; | ||
| 106 | uint32_t i_size; | ||
| 107 | uint32_t i_atime; | ||
| 108 | uint32_t i_mtime; | ||
| 109 | uint32_t i_ctime; | ||
| 110 | uint32_t i_zone[10]; | ||
| 111 | }; | ||
| 112 | |||
| 113 | /* | ||
| 114 | * minix super-block data on disk | ||
| 115 | */ | ||
| 116 | struct minix_super_block { | ||
| 117 | uint16_t s_ninodes; | ||
| 118 | uint16_t s_nzones; | ||
| 119 | uint16_t s_imap_blocks; | ||
| 120 | uint16_t s_zmap_blocks; | ||
| 121 | uint16_t s_firstdatazone; | ||
| 122 | uint16_t s_log_zone_size; | ||
| 123 | uint32_t s_max_size; | ||
| 124 | uint16_t s_magic; | ||
| 125 | uint16_t s_state; | ||
| 126 | uint32_t s_zones; | ||
| 127 | }; | ||
| 128 | |||
| 129 | struct minix_dir_entry { | ||
| 130 | uint16_t inode; | ||
| 131 | char name[0]; | ||
| 132 | }; | ||
| 133 | |||
| 134 | /* Believe it or not, but mount.h has this one */ | ||
| 135 | #undef BLOCK_SIZE | ||
| 136 | enum { | 83 | enum { |
| 137 | BLOCK_SIZE = 1024, | ||
| 138 | BITS_PER_BLOCK = BLOCK_SIZE << 3, | ||
| 139 | |||
| 140 | MINIX_ROOT_INO = 1, | ||
| 141 | MINIX_BAD_INO = 2, | ||
| 142 | MAX_GOOD_BLOCKS = 512, | 84 | MAX_GOOD_BLOCKS = 512, |
| 143 | |||
| 144 | MINIX1_SUPER_MAGIC = 0x137F, /* original minix fs */ | ||
| 145 | MINIX1_SUPER_MAGIC2 = 0x138F, /* minix fs, 30 char names */ | ||
| 146 | MINIX2_SUPER_MAGIC = 0x2468, /* minix V2 fs */ | ||
| 147 | MINIX2_SUPER_MAGIC2 = 0x2478, /* minix V2 fs, 30 char names */ | ||
| 148 | MINIX_VALID_FS = 0x0001, /* clean fs */ | ||
| 149 | MINIX_ERROR_FS = 0x0002, /* fs has errors */ | ||
| 150 | |||
| 151 | INODE_SIZE1 = sizeof(struct minix1_inode), | ||
| 152 | INODE_SIZE2 = sizeof(struct minix2_inode), | ||
| 153 | MINIX1_INODES_PER_BLOCK = BLOCK_SIZE / sizeof(struct minix1_inode), | ||
| 154 | MINIX2_INODES_PER_BLOCK = BLOCK_SIZE / sizeof(struct minix2_inode), | ||
| 155 | |||
| 156 | TEST_BUFFER_BLOCKS = 16, | 85 | TEST_BUFFER_BLOCKS = 16, |
| 157 | }; | 86 | }; |
| 158 | 87 | ||
