From: Theodore Ts'o Date: Wed, 26 Mar 2008 12:26:01 +0000 (-0400) Subject: e2fsck: Support a negative argument to -C to suppress progress information X-Git-Tag: v1.40.9~27 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=be62523be2307123886934f258cf36f4b33b1c38;p=tools%2Fe2fsprogs.git e2fsck: Support a negative argument to -C to suppress progress information If a negative progress argument is given to -C, initially suppress the progress information. It can be enabled later by sending the e2fsck process a SIGUSR1 signal. Addresses-Launchpad-Bug: #203323 Addresses-Sourceforge-Bug: #1926023 Signed-off-by: "Theodore Ts'o" --- diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in index 6cae577..3059e60 100644 --- a/e2fsck/e2fsck.8.in +++ b/e2fsck/e2fsck.8.in @@ -139,6 +139,11 @@ so that the progress of the filesystem check can be monitored. This option is typically used by programs which are running .BR e2fsck . +If the file descriptor number is negative, then absolute value of +the file descriptor will be used, and the progress information will be +suppressed initially. It can later be enabled by sending the +.B e2fsck +process a SIGUSR1 signal. If the file descriptor specified is 0, .B e2fsck will print a completion bar as it goes about its business. This requires @@ -337,14 +342,15 @@ The following signals have the following effect when sent to .B SIGUSR1 This signal causes .B e2fsck -to start displaying a completion bar. (See discussion of the +to start displaying a completion bar or emitting progress information. +(See discussion of the .B \-C option.) .TP .B SIGUSR2 This signal causes .B e2fsck -to stop displaying a completion bar. +to stop displaying a completion bar or emitting progress information. .SH REPORTING BUGS Almost any piece of software will have bugs. If you manage to find a filesystem which causes diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 1227725..e843244 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -490,7 +490,6 @@ static void signal_progress_on(int sig EXT2FS_ATTR((unused))) return; ctx->progress = e2fsck_update_progress; - ctx->progress_fd = 0; } static void signal_progress_off(int sig EXT2FS_ATTR((unused))) @@ -627,6 +626,10 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) if (res != 1) goto sscanf_err; + if (ctx->progress_fd < 0) { + ctx->progress = 0; + ctx->progress_fd = ctx->progress_fd * -1; + } if (!ctx->progress_fd) break; /* Validate the file descriptor to avoid disasters */