mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-20 13:42:14 +00:00
Merge pull request #179 from PartialVolume/fix_percentage_calculation_for_rounds_greater_than_one
Fix percentage calculation for rounds greater than one
This commit is contained in:
18
src/method.c
18
src/method.c
@@ -683,8 +683,8 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns )
|
||||
/* Tell the parent the number of rounds that will be run. */
|
||||
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;
|
||||
/* Set the initial number of bytes that will be written across all rounds. */
|
||||
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 +1036,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 +1201,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 */
|
||||
|
||||
Reference in New Issue
Block a user