2 * problem.h --- e2fsck problem error codes
4 * Copyright 1996 by Theodore Ts'o
7 * This file may be redistributed under the terms of the GNU Public
12 struct problem_context {
14 struct ext2_inode *inode;
15 struct ext2_dir_entry *dirent;
21 struct e2fsck_problem {
23 const char * e2p_description;
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 */
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
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) */
42 #define PR_LATCH(x) ((((x) & PR_LATCH_MASK) >> 4) - 1)
48 /* Block bitmap not in group */
49 #define PR_0_BB_NOT_GROUP 0x000001
51 /* Inode bitmap not in group */
52 #define PR_0_IB_NOT_GROUP 0x000002
54 /* Inode table not in group */
55 #define PR_0_ITABLE_NOT_GROUP 0x000003
61 /* Root directory is not an inode */
62 #define PR_1_ROOT_NO_DIR 0x010001
64 /* Root directory has dtime set */
65 #define PR_1_ROOT_DTIME 0x010002
67 /* Reserved inode has bad mode */
68 #define PR_1_RESERVED_BAD_MODE 0x010003
70 /* Deleted inode has zero dtime */
71 #define PR_1_ZERO_DTIME 0x010004
73 /* Inode in use, but dtime set */
74 #define PR_1_SET_DTIME 0x010005
76 /* Zero-length directory */
77 #define PR_1_ZERO_LENGTH_DIR 0x010006
79 /* Block bitmap conflicts with some other fs block */
80 #define PR_1_BB_CONFLICT 0x010007
82 /* Inode bitmap conflicts with some other fs block */
83 #define PR_1_IB_CONFLICT 0x010008
85 /* Inode table conflicts with some other fs block */
86 #define PR_1_ITABLE_CONFLICT 0x010009
88 /* Block bitmap is on a bad block */
89 #define PR_1_BB_BAD_BLOCK 0x01000A
91 /* Inode bitmap is on a bad block */
92 #define PR_1_IB_BAD_BLOCK 0x01000B
94 /* Inode has incorrect i_size */
95 #define PR_1_BAD_I_SIZE 0x01000C
97 /* Inode has incorrect i_blocks */
98 #define PR_1_BAD_I_BLOCKS 0x01000D
100 /* Illegal block number in inode */
101 #define PR_1_ILLEGAL_BLOCK_NUM 0x01000E
103 /* Block number overlaps fs metadata */
104 #define PR_1_BLOCK_OVERLAPS_METADATA 0x01000F
106 /* Inode has illegal blocks (latch question) */
107 #define PR_1_INODE_BLOCK_LATCH 0x010010
109 /* Too many bad blocks in inode */
110 #define PR_1_TOO_MANY_BAD_BLOCKS 0x010011
112 /* Illegal block number in bad block inode */
113 #define PR_1_BB_ILLEGAL_BLOCK_NUM 0x010012
115 /* Bad block inode has illegal blocks (latch question) */
116 #define PR_1_INODE_BBLOCK_LATCH 0x010013
122 /* File has duplicate blocks */
123 #define PR_1B_DUP_FILE 0x011001
125 /* List of files sharing duplicate blocks */
126 #define PR_1B_DUP_FILE_LIST 0x011002
128 /* File sharing blocks with filesystem metadata */
129 #define PR_1B_SHARE_METADATA 0x011003
135 /* Bad inode number for '.' */
136 #define PR_2_BAD_INODE_DOT 0x020001
138 /* Directory entry has bad inode number */
139 #define PR_2_BAD_INO 0x020002
141 /* Directory entry has deleted or unused inode */
142 #define PR_2_UNUSED_INODE 0x020003
144 /* Directry entry is link to '.' */
145 #define PR_2_LINK_DOT 0x020004
147 /* Directory entry points to inode now located in a bad block */
148 #define PR_2_BB_INODE 0x020005
150 /* Directory entry contains a link to a directory */
151 #define PR_2_LINK_DIR 0x020006
153 /* Directory entry contains a link to the root directry */
154 #define PR_2_LINK_ROOT 0x020007
156 /* Directory entry has illegal characters in its name */
157 #define PR_2_BAD_NAME 0x020008
159 /* Missing '.' in directory inode */
160 #define PR_2_MISSING_DOT 0x020009
162 /* Missing '..' in directory inode */
163 #define PR_2_MISSING_DOT_DOT 0x02000A
165 /* First entry in directory inode doesn't contain '.' */
166 #define PR_2_1ST_NOT_DOT 0x02000B
168 /* Second entry in directory inode doesn't contain '..' */
169 #define PR_2_2ND_NOT_DOT_DOT 0x02000C
171 /* i_faddr should be zero */
172 #define PR_2_FADDR_ZERO 0x02000D
174 /* i_file_acl should be zero */
175 #define PR_2_FILE_ACL_ZERO 0x02000E
177 /* i_dir_acl should be zero */
178 #define PR_2_DIR_ACL_ZERO 0x02000F
180 /* i_frag should be zero */
181 #define PR_2_FRAG_ZERO 0x020010
183 /* i_fsize should be zero */
184 #define PR_2_FSIZE_ZERO 0x020011
186 /* inode has bad mode */
187 #define PR_2_BAD_MODE 0x020012
189 /* directory corrupted */
190 #define PR_2_DIR_CORRUPTED 0x020013
192 /* filename too long */
193 #define PR_2_FILENAME_LONG 0x020014
195 /* Directory inode has a missing block (hole) */
196 #define PR_2_DIRECTORY_HOLE 0x020015
198 /* '.' is not NULL terminated */
199 #define PR_2_DOT_NULL_TERM 0x020016
201 /* '..' is not NULL terminated */
202 #define PR_2_DOT_DOT_NULL_TERM 0x020017
204 /* Illegal character device in inode */
205 #define PR_2_BAD_CHAR_DEV 0x020018
207 /* Illegal block device in inode */
208 #define PR_2_BAD_BLOCK_DEV 0x020019
214 /* Root inode not allocated */
215 #define PR_3_NO_ROOT_INODE 0x030001
217 /* No room in lost+found */
218 #define PR_3_EXPAND_LF_DIR 0x030002
220 /* Unconnected directory inode */
221 #define PR_3_UNCONNECTED_DIR 0x030003
223 /* /lost+found not found */
224 #define PR_3_NO_LF_DIR 0x030004
226 /* .. entry is incorrect */
227 #define PR_3_BAD_DOT_DOT 0x030005
234 /* Unattached zero-length inode */
235 #define PR_4_ZERO_LEN_INODE 0x040001
237 /* Unattached inode */
238 #define PR_4_UNATTACHED_INODE 0x040002
240 /* Inode ref count wrong */
241 #define PR_4_BAD_REF_COUNT 0x040003
248 * Function declarations
250 int fix_problem(ext2_filsys fs, int code, struct problem_context *ctx);
251 void reset_problem_latch(int mask);
252 void suppress_latch_group(int mask, int value);
253 void clear_problem_context(struct problem_context *ctx);
256 void print_e2fsck_message(ext2_filsys fs, const char *msg,
257 struct problem_context *ctx, int first);