blob: 870e811cb3032b1a47c638a0cc299d8221705ebf [file] [log] [blame]
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001/*
2 * problem.c --- report filesystem problems to the user
3 *
4 * Copyright 1996, 1997 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#include <stdlib.h>
13#include <unistd.h>
14#include <string.h>
15#include <ctype.h>
16#include <termios.h>
17
18#include "e2fsck.h"
19
20#include "problem.h"
Theodore Ts'of8188ff1997-11-14 05:23:04 +000021#include "problemP.h"
Theodore Ts'o21c84b71997-04-29 16:15:03 +000022
Theodore Ts'o1b6bf171997-10-03 17:48:10 +000023#define PROMPT_NONE 0
24#define PROMPT_FIX 1
25#define PROMPT_CLEAR 2
26#define PROMPT_RELOCATE 3
27#define PROMPT_ALLOCATE 4
28#define PROMPT_EXPAND 5
29#define PROMPT_CONNECT 6
30#define PROMPT_CREATE 7
31#define PROMPT_SALVAGE 8
32#define PROMPT_TRUNCATE 9
33#define PROMPT_CLEAR_INODE 10
34#define PROMPT_ABORT 11
35#define PROMPT_SPLIT 12
36#define PROMPT_CONTINUE 13
37#define PROMPT_CLONE 14
38#define PROMPT_DELETE 15
Theodore Ts'of8188ff1997-11-14 05:23:04 +000039#define PROMPT_SUPPRESS 16
Theodore Ts'o4a9f5931999-03-16 19:32:52 +000040#define PROMPT_UNLINK 17
Theodore Ts'od37066a2001-12-21 23:28:54 -050041#define PROMPT_NULL 18
Theodore Ts'o21c84b71997-04-29 16:15:03 +000042
43/*
44 * These are the prompts which are used to ask the user if they want
45 * to fix a problem.
46 */
47static const char *prompt[] = {
Theodore Ts'o0c4a0722000-02-07 03:11:03 +000048 N_("(no prompt)"), /* 0 */
49 N_("Fix"), /* 1 */
50 N_("Clear"), /* 2 */
51 N_("Relocate"), /* 3 */
52 N_("Allocate"), /* 4 */
53 N_("Expand"), /* 5 */
54 N_("Connect to /lost+found"), /* 6 */
55 N_("Create"), /* 7 */
56 N_("Salvage"), /* 8 */
57 N_("Truncate"), /* 9 */
58 N_("Clear inode"), /* 10 */
59 N_("Abort"), /* 11 */
60 N_("Split"), /* 12 */
61 N_("Continue"), /* 13 */
62 N_("Clone duplicate/bad blocks"), /* 14 */
63 N_("Delete file"), /* 15 */
64 N_("Suppress messages"),/* 16 */
65 N_("Unlink"), /* 17 */
Theodore Ts'od37066a2001-12-21 23:28:54 -050066 "", /* 18 */
Theodore Ts'o1b6bf171997-10-03 17:48:10 +000067};
Theodore Ts'o21c84b71997-04-29 16:15:03 +000068
69/*
70 * These messages are printed when we are preen mode and we will be
71 * automatically fixing the problem.
72 */
73static const char *preen_msg[] = {
Theodore Ts'o0c4a0722000-02-07 03:11:03 +000074 N_("(NONE)"), /* 0 */
75 N_("FIXED"), /* 1 */
76 N_("CLEARED"), /* 2 */
77 N_("RELOCATED"), /* 3 */
78 N_("ALLOCATED"), /* 4 */
79 N_("EXPANDED"), /* 5 */
80 N_("RECONNECTED"), /* 6 */
81 N_("CREATED"), /* 7 */
82 N_("SALVAGED"), /* 8 */
83 N_("TRUNCATED"), /* 9 */
84 N_("INODE CLEARED"), /* 10 */
85 N_("ABORTED"), /* 11 */
86 N_("SPLIT"), /* 12 */
87 N_("CONTINUING"), /* 13 */
88 N_("DUPLICATE/BAD BLOCKS CLONED"), /* 14 */
89 N_("FILE DELETED"), /* 15 */
90 N_("SUPPRESSED"), /* 16 */
91 N_("UNLINKED"), /* 17 */
Theodore Ts'o21c84b71997-04-29 16:15:03 +000092};
93
Theodore Ts'o1b6bf171997-10-03 17:48:10 +000094static const struct e2fsck_problem problem_table[] = {
Theodore Ts'o21c84b71997-04-29 16:15:03 +000095
96 /* Pre-Pass 1 errors */
97
98 /* Block bitmap not in group */
Theodore Ts'o0c4a0722000-02-07 03:11:03 +000099 { PR_0_BB_NOT_GROUP, N_("@b @B for @g %g is not in @g. (@b %b)\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000100 PROMPT_RELOCATE, PR_LATCH_RELOC },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000101
102 /* Inode bitmap not in group */
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000103 { PR_0_IB_NOT_GROUP, N_("@i @B for @g %g is not in @g. (@b %b)\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000104 PROMPT_RELOCATE, PR_LATCH_RELOC },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000105
106 /* Inode table not in group */
107 { PR_0_ITABLE_NOT_GROUP,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000108 N_("@i table for @g %g is not in @g. (@b %b)\n"
109 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000110 PROMPT_RELOCATE, PR_LATCH_RELOC },
111
112 /* Superblock corrupt */
113 { PR_0_SB_CORRUPT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000114 N_("\nThe @S could not be read or does not describe a correct ext2\n"
Theodore Ts'od74edf42001-01-03 19:38:04 +0000115 "@f. If the @v is valid and it really contains an ext2\n"
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000116 "@f (and not swap or ufs or something else), then the @S\n"
Theodore Ts'o424cd2b2001-05-14 04:06:56 +0000117 "is corrupt, and you might try running e2fsck with an alternate @S:\n"
Theodore Ts'od74edf42001-01-03 19:38:04 +0000118 " e2fsck -b %S <@v>\n\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000119 PROMPT_NONE, PR_FATAL },
120
121 /* Filesystem size is wrong */
122 { PR_0_FS_SIZE_WRONG,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000123 N_("The @f size (according to the @S) is %b @bs\n"
Theodore Ts'od74edf42001-01-03 19:38:04 +0000124 "The physical size of the @v is %c @bs\n"
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000125 "Either the @S or the partition table is likely to be corrupt!\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000126 PROMPT_ABORT, 0 },
127
128 /* Fragments not supported */
129 { PR_0_NO_FRAGMENTS,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000130 N_("@S @b_size = %b, fragsize = %c.\n"
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000131 "This version of e2fsck does not support fragment sizes different\n"
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000132 "from the @b size.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000133 PROMPT_NONE, PR_FATAL },
134
135 /* Bad blocks_per_group */
136 { PR_0_BLOCKS_PER_GROUP,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000137 N_("@S @bs_per_group = %b, should have been %c\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000138 PROMPT_NONE, PR_AFTER_CODE, PR_0_SB_CORRUPT },
139
140 /* Bad first_data_block */
141 { PR_0_FIRST_DATA_BLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000142 N_("@S first_data_@b = %b, should have been %c\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000143 PROMPT_NONE, PR_AFTER_CODE, PR_0_SB_CORRUPT },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000144
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000145 /* Adding UUID to filesystem */
146 { PR_0_ADD_UUID,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000147 N_("@f did not have a UUID; generating one.\n\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000148 PROMPT_NONE, 0 },
149
150 /* Relocate hint */
151 { PR_0_RELOCATE_HINT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000152 N_("Note: if there is several inode or block bitmap blocks\n"
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000153 "which require relocation, or one part of the inode table\n"
154 "which must be moved, you may wish to try running e2fsck\n"
155 "with the '-b %S' option first. The problem may lie only\n"
156 "with the primary block group descriptor, and the backup\n"
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000157 "block group descriptor may be OK.\n\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000158 PROMPT_NONE, PR_PREEN_OK | PR_NOCOLLATE },
159
160 /* Miscellaneous superblock corruption */
161 { PR_0_MISC_CORRUPT_SUPER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000162 N_("Corruption found in @S. (%s = %N).\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000163 PROMPT_NONE, PR_AFTER_CODE, PR_0_SB_CORRUPT },
164
165 /* Error determing physical device size of filesystem */
166 { PR_0_GETSIZE_ERROR,
Theodore Ts'od74edf42001-01-03 19:38:04 +0000167 N_("Error determining size of the physical @v: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000168 PROMPT_NONE, PR_FATAL },
Theodore Ts'od4b0ce01999-06-18 01:09:29 +0000169
170 /* Inode count in superblock is incorrect */
171 { PR_0_INODE_COUNT_WRONG,
Theodore Ts'o4ea0a112000-05-08 13:33:17 +0000172 N_("@i count in @S is %i, should be %j.\n"),
Theodore Ts'od4b0ce01999-06-18 01:09:29 +0000173 PROMPT_FIX, 0 },
Theodore Ts'o4ea0a112000-05-08 13:33:17 +0000174
175 { PR_0_HURD_CLEAR_FILETYPE,
176 N_("The Hurd does not support the filetype feature.\n"),
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000177 PROMPT_CLEAR, 0 },
178
179 /* Journal inode is invalid */
180 { PR_0_JOURNAL_BAD_INODE,
Theodore Ts'o7e92dfa2001-01-12 15:30:25 +0000181 N_("@S has a bad ext3 @j (@i %i).\n"),
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000182 PROMPT_CLEAR, PR_PREEN_OK },
183
Theodore Ts'oadee8d72001-07-23 00:17:49 -0400184 /* The external journal has (unsupported) multiple filesystems */
185 { PR_0_JOURNAL_UNSUPP_MULTIFS,
186 N_("External @j has multiple @f users (unsupported).\n"),
187 PROMPT_NONE, PR_FATAL },
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000188
Theodore Ts'oadee8d72001-07-23 00:17:49 -0400189 /* Can't find external journal */
190 { PR_0_CANT_FIND_JOURNAL,
191 N_("Can't find external @j\n"),
192 PROMPT_NONE, PR_FATAL },
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000193
Theodore Ts'oadee8d72001-07-23 00:17:49 -0400194 /* External journal has bad superblock */
195 { PR_0_EXT_JOURNAL_BAD_SUPER,
196 N_("External @j has bad @S\n"),
197 PROMPT_NONE, PR_FATAL },
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000198
199 /* Superblock has a bad journal UUID */
200 { PR_0_JOURNAL_BAD_UUID,
Theodore Ts'oadee8d72001-07-23 00:17:49 -0400201 N_("External @j does not support this @f\n"),
202 PROMPT_NONE, PR_FATAL },
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000203
204 /* Journal has an unknown superblock type */
Theodore Ts'of76ad462001-06-14 06:58:33 +0000205 { PR_0_JOURNAL_UNSUPP_SUPER,
206 N_("Ext3 @j @S is unknown type %N (unsupported).\n"
207 "It is likely that your copy of e2fsck is old and/or doesn't "
208 "support this @j format.\n"
209 "It is also possible the @j @S is corrupt.\n"),
210 PROMPT_ABORT, PR_NO_OK | PR_AFTER_CODE, PR_0_JOURNAL_BAD_SUPER },
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000211
212 /* Journal superblock is corrupt */
213 { PR_0_JOURNAL_BAD_SUPER,
Theodore Ts'of18996c2001-01-03 16:57:24 +0000214 N_("Ext3 @j @S is corrupt.\n"),
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000215 PROMPT_FIX, PR_PREEN_OK },
216
217 /* Superblock flag should be cleared */
218 { PR_0_JOURNAL_HAS_JOURNAL,
Theodore Ts'od37066a2001-12-21 23:28:54 -0500219 N_("@S doesn't have has_@j flag, but has ext3 @j %s.\n"),
Theodore Ts'o37b6b292001-01-12 21:16:13 +0000220 PROMPT_CLEAR, PR_PREEN_OK },
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000221
222 /* Superblock flag is incorrect */
223 { PR_0_JOURNAL_RECOVER_SET,
Theodore Ts'of18996c2001-01-03 16:57:24 +0000224 N_("@S has ext3 needs_recovery flag set, but no @j.\n"),
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000225 PROMPT_CLEAR, PR_PREEN_OK },
226
Theodore Ts'od37066a2001-12-21 23:28:54 -0500227 /* Journal has data, but recovery flag is clear */
228 { PR_0_JOURNAL_RECOVERY_CLEAR,
229 N_("ext3 recovery flag clear, but @j has data.\n"),
230 PROMPT_NONE, 0 },
Theodore Ts'o3b5386d2000-08-14 14:25:19 +0000231
Theodore Ts'od37066a2001-12-21 23:28:54 -0500232 /* Ask if we should clear the journal */
233 { PR_0_JOURNAL_RESET_JOURNAL,
234 N_("Clear @j"),
235 PROMPT_NULL, PR_PREEN_NOMSG },
236
237 /* Ask if we should run the journal anyway */
238 { PR_0_JOURNAL_RUN,
239 N_("Run @j anyway"),
240 PROMPT_NULL, 0 },
241
242 /* Run the journal by default */
243 { PR_0_JOURNAL_RUN_DEFAULT,
244 N_("Recovery flag not set in backup @S, so running @j anyway.\n"),
245 PROMPT_NONE, 0 },
Theodore Ts'o4ea0a112000-05-08 13:33:17 +0000246
Theodore Ts'oecf1b772000-08-20 22:06:31 +0000247 /* Clearing orphan inode */
Theodore Ts'o83949022000-10-25 01:38:50 +0000248 { PR_0_ORPHAN_CLEAR_INODE,
249 N_("%s @o @i %i (uid=%Iu, gid=%Ig, mode=%Im, size=%Is)\n"),
Theodore Ts'oecf1b772000-08-20 22:06:31 +0000250 PROMPT_NONE, 0 },
251
Theodore Ts'o80bfaa32000-08-18 15:08:37 +0000252 /* Illegal block found in orphaned inode */
253 { PR_0_ORPHAN_ILLEGAL_BLOCK_NUM,
254 N_("@I @b #%B (%b) found in @o @i %i.\n"),
255 PROMPT_NONE, 0 },
256
257 /* Already cleared block found in orphaned inode */
258 { PR_0_ORPHAN_ALREADY_CLEARED_BLOCK,
259 N_("Already cleared @b #%B (%b) found in @o @i %i.\n"),
260 PROMPT_NONE, 0 },
261
262 /* Illegal orphan inode in superblock */
263 { PR_0_ORPHAN_ILLEGAL_HEAD_INODE,
264 N_("@I @o @i %i in @S.\n"),
265 PROMPT_NONE, 0 },
266
267 /* Illegal inode in orphaned inode list */
268 { PR_0_ORPHAN_ILLEGAL_INODE,
269 N_("@I @i %i in @o @i list.\n"),
270 PROMPT_NONE, 0 },
271
Theodore Ts'o060b5fb2000-12-13 18:07:23 +0000272 /* Filesystem revision is 0, but feature flags are set */
273 { PR_0_FS_REV_LEVEL,
Theodore Ts'o95a5bc92001-01-11 04:58:21 +0000274 "@f has feature flag(s) set, but is a revision 0 @f. ",
Theodore Ts'o060b5fb2000-12-13 18:07:23 +0000275 PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
276
Theodore Ts'o424cd2b2001-05-14 04:06:56 +0000277 /* Journal superblock has an unknown read-only feature flag set */
278 { PR_0_JOURNAL_UNSUPP_ROCOMPAT,
279 N_("Ext3 @j @S has an unknown read-only feature flag set.\n"),
Theodore Ts'o2f686ac2001-06-02 00:38:40 +0000280 PROMPT_ABORT, 0 },
Theodore Ts'o424cd2b2001-05-14 04:06:56 +0000281
282 /* Journal superblock has an unknown incompatible feature flag set */
283 { PR_0_JOURNAL_UNSUPP_INCOMPAT,
284 N_("Ext3 @j @S has an unknown incompatible feature flag set.\n"),
Theodore Ts'o2f686ac2001-06-02 00:38:40 +0000285 PROMPT_ABORT, 0 },
Theodore Ts'oc7f23362001-05-23 22:19:47 +0000286
287 /* Journal has unsupported version number */
288 { PR_0_JOURNAL_UNSUPP_VERSION,
289 N_("@j version not supported by this e2fsck.\n"),
290 PROMPT_ABORT, 0 },
Theodore Ts'o773fd8a2001-10-06 21:26:27 -0400291
292 /* Moving journal to hidden file */
293 { PR_0_MOVE_JOURNAL,
294 N_("Moving @j from /%s to hidden inode.\n\n"),
295 PROMPT_NONE, 0 },
296
297 /* Error moving journal to hidden file */
298 { PR_0_ERR_MOVE_JOURNAL,
299 N_("Error moving @j: %m\n\n"),
300 PROMPT_NONE, 0 },
301
Theodore Ts'o62e3e7f2001-10-07 02:13:30 -0400302 /* Clearing V2 journal superblock */
303 { PR_0_CLEAR_V2_JOURNAL,
304 N_("Found invalid V2 @j @S fields (from V1 journal).\n"
305 "Clearing fields beyond the V1 @j @S...\n\n"),
306 PROMPT_NONE, 0 },
307
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000308 /* Pass 1 errors */
309
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000310 /* Pass 1: Checking inodes, blocks, and sizes */
311 { PR_1_PASS_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000312 N_("Pass 1: Checking @is, @bs, and sizes\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000313 PROMPT_NONE, 0 },
314
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000315 /* Root directory is not an inode */
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000316 { PR_1_ROOT_NO_DIR, N_("@r is not a @d. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000317 PROMPT_CLEAR, 0 },
318
319 /* Root directory has dtime set */
320 { PR_1_ROOT_DTIME,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000321 N_("@r has dtime set (probably due to old mke2fs). "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000322 PROMPT_FIX, PR_PREEN_OK },
323
324 /* Reserved inode has bad mode */
325 { PR_1_RESERVED_BAD_MODE,
Theodore Ts'o37b6b292001-01-12 21:16:13 +0000326 N_("Reserved @i %i %Q has bad mode. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000327 PROMPT_CLEAR, PR_PREEN_OK },
328
329 /* Deleted inode has zero dtime */
330 { PR_1_ZERO_DTIME,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000331 N_("@D @i %i has zero dtime. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000332 PROMPT_FIX, PR_PREEN_OK },
333
334 /* Inode in use, but dtime set */
335 { PR_1_SET_DTIME,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000336 N_("@i %i is in use, but has dtime set. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000337 PROMPT_FIX, PR_PREEN_OK },
338
339 /* Zero-length directory */
340 { PR_1_ZERO_LENGTH_DIR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000341 N_("@i %i is a @z @d. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000342 PROMPT_CLEAR, PR_PREEN_OK },
343
344 /* Block bitmap conflicts with some other fs block */
345 { PR_1_BB_CONFLICT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000346 N_("@g %g's @b @B at %b @C.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000347 PROMPT_RELOCATE, 0 },
348
349 /* Inode bitmap conflicts with some other fs block */
350 { PR_1_IB_CONFLICT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000351 N_("@g %g's @i @B at %b @C.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000352 PROMPT_RELOCATE, 0 },
353
354 /* Inode table conflicts with some other fs block */
355 { PR_1_ITABLE_CONFLICT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000356 N_("@g %g's @i table at %b @C.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000357 PROMPT_RELOCATE, 0 },
358
359 /* Block bitmap is on a bad block */
360 { PR_1_BB_BAD_BLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000361 N_("@g %g's @b @B (%b) is bad. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000362 PROMPT_RELOCATE, 0 },
363
364 /* Inode bitmap is on a bad block */
365 { PR_1_IB_BAD_BLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000366 N_("@g %g's @i @B (%b) is bad. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000367 PROMPT_RELOCATE, 0 },
368
369 /* Inode has incorrect i_size */
370 { PR_1_BAD_I_SIZE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000371 N_("@i %i, i_size is %Is, @s %N. "),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000372 PROMPT_FIX, PR_PREEN_OK },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000373
374 /* Inode has incorrect i_blocks */
375 { PR_1_BAD_I_BLOCKS,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000376 N_("@i %i, i_@bs is %Ib, @s %N. "),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000377 PROMPT_FIX, PR_PREEN_OK },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000378
Theodore Ts'o80bfaa32000-08-18 15:08:37 +0000379 /* Illegal blocknumber in inode */
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000380 { PR_1_ILLEGAL_BLOCK_NUM,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000381 N_("@I @b #%B (%b) in @i %i. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000382 PROMPT_CLEAR, PR_LATCH_BLOCK },
383
384 /* Block number overlaps fs metadata */
385 { PR_1_BLOCK_OVERLAPS_METADATA,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000386 N_("@b #%B (%b) overlaps @f metadata in @i %i. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000387 PROMPT_CLEAR, PR_LATCH_BLOCK },
388
389 /* Inode has illegal blocks (latch question) */
390 { PR_1_INODE_BLOCK_LATCH,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000391 N_("@i %i has illegal @b(s). "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000392 PROMPT_CLEAR, 0 },
393
394 /* Too many bad blocks in inode */
395 { PR_1_TOO_MANY_BAD_BLOCKS,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000396 N_("Too many illegal @bs in @i %i.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000397 PROMPT_CLEAR_INODE, PR_NO_OK },
398
399 /* Illegal block number in bad block inode */
400 { PR_1_BB_ILLEGAL_BLOCK_NUM,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000401 N_("@I @b #%B (%b) in bad @b @i. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000402 PROMPT_CLEAR, PR_LATCH_BBLOCK },
403
404 /* Bad block inode has illegal blocks (latch question) */
405 { PR_1_INODE_BBLOCK_LATCH,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000406 N_("Bad @b @i has illegal @b(s). "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000407 PROMPT_CLEAR, 0 },
408
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000409 /* Duplicate or bad blocks in use! */
410 { PR_1_DUP_BLOCKS_PREENSTOP,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000411 N_("Duplicate or bad @b in use!\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000412 PROMPT_NONE, 0 },
413
414 /* Bad block used as bad block indirect block */
415 { PR_1_BBINODE_BAD_METABLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000416 N_("Bad @b %b used as bad @b indirect @b?!?\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000417 PROMPT_NONE, PR_AFTER_CODE, PR_1_BBINODE_BAD_METABLOCK_PROMPT },
418
419 /* Inconsistency can't be fixed prompt */
420 { PR_1_BBINODE_BAD_METABLOCK_PROMPT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000421 N_("\nThis inconsistency can not be fixed with e2fsck; to fix it, use\n"
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000422 """dumpe2fs -b"" to dump out the bad @b "
423 "list and ""e2fsck -L filename""\n"
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000424 "to read it back in again.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000425 PROMPT_CONTINUE, PR_PREEN_NOMSG },
426
427 /* Bad primary block */
428 { PR_1_BAD_PRIMARY_BLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000429 N_("\nIf the @b is really bad, the @f can not be fixed.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000430 PROMPT_NONE, PR_AFTER_CODE, PR_1_BAD_PRIMARY_BLOCK_PROMPT },
431
432 /* Bad primary block prompt */
433 { PR_1_BAD_PRIMARY_BLOCK_PROMPT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000434 N_("You can clear the this @b (and hope for the best) from the\n"
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000435 "bad @b list and hope that @b is really OK, but there are no\n"
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000436 "guarantees.\n\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000437 PROMPT_CLEAR, PR_PREEN_NOMSG },
438
439 /* Bad primary superblock */
440 { PR_1_BAD_PRIMARY_SUPERBLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000441 N_("The primary @S (%b) is on the bad @b list.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000442 PROMPT_NONE, PR_AFTER_CODE, PR_1_BAD_PRIMARY_BLOCK },
443
444 /* Bad primary block group descriptors */
445 { PR_1_BAD_PRIMARY_GROUP_DESCRIPTOR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000446 N_("Block %b in the primary @g descriptors "
447 "is on the bad @b list\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000448 PROMPT_NONE, PR_AFTER_CODE, PR_1_BAD_PRIMARY_BLOCK },
449
450 /* Bad superblock in group */
451 { PR_1_BAD_SUPERBLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000452 N_("Warning: Group %g's @S (%b) is bad.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000453 PROMPT_NONE, PR_PREEN_OK | PR_PREEN_NOMSG },
454
455 /* Bad block group descriptors in group */
456 { PR_1_BAD_GROUP_DESCRIPTORS,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000457 N_("Warning: Group %g's copy of the @g descriptors has a bad "
458 "@b (%b).\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000459 PROMPT_NONE, PR_PREEN_OK | PR_PREEN_NOMSG },
460
461 /* Block claimed for no reason */
462 { PR_1_PROGERR_CLAIMED_BLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000463 N_("Programming error? @b #%b claimed for no reason in "
464 "process_bad_@b.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000465 PROMPT_NONE, PR_PREEN_OK },
466
Theodore Ts'of8188ff1997-11-14 05:23:04 +0000467 /* Error allocating blocks for relocating metadata */
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000468 { PR_1_RELOC_BLOCK_ALLOCATE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000469 N_("@A %N @b(s) for %s: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000470 PROMPT_NONE, PR_PREEN_OK },
471
Theodore Ts'of8188ff1997-11-14 05:23:04 +0000472 /* Error allocating block buffer during relocation process */
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000473 { PR_1_RELOC_MEMORY_ALLOCATE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000474 N_("@A @b buffer for relocating %s\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000475 PROMPT_NONE, PR_PREEN_OK },
476
477 /* Relocating metadata group information from X to Y */
478 { PR_1_RELOC_FROM_TO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000479 N_("Relocating @g %g's %s from %b to %c...\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000480 PROMPT_NONE, PR_PREEN_OK },
481
482 /* Relocating metatdata group information to X */
483 { PR_1_RELOC_TO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000484 N_("Relocating @g %g's %s to %c...\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000485 PROMPT_NONE, PR_PREEN_OK },
486
487 /* Block read error during relocation process */
488 { PR_1_RELOC_READ_ERR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000489 N_("Warning: could not read @b %b of %s: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000490 PROMPT_NONE, PR_PREEN_OK },
491
492 /* Block write error during relocation process */
493 { PR_1_RELOC_WRITE_ERR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000494 N_("Warning: could not write @b %b for %s: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000495 PROMPT_NONE, PR_PREEN_OK },
496
497 /* Error allocating inode bitmap */
498 { PR_1_ALLOCATE_IBITMAP_ERROR,
Theodore Ts'of8188ff1997-11-14 05:23:04 +0000499 "@A @i @B (%N): %m\n",
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000500 PROMPT_NONE, PR_FATAL },
501
502 /* Error allocating block bitmap */
503 { PR_1_ALLOCATE_BBITMAP_ERROR,
Theodore Ts'of8188ff1997-11-14 05:23:04 +0000504 "@A @b @B (%N): %m\n",
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000505 PROMPT_NONE, PR_FATAL },
506
507 /* Error allocating icount structure */
508 { PR_1_ALLOCATE_ICOUNT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000509 N_("@A icount link information: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000510 PROMPT_NONE, PR_FATAL },
511
512 /* Error allocating dbcount */
513 { PR_1_ALLOCATE_DBCOUNT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000514 N_("@A @d @b array: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000515 PROMPT_NONE, PR_FATAL },
516
517 /* Error while scanning inodes */
518 { PR_1_ISCAN_ERROR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000519 N_("Error while scanning @is (%i): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000520 PROMPT_NONE, PR_FATAL },
521
522 /* Error while iterating over blocks */
523 { PR_1_BLOCK_ITERATE,
Theodore Ts'o133a56d2000-11-17 05:40:49 +0000524 N_("Error while iterating over @bs in @i %i: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000525 PROMPT_NONE, PR_FATAL },
526
527 /* Error while storing inode count information */
528 { PR_1_ICOUNT_STORE,
Theodore Ts'of18996c2001-01-03 16:57:24 +0000529 N_("Error storing @i count information (@i=%i, count=%N): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000530 PROMPT_NONE, PR_FATAL },
531
532 /* Error while storing directory block information */
533 { PR_1_ADD_DBLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000534 N_("Error storing @d @b information "
Theodore Ts'of18996c2001-01-03 16:57:24 +0000535 "(@i=%i, @b=%b, num=%N): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000536 PROMPT_NONE, PR_FATAL },
537
538 /* Error while reading inode (for clearing) */
539 { PR_1_READ_INODE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000540 N_("Error reading @i %i: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000541 PROMPT_NONE, PR_FATAL },
Theodore Ts'of8188ff1997-11-14 05:23:04 +0000542
543 /* Suppress messages prompt */
544 { PR_1_SUPPRESS_MESSAGES, "", PROMPT_SUPPRESS, PR_NO_OK },
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000545
Theodore Ts'o6fdc7a31999-11-10 13:34:40 +0000546 /* Imagic flag set on an inode when filesystem doesn't support it */
547 { PR_1_SET_IMAGIC,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000548 N_("@i %i has imagic flag set. "),
Theodore Ts'o6fdc7a31999-11-10 13:34:40 +0000549 PROMPT_CLEAR, 0 },
550
551 /* Immutable flag set on a device or socket inode */
552 { PR_1_SET_IMMUTABLE,
Theodore Ts'oa092c562001-07-27 22:40:09 -0400553 N_("Special (@v/socket/fifo/symlink) file (@i %i) has immutable\n"
554 "or append-only flag set. "),
Theodore Ts'oa846d2f1999-11-10 15:50:24 +0000555 PROMPT_CLEAR, PR_PREEN_OK | PR_PREEN_NO | PR_NO_OK },
Theodore Ts'o6fdc7a31999-11-10 13:34:40 +0000556
Theodore Ts'o01fbc702000-04-03 13:57:21 +0000557 /* Compression flag set on an inode when filesystem doesn't support it */
Theodore Ts'o19178752000-02-11 15:55:07 +0000558 { PR_1_COMPR_SET,
559 N_("@i %i has @cion flag set on @f without @cion support. "),
560 PROMPT_CLEAR, 0 },
561
Theodore Ts'od647a1e2000-05-27 14:40:09 +0000562 /* Non-zero size for device, fifo or socket inode */
563 { PR_1_SET_NONZSIZE,
Theodore Ts'od74edf42001-01-03 19:38:04 +0000564 "Special (@v/socket/fifo) @i %i has non-zero size. ",
Theodore Ts'od647a1e2000-05-27 14:40:09 +0000565 PROMPT_FIX, PR_PREEN_OK },
Theodore Ts'o060b5fb2000-12-13 18:07:23 +0000566
567 /* Filesystem revision is 0, but feature flags are set */
568 { PR_1_FS_REV_LEVEL,
Theodore Ts'of18996c2001-01-03 16:57:24 +0000569 "@f has feature flag(s) set, but is a revision 0 @f. ",
Theodore Ts'o060b5fb2000-12-13 18:07:23 +0000570 PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
571
Theodore Ts'of18996c2001-01-03 16:57:24 +0000572 /* Journal inode is not in use, but contains data */
Theodore Ts'oa9ca2012001-01-12 21:53:25 +0000573 { PR_1_JOURNAL_INODE_NOT_CLEAR,
Theodore Ts'of18996c2001-01-03 16:57:24 +0000574 "@j @i is not in use, but contains data. ",
575 PROMPT_CLEAR, PR_PREEN_OK },
576
Theodore Ts'oa9ca2012001-01-12 21:53:25 +0000577 /* Journal has bad mode */
578 { PR_1_JOURNAL_BAD_MODE,
Theodore Ts'o67a473e2001-02-08 02:34:50 +0000579 N_("@j is not regular file. "),
Theodore Ts'oa9ca2012001-01-12 21:53:25 +0000580 PROMPT_FIX, PR_PREEN_OK },
581
Theodore Ts'o21afac02001-05-14 12:47:41 +0000582 /* Deal with inodes that were part of orphan linked list */
583 { PR_1_LOW_DTIME,
584 N_("@i %i was part of the orphaned @i list. "),
585 PROMPT_FIX, PR_LATCH_LOW_DTIME, 0 },
586
587 /* Deal with inodes that were part of corrupted orphan linked
588 list (latch question) */
589 { PR_1_ORPHAN_LIST_REFUGEES,
590 N_("@is that were part of a corrupted orphan linked list found. "),
591 PROMPT_FIX, 0 },
592
Theodore Ts'o342d8472001-07-02 11:54:09 -0400593 /* Error allocating refcount structure */
594 { PR_1_ALLOCATE_REFCOUNT,
595 "@A refcount structure (%N): %m\n",
596 PROMPT_NONE, PR_FATAL },
597
598 /* Error reading extended attribute block */
599 { PR_1_READ_EA_BLOCK,
600 N_("Error reading @a @b %b for @i %i. "),
601 PROMPT_CLEAR, 0 },
602
Theodore Ts'oe8a3ee62001-07-07 11:12:50 -0400603 /* Invalid extended attribute block */
Theodore Ts'o342d8472001-07-02 11:54:09 -0400604 { PR_1_BAD_EA_BLOCK,
605 N_("@i %i has a bad @a @b %b. "),
606 PROMPT_CLEAR, 0 },
607
Theodore Ts'oe8a3ee62001-07-07 11:12:50 -0400608 /* Error reading Extended Attribute block while fixing refcount */
609 { PR_1_EXTATTR_READ_ABORT,
610 N_("Error reading @a @b %b (%m). "),
611 PROMPT_ABORT, 0 },
612
613 /* Extended attribute reference count incorrect */
614 { PR_1_EXTATTR_REFCOUNT,
615 N_("@a @b %b has reference count %B, should be %N. "),
616 PROMPT_FIX, 0 },
617
618 /* Error writing Extended Attribute block while fixing refcount */
619 { PR_1_EXTATTR_WRITE,
620 N_("Error writing @a @b %b (%m). "),
621 PROMPT_ABORT, 0 },
Theodore Ts'o55fd07e2001-07-19 16:31:25 -0400622
623 /* Multiple EA blocks not supported */
624 { PR_1_EA_MULTI_BLOCK,
625 N_("@a @b %b has h_blocks > 1. "),
626 PROMPT_CLEAR, 0},
627
628 /* Error allocating EA region allocation structure */
629 { PR_1_EA_ALLOC_REGION,
630 N_("Error allocating @a @b %b. "),
631 PROMPT_ABORT, 0},
632
633 /* Error EA allocation collision */
634 { PR_1_EA_ALLOC_COLLISION,
635 N_("@a @b %b is corrupt (allocation collision). "),
Theodore Ts'o14fe1c32001-07-25 19:48:24 -0400636 PROMPT_CLEAR, 0},
Theodore Ts'o55fd07e2001-07-19 16:31:25 -0400637
638 /* Bad extended attribute name */
639 { PR_1_EA_BAD_NAME,
640 N_("@a @b %b is corrupt (invalid name). "),
641 PROMPT_CLEAR, 0},
642
643 /* Bad extended attribute value */
644 { PR_1_EA_BAD_VALUE,
645 N_("@a @b %b is corrupt (invalid value). "),
646 PROMPT_CLEAR, 0},
Theodore Ts'oe8a3ee62001-07-07 11:12:50 -0400647
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000648 /* Pass 1b errors */
649
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000650 /* Pass 1B: Rescan for duplicate/bad blocks */
651 { PR_1B_PASS_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000652 N_("Duplicate @bs found... invoking duplicate @b passes.\n"
653 "Pass 1B: Rescan for duplicate/bad @bs\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000654 PROMPT_NONE, 0 },
655
656 /* Duplicate/bad block(s) header */
657 { PR_1B_DUP_BLOCK_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000658 N_("Duplicate/bad @b(s) in @i %i:"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000659 PROMPT_NONE, 0 },
660
661 /* Duplicate/bad block(s) in inode */
662 { PR_1B_DUP_BLOCK,
663 " %b",
664 PROMPT_NONE, PR_LATCH_DBLOCK },
665
666 /* Duplicate/bad block(s) end */
667 { PR_1B_DUP_BLOCK_END,
668 "\n",
669 PROMPT_NONE, 0 },
670
671 /* Error while scanning inodes */
672 { PR_1B_ISCAN_ERROR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000673 N_("Error while scanning inodes (%i): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000674 PROMPT_NONE, PR_FATAL },
675
676 /* Error allocating inode bitmap */
677 { PR_1B_ALLOCATE_IBITMAP_ERROR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000678 N_("@A @i @B (inode_dup_map): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000679 PROMPT_NONE, PR_FATAL },
680
Theodore Ts'o133a56d2000-11-17 05:40:49 +0000681 /* Error while iterating over blocks */
682 { PR_1B_BLOCK_ITERATE,
683 N_("Error while iterating over @bs in @i %i (%s): %m\n"),
684 PROMPT_NONE, 0 },
685
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000686 /* Pass 1C: Scan directories for inodes with dup blocks. */
687 { PR_1C_PASS_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000688 N_("Pass 1C: Scan directories for @is with dup @bs.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000689 PROMPT_NONE, 0 },
690
691
692 /* Pass 1D: Reconciling duplicate blocks */
693 { PR_1D_PASS_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000694 N_("Pass 1D: Reconciling duplicate @bs\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000695 PROMPT_NONE, 0 },
696
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000697 /* File has duplicate blocks */
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000698 { PR_1D_DUP_FILE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000699 N_("File %Q (@i #%i, mod time %IM) \n"
700 " has %B duplicate @b(s), shared with %N file(s):\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000701 PROMPT_NONE, 0 },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000702
703 /* List of files sharing duplicate blocks */
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000704 { PR_1D_DUP_FILE_LIST,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000705 N_("\t%Q (@i #%i, mod time %IM)\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000706 PROMPT_NONE, 0 },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000707
Theodore Ts'o521e3681997-04-29 17:48:10 +0000708 /* File sharing blocks with filesystem metadata */
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000709 { PR_1D_SHARE_METADATA,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000710 N_("\t<@f metadata>\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000711 PROMPT_NONE, 0 },
712
713 /* Report of how many duplicate/bad inodes */
714 { PR_1D_NUM_DUP_INODES,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000715 N_("(There are %N @is containing duplicate/bad @bs.)\n\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000716 PROMPT_NONE, 0 },
717
718 /* Duplicated blocks already reassigned or cloned. */
719 { PR_1D_DUP_BLOCKS_DEALT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000720 N_("Duplicated @bs already reassigned or cloned.\n\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000721 PROMPT_NONE, 0 },
722
723 /* Clone duplicate/bad blocks? */
724 { PR_1D_CLONE_QUESTION,
725 "", PROMPT_CLONE, PR_NO_OK },
726
727 /* Delete file? */
728 { PR_1D_DELETE_QUESTION,
729 "", PROMPT_DELETE, 0 },
730
731 /* Couldn't clone file (error) */
732 { PR_1D_CLONE_ERROR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000733 N_("Couldn't clone file: %m\n"), PROMPT_NONE, 0 },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000734
735 /* Pass 2 errors */
736
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000737 /* Pass 2: Checking directory structure */
738 { PR_2_PASS_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000739 N_("Pass 2: Checking @d structure\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000740 PROMPT_NONE, 0 },
741
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000742 /* Bad inode number for '.' */
743 { PR_2_BAD_INODE_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000744 N_("Bad @i number for '.' in @d @i %i.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000745 PROMPT_FIX, 0 },
746
747 /* Directory entry has bad inode number */
748 { PR_2_BAD_INO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000749 N_("@E has bad @i #: %Di.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000750 PROMPT_CLEAR, 0 },
751
752 /* Directory entry has deleted or unused inode */
753 { PR_2_UNUSED_INODE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000754 N_("@E has @D/unused @i %Di. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000755 PROMPT_CLEAR, PR_PREEN_OK },
756
757 /* Directry entry is link to '.' */
758 { PR_2_LINK_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000759 N_("@E @L to '.' "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000760 PROMPT_CLEAR, 0 },
761
762 /* Directory entry points to inode now located in a bad block */
763 { PR_2_BB_INODE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000764 N_("@E points to @i (%Di) located in a bad @b.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000765 PROMPT_CLEAR, 0 },
766
767 /* Directory entry contains a link to a directory */
768 { PR_2_LINK_DIR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000769 N_("@E @L to @d %P (%Di).\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000770 PROMPT_CLEAR, 0 },
771
772 /* Directory entry contains a link to the root directry */
773 { PR_2_LINK_ROOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000774 N_("@E @L to the @r.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000775 PROMPT_CLEAR, 0 },
776
777 /* Directory entry has illegal characters in its name */
778 { PR_2_BAD_NAME,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000779 N_("@E has illegal characters in its name.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000780 PROMPT_FIX, 0 },
781
782 /* Missing '.' in directory inode */
783 { PR_2_MISSING_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000784 N_("Missing '.' in @d @i %i.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000785 PROMPT_FIX, 0 },
786
787 /* Missing '..' in directory inode */
788 { PR_2_MISSING_DOT_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000789 N_("Missing '..' in @d @i %i.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000790 PROMPT_FIX, 0 },
791
792 /* First entry in directory inode doesn't contain '.' */
793 { PR_2_1ST_NOT_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000794 N_("First @e '%Dn' (inode=%Di) in @d @i %i (%p) @s '.'\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000795 PROMPT_FIX, 0 },
796
797 /* Second entry in directory inode doesn't contain '..' */
798 { PR_2_2ND_NOT_DOT_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000799 N_("Second @e '%Dn' (inode=%Di) in @d @i %i @s '..'\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000800 PROMPT_FIX, 0 },
801
802 /* i_faddr should be zero */
803 { PR_2_FADDR_ZERO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000804 N_("i_faddr @F %IF, @s zero.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000805 PROMPT_CLEAR, 0 },
806
807 /* i_file_acl should be zero */
808 { PR_2_FILE_ACL_ZERO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000809 N_("i_file_acl @F %If, @s zero.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000810 PROMPT_CLEAR, 0 },
811
812 /* i_dir_acl should be zero */
813 { PR_2_DIR_ACL_ZERO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000814 N_("i_dir_acl @F %Id, @s zero.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000815 PROMPT_CLEAR, 0 },
816
817 /* i_frag should be zero */
818 { PR_2_FRAG_ZERO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000819 N_("i_frag @F %N, @s zero.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000820 PROMPT_CLEAR, 0 },
821
822 /* i_fsize should be zero */
823 { PR_2_FSIZE_ZERO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000824 N_("i_fsize @F %N, @s zero.\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000825 PROMPT_CLEAR, 0 },
826
827 /* inode has bad mode */
828 { PR_2_BAD_MODE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000829 N_("@i %i (%Q) has a bad mode (%Im).\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000830 PROMPT_CLEAR, 0 },
831
832 /* directory corrupted */
833 { PR_2_DIR_CORRUPTED,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000834 N_("@d @i %i, @b %B, offset %N: @d corrupted\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000835 PROMPT_SALVAGE, 0 },
836
837 /* filename too long */
838 { PR_2_FILENAME_LONG,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000839 N_("@d @i %i, @b %B, offset %N: filename too long\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000840 PROMPT_TRUNCATE, 0 },
841
842 /* Directory inode has a missing block (hole) */
843 { PR_2_DIRECTORY_HOLE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000844 N_("@d @i %i has an unallocated @b #%B. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000845 PROMPT_ALLOCATE, 0 },
846
847 /* '.' is not NULL terminated */
848 { PR_2_DOT_NULL_TERM,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000849 N_("'.' @d @e in @d @i %i is not NULL terminated\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000850 PROMPT_FIX, 0 },
851
852 /* '..' is not NULL terminated */
853 { PR_2_DOT_DOT_NULL_TERM,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000854 N_("'..' @d @e in @d @i %i is not NULL terminated\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000855 PROMPT_FIX, 0 },
856
Theodore Ts'o7cf73dc1997-08-14 17:17:16 +0000857 /* Illegal character device inode */
858 { PR_2_BAD_CHAR_DEV,
Theodore Ts'od74edf42001-01-03 19:38:04 +0000859 N_("@i %i (%Q) is an @I character @v.\n"),
Theodore Ts'o7cf73dc1997-08-14 17:17:16 +0000860 PROMPT_CLEAR, 0 },
861
862 /* Illegal block device inode */
863 { PR_2_BAD_BLOCK_DEV,
Theodore Ts'od74edf42001-01-03 19:38:04 +0000864 N_("@i %i (%Q) is an @I @b @v.\n"),
Theodore Ts'o7cf73dc1997-08-14 17:17:16 +0000865 PROMPT_CLEAR, 0 },
866
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000867 /* Duplicate '.' entry */
868 { PR_2_DUP_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000869 N_("@E is duplicate '.' @e.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000870 PROMPT_FIX, 0 },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000871
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000872 /* Duplicate '..' entry */
873 { PR_2_DUP_DOT_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000874 N_("@E is duplicate '..' @e.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000875 PROMPT_FIX, 0 },
876
877 /* Internal error: couldn't find dir_info */
878 { PR_2_NO_DIRINFO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000879 N_("Internal error: couldn't find dir_info for %i.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000880 PROMPT_NONE, PR_FATAL },
881
882 /* Final rec_len is wrong */
883 { PR_2_FINAL_RECLEN,
Andreas Dilgerfcdebce2001-08-04 01:47:01 -0600884 N_("@E has rec_len of %Dr, should be %N.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000885 PROMPT_FIX, 0 },
886
887 /* Error allocating icount structure */
888 { PR_2_ALLOCATE_ICOUNT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000889 N_("@A icount structure: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000890 PROMPT_NONE, PR_FATAL },
891
892 /* Error iterating over directory blocks */
893 { PR_2_DBLIST_ITERATE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000894 N_("Error interating over @d @bs: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000895 PROMPT_NONE, PR_FATAL },
896
897 /* Error reading directory block */
898 { PR_2_READ_DIRBLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000899 N_("Error reading @d @b %b (@i %i): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000900 PROMPT_CONTINUE, 0 },
901
902 /* Error writing directory block */
903 { PR_2_WRITE_DIRBLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000904 N_("Error writing @d @b %b (@i %i): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000905 PROMPT_CONTINUE, 0 },
906
907 /* Error allocating new directory block */
908 { PR_2_ALLOC_DIRBOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000909 N_("@A new @d @b for @i %i (%s): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000910 PROMPT_NONE, 0 },
911
912 /* Error deallocating inode */
913 { PR_2_DEALLOC_INODE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000914 N_("Error deallocating @i %i: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000915 PROMPT_NONE, PR_FATAL },
916
Theodore Ts'of8188ff1997-11-14 05:23:04 +0000917 /* Directory entry for '.' is big. Split? */
918 { PR_2_SPLIT_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000919 N_("@d @e for '.' is big. "),
Theodore Ts'of8188ff1997-11-14 05:23:04 +0000920 PROMPT_SPLIT, PR_NO_OK },
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000921
Theodore Ts'o1dde43f1998-11-14 04:18:28 +0000922 /* Illegal FIFO inode */
923 { PR_2_BAD_FIFO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000924 N_("@i %i (%Q) is an @I FIFO.\n"),
Theodore Ts'o1dde43f1998-11-14 04:18:28 +0000925 PROMPT_CLEAR, 0 },
926
927 /* Illegal socket inode */
928 { PR_2_BAD_SOCKET,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000929 N_("@i %i (%Q) is an @I socket.\n"),
Theodore Ts'o1dde43f1998-11-14 04:18:28 +0000930 PROMPT_CLEAR, 0 },
931
Theodore Ts'oaa4115a1999-10-21 19:33:18 +0000932 /* Directory filetype not set */
933 { PR_2_SET_FILETYPE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000934 N_("Setting filetype for @E to %N.\n"),
Theodore Ts'oaa4115a1999-10-21 19:33:18 +0000935 PROMPT_NONE, PR_PREEN_OK | PR_NO_OK | PR_NO_NOMSG },
936
937 /* Directory filetype incorrect */
938 { PR_2_BAD_FILETYPE,
Andreas Dilgerfcdebce2001-08-04 01:47:01 -0600939 N_("@E has an incorrect filetype (was %Dt, should be %N).\n"),
Theodore Ts'oaa4115a1999-10-21 19:33:18 +0000940 PROMPT_FIX, 0 },
941
Theodore Ts'o7847c1d1999-10-22 15:11:42 +0000942 /* Directory filetype set on filesystem */
943 { PR_2_CLEAR_FILETYPE,
Theodore Ts'od007cb42001-08-04 20:39:39 -0400944 N_("@E has filetype set.\n"),
Theodore Ts'o7847c1d1999-10-22 15:11:42 +0000945 PROMPT_CLEAR, PR_PREEN_OK },
946
Theodore Ts'oc40db6d1999-10-25 21:03:34 +0000947 /* Directory filename is null */
948 { PR_2_NULL_NAME,
Theodore Ts'od007cb42001-08-04 20:39:39 -0400949 N_("@E has a zero-length name.\n"),
Theodore Ts'oc40db6d1999-10-25 21:03:34 +0000950 PROMPT_CLEAR, 0 },
951
Theodore Ts'ofdbdea02001-06-02 04:26:26 +0000952 /* Invalid fast symlink size */
953 { PR_2_SYMLINK_SIZE,
Theodore Ts'od007cb42001-08-04 20:39:39 -0400954 N_("Symlink %Q (@i #%i) has an invalid size (%Is).\n"),
Theodore Ts'o342d8472001-07-02 11:54:09 -0400955 PROMPT_CLEAR, 0 },
956
957 /* i_file_acl (extended attribute block) is bad */
958 { PR_2_FILE_ACL_BAD,
959 N_("@a @b @F is invalid (%If).\n"),
Theodore Ts'ofdbdea02001-06-02 04:26:26 +0000960 PROMPT_CLEAR, 0 },
961
Theodore Ts'oa4742692001-08-09 04:14:04 -0400962 /* Filesystem contains large files, but has no such flag in sb */
963 { PR_2_FEATURE_LARGE_FILES,
964 N_("@f contains large files, but lacks LARGE_FILE flag in @S.\n"),
965 PROMPT_FIX, 0 },
966
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000967 /* Pass 3 errors */
968
969 /* Pass 3: Checking directory connectivity */
970 { PR_3_PASS_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000971 N_("Pass 3: Checking @d connectivity\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000972 PROMPT_NONE, 0 },
973
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000974 /* Root inode not allocated */
975 { PR_3_NO_ROOT_INODE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000976 N_("@r not allocated. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000977 PROMPT_ALLOCATE, 0 },
978
979 /* No room in lost+found */
980 { PR_3_EXPAND_LF_DIR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000981 N_("No room in @l @d. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000982 PROMPT_EXPAND, 0 },
983
984 /* Unconnected directory inode */
985 { PR_3_UNCONNECTED_DIR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000986 N_("Unconnected @d @i %i (%p)\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000987 PROMPT_CONNECT, 0 },
988
989 /* /lost+found not found */
990 { PR_3_NO_LF_DIR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000991 N_("/@l not found. "),
Theodore Ts'o5a679c81998-12-03 16:40:38 +0000992 PROMPT_CREATE, PR_PREEN_OK },
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000993
994 /* .. entry is incorrect */
995 { PR_3_BAD_DOT_DOT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +0000996 N_("'..' in %Q (%i) is %P (%j), @s %q (%d).\n"),
Theodore Ts'o21c84b71997-04-29 16:15:03 +0000997 PROMPT_FIX, 0 },
998
Theodore Ts'o1b6bf171997-10-03 17:48:10 +0000999 /* Bad or non-existent /lost+found. Cannot reconnect */
1000 { PR_3_NO_LPF,
Theodore Ts'od007cb42001-08-04 20:39:39 -04001001 N_("Bad or non-existent /@l. Cannot reconnect.\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001002 PROMPT_NONE, 0 },
1003
1004 /* Could not expand /lost+found */
1005 { PR_3_CANT_EXPAND_LPF,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001006 N_("Could not expand /@l: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001007 PROMPT_NONE, 0 },
1008
1009 /* Could not reconnect inode */
1010 { PR_3_CANT_RECONNECT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001011 N_("Could not reconnect %i: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001012 PROMPT_NONE, 0 },
1013
1014 /* Error while trying to find /lost+found */
1015 { PR_3_ERR_FIND_LPF,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001016 N_("Error while trying to find /@l: %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001017 PROMPT_NONE, 0 },
1018
1019 /* Error in ext2fs_new_block while creating /lost+found */
1020 { PR_3_ERR_LPF_NEW_BLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001021 N_("ext2fs_new_@b: %m while trying to create /@l @d\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001022 PROMPT_NONE, 0 },
1023
1024 /* Error in ext2fs_new_inode while creating /lost+found */
1025 { PR_3_ERR_LPF_NEW_INODE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001026 N_("ext2fs_new_@i: %m while trying to create /@l @d\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001027 PROMPT_NONE, 0 },
1028
1029 /* Error in ext2fs_new_dir_block while creating /lost+found */
1030 { PR_3_ERR_LPF_NEW_DIR_BLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001031 N_("ext2fs_new_dir_@b: %m while creating new @d @b\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001032 PROMPT_NONE, 0 },
1033
1034 /* Error while writing directory block for /lost+found */
1035 { PR_3_ERR_LPF_WRITE_BLOCK,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001036 N_("ext2fs_write_dir_@b: %m while writing the @d @b for /@l\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001037 PROMPT_NONE, 0 },
1038
1039 /* Error while adjusting inode count */
1040 { PR_3_ADJUST_INODE,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001041 N_("Error while adjusting @i count on @i %i\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001042 PROMPT_NONE, 0 },
1043
1044 /* Couldn't fix parent directory -- error */
1045 { PR_3_FIX_PARENT_ERR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001046 N_("Couldn't fix parent of @i %i: %m\n\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001047 PROMPT_NONE, 0 },
1048
1049 /* Couldn't fix parent directory -- couldn't find it */
1050 { PR_3_FIX_PARENT_NOFIND,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001051 N_("Couldn't fix parent of @i %i: Couldn't find parent @d entry\n\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001052 PROMPT_NONE, 0 },
1053
1054 /* Error allocating inode bitmap */
1055 { PR_3_ALLOCATE_IBITMAP_ERROR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001056 N_("@A @i @B (%N): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001057 PROMPT_NONE, PR_FATAL },
1058
1059 /* Error creating root directory */
1060 { PR_3_CREATE_ROOT_ERROR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001061 N_("Error creating root @d (%s): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001062 PROMPT_NONE, PR_FATAL },
1063
1064 /* Error creating lost and found directory */
1065 { PR_3_CREATE_LPF_ERROR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001066 N_("Error creating /@l @d (%s): %m\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001067 PROMPT_NONE, PR_FATAL },
1068
Theodore Ts'of8188ff1997-11-14 05:23:04 +00001069 /* Root inode is not directory; aborting */
1070 { PR_3_ROOT_NOT_DIR_ABORT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001071 N_("@r is not a @d; aborting.\n"),
Theodore Ts'of8188ff1997-11-14 05:23:04 +00001072 PROMPT_NONE, PR_FATAL },
1073
1074 /* Cannot proceed without a root inode. */
1075 { PR_3_NO_ROOT_INODE_ABORT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001076 N_("Cannot proceed without a @r.\n"),
Theodore Ts'of8188ff1997-11-14 05:23:04 +00001077 PROMPT_NONE, PR_FATAL },
1078
Theodore Ts'o7f813ba1998-09-03 01:26:03 +00001079 /* Internal error: couldn't find dir_info */
1080 { PR_3_NO_DIRINFO,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001081 N_("Internal error: couldn't find dir_info for %i.\n"),
Theodore Ts'o7f813ba1998-09-03 01:26:03 +00001082 PROMPT_NONE, PR_FATAL },
1083
Theodore Ts'o4a9f5931999-03-16 19:32:52 +00001084 /* Lost+found not a directory */
1085 { PR_3_LPF_NOTDIR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001086 N_("/@l is not a @d (ino=%i)\n"),
Theodore Ts'o4a9f5931999-03-16 19:32:52 +00001087 PROMPT_UNLINK, 0 },
1088
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001089 /* Pass 4 errors */
1090
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001091 /* Pass 4: Checking reference counts */
1092 { PR_4_PASS_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001093 N_("Pass 4: Checking reference counts\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001094 PROMPT_NONE, 0 },
1095
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001096 /* Unattached zero-length inode */
1097 { PR_4_ZERO_LEN_INODE,
1098 "@u @z @i %i. ",
1099 PROMPT_CLEAR, PR_PREEN_OK|PR_NO_OK },
1100
1101 /* Unattached inode */
1102 { PR_4_UNATTACHED_INODE,
1103 "@u @i %i\n",
1104 PROMPT_CONNECT, 0 },
1105
1106 /* Inode ref count wrong */
1107 { PR_4_BAD_REF_COUNT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001108 N_("@i %i ref count is %Il, @s %N. "),
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001109 PROMPT_FIX, PR_PREEN_OK },
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001110
1111 { PR_4_INCONSISTENT_COUNT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001112 N_("WARNING: PROGRAMMING BUG IN E2FSCK!\n"
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001113 "\tOR SOME BONEHEAD (YOU) IS CHECKING A MOUNTED (LIVE) FILESYSTEM.\n"
1114 "@i_link_info[%i] is %N, @i.i_links_count is %Il. "
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001115 "They should be the same!\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001116 PROMPT_NONE, 0 },
1117
1118 /* Pass 5 errors */
1119
1120 /* Pass 5: Checking group summary information */
1121 { PR_5_PASS_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001122 N_("Pass 5: Checking @g summary information\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001123 PROMPT_NONE, 0 },
1124
1125 /* Padding at end of inode bitmap is not set. */
1126 { PR_5_INODE_BMAP_PADDING,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001127 N_("Padding at end of @i @B is not set. "),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001128 PROMPT_FIX, PR_PREEN_OK },
1129
1130 /* Padding at end of block bitmap is not set. */
1131 { PR_5_BLOCK_BMAP_PADDING,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001132 N_("Padding at end of @b @B is not set. "),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001133 PROMPT_FIX, PR_PREEN_OK },
1134
1135 /* Block bitmap differences header */
1136 { PR_5_BLOCK_BITMAP_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001137 N_("@b @B differences: "),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001138 PROMPT_NONE, PR_PREEN_OK | PR_PREEN_NOMSG},
1139
1140 /* Block not used, but marked in bitmap */
1141 { PR_5_UNUSED_BLOCK,
1142 " -%b",
1143 PROMPT_NONE, PR_LATCH_BBITMAP | PR_PREEN_OK | PR_PREEN_NOMSG },
1144
1145 /* Block used, but not marked used in bitmap */
1146 { PR_5_BLOCK_USED,
1147 " +%b",
1148 PROMPT_NONE, PR_LATCH_BBITMAP | PR_PREEN_OK | PR_PREEN_NOMSG },
1149
1150 /* Block bitmap differences end */
1151 { PR_5_BLOCK_BITMAP_END,
1152 "\n",
1153 PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
1154
1155 /* Inode bitmap differences header */
1156 { PR_5_INODE_BITMAP_HEADER,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001157 N_("@i @B differences: "),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001158 PROMPT_NONE, PR_PREEN_OK | PR_PREEN_NOMSG },
1159
1160 /* Inode not used, but marked in bitmap */
1161 { PR_5_UNUSED_INODE,
1162 " -%i",
1163 PROMPT_NONE, PR_LATCH_IBITMAP | PR_PREEN_OK | PR_PREEN_NOMSG },
1164
1165 /* Inode used, but not marked used in bitmap */
1166 { PR_5_INODE_USED,
1167 " +%i",
1168 PROMPT_NONE, PR_LATCH_IBITMAP | PR_PREEN_OK | PR_PREEN_NOMSG },
1169
1170 /* Inode bitmap differences end */
1171 { PR_5_INODE_BITMAP_END,
1172 "\n",
1173 PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
1174
1175 /* Free inodes count for group wrong */
1176 { PR_5_FREE_INODE_COUNT_GROUP,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001177 N_("Free @is count wrong for @g #%g (%i, counted=%j).\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001178 PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
1179
1180 /* Directories count for group wrong */
1181 { PR_5_FREE_DIR_COUNT_GROUP,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001182 N_("Directories count wrong for @g #%g (%i, counted=%j).\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001183 PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
1184
1185 /* Free inodes count wrong */
1186 { PR_5_FREE_INODE_COUNT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001187 N_("Free @is count wrong (%i, counted=%j).\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001188 PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
1189
1190 /* Free blocks count for group wrong */
1191 { PR_5_FREE_BLOCK_COUNT_GROUP,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001192 N_("Free @bs count wrong for @g #%g (%b, counted=%c).\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001193 PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
1194
1195 /* Free blocks count wrong */
1196 { PR_5_FREE_BLOCK_COUNT,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001197 N_("Free @bs count wrong (%b, counted=%c).\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001198 PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
1199
1200 /* Programming error: bitmap endpoints don't match */
1201 { PR_5_BMAP_ENDPOINTS,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001202 N_("PROGRAMMING ERROR: @f (#%N) @B endpoints (%b, %c) don't "
1203 "match calculated @B endpoints (%i, %j)\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001204 PROMPT_NONE, PR_FATAL },
1205
1206 /* Internal error: fudging end of bitmap */
1207 { PR_5_FUDGE_BITMAP_ERROR,
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001208 N_("Internal error: fudging end of bitmap (%N)\n"),
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001209 PROMPT_NONE, PR_FATAL },
Theodore Ts'obbd47d72000-06-10 19:21:33 +00001210
1211 /* Error copying in replacement inode bitmap */
1212 { PR_5_COPY_IBITMAP_ERROR,
1213 "Error copying in replacement @i @B: %m\n",
1214 PROMPT_NONE, PR_FATAL },
1215
1216 /* Error copying in replacement block bitmap */
1217 { PR_5_COPY_BBITMAP_ERROR,
1218 "Error copying in replacement @b @B: %m\n",
1219 PROMPT_NONE, PR_FATAL },
1220
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001221 { 0 }
1222};
1223
1224/*
1225 * This is the latch flags register. It allows several problems to be
1226 * "latched" together. This means that the user has to answer but one
1227 * question for the set of problems, and all of the associated
1228 * problems will be either fixed or not fixed.
1229 */
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001230static struct latch_descr pr_latch_info[] = {
1231 { PR_LATCH_BLOCK, PR_1_INODE_BLOCK_LATCH, 0 },
1232 { PR_LATCH_BBLOCK, PR_1_INODE_BBLOCK_LATCH, 0 },
1233 { PR_LATCH_IBITMAP, PR_5_INODE_BITMAP_HEADER, PR_5_INODE_BITMAP_END },
1234 { PR_LATCH_BBITMAP, PR_5_BLOCK_BITMAP_HEADER, PR_5_BLOCK_BITMAP_END },
1235 { PR_LATCH_RELOC, PR_0_RELOCATE_HINT, 0 },
1236 { PR_LATCH_DBLOCK, PR_1B_DUP_BLOCK_HEADER, PR_1B_DUP_BLOCK_END },
Theodore Ts'o21afac02001-05-14 12:47:41 +00001237 { PR_LATCH_LOW_DTIME, PR_1_ORPHAN_LIST_REFUGEES, 0 },
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001238 { -1, 0, 0 },
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001239};
1240
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001241static const struct e2fsck_problem *find_problem(int code)
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001242{
1243 int i;
1244
1245 for (i=0; problem_table[i].e2p_code; i++) {
1246 if (problem_table[i].e2p_code == code)
1247 return &problem_table[i];
1248 }
1249 return 0;
1250}
1251
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001252static struct latch_descr *find_latch(int code)
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001253{
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001254 int i;
1255
1256 for (i=0; pr_latch_info[i].latch_code >= 0; i++) {
1257 if (pr_latch_info[i].latch_code == code)
1258 return &pr_latch_info[i];
1259 }
1260 return 0;
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001261}
1262
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001263int end_problem_latch(e2fsck_t ctx, int mask)
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001264{
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001265 struct latch_descr *ldesc;
1266 struct problem_context pctx;
1267 int answer = -1;
1268
1269 ldesc = find_latch(mask);
1270 if (ldesc->end_message && (ldesc->flags & PRL_LATCHED)) {
1271 clear_problem_context(&pctx);
1272 answer = fix_problem(ctx, ldesc->end_message, &pctx);
1273 }
1274 ldesc->flags &= ~(PRL_VARIABLE);
1275 return answer;
1276}
1277
1278int set_latch_flags(int mask, int setflags, int clearflags)
1279{
1280 struct latch_descr *ldesc;
1281
1282 ldesc = find_latch(mask);
1283 if (!ldesc)
1284 return -1;
1285 ldesc->flags |= setflags;
1286 ldesc->flags &= ~clearflags;
1287 return 0;
1288}
1289
1290int get_latch_flags(int mask, int *value)
1291{
1292 struct latch_descr *ldesc;
1293
1294 ldesc = find_latch(mask);
1295 if (!ldesc)
1296 return -1;
1297 *value = ldesc->flags;
1298 return 0;
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001299}
1300
1301void clear_problem_context(struct problem_context *ctx)
1302{
1303 memset(ctx, 0, sizeof(struct problem_context));
1304 ctx->blkcount = -1;
1305 ctx->group = -1;
1306}
1307
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001308int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001309{
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001310 ext2_filsys fs = ctx->fs;
1311 const struct e2fsck_problem *ptr;
1312 struct latch_descr *ldesc = 0;
1313 const char *message;
1314 int def_yn, answer, ans;
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001315 int print_answer = 0;
1316 int suppress = 0;
1317
1318 ptr = find_problem(code);
1319 if (!ptr) {
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001320 printf(_("Unhandled error code (%d)!\n"), code);
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001321 return 0;
1322 }
Theodore Ts'oaa4115a1999-10-21 19:33:18 +00001323 def_yn = 1;
Theodore Ts'oa846d2f1999-11-10 15:50:24 +00001324 if ((ptr->flags & PR_NO_DEFAULT) ||
1325 ((ptr->flags & PR_PREEN_NO) && (ctx->options & E2F_OPT_PREEN)) ||
1326 (ctx->options & E2F_OPT_NO))
Theodore Ts'oaa4115a1999-10-21 19:33:18 +00001327 def_yn= 0;
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001328
1329 /*
1330 * Do special latch processing. This is where we ask the
1331 * latch question, if it exists
1332 */
1333 if (ptr->flags & PR_LATCH_MASK) {
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001334 ldesc = find_latch(ptr->flags & PR_LATCH_MASK);
1335 if (ldesc->question && !(ldesc->flags & PRL_LATCHED)) {
1336 ans = fix_problem(ctx, ldesc->question, pctx);
1337 if (ans == 1)
1338 ldesc->flags |= PRL_YES;
1339 if (ans == 0)
1340 ldesc->flags |= PRL_NO;
1341 ldesc->flags |= PRL_LATCHED;
1342 }
1343 if (ldesc->flags & PRL_SUPPRESS)
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001344 suppress++;
1345 }
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001346 if ((ptr->flags & PR_PREEN_NOMSG) &&
1347 (ctx->options & E2F_OPT_PREEN))
1348 suppress++;
Theodore Ts'oaa4115a1999-10-21 19:33:18 +00001349 if ((ptr->flags & PR_NO_NOMSG) &&
1350 (ctx->options & E2F_OPT_NO))
1351 suppress++;
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001352 if (!suppress) {
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001353 message = ptr->e2p_description;
1354 if (ctx->options & E2F_OPT_PREEN) {
Theodore Ts'o6a50c5e2001-12-21 23:29:35 -05001355 printf("%s: ", ctx->device_name ?
1356 ctx->device_name : ctx->filesystem_name);
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001357#if 0
1358 if (ptr->e2p_preen_msg)
1359 message = ptr->e2p_preen_msg;
1360#endif
1361 }
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001362 print_e2fsck_message(ctx, _(message), pctx, 1);
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001363 }
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001364 if (!(ptr->flags & PR_PREEN_OK) && (ptr->prompt != PROMPT_NONE))
1365 preenhalt(ctx);
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001366
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001367 if (ptr->flags & PR_FATAL)
Theodore Ts'of8188ff1997-11-14 05:23:04 +00001368 fatal_error(ctx, 0);
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001369
1370 if (ptr->prompt == PROMPT_NONE) {
1371 if (ptr->flags & PR_NOCOLLATE)
1372 answer = -1;
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001373 else
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001374 answer = def_yn;
1375 } else {
1376 if (ctx->options & E2F_OPT_PREEN) {
1377 answer = def_yn;
1378 if (!(ptr->flags & PR_PREEN_NOMSG))
1379 print_answer = 1;
1380 } else if ((ptr->flags & PR_LATCH_MASK) &&
1381 (ldesc->flags & (PRL_YES | PRL_NO))) {
1382 if (!suppress)
1383 print_answer = 1;
1384 if (ldesc->flags & PRL_YES)
1385 answer = 1;
1386 else
1387 answer = 0;
1388 } else
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001389 answer = ask(ctx, _(prompt[(int) ptr->prompt]), def_yn);
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001390 if (!answer && !(ptr->flags & PR_NO_OK))
1391 ext2fs_unmark_valid(fs);
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001392
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001393 if (print_answer)
1394 printf("%s.\n", answer ?
Theodore Ts'o0c4a0722000-02-07 03:11:03 +00001395 _(preen_msg[(int) ptr->prompt]) : _("IGNORED"));
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001396
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001397 }
1398
Theodore Ts'of8188ff1997-11-14 05:23:04 +00001399 if ((ptr->prompt == PROMPT_ABORT) && answer)
1400 fatal_error(ctx, 0);
Theodore Ts'o1b6bf171997-10-03 17:48:10 +00001401
Theodore Ts'o3b5386d2000-08-14 14:25:19 +00001402 if (ptr->flags & PR_AFTER_CODE)
1403 answer = fix_problem(ctx, ptr->second_code, pctx);
1404
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001405 return answer;
1406}