From b6a0807b088e12777609728bb3f80490db58f8aa Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 14 Jun 2001 01:16:17 +0000 Subject: ChangeLog, unix.c: unix.c (check_if_skip): Adapted patch from Andreas Dilger which prints the number of mounts or days elapsed since the last check when e2fsck is forced to check an otherwise clean filesystem. --- e2fsck/ChangeLog | 7 +++++++ e2fsck/unix.c | 22 ++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'e2fsck') diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 7190cb8a..272c6403 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,10 @@ +2001-06-13 Theodore Tso + + * unix.c (check_if_skip): Adapted patch from Andreas Dilger which + prints the number of mounts or days elapsed since the last + check when e2fsck is forced to check an otherwise clean + filesystem. + 2001-06-12 Theodore Tso * badblocks.c: Stop using the compatibility badblocks function, diff --git a/e2fsck/unix.c b/e2fsck/unix.c index f7ed56d0..816f3cea 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -253,24 +253,30 @@ static void check_if_skip(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; const char *reason = NULL; + unsigned int reason_arg = 0; if (force || bad_blocks_file || cflag || swapfs) return; if (fs->super->s_state & EXT2_ERROR_FS) - reason = _("contains a file system with errors"); + reason = _(" contains a file system with errors"); else if ((fs->super->s_state & EXT2_VALID_FS) == 0) - reason = _("was not cleanly unmounted"); + reason = _(" was not cleanly unmounted"); else if ((fs->super->s_max_mnt_count > 0) && (fs->super->s_mnt_count >= - (unsigned) fs->super->s_max_mnt_count)) - reason = _("has reached maximal mount count"); - else if (fs->super->s_checkinterval && + (unsigned) fs->super->s_max_mnt_count)) { + reason = _(" has been mounted %u times without being checked"); + reason_arg = fs->super->s_mnt_count; + } else if (fs->super->s_checkinterval && time(0) >= (fs->super->s_lastcheck + - fs->super->s_checkinterval)) - reason = _("has gone too long without being checked"); + fs->super->s_checkinterval)) { + reason = _(" has gone %u days without being checked"); + reason_arg = (time(0) - fs->super->s_lastcheck)/(3600*24); + } if (reason) { - printf(_("%s %s, check forced.\n"), ctx->device_name, reason); + fputs(ctx->device_name, stdout); + printf(reason, reason_arg); + fputs(_(", check forced.\n"), stdout); return; } printf(_("%s: clean, %d/%d files, %d/%d blocks\n"), ctx->device_name, -- cgit v1.2.3