]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - e2fsck/problem.h
ChangeLog, fsck.c:
[thirdparty/e2fsprogs.git] / e2fsck / problem.h
CommitLineData
21c84b71
TT
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
1b6bf175
TT
12typedef __u32 problem_t;
13
21c84b71 14struct problem_context {
1b6bf175 15 errcode_t errcode;
21c84b71
TT
16 ino_t ino, ino2, dir;
17 struct ext2_inode *inode;
18 struct ext2_dir_entry *dirent;
1b6bf175 19 blk_t blk, blk2;
9d1bd3de 20 e2_blkcnt_t blkcount;
246501c6
TT
21 int group;
22 __u64 num;
1b6bf175 23 const char *str;
21c84b71
TT
24};
25
21c84b71
TT
26/*
27 * We define a set of "latch groups"; these are problems which are
28 * handled as a set. The user answers once for a particular latch
29 * group.
30 */
31#define PR_LATCH_MASK 0x0070 /* Latch mask */
32#define PR_LATCH_BLOCK 0x0010 /* Latch for illegal blocks (pass 1) */
33#define PR_LATCH_BBLOCK 0x0020 /* Latch for bad block inode blocks (pass 1) */
1b6bf175
TT
34#define PR_LATCH_IBITMAP 0x0030 /* Latch for pass 5 inode bitmap proc. */
35#define PR_LATCH_BBITMAP 0x0040 /* Latch for pass 5 inode bitmap proc. */
36#define PR_LATCH_RELOC 0x0050 /* Latch for superblock relocate hint */
37#define PR_LATCH_DBLOCK 0x0060 /* Latch for pass 1b dup block headers */
21c84b71
TT
38
39#define PR_LATCH(x) ((((x) & PR_LATCH_MASK) >> 4) - 1)
40
1b6bf175
TT
41/*
42 * Latch group descriptor flags
43 */
44#define PRL_YES 0x0001 /* Answer yes */
45#define PRL_NO 0x0002 /* Answer no */
46#define PRL_LATCHED 0x0004 /* The latch group is latched */
47#define PRL_SUPPRESS 0x0008 /* Suppress all latch group questions */
48
49#define PRL_VARIABLE 0x000f /* All the flags that need to be reset */
50
21c84b71
TT
51/*
52 * Pre-Pass 1 errors
53 */
54
55/* Block bitmap not in group */
56#define PR_0_BB_NOT_GROUP 0x000001
57
58/* Inode bitmap not in group */
59#define PR_0_IB_NOT_GROUP 0x000002
60
61/* Inode table not in group */
62#define PR_0_ITABLE_NOT_GROUP 0x000003
63
1b6bf175
TT
64/* Superblock corrupt */
65#define PR_0_SB_CORRUPT 0x000004
66
67/* Filesystem size is wrong */
68#define PR_0_FS_SIZE_WRONG 0x000005
69
70/* Fragments not supported */
71#define PR_0_NO_FRAGMENTS 0x000006
72
73/* Bad blocks_per_group */
74#define PR_0_BLOCKS_PER_GROUP 0x000007
75
76/* Bad first_data_block */
77#define PR_0_FIRST_DATA_BLOCK 0x000008
78
79/* Adding UUID to filesystem */
80#define PR_0_ADD_UUID 0x000009
81
82/* Relocate hint */
83#define PR_0_RELOCATE_HINT 0x00000A
84
85/* Miscellaneous superblock corruption */
86#define PR_0_MISC_CORRUPT_SUPER 0x00000B
87
88/* Error determing physical device size of filesystem */
89#define PR_0_GETSIZE_ERROR 0x00000C
90
d4b0ce03
TT
91/* Inode count in the superblock incorrect */
92#define PR_0_INODE_COUNT_WRONG 0x00000D
93
21c84b71
TT
94/*
95 * Pass 1 errors
96 */
97
1b6bf175
TT
98/* Pass 1: Checking inodes, blocks, and sizes */
99#define PR_1_PASS_HEADER 0x010000
100
21c84b71 101/* Root directory is not an inode */
1b6bf175 102#define PR_1_ROOT_NO_DIR 0x010001
21c84b71
TT
103
104/* Root directory has dtime set */
1b6bf175 105#define PR_1_ROOT_DTIME 0x010002
21c84b71
TT
106
107/* Reserved inode has bad mode */
1b6bf175 108#define PR_1_RESERVED_BAD_MODE 0x010003
21c84b71
TT
109
110/* Deleted inode has zero dtime */
1b6bf175 111#define PR_1_ZERO_DTIME 0x010004
21c84b71
TT
112
113/* Inode in use, but dtime set */
1b6bf175 114#define PR_1_SET_DTIME 0x010005
21c84b71
TT
115
116/* Zero-length directory */
1b6bf175 117#define PR_1_ZERO_LENGTH_DIR 0x010006
21c84b71
TT
118
119/* Block bitmap conflicts with some other fs block */
1b6bf175 120#define PR_1_BB_CONFLICT 0x010007
21c84b71
TT
121
122/* Inode bitmap conflicts with some other fs block */
1b6bf175 123#define PR_1_IB_CONFLICT 0x010008
21c84b71
TT
124
125/* Inode table conflicts with some other fs block */
1b6bf175 126#define PR_1_ITABLE_CONFLICT 0x010009
21c84b71
TT
127
128/* Block bitmap is on a bad block */
1b6bf175 129#define PR_1_BB_BAD_BLOCK 0x01000A
21c84b71
TT
130
131/* Inode bitmap is on a bad block */
1b6bf175 132#define PR_1_IB_BAD_BLOCK 0x01000B
21c84b71
TT
133
134/* Inode has incorrect i_size */
1b6bf175 135#define PR_1_BAD_I_SIZE 0x01000C
21c84b71
TT
136
137/* Inode has incorrect i_blocks */
1b6bf175 138#define PR_1_BAD_I_BLOCKS 0x01000D
21c84b71
TT
139
140/* Illegal block number in inode */
1b6bf175 141#define PR_1_ILLEGAL_BLOCK_NUM 0x01000E
21c84b71
TT
142
143/* Block number overlaps fs metadata */
144#define PR_1_BLOCK_OVERLAPS_METADATA 0x01000F
145
146/* Inode has illegal blocks (latch question) */
1b6bf175 147#define PR_1_INODE_BLOCK_LATCH 0x010010
21c84b71
TT
148
149/* Too many bad blocks in inode */
1b6bf175 150#define PR_1_TOO_MANY_BAD_BLOCKS 0x010011
21c84b71
TT
151
152/* Illegal block number in bad block inode */
1b6bf175 153#define PR_1_BB_ILLEGAL_BLOCK_NUM 0x010012
21c84b71
TT
154
155/* Bad block inode has illegal blocks (latch question) */
1b6bf175
TT
156#define PR_1_INODE_BBLOCK_LATCH 0x010013
157
158/* Duplicate or bad blocks in use! */
159#define PR_1_DUP_BLOCKS_PREENSTOP 0x010014
160
161/* Bad block used as bad block indirect block */
162#define PR_1_BBINODE_BAD_METABLOCK 0x010015
163
164/* Inconsistency can't be fixed prompt */
165#define PR_1_BBINODE_BAD_METABLOCK_PROMPT 0x010016
166
167/* Bad primary block */
168#define PR_1_BAD_PRIMARY_BLOCK 0x0100017
169
170/* Bad primary block prompt */
171#define PR_1_BAD_PRIMARY_BLOCK_PROMPT 0x0100018
172
173/* Bad primary superblock */
174#define PR_1_BAD_PRIMARY_SUPERBLOCK 0x0100019
175
176/* Bad primary block group descriptors */
177#define PR_1_BAD_PRIMARY_GROUP_DESCRIPTOR 0x010001A
178
179/* Bad superblock in group */
180#define PR_1_BAD_SUPERBLOCK 0x010001B
181
182/* Bad block group descriptors in group */
183#define PR_1_BAD_GROUP_DESCRIPTORS 0x010001C
184
185/* Block claimed for no reason */
186#define PR_1_PROGERR_CLAIMED_BLOCK 0x010001D
187
f8188fff 188/* Error allocating blocks for relocating metadata */
1b6bf175
TT
189#define PR_1_RELOC_BLOCK_ALLOCATE 0x010001E
190
f8188fff 191/* Error allocating block buffer during relocation process */
1b6bf175
TT
192#define PR_1_RELOC_MEMORY_ALLOCATE 0x010001F
193
194/* Relocating metadata group information from X to Y */
195#define PR_1_RELOC_FROM_TO 0x0100020
196
197/* Relocating metatdata group information to X */
198#define PR_1_RELOC_TO 0x0100021
199
200/* Block read error during relocation process */
201#define PR_1_RELOC_READ_ERR 0x0100022
202
203/* Block write error during relocation process */
204#define PR_1_RELOC_WRITE_ERR 0x0100023
205
206/* Error allocating inode bitmap */
207#define PR_1_ALLOCATE_IBITMAP_ERROR 0x0100024
208
209/* Error allocating block bitmap */
210#define PR_1_ALLOCATE_BBITMAP_ERROR 0x0100025
211
212/* Error allocating icount structure */
213#define PR_1_ALLOCATE_ICOUNT 0x0100026
214
215/* Error allocating dbcount */
216#define PR_1_ALLOCATE_DBCOUNT 0x0100027
217
218/* Error while scanning inodes */
219#define PR_1_ISCAN_ERROR 0x0100028
220
221/* Error while iterating over blocks */
222#define PR_1_BLOCK_ITERATE 0x0100029
223
224/* Error while storing inode count information */
225#define PR_1_ICOUNT_STORE 0x010002A
226
227/* Error while storing directory block information */
228#define PR_1_ADD_DBLOCK 0x010002B
229
230/* Error while reading inode (for clearing) */
231#define PR_1_READ_INODE 0x010002C
232
f8188fff
TT
233/* Suppress messages prompt */
234#define PR_1_SUPPRESS_MESSAGES 0x010002D
21c84b71 235
246501c6
TT
236/* Filesystem contains large files, but has no such flag in sb */
237#define PR_1_FEATURE_LARGE_FILES 0x01002E
238
21c84b71
TT
239/*
240 * Pass 1b errors
241 */
242
1b6bf175
TT
243/* Pass 1B: Rescan for duplicate/bad blocks */
244#define PR_1B_PASS_HEADER 0x011000
245
246/* Duplicate/bad block(s) header */
247#define PR_1B_DUP_BLOCK_HEADER 0x011001
248
249/* Duplicate/bad block(s) in inode */
250#define PR_1B_DUP_BLOCK 0x011002
251
252/* Duplicate/bad block(s) end */
253#define PR_1B_DUP_BLOCK_END 0x011003
254
255/* Error while scanning inodes */
256#define PR_1B_ISCAN_ERROR 0x011004
257
258/* Error allocating inode bitmap */
259#define PR_1B_ALLOCATE_IBITMAP_ERROR 0x011005
260
261
262/* Pass 1C: Scan directories for inodes with dup blocks. */
263#define PR_1C_PASS_HEADER 0x012000
264
265
266/* Pass 1D: Reconciling duplicate blocks */
267#define PR_1D_PASS_HEADER 0x013000
268
21c84b71 269/* File has duplicate blocks */
1b6bf175 270#define PR_1D_DUP_FILE 0x013001
21c84b71
TT
271
272/* List of files sharing duplicate blocks */
1b6bf175 273#define PR_1D_DUP_FILE_LIST 0x013002
21c84b71 274
521e3685 275/* File sharing blocks with filesystem metadata */
1b6bf175
TT
276#define PR_1D_SHARE_METADATA 0x013003
277
278/* Report of how many duplicate/bad inodes */
279#define PR_1D_NUM_DUP_INODES 0x013004
280
281/* Duplicated blocks already reassigned or cloned. */
282#define PR_1D_DUP_BLOCKS_DEALT 0x013005
283
284/* Clone duplicate/bad blocks? */
285#define PR_1D_CLONE_QUESTION 0x013006
286
287/* Delete file? */
288#define PR_1D_DELETE_QUESTION 0x013007
521e3685 289
1b6bf175
TT
290/* Couldn't clone file (error) */
291#define PR_1D_CLONE_ERROR 0x013008
292
21c84b71
TT
293/*
294 * Pass 2 errors
295 */
296
1b6bf175
TT
297/* Pass 2: Checking directory structure */
298#define PR_2_PASS_HEADER 0x020000
299
21c84b71
TT
300/* Bad inode number for '.' */
301#define PR_2_BAD_INODE_DOT 0x020001
302
303/* Directory entry has bad inode number */
304#define PR_2_BAD_INO 0x020002
305
306/* Directory entry has deleted or unused inode */
307#define PR_2_UNUSED_INODE 0x020003
308
309/* Directry entry is link to '.' */
310#define PR_2_LINK_DOT 0x020004
311
312/* Directory entry points to inode now located in a bad block */
313#define PR_2_BB_INODE 0x020005
314
315/* Directory entry contains a link to a directory */
316#define PR_2_LINK_DIR 0x020006
317
318/* Directory entry contains a link to the root directry */
319#define PR_2_LINK_ROOT 0x020007
320
321/* Directory entry has illegal characters in its name */
322#define PR_2_BAD_NAME 0x020008
323
324/* Missing '.' in directory inode */
325#define PR_2_MISSING_DOT 0x020009
326
327/* Missing '..' in directory inode */
328#define PR_2_MISSING_DOT_DOT 0x02000A
329
330/* First entry in directory inode doesn't contain '.' */
331#define PR_2_1ST_NOT_DOT 0x02000B
332
333/* Second entry in directory inode doesn't contain '..' */
334#define PR_2_2ND_NOT_DOT_DOT 0x02000C
335
336/* i_faddr should be zero */
337#define PR_2_FADDR_ZERO 0x02000D
338
339/* i_file_acl should be zero */
340#define PR_2_FILE_ACL_ZERO 0x02000E
341
342/* i_dir_acl should be zero */
343#define PR_2_DIR_ACL_ZERO 0x02000F
344
345/* i_frag should be zero */
346#define PR_2_FRAG_ZERO 0x020010
347
348/* i_fsize should be zero */
349#define PR_2_FSIZE_ZERO 0x020011
350
351/* inode has bad mode */
352#define PR_2_BAD_MODE 0x020012
353
354/* directory corrupted */
355#define PR_2_DIR_CORRUPTED 0x020013
356
357/* filename too long */
358#define PR_2_FILENAME_LONG 0x020014
359
360/* Directory inode has a missing block (hole) */
361#define PR_2_DIRECTORY_HOLE 0x020015
362
363/* '.' is not NULL terminated */
364#define PR_2_DOT_NULL_TERM 0x020016
365
366/* '..' is not NULL terminated */
367#define PR_2_DOT_DOT_NULL_TERM 0x020017
368
7cf73dcd
TT
369/* Illegal character device in inode */
370#define PR_2_BAD_CHAR_DEV 0x020018
371
372/* Illegal block device in inode */
373#define PR_2_BAD_BLOCK_DEV 0x020019
374
1b6bf175
TT
375/* Duplicate '.' entry */
376#define PR_2_DUP_DOT 0x02001A
377
378/* Duplicate '..' entry */
379#define PR_2_DUP_DOT_DOT 0x02001B
380
381/* Internal error: couldn't find dir_info */
382#define PR_2_NO_DIRINFO 0x02001C
383
384/* Final rec_len is wrong */
385#define PR_2_FINAL_RECLEN 0x02001D
386
387/* Error allocating icount structure */
388#define PR_2_ALLOCATE_ICOUNT 0x02001E
389
390/* Error iterating over directory blocks */
391#define PR_2_DBLIST_ITERATE 0x02001F
392
393/* Error reading directory block */
394#define PR_2_READ_DIRBLOCK 0x020020
395
396/* Error writing directory block */
397#define PR_2_WRITE_DIRBLOCK 0x020021
398
399/* Error allocating new directory block */
400#define PR_2_ALLOC_DIRBOCK 0x020022
401
402/* Error deallocating inode */
403#define PR_2_DEALLOC_INODE 0x020023
404
f8188fff
TT
405/* Directory entry for '.' is big. Split? */
406#define PR_2_SPLIT_DOT 0x0200024
407
1dde43f0
TT
408/* Illegal FIFO */
409#define PR_2_BAD_FIFO 0x020025
410
411/* Illegal socket */
412#define PR_2_BAD_SOCKET 0x020026
413
aa4115a4
TT
414/* Directory filetype not set */
415#define PR_2_SET_FILETYPE 0x020027
416
417/* Directory filetype incorrect */
418#define PR_2_BAD_FILETYPE 0x020028
419
7847c1d4
TT
420/* Directory filetype set when it shouldn't be */
421#define PR_2_CLEAR_FILETYPE 0x020029
422
c40db6d5
TT
423/* Directory filename can't be zero-length */
424#define PR_2_NULL_NAME 0x020030
425
21c84b71
TT
426/*
427 * Pass 3 errors
428 */
429
1b6bf175
TT
430/* Pass 3: Checking directory connectivity */
431#define PR_3_PASS_HEADER 0x030000
432
21c84b71 433/* Root inode not allocated */
1b6bf175 434#define PR_3_NO_ROOT_INODE 0x030001
21c84b71
TT
435
436/* No room in lost+found */
1b6bf175 437#define PR_3_EXPAND_LF_DIR 0x030002
21c84b71
TT
438
439/* Unconnected directory inode */
1b6bf175 440#define PR_3_UNCONNECTED_DIR 0x030003
21c84b71
TT
441
442/* /lost+found not found */
1b6bf175 443#define PR_3_NO_LF_DIR 0x030004
21c84b71
TT
444
445/* .. entry is incorrect */
1b6bf175
TT
446#define PR_3_BAD_DOT_DOT 0x030005
447
448/* Bad or non-existent /lost+found. Cannot reconnect */
449#define PR_3_NO_LPF 0x030006
450
451/* Could not expand /lost+found */
452#define PR_3_CANT_EXPAND_LPF 0x030007
453
454/* Could not reconnect inode */
455#define PR_3_CANT_RECONNECT 0x030008
456
457/* Error while trying to find /lost+found */
458#define PR_3_ERR_FIND_LPF 0x030009
459
460/* Error in ext2fs_new_block while creating /lost+found */
461#define PR_3_ERR_LPF_NEW_BLOCK 0x03000A
21c84b71 462
1b6bf175
TT
463/* Error in ext2fs_new_inode while creating /lost+found */
464#define PR_3_ERR_LPF_NEW_INODE 0x03000B
465
466/* Error in ext2fs_new_dir_block while creating /lost+found */
467#define PR_3_ERR_LPF_NEW_DIR_BLOCK 0x03000C
468
469/* Error while writing directory block for /lost+found */
470#define PR_3_ERR_LPF_WRITE_BLOCK 0x03000D
471
472/* Error while adjusting inode count */
473#define PR_3_ADJUST_INODE 0x03000E
474
475/* Couldn't fix parent directory -- error */
476#define PR_3_FIX_PARENT_ERR 0x03000F
477
478/* Couldn't fix parent directory -- couldn't find it */
479#define PR_3_FIX_PARENT_NOFIND 0x030010
480
481/* Error allocating inode bitmap */
482#define PR_3_ALLOCATE_IBITMAP_ERROR 0x030011
483
484/* Error creating root directory */
485#define PR_3_CREATE_ROOT_ERROR 0x030012
486
487/* Error creating lost and found directory */
488#define PR_3_CREATE_LPF_ERROR 0x030013
21c84b71 489
f8188fff
TT
490/* Root inode is not directory; aborting */
491#define PR_3_ROOT_NOT_DIR_ABORT 0x030014
492
493/* Cannot proceed without a root inode. */
494#define PR_3_NO_ROOT_INODE_ABORT 0x030015
495
7f813ba3 496/* Internal error: couldn't find dir_info */
4a9f5936
TT
497#define PR_3_NO_DIRINFO 0x030016
498
499/* Lost+found is not a directory */
500#define PR_3_LPF_NOTDIR 0x030017
7f813ba3 501
21c84b71
TT
502/*
503 * Pass 4 errors
504 */
505
1b6bf175
TT
506/* Pass 4: Checking reference counts */
507#define PR_4_PASS_HEADER 0x040000
508
21c84b71
TT
509/* Unattached zero-length inode */
510#define PR_4_ZERO_LEN_INODE 0x040001
511
512/* Unattached inode */
513#define PR_4_UNATTACHED_INODE 0x040002
514
515/* Inode ref count wrong */
516#define PR_4_BAD_REF_COUNT 0x040003
517
1b6bf175
TT
518/* Inconsistent inode count information cached */
519#define PR_4_INCONSISTENT_COUNT 0x040004
520
21c84b71
TT
521/*
522 * Pass 5 errors
523 */
524
1b6bf175
TT
525/* Pass 5: Checking group summary information */
526#define PR_5_PASS_HEADER 0x050000
527
528/* Padding at end of inode bitmap is not set. */
529#define PR_5_INODE_BMAP_PADDING 0x050001
530
531/* Padding at end of block bitmap is not set. */
532#define PR_5_BLOCK_BMAP_PADDING 0x050002
533
534/* Block bitmap differences header */
535#define PR_5_BLOCK_BITMAP_HEADER 0x050003
536
537/* Block not used, but marked in bitmap */
538#define PR_5_UNUSED_BLOCK 0x050004
539
540/* Block used, but not marked used in bitmap */
541#define PR_5_BLOCK_USED 0x050005
542
543/* Block bitmap differences end */
544#define PR_5_BLOCK_BITMAP_END 0x050006
545
546/* Inode bitmap differences header */
547#define PR_5_INODE_BITMAP_HEADER 0x050007
548
549/* Inode not used, but marked in bitmap */
550#define PR_5_UNUSED_INODE 0x050008
551
552/* Inode used, but not marked used in bitmap */
553#define PR_5_INODE_USED 0x050009
554
555/* Inode bitmap differences end */
556#define PR_5_INODE_BITMAP_END 0x05000A
557
558/* Free inodes count for group wrong */
559#define PR_5_FREE_INODE_COUNT_GROUP 0x05000B
560
561/* Directories count for group wrong */
562#define PR_5_FREE_DIR_COUNT_GROUP 0x05000C
563
564/* Free inodes count wrong */
565#define PR_5_FREE_INODE_COUNT 0x05000D
566
567/* Free blocks count for group wrong */
568#define PR_5_FREE_BLOCK_COUNT_GROUP 0x05000E
569
570/* Free blocks count wrong */
571#define PR_5_FREE_BLOCK_COUNT 0x05000F
572
573/* Programming error: bitmap endpoints don't match */
574#define PR_5_BMAP_ENDPOINTS 0x050010
575
576/* Internal error: fudging end of bitmap */
577#define PR_5_FUDGE_BITMAP_ERROR 0x050011
578
21c84b71
TT
579/*
580 * Function declarations
581 */
1b6bf175
TT
582int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx);
583int end_problem_latch(e2fsck_t ctx, int mask);
584int set_latch_flags(int mask, int setflags, int clearflags);
585int get_latch_flags(int mask, int *value);
21c84b71
TT
586void clear_problem_context(struct problem_context *ctx);
587
588/* message.c */
1b6bf175
TT
589void print_e2fsck_message(e2fsck_t ctx, const char *msg,
590 struct problem_context *pctx, int first);
21c84b71 591