Theodore Ts'o | 21c84b7 | 1997-04-29 16:15:03 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * problem.h --- e2fsck problem error codes |
| 3 | * |
| 4 | * Copyright 1996 by Theodore Ts'o |
| 5 | * |
| 6 | * %Begin-Header% |
| 7 | * This file may be redistributed under the terms of the GNU Public |
| 8 | * License. |
| 9 | * %End-Header% |
| 10 | */ |
| 11 | |
| 12 | struct problem_context { |
| 13 | ino_t ino, ino2, dir; |
| 14 | struct ext2_inode *inode; |
| 15 | struct ext2_dir_entry *dirent; |
| 16 | blk_t blk; |
| 17 | int blkcount, group; |
| 18 | __u32 num; |
| 19 | }; |
| 20 | |
| 21 | struct e2fsck_problem { |
| 22 | int e2p_code; |
| 23 | const char * e2p_description; |
| 24 | char prompt; |
| 25 | short flags; |
| 26 | }; |
| 27 | |
| 28 | #define PR_PREEN_OK 0x0001 /* Don't need to do preenhalt */ |
| 29 | #define PR_NO_OK 0x0002 /* If user answers no, don't make fs invalid */ |
| 30 | #define PR_NO_DEFAULT 0x0004 /* Default to no */ |
| 31 | #define PR_MSG_ONLY 0x0008 /* Print message only */ |
| 32 | |
| 33 | /* |
| 34 | * We define a set of "latch groups"; these are problems which are |
| 35 | * handled as a set. The user answers once for a particular latch |
| 36 | * group. |
| 37 | */ |
| 38 | #define PR_LATCH_MASK 0x0070 /* Latch mask */ |
| 39 | #define PR_LATCH_BLOCK 0x0010 /* Latch for illegal blocks (pass 1) */ |
| 40 | #define PR_LATCH_BBLOCK 0x0020 /* Latch for bad block inode blocks (pass 1) */ |
| 41 | |
| 42 | #define PR_LATCH(x) ((((x) & PR_LATCH_MASK) >> 4) - 1) |
| 43 | |
| 44 | /* |
| 45 | * Pre-Pass 1 errors |
| 46 | */ |
| 47 | |
| 48 | /* Block bitmap not in group */ |
| 49 | #define PR_0_BB_NOT_GROUP 0x000001 |
| 50 | |
| 51 | /* Inode bitmap not in group */ |
| 52 | #define PR_0_IB_NOT_GROUP 0x000002 |
| 53 | |
| 54 | /* Inode table not in group */ |
| 55 | #define PR_0_ITABLE_NOT_GROUP 0x000003 |
| 56 | |
| 57 | /* |
| 58 | * Pass 1 errors |
| 59 | */ |
| 60 | |
| 61 | /* Root directory is not an inode */ |
| 62 | #define PR_1_ROOT_NO_DIR 0x010001 |
| 63 | |
| 64 | /* Root directory has dtime set */ |
| 65 | #define PR_1_ROOT_DTIME 0x010002 |
| 66 | |
| 67 | /* Reserved inode has bad mode */ |
| 68 | #define PR_1_RESERVED_BAD_MODE 0x010003 |
| 69 | |
| 70 | /* Deleted inode has zero dtime */ |
| 71 | #define PR_1_ZERO_DTIME 0x010004 |
| 72 | |
| 73 | /* Inode in use, but dtime set */ |
| 74 | #define PR_1_SET_DTIME 0x010005 |
| 75 | |
| 76 | /* Zero-length directory */ |
| 77 | #define PR_1_ZERO_LENGTH_DIR 0x010006 |
| 78 | |
| 79 | /* Block bitmap conflicts with some other fs block */ |
| 80 | #define PR_1_BB_CONFLICT 0x010007 |
| 81 | |
| 82 | /* Inode bitmap conflicts with some other fs block */ |
| 83 | #define PR_1_IB_CONFLICT 0x010008 |
| 84 | |
| 85 | /* Inode table conflicts with some other fs block */ |
| 86 | #define PR_1_ITABLE_CONFLICT 0x010009 |
| 87 | |
| 88 | /* Block bitmap is on a bad block */ |
| 89 | #define PR_1_BB_BAD_BLOCK 0x01000A |
| 90 | |
| 91 | /* Inode bitmap is on a bad block */ |
| 92 | #define PR_1_IB_BAD_BLOCK 0x01000B |
| 93 | |
| 94 | /* Inode has incorrect i_size */ |
| 95 | #define PR_1_BAD_I_SIZE 0x01000C |
| 96 | |
| 97 | /* Inode has incorrect i_blocks */ |
| 98 | #define PR_1_BAD_I_BLOCKS 0x01000D |
| 99 | |
| 100 | /* Illegal block number in inode */ |
| 101 | #define PR_1_ILLEGAL_BLOCK_NUM 0x01000E |
| 102 | |
| 103 | /* Block number overlaps fs metadata */ |
| 104 | #define PR_1_BLOCK_OVERLAPS_METADATA 0x01000F |
| 105 | |
| 106 | /* Inode has illegal blocks (latch question) */ |
| 107 | #define PR_1_INODE_BLOCK_LATCH 0x010010 |
| 108 | |
| 109 | /* Too many bad blocks in inode */ |
| 110 | #define PR_1_TOO_MANY_BAD_BLOCKS 0x010011 |
| 111 | |
| 112 | /* Illegal block number in bad block inode */ |
| 113 | #define PR_1_BB_ILLEGAL_BLOCK_NUM 0x010012 |
| 114 | |
| 115 | /* Bad block inode has illegal blocks (latch question) */ |
| 116 | #define PR_1_INODE_BBLOCK_LATCH 0x010013 |
| 117 | |
| 118 | /* |
| 119 | * Pass 1b errors |
| 120 | */ |
| 121 | |
| 122 | /* File has duplicate blocks */ |
| 123 | #define PR_1B_DUP_FILE 0x011001 |
| 124 | |
| 125 | /* List of files sharing duplicate blocks */ |
| 126 | #define PR_1B_DUP_FILE_LIST 0x011002 |
| 127 | |
| 128 | /* |
| 129 | * Pass 2 errors |
| 130 | */ |
| 131 | |
| 132 | /* Bad inode number for '.' */ |
| 133 | #define PR_2_BAD_INODE_DOT 0x020001 |
| 134 | |
| 135 | /* Directory entry has bad inode number */ |
| 136 | #define PR_2_BAD_INO 0x020002 |
| 137 | |
| 138 | /* Directory entry has deleted or unused inode */ |
| 139 | #define PR_2_UNUSED_INODE 0x020003 |
| 140 | |
| 141 | /* Directry entry is link to '.' */ |
| 142 | #define PR_2_LINK_DOT 0x020004 |
| 143 | |
| 144 | /* Directory entry points to inode now located in a bad block */ |
| 145 | #define PR_2_BB_INODE 0x020005 |
| 146 | |
| 147 | /* Directory entry contains a link to a directory */ |
| 148 | #define PR_2_LINK_DIR 0x020006 |
| 149 | |
| 150 | /* Directory entry contains a link to the root directry */ |
| 151 | #define PR_2_LINK_ROOT 0x020007 |
| 152 | |
| 153 | /* Directory entry has illegal characters in its name */ |
| 154 | #define PR_2_BAD_NAME 0x020008 |
| 155 | |
| 156 | /* Missing '.' in directory inode */ |
| 157 | #define PR_2_MISSING_DOT 0x020009 |
| 158 | |
| 159 | /* Missing '..' in directory inode */ |
| 160 | #define PR_2_MISSING_DOT_DOT 0x02000A |
| 161 | |
| 162 | /* First entry in directory inode doesn't contain '.' */ |
| 163 | #define PR_2_1ST_NOT_DOT 0x02000B |
| 164 | |
| 165 | /* Second entry in directory inode doesn't contain '..' */ |
| 166 | #define PR_2_2ND_NOT_DOT_DOT 0x02000C |
| 167 | |
| 168 | /* i_faddr should be zero */ |
| 169 | #define PR_2_FADDR_ZERO 0x02000D |
| 170 | |
| 171 | /* i_file_acl should be zero */ |
| 172 | #define PR_2_FILE_ACL_ZERO 0x02000E |
| 173 | |
| 174 | /* i_dir_acl should be zero */ |
| 175 | #define PR_2_DIR_ACL_ZERO 0x02000F |
| 176 | |
| 177 | /* i_frag should be zero */ |
| 178 | #define PR_2_FRAG_ZERO 0x020010 |
| 179 | |
| 180 | /* i_fsize should be zero */ |
| 181 | #define PR_2_FSIZE_ZERO 0x020011 |
| 182 | |
| 183 | /* inode has bad mode */ |
| 184 | #define PR_2_BAD_MODE 0x020012 |
| 185 | |
| 186 | /* directory corrupted */ |
| 187 | #define PR_2_DIR_CORRUPTED 0x020013 |
| 188 | |
| 189 | /* filename too long */ |
| 190 | #define PR_2_FILENAME_LONG 0x020014 |
| 191 | |
| 192 | /* Directory inode has a missing block (hole) */ |
| 193 | #define PR_2_DIRECTORY_HOLE 0x020015 |
| 194 | |
| 195 | /* '.' is not NULL terminated */ |
| 196 | #define PR_2_DOT_NULL_TERM 0x020016 |
| 197 | |
| 198 | /* '..' is not NULL terminated */ |
| 199 | #define PR_2_DOT_DOT_NULL_TERM 0x020017 |
| 200 | |
| 201 | /* |
| 202 | * Pass 3 errors |
| 203 | */ |
| 204 | |
| 205 | /* Root inode not allocated */ |
| 206 | #define PR_3_NO_ROOT_INODE 0x030001 |
| 207 | |
| 208 | /* No room in lost+found */ |
| 209 | #define PR_3_EXPAND_LF_DIR 0x030002 |
| 210 | |
| 211 | /* Unconnected directory inode */ |
| 212 | #define PR_3_UNCONNECTED_DIR 0x030003 |
| 213 | |
| 214 | /* /lost+found not found */ |
| 215 | #define PR_3_NO_LF_DIR 0x030004 |
| 216 | |
| 217 | /* .. entry is incorrect */ |
| 218 | #define PR_3_BAD_DOT_DOT 0x030005 |
| 219 | |
| 220 | |
| 221 | /* |
| 222 | * Pass 4 errors |
| 223 | */ |
| 224 | |
| 225 | /* Unattached zero-length inode */ |
| 226 | #define PR_4_ZERO_LEN_INODE 0x040001 |
| 227 | |
| 228 | /* Unattached inode */ |
| 229 | #define PR_4_UNATTACHED_INODE 0x040002 |
| 230 | |
| 231 | /* Inode ref count wrong */ |
| 232 | #define PR_4_BAD_REF_COUNT 0x040003 |
| 233 | |
| 234 | /* |
| 235 | * Pass 5 errors |
| 236 | */ |
| 237 | |
| 238 | /* |
| 239 | * Function declarations |
| 240 | */ |
| 241 | int fix_problem(ext2_filsys fs, int code, struct problem_context *ctx); |
| 242 | void reset_problem_latch(int mask); |
| 243 | void suppress_latch_group(int mask, int value); |
| 244 | void clear_problem_context(struct problem_context *ctx); |
| 245 | |
| 246 | /* message.c */ |
| 247 | void print_e2fsck_message(ext2_filsys fs, const char *msg, |
| 248 | struct problem_context *ctx, int first); |
| 249 | |