Moved and added some comments, no code changes
This commit is contained in:
parent
5e78718881
commit
7088f57ba6
10
wipe.pl
10
wipe.pl
@ -101,11 +101,11 @@ sub getdisks {
|
|||||||
sub wipethemdrives {
|
sub wipethemdrives {
|
||||||
my $diskid = shift;
|
my $diskid = shift;
|
||||||
my $disks = shift;
|
my $disks = shift;
|
||||||
# Write
|
|
||||||
say "$disks->{$diskid}{path} - Serial:$disks->{$diskid}{serial} is being wiped...";
|
say "$disks->{$diskid}{path} - Serial:$disks->{$diskid}{serial} is being wiped...";
|
||||||
my $disksum;
|
my $disksum;
|
||||||
my $disksum2;
|
my $disksum2;
|
||||||
my $spacer = 29;
|
my $spacer = 29;
|
||||||
|
# Write
|
||||||
if ($notreally) {
|
if ($notreally) {
|
||||||
$spacer = 18;
|
$spacer = 18;
|
||||||
print "Pretend wipe complete, pretending to check...";
|
print "Pretend wipe complete, pretending to check...";
|
||||||
@ -113,11 +113,12 @@ sub wipethemdrives {
|
|||||||
$disksum2 = $clobsum;
|
$disksum2 = $clobsum;
|
||||||
} else {
|
} else {
|
||||||
open(my $diskw, ">", $disks->{$diskid}{path}) or return warning("could not open $disks->{$diskid}{path}");
|
open(my $diskw, ">", $disks->{$diskid}{path}) or return warning("could not open $disks->{$diskid}{path}");
|
||||||
print $diskw $clobber;
|
print $diskw $clobber; #Start of Disk
|
||||||
seek($diskw,-10240000,2);
|
seek($diskw,-10240000,2);
|
||||||
print $diskw $clobber;
|
print $diskw $clobber; #End of Disk
|
||||||
close($diskw);
|
close($diskw);
|
||||||
system("sync");
|
#######################################
|
||||||
|
system("sync"); #Need to check if this failes and actually fail the disk if it fails.
|
||||||
print "Wipe attempt complete, checking...";
|
print "Wipe attempt complete, checking...";
|
||||||
# Read
|
# Read
|
||||||
open(my $diskr, "<", $disks->{$diskid}{path}) or return warning("could not open $disks->{$diskid}{path}");
|
open(my $diskr, "<", $disks->{$diskid}{path}) or return warning("could not open $disks->{$diskid}{path}");
|
||||||
@ -149,6 +150,7 @@ sub wipethemdrives {
|
|||||||
seek($longdiskw,0,2);
|
seek($longdiskw,0,2);
|
||||||
my $totalBytes = tell($longdiskw);
|
my $totalBytes = tell($longdiskw);
|
||||||
seek($longdiskw,0,0);
|
seek($longdiskw,0,0);
|
||||||
|
#################################################### Need to double check this math, its not calculating % right
|
||||||
for (0..($totalBytes/4096)) {
|
for (0..($totalBytes/4096)) {
|
||||||
print $longdiskw "\0"x4096;
|
print $longdiskw "\0"x4096;
|
||||||
if ( !(tell($longdiskw) % (16*4096)) ) {
|
if ( !(tell($longdiskw) % (16*4096)) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user