From 0601232332e080aac1a19748e78c22021c7815c4 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 12 Feb 2000 20:12:43 +0000 Subject: [PATCH] ChangeLog, e2fsck.h, unix.c: unix.c (e2fsck_update_progress): Limit the number of updates to the progress bars to 8 times a second. This allows a 9600 baud console link to keep up. --- e2fsck/ChangeLog | 6 ++++++ e2fsck/e2fsck.h | 1 + e2fsck/unix.c | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 89c2133..e783b94 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,9 @@ +2000-02-12 + + * unix.c (e2fsck_update_progress): Limit the number of updates to + the progress bars to 8 times a second. This allows a 9600 + baud console link to keep up. + 2000-02-11 * unix.c (main): If compression is enabled on the filesystem, diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index 28f2a90..b0ba043 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -219,6 +219,7 @@ struct e2fsck_struct { int progress_fd; int progress_pos; int progress_last_percent; + unsigned int progress_last_time; /* File counts */ int fs_directory_count; diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 9696a77..16c9491 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -325,6 +325,8 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass, char buf[80]; int i; float percent; + int tick; + struct timeval tv; if (pass == 0) return 0; @@ -335,6 +337,12 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass, } else { if (ctx->flags & E2F_FLAG_PROG_SUPPRESS) return 0; + gettimeofday(&tv, NULL); + tick = (tv.tv_sec << 3) + (tv.tv_usec / (1000000 / 8)); + if ((tick == ctx->progress_last_time) && + (cur != max) && (cur != 0)) + return 0; + ctx->progress_last_time = tick; ctx->progress_pos = (ctx->progress_pos+1) & 3; ctx->flags |= E2F_FLAG_PROG_BAR; percent = calc_percent(&e2fsck_tbl, pass, cur, max); -- 1.8.3.1