Whamcloud - gitweb
e2fsck: Support a negative argument to -C to suppress progress information
authorTheodore Ts'o <tytso@mit.edu>
Wed, 26 Mar 2008 12:26:01 +0000 (08:26 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 26 Mar 2008 12:26:01 +0000 (08:26 -0400)
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" <tytso@mit.edu>
e2fsck/e2fsck.8.in
e2fsck/unix.c

index 6cae577..3059e60 100644 (file)
@@ -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 
index 1227725..e843244 100644 (file)
@@ -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 */