Skip to content

Commit

Permalink
Various fixes to methods
Browse files Browse the repository at this point in the history
1. Allows zero fill to be verified when blanking off.
Prior to this if you wanted to verify a zero pass,
blanking had to be on. This meant a zero pass, then a
blanking pass then a verify, effectively two zero passes
and a verify. This is now fixed so you can now do a zero
pass with verification without a blanking pass. This knocks
a third off the wipe time of a zero fill with verification.

This also means all other methods can have either all their
passes or just the last pass verified without blanking being
enabled.

2. OPS2 method requires the last pass to be random, the GUI
now disables the use of the blanking option for this message
and displays a warning message that a final blanking pass is
not allowed for OPS2. It never did a final blanking pass
anyway, even if it was selected, but this makes it clearer in
the GUI.

3. The caculate_round_size() function was improved by reducing
some duplicated code and bring the full calculation into this function.

4. On completion of each pass or verification the total number of
bytes written or read for each pass or verification is logged.
  • Loading branch information
PartialVolume committed Jun 4, 2021
1 parent 970d74f commit 4b1c700
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 117 deletions.
50 changes: 46 additions & 4 deletions src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ const char* stats_title = " Statistics ";
/* Footer labels. */
const char* main_window_footer = "S=Start m=Method p=PRNG v=Verify r=Rounds b=Blanking Space=Select CTRL+C=Quit";
const char* main_window_footer_warning_lower_case_s = " WARNING: To start the wipe press SHIFT+S (uppercase S) ";

const char* main_window_fotter_warning_no_blanking_with_ops2 =
" WARNING: Zero blanking is not allowed with ops2 method ";

const char* main_window_fotter_warning_no_blanking_with_verify_only =
" WARNING: Zero blanking is not allowed with verify method ";

const char* main_window_footer_warning_no_drive_selected =
" No drives selected, use spacebar to select a drive, then press S to start ";

Expand Down Expand Up @@ -970,6 +977,38 @@ void nwipe_gui_select( int count, nwipe_context_t** c )

validkeyhit = 1;

if( nwipe_options.method == &nwipe_ops2 )
{
/* Warn the user about that zero blanking with the ops2 method is not allowed */
wattron( footer_window, COLOR_PAIR( 10 ) );
nwipe_gui_amend_footer_window( main_window_fotter_warning_no_blanking_with_ops2 );
doupdate();
sleep( 3 );
wattroff( footer_window, COLOR_PAIR( 10 ) );

/* After the delay return footer text back to key help */
nwipe_gui_amend_footer_window( main_window_footer );
doupdate();

break;
}

if( nwipe_options.method == &nwipe_verify )
{
/* Warn the user about that zero blanking with the ops2 method is not allowed */
wattron( footer_window, COLOR_PAIR( 10 ) );
nwipe_gui_amend_footer_window( main_window_fotter_warning_no_blanking_with_verify_only );
doupdate();
sleep( 3 );
wattroff( footer_window, COLOR_PAIR( 10 ) );

/* After the delay return footer text back to key help */
nwipe_gui_amend_footer_window( main_window_footer );
doupdate();

break;
}

/* Run the noblank dialog. */
nwipe_gui_noblank();
break;
Expand Down Expand Up @@ -1148,6 +1187,13 @@ void nwipe_gui_options( void )
} /* switch verify */

mvwprintw( options_window, NWIPE_GUI_OPTIONS_ROUNDS_Y, NWIPE_GUI_OPTIONS_ROUNDS_X, "Rounds: " );

/* Disable blanking for ops2 and verify methods */
if( nwipe_options.method == &nwipe_ops2 || nwipe_options.method == &nwipe_verify )
{
nwipe_options.noblank = 1;
}

if( nwipe_options.noblank )
{
wprintw( options_window, "%i (no final blanking pass)", nwipe_options.rounds );
Expand Down Expand Up @@ -1821,10 +1867,6 @@ void nwipe_gui_noblank( void )
{
nwipe_options.noblank = focus;
}
if( nwipe_options.noblank )
{
nwipe_options.verify = NWIPE_VERIFY_NONE;
}
return;

case KEY_BACKSPACE:
Expand Down
Loading

0 comments on commit 4b1c700

Please sign in to comment.