mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-20 13:42:14 +00:00
Merge branch 'master' into formatting_pass_4
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -23,4 +23,4 @@ jobs:
|
||||
- name: verifying code style
|
||||
# TODO use check-format when all the code has been formatted.
|
||||
# run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && make check-format
|
||||
run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && clang-format -i -style=file src/context.h src/nwipe.c src/nwipe.h src/options.c src/options.h && git diff-index --quiet HEAD
|
||||
run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && clang-format -i -style=file src/context.h src/nwipe.c src/nwipe.h src/options.c src/options.h src/version.h src/version.c src/method.h src/method.c && git diff-index --quiet HEAD
|
||||
|
||||
2
.github/workflows/ci_ubuntu-16.04.yml
vendored
2
.github/workflows/ci_ubuntu-16.04.yml
vendored
@@ -23,4 +23,4 @@ jobs:
|
||||
- name: verifying code style
|
||||
# TODO use check-format when all the code has been formatted.
|
||||
# run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && make check-format
|
||||
run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && clang-format -i -style=file src/context.h src/nwipe.c src/nwipe.h src/options.c src/options.h && git diff-index --quiet HEAD
|
||||
run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && clang-format -i -style=file src/context.h src/nwipe.c src/nwipe.h src/options.c src/options.h src/version.h src/version.c src/method.h src/method.c && git diff-index --quiet HEAD
|
||||
|
||||
52
src/gui.c
52
src/gui.c
@@ -1983,6 +1983,7 @@ void *nwipe_gui_status( void *ptr )
|
||||
|
||||
else
|
||||
{
|
||||
nwipe_active = compute_stats(ptr); // compute the final percentage completion value.
|
||||
if( c[i]->result == 0 ) { mvwprintw( main_window, yy++, 4, "[%05.2f%% complete, SUCCESS! ", c[i]->round_percent); }
|
||||
else if( c[i]->signal ) { mvwprintw( main_window, yy++, 4, "(>>> FAILURE! <<<, signal %i) ", c[i]->signal ); }
|
||||
else { mvwprintw( main_window, yy++, 4, "(>>>FAILURE!<<<, code %i) ", c[i]->result ); }
|
||||
@@ -2146,7 +2147,6 @@ void *nwipe_gui_status( void *ptr )
|
||||
|
||||
/* Test for a thread cancellation request */
|
||||
pthread_testcancel();
|
||||
|
||||
} // while
|
||||
|
||||
if (nwipe_options.logfile[0] == '\0')
|
||||
@@ -2190,41 +2190,41 @@ int compute_stats(void *ptr)
|
||||
for( i = 0 ; i < count ; i++ )
|
||||
{
|
||||
/* Check whether the child process is still running the wipe. */
|
||||
// if( c[i]->thread > 0 )
|
||||
if( c[i]->wipe_status == 1 )
|
||||
{
|
||||
/* Increment the child counter. */
|
||||
nwipe_active += 1;
|
||||
}
|
||||
|
||||
/* Maintain a rolling average of throughput. */
|
||||
nwipe_update_speedring( &c[i]->speedring, c[i]->round_done, nwipe_time_now );
|
||||
/* Even if the wipe has finished ALWAYS run the stats one last time so the final SUCCESS percentage value is correct.
|
||||
* Maintain a rolling average of throughput. */
|
||||
nwipe_update_speedring( &c[i]->speedring, c[i]->round_done, nwipe_time_now );
|
||||
|
||||
if( c[i]->speedring.timestotal > 0 )
|
||||
if( c[i]->speedring.timestotal > 0 )
|
||||
{
|
||||
/* Update the current average throughput in bytes-per-second. */
|
||||
c[i]->throughput = c[i]->speedring.bytestotal / c[i]->speedring.timestotal;
|
||||
|
||||
/* Update the estimated remaining runtime. */
|
||||
/* Check that throughput is not zero (sometimes caused during a sync) */
|
||||
if (c[i]->throughput == 0)
|
||||
{
|
||||
/* Update the current average throughput in bytes-per-second. */
|
||||
c[i]->throughput = c[i]->speedring.bytestotal / c[i]->speedring.timestotal;
|
||||
|
||||
/* Update the estimated remaining runtime. */
|
||||
/* Check that throughput is not zero (sometimes caused during a sync) */
|
||||
if (c[i]->throughput == 0)
|
||||
{
|
||||
c[i]->throughput = 1;
|
||||
}
|
||||
|
||||
c[i]->eta = ( c[i]->round_size - c[i]->round_done ) / c[i]->throughput;
|
||||
|
||||
if( c[i]->eta > nwipe_misc_thread_data->maxeta )
|
||||
{
|
||||
nwipe_misc_thread_data->maxeta = c[i]->eta;
|
||||
}
|
||||
c[i]->throughput = 1;
|
||||
}
|
||||
|
||||
/* Update the percentage value. */
|
||||
c[i]->round_percent = (double) c[i]->round_done / (double) c[i]->round_size * 100;
|
||||
c[i]->eta = ( c[i]->round_size - c[i]->round_done ) / c[i]->throughput;
|
||||
|
||||
/* Accumulate combined throughput. */
|
||||
nwipe_misc_thread_data->throughput += c[i]->throughput;
|
||||
} /* child running */
|
||||
if( c[i]->eta > nwipe_misc_thread_data->maxeta )
|
||||
{
|
||||
nwipe_misc_thread_data->maxeta = c[i]->eta;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the percentage value. */
|
||||
c[i]->round_percent = (double) c[i]->round_done / (double) c[i]->round_size * 100;
|
||||
|
||||
/* Accumulate combined throughput. */
|
||||
nwipe_misc_thread_data->throughput += c[i]->throughput;
|
||||
|
||||
/* Accumulate the error count. */
|
||||
nwipe_misc_thread_data->errors += c[i]->pass_errors;
|
||||
|
||||
1672
src/method.c
1672
src/method.c
File diff suppressed because it is too large
Load Diff
42
src/method.h
42
src/method.h
@@ -2,7 +2,7 @@
|
||||
* methods.c: Method implementations for nwipe.
|
||||
*
|
||||
* Copyright Darik Horn <dajhorn-dban@vanadac.com>.
|
||||
*
|
||||
*
|
||||
* Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -16,45 +16,43 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef METHOD_H_
|
||||
#define METHOD_H_
|
||||
|
||||
/* The argument list for nwipe methods. */
|
||||
#define NWIPE_METHOD_SIGNATURE nwipe_context_t* c
|
||||
|
||||
typedef enum nwipe_verify_t_
|
||||
{
|
||||
NWIPE_VERIFY_NONE = 0, /* Do not read anything back from the device. */
|
||||
NWIPE_VERIFY_LAST, /* Check the last pass. */
|
||||
NWIPE_VERIFY_ALL, /* Check all passes. */
|
||||
typedef enum nwipe_verify_t_ {
|
||||
NWIPE_VERIFY_NONE = 0, // Do not read anything back from the device.
|
||||
NWIPE_VERIFY_LAST, // Check the last pass.
|
||||
NWIPE_VERIFY_ALL, // Check all passes.
|
||||
} nwipe_verify_t;
|
||||
|
||||
/* The typedef of the function that will do the wipe. */
|
||||
typedef int(*nwipe_method_t)( void *ptr );
|
||||
typedef int ( *nwipe_method_t )( void* ptr );
|
||||
|
||||
typedef struct /* nwipe_pattern_t */
|
||||
typedef struct
|
||||
{
|
||||
int length; /* Length of the pattern in bytes, -1 means random. */
|
||||
char* s; /* The actual bytes of the pattern. */
|
||||
int length; // Length of the pattern in bytes, -1 means random.
|
||||
char* s; // The actual bytes of the pattern.
|
||||
} nwipe_pattern_t;
|
||||
|
||||
const char* nwipe_method_label( void* method );
|
||||
int nwipe_runmethod( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* patterns );
|
||||
|
||||
void *nwipe_dod522022m( void *ptr );
|
||||
void *nwipe_dodshort( void *ptr );
|
||||
void *nwipe_gutmann( void *ptr );
|
||||
void *nwipe_ops2( void *ptr );
|
||||
void *nwipe_is5enh( void *ptr );
|
||||
void *nwipe_random( void *ptr );
|
||||
void *nwipe_zero( void *ptr );
|
||||
void *nwipe_verify( void *ptr );
|
||||
void* nwipe_dod522022m( void* ptr );
|
||||
void* nwipe_dodshort( void* ptr );
|
||||
void* nwipe_gutmann( void* ptr );
|
||||
void* nwipe_ops2( void* ptr );
|
||||
void* nwipe_is5enh( void* ptr );
|
||||
void* nwipe_random( void* ptr );
|
||||
void* nwipe_zero( void* ptr );
|
||||
void* nwipe_verify( void* ptr );
|
||||
|
||||
void calculate_round_size( nwipe_context_t* );
|
||||
|
||||
#endif /* METHOD_H_ */
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "options.h"
|
||||
#include "pass.h"
|
||||
#include "logging.h"
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
int nwipe_random_verify( nwipe_context_t* c )
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
* version_string and program_name are used by siege
|
||||
* and configure; author_name and email_address are
|
||||
* used by configure to dynamically assign those values
|
||||
* and configure; author_name and email_address are
|
||||
* used by configure to dynamically assign those values
|
||||
* to documentation files.
|
||||
*/
|
||||
const char *version_string = "0.27rc1";
|
||||
const char *program_name = "nwipe";
|
||||
const char *author_name = "Martijn van Brummelen";
|
||||
const char *email_address = "git@brumit.nl";
|
||||
const char *years = "2019";
|
||||
const char *copyright = "Copyright Darik Horn <dajhorn-dban@vanadac.com>\n\
|
||||
const char* version_string = "0.27rc1";
|
||||
const char* program_name = "nwipe";
|
||||
const char* author_name = "Martijn van Brummelen";
|
||||
const char* email_address = "git@brumit.nl";
|
||||
const char* years = "2019";
|
||||
const char* copyright = "Copyright Darik Horn <dajhorn-dban@vanadac.com>\n\
|
||||
Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>\n\
|
||||
This is free software; see the source for copying conditions.\n\
|
||||
There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\
|
||||
FOR A PARTICULAR PURPOSE.\n";
|
||||
const char *banner = "nwipe 0.27rc1";
|
||||
const char* banner = "nwipe 0.27rc1";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
extern char *version_string;
|
||||
extern char *program_name;
|
||||
extern char *author_name;
|
||||
extern char *email_address;
|
||||
extern char *copyright;
|
||||
extern char *banner;
|
||||
extern char* version_string;
|
||||
extern char* program_name;
|
||||
extern char* author_name;
|
||||
extern char* email_address;
|
||||
extern char* copyright;
|
||||
extern char* banner;
|
||||
|
||||
#endif/*__VERSION_H*/
|
||||
#endif /*__VERSION_H*/
|
||||
|
||||
Reference in New Issue
Block a user