Fix percentage calculation when rounds > 1

Update comment.
This commit is contained in:
PartialVolume
2020-01-05 21:10:50 +00:00
parent 5f01b660bd
commit 0b6ce3182d

View File

@@ -684,7 +684,8 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
c->round_count = nwipe_options.rounds;
/* Set the number of bytes that will be written across all rounds. */
c->round_size = c->round_count * c->pass_size;
//c->round_size = c->round_count * c->pass_size;
c->round_size = c->pass_size;
/* For the selected method, calculate the correct round_size value (for correct percentage calculation) */
calculate_round_size( c );
@@ -1036,10 +1037,12 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
void calculate_round_size( nwipe_context_t* c )
{
/* This is where the round size is adjusted. round_size is used in the running percentage completion
* calculation. Adjustment the round size as pass_size and pass_count are not sufficient in
* always calculating round size correctly. To hopefully make this adjustment more
* understanable I have itemised the adjustments under each method. This should make it easier
* to add a new method here without breaking the calculations for other methods.
* calculation. round size is calculated based on pass_size, pass_count, number of rounds, blanking
* on/off and verification on/off
*
* To hopefully make this adjustment more understandable, I have presented each calculation
* under each method. This should make it easier to add a new method here without breaking the
* calculations for other methods.
*/
/* Don't change the order of these values as the case statements use their index in the array */
@@ -1199,6 +1202,10 @@ void calculate_round_size( nwipe_context_t* c )
}
break;
}
/* Multiple the round_size by the number of rounds (times) the user wants to wipe the drive with this method.
*/
c->round_size *= c->round_count;
}
/* eof */