diff --git a/src/device.c b/src/device.c index 60afb28..6fc3f5b 100644 --- a/src/device.c +++ b/src/device.c @@ -198,10 +198,10 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount ) next_device->device_model ); } - nwipe_log( NWIPE_LOG_INFO, - "Found drive model=\"%s\", device path=\"%s\", size=\"%s\", serial number=\"%s\"", - next_device->device_model, + nwipe_log( NWIPE_LOG_NOTICE, + "Found %s, %s, %s, S/N=%s", next_device->device_name, + next_device->device_model, next_device->device_size_text, next_device->device_serial_no ); diff --git a/src/logging.c b/src/logging.c index aefb390..ba055a7 100644 --- a/src/logging.c +++ b/src/logging.c @@ -80,7 +80,7 @@ void nwipe_log( nwipe_log_t level, const char* format, ... ) /* Print the date. The rc script uses the same format. */ chars_written = snprintf( message_buffer, MAX_LOG_LINE_CHARS, - "[%i/%02i/%02i %02i:%02i:%02i] nwipe: ", + "[%i/%02i/%02i %02i:%02i:%02i] ", 1900 + p->tm_year, 1 + p->tm_mon, p->tm_mday, @@ -443,7 +443,7 @@ int nwipe_log_sysinfo() fp = popen( cmd, "r" ); if( fp == NULL ) { - nwipe_log( NWIPE_LOG_INFO, "nwipe_log_sysinfo: Failed to create stream to %s", cmd ); + nwipe_log( NWIPE_LOG_WARNING, "nwipe_log_sysinfo: Failed to create stream to %s", cmd ); return 1; } /* Read the output a line at a time - output it. */ @@ -455,13 +455,13 @@ int nwipe_log_sysinfo() { path[len - 1] = 0; } - nwipe_log( NWIPE_LOG_INFO, "%s = %s", &dmidecode_keywords[keywords_idx][0], path ); + nwipe_log( NWIPE_LOG_NOTICE, "%s = %s", &dmidecode_keywords[keywords_idx][0], path ); } /* close */ r = pclose( fp ); if( r > 0 ) { - nwipe_log( NWIPE_LOG_INFO, + nwipe_log( NWIPE_LOG_WARNING, "nwipe_log_sysinfo(): dmidecode failed, \"%s\" exit status = %u", cmd, WEXITSTATUS( r ) ); diff --git a/src/method.c b/src/method.c index 9324de0..e79d746 100644 --- a/src/method.c +++ b/src/method.c @@ -703,21 +703,16 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) /* Initialize the working round counter. */ c->round_working = 0; - nwipe_log( NWIPE_LOG_NOTICE, - "Invoking method '%s' on device '%s'.", - nwipe_method_label( nwipe_options.method ), - c->device_name ); + nwipe_log( + NWIPE_LOG_NOTICE, "Invoking method '%s' on %s", nwipe_method_label( nwipe_options.method ), c->device_name ); while( c->round_working < c->round_count ) { /* Increment the round counter. */ c->round_working += 1; - nwipe_log( NWIPE_LOG_NOTICE, - "Starting round %i of %i on device '%s'.", - c->round_working, - c->round_count, - c->device_name ); + nwipe_log( + NWIPE_LOG_NOTICE, "Starting round %i of %i on %s", c->round_working, c->round_count, c->device_name ); /* Initialize the working pass counter. */ c->pass_working = 0; @@ -738,7 +733,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) } nwipe_log( NWIPE_LOG_NOTICE, - "Starting pass %i of %i, round %i of %i, on device '%s'.", + "Starting pass %i/%i, round %i/%i, on %s", c->pass_working, c->pass_count, c->round_working, @@ -761,7 +756,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) c->pass_type = NWIPE_PASS_NONE; /* Log number of bytes written to disk */ - nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes written to device '%s'.", c->pass_done, c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes written to %s", c->pass_done, c->device_name ); /* Check for a fatal error. */ if( r < 0 ) @@ -773,7 +768,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) { nwipe_log( NWIPE_LOG_NOTICE, - "Verifying pass %i of %i, round %i of %i, on device '%s'.", + "Verifying pass %i of %i, round %i of %i, on %s", c->pass_working, c->pass_count, c->round_working, @@ -792,7 +787,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) } nwipe_log( NWIPE_LOG_NOTICE, - "Verified pass %i of %i, round %i of %i, on device '%s'.", + "Verified pass %i of %i, round %i of %i, on '%s'.", c->pass_working, c->pass_count, c->round_working, @@ -831,7 +826,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) c->pass_type = NWIPE_PASS_NONE; /* Log number of bytes written to disk */ - nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes written to device '%s'.", c->pass_done, c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "%llu bytes written to %s", c->pass_done, c->device_name ); /* Check for a fatal error. */ if( r < 0 ) @@ -845,7 +840,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) if( nwipe_options.verify == NWIPE_VERIFY_ALL || lastpass == 1 || nwipe_options.method == &nwipe_is5enh ) { nwipe_log( NWIPE_LOG_NOTICE, - "Verifying pass %i of %i, round %i of %i, on device '%s'.", + "Verifying pass %i of %i, round %i of %i, on %s", c->pass_working, c->pass_count, c->round_working, @@ -864,7 +859,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) } nwipe_log( NWIPE_LOG_NOTICE, - "Verified pass %i of %i, round %i of %i, on device '%s'.", + "Verified pass %i of %i, round %i of %i, on '%s'.", c->pass_working, c->pass_count, c->round_working, @@ -875,7 +870,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) } /* random pass */ nwipe_log( NWIPE_LOG_NOTICE, - "Finished pass %i of %i, round %i of %i, on device '%s'.", + "Finished pass %i/%i, round %i/%i, on %s", c->pass_working, c->pass_count, c->round_working, @@ -884,11 +879,8 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) } /* for passes */ - nwipe_log( NWIPE_LOG_NOTICE, - "Finished round %i of %i on device '%s'.", - c->round_working, - c->round_count, - c->device_name ); + nwipe_log( + NWIPE_LOG_NOTICE, "Finished round %i of %i on %s", c->round_working, c->round_count, c->device_name ); } /* while rounds */ @@ -931,7 +923,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) if( nwipe_options.verify == NWIPE_VERIFY_LAST || nwipe_options.verify == NWIPE_VERIFY_ALL ) { - nwipe_log( NWIPE_LOG_NOTICE, "Verifying the final random pattern on '%s' is empty.", c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "Verifying the final random pattern on %s is empty.", c->device_name ); /* Verify the final zero pass. */ r = nwipe_random_verify( c ); @@ -951,7 +943,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) else if( nwipe_options.method == &nwipe_verify ) { - nwipe_log( NWIPE_LOG_NOTICE, "Verifying that '%s' is empty.", c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "Verifying that %s is empty", c->device_name ); /* Verify the final zero pass. */ c->pass_type = NWIPE_PASS_VERIFY; @@ -964,7 +956,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) return r; } - nwipe_log( NWIPE_LOG_NOTICE, "Verified that '%s' is empty.", c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Verified that %s is empty.", c->device_name ); } /* verify */ @@ -973,7 +965,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) /* Tell the user that we are on the final pass. */ c->pass_type = NWIPE_PASS_FINAL_BLANK; - nwipe_log( NWIPE_LOG_NOTICE, "Blanking device '%s'.", c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "Blanking device %s", c->device_name ); /* The final zero pass. */ r = nwipe_static_pass( c, &pattern_zero ); @@ -986,7 +978,7 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) if( nwipe_options.verify == NWIPE_VERIFY_LAST || nwipe_options.verify == NWIPE_VERIFY_ALL ) { - nwipe_log( NWIPE_LOG_NOTICE, "Verifying that '%s' is empty.", c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "Verifying that %s is empty.", c->device_name ); /* Verify the final zero pass. */ r = nwipe_static_verify( c, &pattern_zero ); @@ -997,10 +989,10 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) return r; } - nwipe_log( NWIPE_LOG_NOTICE, "Verified that '%s' is empty.", c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Verified that %s is empty.", c->device_name ); } - nwipe_log( NWIPE_LOG_NOTICE, "Blanked device '%s'.", c->device_name ); + nwipe_log( NWIPE_LOG_NOTICE, "[SUCCESS] Blanked device %s", c->device_name ); } /* final blank */ @@ -1014,13 +1006,13 @@ int nwipe_runmethod( nwipe_context_t* c, nwipe_pattern_t* patterns ) if( c->verify_errors > 0 ) { /* We finished, but with non-fatal verification errors. */ - nwipe_log( NWIPE_LOG_ERROR, "%llu verification errors on device '%s'.", c->verify_errors, c->device_name ); + nwipe_log( NWIPE_LOG_ERROR, "%llu verification errors on '%s'.", c->verify_errors, c->device_name ); } if( c->pass_errors > 0 ) { /* We finished, but with non-fatal wipe errors. */ - nwipe_log( NWIPE_LOG_ERROR, "%llu wipe errors on device '%s'.", c->pass_errors, c->device_name ); + nwipe_log( NWIPE_LOG_ERROR, "%llu wipe errors on '%s'.", c->pass_errors, c->device_name ); } /* FIXME: The 'round_errors' context member is not being used. */ diff --git a/src/nwipe.c b/src/nwipe.c index 008b8b7..fc26fe6 100644 --- a/src/nwipe.c +++ b/src/nwipe.c @@ -317,15 +317,8 @@ int main( int argc, char** argv ) /* Do sector size and block size checking. */ if( ioctl( c2[i]->device_fd, BLKSSZGET, &c2[i]->device_sector_size ) == 0 ) { - nwipe_log( - NWIPE_LOG_INFO, "Device '%s' has sector size %i.", c2[i]->device_name, c2[i]->device_sector_size ); - if( ioctl( c2[i]->device_fd, BLKBSZGET, &c2[i]->device_block_size ) == 0 ) - { - nwipe_log( - NWIPE_LOG_INFO, "Device '%s' has block size %i.", c2[i]->device_name, c2[i]->device_block_size ); - } - else + if( ioctl( c2[i]->device_fd, BLKBSZGET, &c2[i]->device_block_size ) != 0 ) { nwipe_log( NWIPE_LOG_WARNING, "Device '%s' failed BLKBSZGET ioctl.", c2[i]->device_name ); c2[i]->device_block_size = 0; @@ -386,13 +379,23 @@ int main( int argc, char** argv ) if( c2[i]->device_size == 0 ) { - nwipe_log( NWIPE_LOG_ERROR, "Device '%s' is size %llu.", c2[i]->device_name, c2[i]->device_size ); + nwipe_log( NWIPE_LOG_ERROR, + "%s, sect/blk/dev %llu/%i/%i", + c2[i]->device_name, + c2[i]->device_sector_size, + c2[i]->device_block_size, + c2[i]->device_size ); nwipe_error++; continue; } else { - nwipe_log( NWIPE_LOG_INFO, "Device '%s' is size %llu.", c2[i]->device_name, c2[i]->device_size ); + nwipe_log( NWIPE_LOG_NOTICE, + "%s, sect/blk/dev %llu/%i/%i", + c2[i]->device_name, + c2[i]->device_sector_size, + c2[i]->device_block_size, + c2[i]->device_size ); } /* Fork a child process. */