diff --git a/src/create_pdf.c b/src/create_pdf.c index 455c129..8e0cc18 100644 --- a/src/create_pdf.c +++ b/src/create_pdf.c @@ -205,7 +205,7 @@ int create_pdf( nwipe_context_t* ptr ) if( !strcmp( c->device_type_str, "NVME" ) || !strcmp( c->device_type_str, "VIRT" ) || c->HPA_status == HPA_NOT_APPLICABLE ) { - snprintf( device_size, sizeof( device_size ), "Not applicable to %s", c->device_type_str ); + snprintf( device_size, sizeof( device_size ), "%s, %lli bytes", c->device_size_text, c->device_size ); pdf_add_text( pdf, NULL, device_size, text_size_data, 125, 370, PDF_DARK_GREEN ); } else @@ -213,7 +213,7 @@ int create_pdf( nwipe_context_t* ptr ) /* If there is a real max size always show in green, if the drive doesn't * support HPA show device size as that is the real size. */ - if( c->DCO_reported_real_max_size > 1 || c->HPA_status == HPA_NOT_APPLICABLE ) + if( c->DCO_reported_real_max_size > 1 ) { /* displays the real max size of the disc from the DCO displayed in Green */ snprintf( device_size, diff --git a/src/gui.c b/src/gui.c index 0a74d3d..3676376 100644 --- a/src/gui.c +++ b/src/gui.c @@ -824,19 +824,19 @@ void nwipe_gui_select( int count, nwipe_context_t** c ) case HPA_ENABLED: wprintw( main_window, " " ); wattron( main_window, COLOR_PAIR( 9 ) ); - wprintw( main_window, " HPA/DCO Hidden area detected !! " ); + wprintw( main_window, " HPA/DCO Hidden sectors detected !!" ); wattroff( main_window, COLOR_PAIR( 9 ) ); break; case HPA_DISABLED: wprintw( main_window, " " ); - wprintw( main_window, " HPA/DCO No hidden areas detected " ); + wprintw( main_window, "HPA/DCO No hidden sectors detected " ); break; case HPA_UNKNOWN: wprintw( main_window, " " ); wattron( main_window, COLOR_PAIR( 9 ) ); - wprintw( main_window, " HPA/DCO hidden area indeterminate " ); + wprintw( main_window, " HPA/DCO hidden sectors indeterminate " ); wattroff( main_window, COLOR_PAIR( 9 ) ); break; diff --git a/src/hpa_dco.c b/src/hpa_dco.c index 3a1b848..2fb7f60 100644 --- a/src/hpa_dco.c +++ b/src/hpa_dco.c @@ -491,11 +491,21 @@ int hpa_dco_status( nwipe_context_t* ptr ) } else { + /* NVMe drives don't support HPA/DCO */ if( !strcmp( c->device_type_str, "NVME" ) || ( c->HPA_reported_set > 1 && c->DCO_reported_real_max_sectors < 2 ) ) { c->HPA_status = HPA_NOT_APPLICABLE; } + else + { + /* For recent enterprise and new drives that don't provide HPA/DCO anymore */ + if( c->HPA_reported_set > 0 && c->HPA_reported_real == 1 + && c->DCO_reported_real_max_sectors < 2 ) + { + c->HPA_status = HPA_NOT_APPLICABLE; + } + } } } } @@ -503,21 +513,37 @@ int hpa_dco_status( nwipe_context_t* ptr ) if( c->HPA_status == HPA_DISABLED ) { - nwipe_log( NWIPE_LOG_INFO, "No hidden areas on %s", c->device_name ); + nwipe_log( NWIPE_LOG_INFO, "No hidden sectors on %s", c->device_name ); } else { if( c->HPA_status == HPA_ENABLED ) { - nwipe_log( NWIPE_LOG_WARNING, "HIDDEN AREA DETECTED! on %s", c->device_name ); + nwipe_log( NWIPE_LOG_WARNING, " *********************************" ); + nwipe_log( NWIPE_LOG_WARNING, " *** HIDDEN SECTORS DETECTED ! *** on %s", c->device_name ); + nwipe_log( NWIPE_LOG_WARNING, " *********************************" ); } else { if( c->HPA_status == HPA_UNKNOWN ) { - nwipe_log( NWIPE_LOG_WARNING, - "HIDDEN AREA INDETERMINATE! on %s, are you using a USB bridge or memory stick?", - c->device_name ); + if( c->device_bus == NWIPE_DEVICE_USB ) + nwipe_log( NWIPE_LOG_WARNING, + "HIDDEN SECTORS INDETERMINATE! on %s, Some USB adapters & memory sticks don't support " + "ATA pass through", + c->device_name ); + else + { + if( c->HPA_status == HPA_NOT_APPLICABLE ) + { + nwipe_log( NWIPE_LOG_WARNING, "%s may not support HPA/DCO", c->device_name ); + } + else + { + nwipe_log( + NWIPE_LOG_SANITY, "Unrecognised HPA_status, should not be possible %s", c->device_name ); + } + } } } } diff --git a/src/nwipe.c b/src/nwipe.c index 56d70c5..8055938 100644 --- a/src/nwipe.c +++ b/src/nwipe.c @@ -84,32 +84,6 @@ int main( int argc, char** argv ) /* The generic result buffer. */ int r; - /* Log nwipes version */ - nwipe_log( NWIPE_LOG_INFO, "%s", banner ); - - /* Check that hdparm exists, we use hdparm for HPA/DCO detection etc, if not exit nwipe - * required if the PATH environment is not setup ! (Debian sid 'su' as - * opposed to 'su -' - */ - if( system( "which hdparm > /dev/null 2>&1" ) ) - { - if( system( "which /sbin/hdparm > /dev/null 2>&1" ) ) - { - if( system( "which /usr/bin/hdparm > /dev/null 2>&1" ) ) - { - nwipe_log( NWIPE_LOG_WARNING, "hdparm command not found." ); - nwipe_log( NWIPE_LOG_WARNING, - "Required by nwipe for HPA/DCO detection & correction and ATA secure erase." ); - nwipe_log( NWIPE_LOG_WARNING, "** Please install hdparm **\n" ); - cleanup(); - exit( 1 ); - } - } - } - - /* Log OS info */ - nwipe_log_OSinfo(); - /* Initialise the termintaion signal, 1=terminate nwipe */ terminate_signal = 0; @@ -136,9 +110,44 @@ int main( int argc, char** argv ) int wipe_threads_started = 0; - /* Parse command line options. */ + /** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** + * Important Note: if you want nwipe_log messages to go into the logfile + * they must after after the options are parsed here, else they will + * appear in the console but not in the logfile, that is, assuming you + * specified a log file on the command line as an nwipe option. + */ + + /***************************** + * Parse command line options. + */ nwipe_optind = nwipe_options_parse( argc, argv ); + /* Log nwipes version */ + nwipe_log( NWIPE_LOG_INFO, "%s", banner ); + + /* Log OS info */ + nwipe_log_OSinfo(); + + /* Check that hdparm exists, we use hdparm for HPA/DCO detection etc, if not exit nwipe + * required if the PATH environment is not setup ! (Debian sid 'su' as + * opposed to 'su -' + */ + if( system( "which hdparm > /dev/null 2>&1" ) ) + { + if( system( "which /sbin/hdparm > /dev/null 2>&1" ) ) + { + if( system( "which /usr/bin/hdparm > /dev/null 2>&1" ) ) + { + nwipe_log( NWIPE_LOG_WARNING, "hdparm command not found." ); + nwipe_log( NWIPE_LOG_WARNING, + "Required by nwipe for HPA/DCO detection & correction and ATA secure erase." ); + nwipe_log( NWIPE_LOG_WARNING, "** Please install hdparm **\n" ); + cleanup(); + exit( 1 ); + } + } + } + if( nwipe_optind == argc ) { /* File names were not given by the user. Scan for devices. */ @@ -973,7 +982,7 @@ int cleanup() extern int log_elements_allocated; // initialised and found in logging.c extern char** log_lines; - /* Print the logs held in memory. */ + /* Print the logs held in memory to the console */ for( i = log_elements_displayed; i < log_elements_allocated; i++ ) { printf( "%s\n", log_lines[i] ); diff --git a/src/version.c b/src/version.c index 87c0ab9..aa99462 100644 --- a/src/version.c +++ b/src/version.c @@ -4,7 +4,7 @@ * used by configure to dynamically assign those values * to documentation files. */ -const char* version_string = "0.34.8 Development code, not for production use!"; +const char* version_string = "0.34.81 Development code, not for production use!"; const char* program_name = "nwipe"; const char* author_name = "Martijn van Brummelen"; const char* email_address = "git@brumit.nl"; @@ -14,4 +14,4 @@ Modifications to original dwipe Copyright Andy Beverley \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.34.8 Development code, not for production use!"; +const char* banner = "nwipe 0.34.81 Development code, not for production use!";