Whamcloud - gitweb
ChangeLog, e2fsck.h, message.c, pass1.c, pass2.c, problem.c, problem.h:
[tools/e2fsprogs.git] / e2fsck / problem.h
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 /* File sharing blocks with filesystem metadata  */     
129 #define PR_1B_SHARE_METADATA    0x011003
130
131 /*
132  * Pass 2 errors
133  */
134
135 /* Bad inode number for '.' */
136 #define PR_2_BAD_INODE_DOT      0x020001
137
138 /* Directory entry has bad inode number */
139 #define PR_2_BAD_INO            0x020002
140
141 /* Directory entry has deleted or unused inode */
142 #define PR_2_UNUSED_INODE       0x020003
143
144 /* Directry entry is link to '.' */
145 #define PR_2_LINK_DOT           0x020004
146
147 /* Directory entry points to inode now located in a bad block */
148 #define PR_2_BB_INODE           0x020005
149
150 /* Directory entry contains a link to a directory */
151 #define PR_2_LINK_DIR           0x020006
152
153 /* Directory entry contains a link to the root directry */
154 #define PR_2_LINK_ROOT          0x020007
155
156 /* Directory entry has illegal characters in its name */
157 #define PR_2_BAD_NAME           0x020008
158
159 /* Missing '.' in directory inode */      
160 #define PR_2_MISSING_DOT        0x020009
161
162 /* Missing '..' in directory inode */     
163 #define PR_2_MISSING_DOT_DOT    0x02000A
164
165 /* First entry in directory inode doesn't contain '.' */
166 #define PR_2_1ST_NOT_DOT        0x02000B
167
168 /* Second entry in directory inode doesn't contain '..' */
169 #define PR_2_2ND_NOT_DOT_DOT    0x02000C
170
171 /* i_faddr should be zero */
172 #define PR_2_FADDR_ZERO         0x02000D
173
174 /* i_file_acl should be zero */
175 #define PR_2_FILE_ACL_ZERO      0x02000E
176
177 /* i_dir_acl should be zero */
178 #define PR_2_DIR_ACL_ZERO       0x02000F
179
180 /* i_frag should be zero */
181 #define PR_2_FRAG_ZERO          0x020010
182
183 /* i_fsize should be zero */
184 #define PR_2_FSIZE_ZERO         0x020011
185                   
186 /* inode has bad mode */
187 #define PR_2_BAD_MODE           0x020012
188
189 /* directory corrupted */
190 #define PR_2_DIR_CORRUPTED      0x020013
191                   
192 /* filename too long */
193 #define PR_2_FILENAME_LONG      0x020014
194                   
195 /* Directory inode has a missing block (hole) */
196 #define PR_2_DIRECTORY_HOLE     0x020015
197
198 /* '.' is not NULL terminated */
199 #define PR_2_DOT_NULL_TERM      0x020016
200
201 /* '..' is not NULL terminated */
202 #define PR_2_DOT_DOT_NULL_TERM  0x020017
203
204 /* Illegal character device in inode */
205 #define PR_2_BAD_CHAR_DEV       0x020018
206
207 /* Illegal block device in inode */
208 #define PR_2_BAD_BLOCK_DEV      0x020019
209
210 /*
211  * Pass 3 errors
212  */
213
214 /* Root inode not allocated */
215 #define PR_3_NO_ROOT_INODE      0x030001
216
217 /* No room in lost+found */
218 #define PR_3_EXPAND_LF_DIR      0x030002
219
220 /* Unconnected directory inode */
221 #define PR_3_UNCONNECTED_DIR    0x030003
222
223 /* /lost+found not found */
224 #define PR_3_NO_LF_DIR          0x030004
225
226 /* .. entry is incorrect */
227 #define PR_3_BAD_DOT_DOT        0x030005
228
229
230 /*
231  * Pass 4 errors
232  */
233
234 /* Unattached zero-length inode */
235 #define PR_4_ZERO_LEN_INODE     0x040001
236
237 /* Unattached inode */
238 #define PR_4_UNATTACHED_INODE   0x040002
239
240 /* Inode ref count wrong */
241 #define PR_4_BAD_REF_COUNT      0x040003
242
243 /*
244  * Pass 5 errors
245  */
246
247 /*
248  * Function declarations
249  */
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);
254
255 /* message.c */
256 void print_e2fsck_message(ext2_filsys fs, const char *msg,
257                           struct problem_context *ctx, int first);
258