Whamcloud - gitweb
e2fsck: allow deleting or zeroing shared blocks
[tools/e2fsprogs.git] / e2fsck / problem.c
index 06eb179..5a4d272 100644 (file)
@@ -410,7 +410,7 @@ static struct e2fsck_problem problem_table[] = {
 
        /* Making quota file hidden */
        { PR_0_HIDE_QUOTA,
-         N_("Making @q @is hidden.\n\n"),
+         N_("Making @q @i %i (%Q) hidden.\n"),
          PROMPT_NONE, PR_PREEN_OK },
 
        /* Superblock has invalid MMP block. */
@@ -423,6 +423,16 @@ static struct e2fsck_problem problem_table[] = {
          N_("@S has invalid MMP magic.  "),
          PROMPT_FIX, PR_PREEN_OK | PR_NO_OK},
 
+       /* Opening file system failed */
+       { PR_0_OPEN_FAILED,
+         N_("ext2fs_open2: %m\n"),
+         PROMPT_NONE, 0 },
+
+       /* Checking group descriptor failed */
+       { PR_0_CHECK_DESC_FAILED,
+         N_("ext2fs_check_desc: %m\n"),
+         PROMPT_NONE, 0 },
+
        /* Pass 1 errors */
 
        /* Pass 1: Checking inodes, blocks, and sizes */
@@ -906,11 +916,6 @@ static struct e2fsck_problem problem_table[] = {
          N_("@i %i has an invalid extent node (blk %b, lblk %c)\n"),
          PROMPT_CLEAR, 0 },
 
-       { PR_1_EOFBLOCKS_FL_SET,
-         N_("@i %i should not have EOFBLOCKS_FL set "
-            "(size %Is, lblk %r)\n"),
-         PROMPT_CLEAR, PR_PREEN_OK },
-
        /* Failed to convert subcluster bitmap */
        { PR_1_CONVERT_SUBCLUSTER,
          N_("Error converting subcluster @b @B: %m\n"),
@@ -941,6 +946,11 @@ static struct e2fsck_problem problem_table[] = {
          N_("@i %i has zero length extent\n\t(@n logical @b %c, physical @b %b)\n"),
          PROMPT_CLEAR, 0 },
 
+       /* Bad extended attribute value in inode */
+       { PR_1_INODE_EA_BAD_VALUE,
+         N_("@a in @i %i is corrupt (@n value)."),
+         PROMPT_CLEAR, 0},
+
        /* Pass 1b errors */
 
        /* Pass 1B: Rescan for duplicate/bad blocks */
@@ -1033,6 +1043,14 @@ static struct e2fsck_problem problem_table[] = {
        { PR_1D_CLONE_ERROR,
          N_("Couldn't clone file: %m\n"), PROMPT_NONE, 0 },
 
+       /* File with shared blocks found */
+       { PR_1D_DISCONNECT_QUESTION,
+         N_("File with shared blocks found\n"), PROMPT_CONNECT, 0 },
+
+       /* Couldn't unlink file (error) */
+       { PR_1D_DISCONNECT_ERROR,
+         N_("Couldn't unlink file: %m\n"), PROMPT_NONE, 0 },
+
        /* Pass 2 errors */
 
        /* Pass 2: Checking directory structure */
@@ -1616,7 +1634,7 @@ static struct e2fsck_problem problem_table[] = {
        /* Free inodes count wrong */
        { PR_5_FREE_INODE_COUNT,
          N_("Free @is count wrong (%i, counted=%j).\n"),
-         PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
+         PROMPT_FIX, PR_PREEN_OK | PR_NO_OK | PR_PREEN_NOMSG },
 
        /* Free blocks count for group wrong */
        { PR_5_FREE_BLOCK_COUNT_GROUP,
@@ -1626,7 +1644,7 @@ static struct e2fsck_problem problem_table[] = {
        /* Free blocks count wrong */
        { PR_5_FREE_BLOCK_COUNT,
          N_("Free @bs count wrong (%b, counted=%c).\n"),
-         PROMPT_FIX, PR_PREEN_OK | PR_PREEN_NOMSG },
+         PROMPT_FIX, PR_PREEN_OK | PR_NO_OK | PR_PREEN_NOMSG },
 
        /* Programming error: bitmap endpoints don't match */
        { PR_5_BMAP_ENDPOINTS,
@@ -1686,6 +1704,11 @@ static struct e2fsck_problem problem_table[] = {
          N_("Recreate @j"),
          PROMPT_NULL, PR_PREEN_OK | PR_NO_OK },
 
+       /* Update quota information if it is inconsistent */
+       { PR_6_UPDATE_QUOTAS,
+         N_("Update quota info for quota type %N"),
+         PROMPT_NULL, PR_PREEN_OK | PR_NO_OK },
+
        { 0 }
 };
 
@@ -1877,16 +1900,20 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
                        fflush(stdout);
                }
        }
+       message = ptr->e2p_description;
+       if (*message)
+               message = _(message);
        if (!suppress) {
-               message = ptr->e2p_description;
                if ((ctx->options & E2F_OPT_PREEN) &&
                    !(ptr->flags & PR_PREEN_NOHDR)) {
                        printf("%s: ", ctx->device_name ?
                               ctx->device_name : ctx->filesystem_name);
                }
                if (*message)
-                       print_e2fsck_message(ctx, _(message), pctx, 1, 0);
+                       print_e2fsck_message(stdout, ctx, message, pctx, 1, 0);
        }
+       if (ctx->logf && message)
+               print_e2fsck_message(ctx->logf, ctx, message, pctx, 1, 0);
        if (!(ptr->flags & PR_PREEN_OK) && (ptr->prompt != PROMPT_NONE))
                preenhalt(ctx);
 
@@ -1901,16 +1928,14 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
        } else {
                if (ptr->flags & PR_FORCE_NO) {
                        answer = 0;
-                       if (!suppress)
-                               print_answer = 1;
+                       print_answer = 1;
                } else if (ctx->options & E2F_OPT_PREEN) {
                        answer = def_yn;
                        if (!(ptr->flags & PR_PREEN_NOMSG))
                                print_answer = 1;
                } else if ((ptr->flags & PR_LATCH_MASK) &&
                           (ldesc->flags & (PRL_YES | PRL_NO))) {
-                       if (!suppress)
-                               print_answer = 1;
+                       print_answer = 1;
                        if (ldesc->flags & PRL_YES)
                                answer = 1;
                        else
@@ -1921,10 +1946,16 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
                if (!answer && !(ptr->flags & PR_NO_OK))
                        ext2fs_unmark_valid(fs);
 
-               if (print_answer)
-                       printf("%s.\n", answer ?
-                              _(preen_msg[(int) ptr->prompt]) : _("IGNORED"));
-
+               if (print_answer) {
+                       if (!suppress)
+                               printf("%s.\n", answer ?
+                                      _(preen_msg[(int) ptr->prompt]) :
+                                      _("IGNORED"));
+                       if (ctx->logf)
+                               fprintf(ctx->logf, "%s.\n", answer ?
+                                       _(preen_msg[(int) ptr->prompt]) :
+                                       _("IGNORED"));
+               }
        }
 
        if ((ptr->prompt == PROMPT_ABORT) && answer)
@@ -1955,7 +1986,7 @@ profile_get_integer(profile_t profile, const char *name, const char *subname,
        return 0;
 }
 
-void print_e2fsck_message(e2fsck_t ctx, const char *msg,
+void print_e2fsck_message(FILE *f, e2fsck_t ctx, const char *msg,
                          struct problem_context *pctx, int first,
                          int recurse)
 {