OSDN Git Service

unix.c (main, PRS), e2fsck.8.in: Add a new -k option which keeps
authorTheodore Ts'o <tytso@mit.edu>
Tue, 24 Feb 2004 05:16:09 +0000 (00:16 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 24 Feb 2004 05:16:09 +0000 (00:16 -0500)
the existing badblocks list when using the -c option.
(Addresses Debian bug #229103)

e2fsck/ChangeLog
e2fsck/e2fsck.8.in
e2fsck/unix.c

index a53f0cf..c163794 100644 (file)
@@ -1,3 +1,9 @@
+2004-02-24  Theodore Ts'o  <tytso@mit.edu>
+
+       * unix.c (main, PRS), e2fsck.8.in: Add a new -k option which keeps
+               the existing badblocks list when using the -c option.
+               (Addresses Debian bug #229103)
+
 2004-02-23  Theodore Ts'o  <tytso@mit.edu>
 
        * Makefile.in (PROFILED_LIBS, PROFILED_DEPLIBS): Fix reference to
index 4630df8..5fb125a 100644 (file)
@@ -8,7 +8,7 @@ e2fsck \- check a Linux ext2/ext3 file system
 .SH SYNOPSIS
 .B e2fsck
 [
-.B \-pacnyrdfvstDFSV
+.B \-pacnyrdfkvstDFSV
 ]
 [
 .B \-b
@@ -160,6 +160,14 @@ time trials.
 @JDEV@Set the pathname where the external-journal for this filesystem can be
 @JDEV@found.
 .TP
+.BI \-k
+When combined with the 
+.B \-c
+option, any existing bad blocks in the bad blocks list are preserved,
+and any new bad blocks found by running
+.BR badblocks (8) 
+will be added to the existing bad blocks list.
+.TP
 .BI \-l " filename"
 Add the block numbers listed in the file specified by 
 .I filename
index 4c2598f..55dcfc1 100644 (file)
@@ -53,6 +53,7 @@ static int show_version_only;
 static int verbose;
 
 static int replace_bad_blocks;
+static int keep_bad_blocks;
 static char *bad_blocks_file;
 
 e2fsck_t e2fsck_global_ctx;    /* Try your very best not to use this! */
@@ -554,7 +555,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                ctx->program_name = *argv;
        else
                ctx->program_name = "e2fsck";
-       while ((c = getopt (argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsD")) != EOF)
+       while ((c = getopt (argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDk")) != EOF)
                switch (c) {
                case 'C':
                        ctx->progress = e2fsck_update_progress;
@@ -675,6 +676,8 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                                          "of e2fsck\n"));
                        exit(1);
 #endif
+               case 'k':
+                       keep_bad_blocks++;
                default:
                        usage(ctx);
                }
@@ -1034,7 +1037,7 @@ restart:
        if (bad_blocks_file)
                read_bad_blocks_file(ctx, bad_blocks_file, replace_bad_blocks);
        else if (cflag)
-               read_bad_blocks_file(ctx, 0, 1); /* Test disk */
+               read_bad_blocks_file(ctx, 0, !keep_bad_blocks); /* Test disk */
        if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
                fatal_error(ctx, 0);
 #ifdef ENABLE_SWAPFS