[syslinux] [PATCH 04/05] utils/mkdiskimage.in: New option -S to sync zeroizing after each cylinder and to issue pacifier messages

Thomas Schmitt scdbackup at gmx.net
Thu Jan 30 13:01:49 PST 2014


 utils/mkdiskimage.in: New option -S to sync zeroizing after each cylinder and to issue pacifier messages.

--- utils/mkdiskimage_patched_03.in	2014-01-30 20:54:27.000000000 +0100
+++ utils/mkdiskimage.in	2014-01-30 20:59:19.000000000 +0100
@@ -139,6 +139,7 @@ if ( $file eq '' || $c < 1 || $h < 1 || 
     print STDERR "    -4    use partition entry 4 (standard for zipdisks)\n";
     print STDERR "    -i    specify the MBR ID\n";
     print STDERR "    -s    output a sparse file (don't allocate all blocks)\n";
+    print STDERR "    -S    sync after each zeroized cylinder and show count\n";
     exit 1;
 }
 
@@ -218,12 +219,24 @@ if ($opt{'s'}) {
 } else {
     $track = "\0" x (512*$s);
 
+    $show_pacifier = $opt{'S'};
+
     # Print fractional track
     print OUTPUT "\0" x (512 * ($s-1));
 
     for ( $i = 1 ; $i < $tracks ; $i++ ) {
+	if ( $show_pacifier && ( $i - 1 ) % $h == 0 ) {
+	    $cyl_to_write = ( $i - 1 ) / $h + 1;
+	    IO::Handle::sync(OUTPUT);
+	    print STDERR " zeroizing cylinder $cyl_to_write of $c\r";
+	}
 	print OUTPUT $track;
     }
+    if ( $show_pacifier ) {
+	IO::Handle::sync(OUTPUT);
+	$zeroized = $totalsize + $zero_tail - 1;
+	print STDERR " $zeroized blocks zeroized.              \n";
+    }
 }
 
 # Print mtools temp file


More information about the Syslinux mailing list