From 4fb9d52ba616619be3d03847f8ccc33e954aa055 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 24 Feb 2004 00:16:09 -0500 Subject: [PATCH] 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) --- e2fsck/ChangeLog | 6 ++++++ e2fsck/e2fsck.8.in | 10 +++++++++- e2fsck/unix.c | 7 +++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index a53f0cf..c163794 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,9 @@ +2004-02-24 Theodore Ts'o + + * 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 * Makefile.in (PROFILED_LIBS, PROFILED_DEPLIBS): Fix reference to diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in index 4630df8..5fb125a 100644 --- a/e2fsck/e2fsck.8.in +++ b/e2fsck/e2fsck.8.in @@ -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 diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 4c2598f..55dcfc1 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -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 -- 1.8.3.1