32 Commits
v0.35 ... v0.36

Author SHA1 Message Date
PartialVolume
cb595e139c Update README.md 2024-02-20 21:19:54 +00:00
PartialVolume
08f68f14d9 Merge pull request #549 from PartialVolume/Bump_version_to_0.36
Bump version to 0.36
2024-02-20 20:53:14 +00:00
PartialVolume
f17845c54b Updated CHANGELOG.md 2024-02-20 20:43:54 +00:00
PartialVolume
230e7f524a Bump to v0.36 2024-02-20 19:52:25 +00:00
PartialVolume
de077211e6 Merge pull request #548 from PartialVolume/Fix_some_strcpy_warnings_for_Debian
Fix some strcpy compiler warnings
2024-02-17 17:23:30 +00:00
PartialVolume
07a7c0ab0c Fix some strcpy compiler warnings
Replace three strcpy commands with strncpy,
bump minor version ready for more testing.
2024-02-17 17:00:37 +00:00
PartialVolume
2fae6ea5f5 Merge pull request #546 from PartialVolume/Determine_block_sizes_before_hidden_sector_detection
Populates device block size before hidden sector
2024-02-15 23:21:50 +00:00
PartialVolume
d6f7238cb3 Populates device block size before hidden sector
Now populates the block size (physical) before
the hidden sector determination function runs.

The naming of block/sector can be very confusing in
nwipe. So I have created a device_phy_sector_size
in the drive context, so we have

->device_sector_size // logical sector size
->device_phys_sector_size // physical sector size
->device_block_size // Usually the same as logical
size but could be increased by nwipe to encompass
multiple logical sectors, i.e a block of sectors
2024-02-15 23:11:09 +00:00
PartialVolume
c007d0f2ab Update version.c
Bump minor version from 0.35.6 to 0.35.7
2024-02-15 11:51:45 +00:00
PartialVolume
161054269c Merge pull request #543 from PartialVolume/Fix_incorrect_HS_status_for_4096_sectors_as_reported_by_libata
Fix hidden sector detection for logical 4096 size
2024-02-03 22:34:47 +00:00
PartialVolume
dd7ffab816 Fix hidden sector detection for logical 4096 size
This fixes an issue where nwipe detects a discrepancy
between the number of sectors reported by hdparm and
nwipe's own HPA/DCO functions that were reporting the
same values, using number of sectors based on 512 byte
sectors but disagreed with the number of sectors
generated from libata which was reporting the number of
sectors based on 4096 byte sectors.

This has been fixed by always calculating the number
of sectors returned by libata using 512 bytes per sector
so a direct comparison can be made to data from hdparm
& nwipe's HPA/DCO functions.
2024-02-03 20:20:39 +00:00
PartialVolume
9edebde20d Merge pull request #538 from PartialVolume/Make_footer_text_more_informative_at_end_of_all_wipes
Make completion footer more informative
2023-12-20 21:10:34 +00:00
PartialVolume
807eed0ffc Make completion footer more informative
These changes solve three issues. The first
issue was that it wasn't obvious that the
PDFs are only created once you press return
to exit after all the wipes have finished. It
is now explicitly stated in the footer message if
PDFs are enabled.

It also now specifies the logfile name on the
footer if the user has specified a log file as a
command line option. If no logfile is specified
then STDOUT is displayed.

If the user specified --PDFreportpath=noPDF on the
command line, prior to this commit it had no affect.
This is now fixed so that it disables PDF's irrespective
of what is in nwipe.conf. i.e command line options
override the entries in nwipe.conf

If the user has specified a --PDFreportpath=noPDF=/some/path
then PDF's are enabled irrespective of the value in nwipe.conf
2023-12-20 20:53:43 +00:00
PartialVolume
78f3a26795 Merge pull request #536 from PartialVolume/Bump_minor_version
Bump version from 0.35.3 to 0.35.4
2023-12-16 19:14:47 +00:00
PartialVolume
dbe7103fe9 Bump version from 0.35.3 to 0.35.4 2023-12-16 19:12:23 +00:00
PartialVolume
eef25e829e Merge pull request #535 from PartialVolume/Fix_incorrect_footer_on_return_to_preview
Fix incorrect footer on return to preview
2023-12-16 18:57:59 +00:00
PartialVolume
43bfb3a08e Fix incorrect footer on return to preview
This fixes incorrect footer text being displayed when
Enable customer/company preview is enabled and the user
select a field to be edited, completes the editing and
returns to the preview to select A for accept. Only
problem was A=Accept wasn't listed on the footer.
2023-12-16 18:50:33 +00:00
PartialVolume
fd6cca7010 Merge pull request #534 from PartialVolume/Fix_spacing_between_temperature_and_model
Place a space between temperature and model
2023-11-29 22:23:44 +00:00
PartialVolume
1220eca2ef Place a space between temperature and model
eg [36C] ST3500... and not [36C]ST3500..
2023-11-29 22:21:01 +00:00
PartialVolume
32321f49fa Merge pull request #533 from PartialVolume/Fix_config_key_shortcuts_help_text
Fix the config help messages.

Some of the config help messages that show the purpose of the keys were inconsistent or not updating correctly when going back to the previous menu. Now fixed.
2023-11-29 19:51:02 +00:00
PartialVolume
cca93f845d Fix the config help messages
Some of the help messages that show the
purpose of the keys were inconsistent or
not updated when going back. Now fixed.
2023-11-29 19:40:47 +00:00
PartialVolume
789aa134a0 Merge pull request #532 from PartialVolume/Fix_PDF_page_titles
Make smart page titles consistent with page 1

Should now read
Page 1 - Erasure Status
Page 2 - Smart Data
Page 3 - Smart Data

and not as previously
Page 1 - Erasure Status
Smart Data - Page 2
Smart Data - Page 3
2023-11-28 21:25:52 +00:00
PartialVolume
c24e248055 Make smart page titles consistent with page 1
Should now read
Page 1 - Erasure Status
Page 2 - Smart Data
Page 3 - Smart Data

and not as previously
Page 1 - Erasure Status
Smart Data - Page 2
Smart Data - Page 3
2023-11-28 21:21:48 +00:00
PartialVolume
3f78d76bac Merge pull request #531 from PartialVolume/Fix_no_auto_exit_in_non_gui_mode
Fix nwipe not auto exiting on completion in non gui mode.
2023-11-28 00:52:54 +00:00
PartialVolume
626ca3826c Fix nwipe not auto exiting on completion in non gui mode. 2023-11-27 23:39:50 +00:00
PartialVolume
f61b593093 Merge pull request #529 from PartialVolume/Fix_autopoweroff_and_nowait_when_screen_blank
Fix autopoweroff and nowait when screen blank
2023-11-24 01:14:31 +00:00
PartialVolume
7f39d81548 Fix autopoweroff and nowait when screen blank
If the user had blanked the screen, the autopoweroff
and nowait options did not work. Instead they paused
nwipe on completion of the wipe/s waiting for the b
key to be pressed which reactivated compute_stats()
function who's output indicates whether any wipes were
still active.

This was fixed so that compute_stats() is always
active while wipes are in progress, so that the
nwipe_gui_status() function will exit when all wipe
threads have completed even if the screen has been
blanked.
2023-11-24 01:06:29 +00:00
PartialVolume
d0a53f57be Merge pull request #527 from ggruber/SerialGarbage
fix: again garbage after serial number
2023-11-20 00:15:03 +00:00
Gerold Gruber
811c36b65a again garbage after serial number 2023-11-20 00:14:05 +01:00
PartialVolume
2ff23eb02c Update version.c
Bump minor version from 0.35 to 0.35.1
2023-11-17 12:04:48 +00:00
PartialVolume
7a4709da55 Merge pull request #526 from PartialVolume/Identify_mmcblk_devices
Added mmcblk device type MMC

Changed log message from "USB bridge, no pass-through support" to "Smart data unavailable" as no smart data could be caused by a non USB device such as mmcblk as well as USB devices with no ATA pass through and other devices that smartctl does not detect.
2023-11-16 20:00:13 +00:00
PartialVolume
9ee5193673 Added mmcblk device type MMC
Added the abbreviation MMC for mmcblk devices such as SD and
microSD cards and some low budget laptops.

Changed log message from "USB bridge, no pass-through support"
to "Smart data unavailable" as no smart data could be caused by
a non USB device such as mmcblk as well as USB devices with no ATA
pass through and other devices that smartctl does not detect.
2023-11-16 19:35:07 +00:00
13 changed files with 436 additions and 330 deletions

View File

@@ -1,6 +1,21 @@
RELEASE NOTES
=============
v0.36
-----------------------
- Added the abbreviation MMC for mmcblk devices such as SD and microSD cards and some low budget laptops. #526
- Fixed some serial numbers that were displaying garbage. #527
- Fixed auto power off and nowait when the screen has been blanked by the user. #529
- Fixed nwipe not auto exiting on completion when in non gui mode. #531
- Fixed smart page titles so they have a consistent format with page 1 in the PDF report. #532
- Fixed some of the config help messages that displayed incorrect information. #533
- Inserted a space between temperature and model. #534
- Fixed incorrect footer on return to organisation/customer preview screen. #535
- Made footer completion message more informative. #538
- Fixed hidden sector detection for devices with logical/physical size of 4096/4096. #543 #546
- Fixed some strcpy compiler warnings. #548
v0.35
-----------------------
- Nwipe will now optionally create a multi-page PDF certificate that shows details of a specific discs erasure. The first page forms the certificate of erasure and subsequent pages show the drives smart data. Two related options have been added to nwipe's command line options -P, --PDFreportpath=PATH Path to write PDF reports to. Default is "." If set to "noPDF" no PDF reports are written. From the drive selection screen you can now press 'c' for config. This takes you to the configuration screen where you can select various PDF certificate related options such as enabling PDF, entering customer or company data for entry onto the certificate and enabling a preview of customer/company info prior to the drive selection screen starting.

View File

@@ -9,14 +9,6 @@ nwipe is a program that will securely erase the entire contents of disks. It can
> **Warning**
> For some of nwipes features such as smart data in the PDF certificate, HPA/DCO detection and other uses, nwipe utilises smartmontools and hdparm. Therefore both hdparm & smartmontools are a mandatory requirement if you want all of nwipes features to be fully available. If you do not install smartmontools and hdparm, nwipe will provide a warning in the log that these programs cannot be found but will still run but many important features may not work as they should do.
# New Features in 0.35
- Nwipe now supports HPA/DCO (hidden disc area) detection. The status of a discs HPA/DCO is shown on nwipes's drive selection screen. This allows you to identify a drive that is reporting a smaller size than it actually is. To wipe the hidden sectors the HPA/DCO must be reset to the true size of the disc. Currently nwipe cannot reset the HPA/DCO (scheduled for 0.36). To reset the HPA/DCO you would need to manually perform a reset using the command line tool hdparm.
- Nwipe now optionally generates a multi page PDF certificate for each drive erased. Page one of the PDF is a erasure certificate that shows the erasure details such as drive make, model, serial number, bytes erased, HPA/DCO status, organisation performing the erase, customer details, technician name, status of erasure, errors detected.
- Nwipe now has a configuration file, /etc/nwipe/nwipe.conf. This is currently used to store PDF parameters but will be enhanced over the next versions to include default wipe parameters amongst other additions.
- There is a new configuration screen in nwipe. It can be accessed from the drive selection screen by typing 'c'. Curerntly the configuration screen allows changes to be made to the PDF certificate however later versions will expand this configuration screen.
- Nwipe now provides better support for temperature retrieval specifically on SAS hardware, so that both SATA and SAS drives should now all show temperatures both at drive selection and during the erasure.
- Nwipes temperature retrieval code has been placed in it's own thread. This was done because it was found that any delays in obtaining the temperature resulted in a momentary freeze in the GUI wipe screen updating it's stats. This wasn't noticable if you were erasing a small number of drives but become apparent when wiping ten or twenty drives simultaneously.
![Example wipe](/images/example_wipe.gif)
<i>The video above shows six drives being simultaneously erased. It skips to the completion of all six wipes and shows five drives that were successfully erased and one drive that failed due to an I/O error. The drive that failed would then normally be physically destroyed. The five drives that were successfully wiped with zero errors or failures can then be redeployed.</i>

View File

@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([nwipe],[0.35],[git@brumit.nl])
AC_INIT([nwipe],[0.36],[git@brumit.nl])
AM_INIT_AUTOMAKE(foreign subdir-objects)
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
AC_OUTPUT

View File

@@ -1,4 +1,4 @@
.TH NWIPE "24" "October 2023" "nwipe version 0.35" "User Commands"
.TH NWIPE "20" "February 2024" "nwipe version 0.36" "User Commands"
.SH NAME
nwipe \- securely erase disks
.SH SYNOPSIS

View File

@@ -38,7 +38,8 @@ typedef enum nwipe_device_t_ {
NWIPE_DEVICE_ATA,
NWIPE_DEVICE_NVME,
NWIPE_DEVICE_VIRT,
NWIPE_DEVICE_SAS
NWIPE_DEVICE_SAS,
NWIPE_DEVICE_MMC
} nwipe_device_t;
typedef enum nwipe_pass_t_ {
@@ -78,13 +79,17 @@ typedef struct nwipe_speedring_t_
// Arbitrary length, so far most paths don't exceed about 25 characters
#define MAX_HWMON_PATH_LENGTH 100
// 20 chracters for serial number plus null Byte
#define NWIPE_SERIALNUMBER_LENGTH 20
typedef struct nwipe_context_t_
{
/*
* Device fields
*/
int device_block_size; // The soft block size reported by the device.
int device_sector_size; // The hard sector size reported by the device.
int device_block_size; // The soft block size reported by the device, as logical
int device_sector_size; // The logical sector size reported by libparted
int device_phys_sector_size; // The physical sector size reported by libparted
int device_bus; // The device bus number.
int device_fd; // The file descriptor of the device file being wiped.
int device_host; // The host number.
@@ -97,7 +102,9 @@ typedef struct nwipe_context_t_
char device_name_without_path[100];
char gui_device_name[100];
unsigned long long device_size; // The device size in bytes.
u64 device_size_in_sectors; // The device size in sectors
u64 device_size_in_sectors; // The device size in number of logical sectors, this may be 512 or 4096 sectors
u64 device_size_in_512byte_sectors; // The device size in number of 512byte sectors, irrespective of logical sector
// size reported by libata
unsigned long long bytes_erased; // Irrespective of pass, this how much of the drive has been erased, CANNOT be
// greater than device_size.
char* device_size_text; // The device size in a more (human)readable format.
@@ -108,7 +115,8 @@ typedef struct nwipe_context_t_
nwipe_device_t device_type; // Indicates an IDE, SCSI, or Compaq SMART device in enumerated form (int)
char device_type_str[14]; // Indicates an IDE, SCSI, USB etc as per nwipe_device_t but in ascii
int device_is_ssd; // 0 = no SSD, 1 = is a SSD
char device_serial_no[21]; // Serial number(processed, 20 characters plus null termination) of the device.
char device_serial_no[NWIPE_SERIALNUMBER_LENGTH
+ 1]; // Serial number(processed, 20 characters plus null termination) of the device.
int device_target; // The device target.
u64 eta; // The estimated number of seconds until method completion.

View File

@@ -872,7 +872,7 @@ int nwipe_get_smart_data( nwipe_context_t* c )
page = pdf_append_page( pdf );
/* Create the header and footer for page 2, the start of the smart data */
snprintf( page_title, sizeof( page_title ), "Smart Data - Page %i", page_number );
snprintf( page_title, sizeof( page_title ), "Page %i - Smart Data", page_number );
create_header_and_footer( c, page_title );
/* Read the output a line at a time - output it. */
@@ -930,7 +930,7 @@ int nwipe_get_smart_data( nwipe_context_t* c )
y = 630;
/* create the header and footer for the next page */
snprintf( page_title, sizeof( page_title ), "Smart Data - Page %i", page_number );
snprintf( page_title, sizeof( page_title ), "Page %i - Smart Data", page_number );
create_header_and_footer( c, page_title );
}
}

View File

@@ -131,7 +131,7 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
int fd;
int idx;
int r;
char tmp_serial[21];
char tmp_serial[NWIPE_SERIALNUMBER_LENGTH + 1];
nwipe_device_t bus;
int is_ssd;
int check_HPA; // a flag that indicates whether we check for a HPA on this device
@@ -229,8 +229,11 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
}
next_device->device_size = dev->length * dev->sector_size;
next_device->device_sector_size = dev->sector_size;
next_device->device_sector_size = dev->sector_size; // logical sector size
next_device->device_block_size = dev->sector_size; // set as logical but could be a multiple of logical sector size
next_device->device_phys_sector_size = dev->phys_sector_size; // physical sector size
next_device->device_size_in_sectors = next_device->device_size / next_device->device_sector_size;
next_device->device_size_in_512byte_sectors = next_device->device_size / 512;
Determine_C_B_nomenclature( next_device->device_size, next_device->device_size_txt, NWIPE_DEVICE_SIZE_TXT_LENGTH );
next_device->device_size_text = next_device->device_size_txt;
next_device->result = -2;
@@ -252,7 +255,7 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
ioctl( fd, HDIO_GET_IDENTITY, &next_device->identity );
close( fd );
for( idx = 0; idx < 20; idx++ )
for( idx = 0; idx < NWIPE_SERIALNUMBER_LENGTH; idx++ )
{
if( isascii( next_device->identity.serial_no[idx] ) && !iscntrl( next_device->identity.serial_no[idx] ) )
{
@@ -280,7 +283,7 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
/* If the serial number hasn't already been populated */
if( next_device->device_serial_no[0] == 0 )
{
strcpy( next_device->device_serial_no, tmp_serial );
strncpy( next_device->device_serial_no, tmp_serial, NWIPE_SERIALNUMBER_LENGTH );
}
}
@@ -289,13 +292,16 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
{
if( next_device->device_serial_no[0] == 0 )
{
strcpy( next_device->device_serial_no, "???????????????" );
strncpy( next_device->device_serial_no, "????????????????????", NWIPE_SERIALNUMBER_LENGTH + 1 );
}
else
{
strcpy( next_device->device_serial_no, "XXXXXXXXXXXXXXX" );
strncpy( next_device->device_serial_no, "XXXXXXXXXXXXXXXXXXXX", NWIPE_SERIALNUMBER_LENGTH + 1 );
}
}
/* strncpy would have copied the null terminator BUT just to be sure, just in case somebody changes the length
* of those strings we should explicitly terminate the string */
next_device->device_serial_no[NWIPE_SERIALNUMBER_LENGTH] = 0;
/* Initialise the variables that toggle the [size][temp c] with [HPA status]
* Not currently used, but may be used in the future or for other purposes
@@ -365,6 +371,10 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
strcpy( next_device->device_type_str, " SAS" );
check_HPA = 1;
break;
case NWIPE_DEVICE_MMC:
strcpy( next_device->device_type_str, " MMC" );
break;
}
if( next_device->device_is_ssd )
{
@@ -405,6 +415,12 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
next_device->device_size_text,
next_device->device_serial_no );
nwipe_log( NWIPE_LOG_INFO,
"%s, sector(logical)/block(physical) sizes %i/%i",
next_device->device_name,
dev->sector_size,
dev->phys_sector_size );
/******************************
* Check for hidden sector_size
*/
@@ -638,6 +654,13 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, i
{
*bus = NWIPE_DEVICE_VIRT;
}
else
{
if( strstr( result, "/mmcblk" ) != 0 )
{
*bus = NWIPE_DEVICE_MMC;
}
}
}
}
}
@@ -783,7 +806,8 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, i
/* strip any leading or trailing spaces and left justify, +15 is the length of "Serial Number:" */
trim( &result[15] );
strncpy( serialnumber, &result[15], 20 );
strncpy( serialnumber, &result[15], NWIPE_SERIALNUMBER_LENGTH );
serialnumber[NWIPE_SERIALNUMBER_LENGTH] = 0;
}
if( *bus == 0 )
@@ -859,9 +883,9 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, i
if( exit_status == 1 )
{
nwipe_log( NWIPE_LOG_WARNING, "%s USB bridge, no pass-through support", device );
nwipe_log( NWIPE_LOG_WARNING, "Smartctl is unable to provide smart data for %s", device );
if( *bus == NWIPE_DEVICE_USB )
if( *bus == NWIPE_DEVICE_USB || *bus == NWIPE_DEVICE_MMC )
{
strcpy( serialnumber, "(S/N: unknown)" );
set_return_value = 5;

554
src/gui.c
View File

@@ -160,15 +160,14 @@ const char* main_window_footer_warning_no_drive_selected =
/* Oddly enough, placing extra quotes around the footer strings fixes corruption to the right
* of the footer message when the terminal is resized, a quirk in ncurses? - DO NOT REMOVE THE \" */
const char* selection_footer = "J=Down K=Up Space=Select Backspace=Cancel Ctrl+C=Quit";
const char* selection_footer_config = "J=Down K=Up Return=Select ESC|Backspace=back Ctrl+C=Quit";
const char* selection_footer_preview_prior_to_drive_selection =
"A=Accept & display drives J=Down K=Up Space=Select Backspace=Cancel Ctrl+C=Quit";
const char* selection_footer_add_customer = "S=Save J=Down K=Up Space=Select Backspace=Cancel Ctrl+C=Quit";
const char* selection_footer_add_customer_yes_no = "Save Customer Details Y/N";
const char* end_wipe_footer = "B=[Toggle between dark\\blank\\blue screen] Ctrl+C=Quit";
const char* rounds_footer = "Left=Erase Esc=Cancel Ctrl+C=Quit";
const char* selection_footer_text_entry = "Esc=Cancel Ctrl+C=Quit";
const char* wipes_finished_footer = "Wipe finished - press enter to exit. Logged to STDOUT";
const char* selection_footer_text_entry = "Esc=Cancel Return=Submit Ctrl+C=Quit";
/* The number of lines available in the terminal */
int stdscr_lines;
@@ -2496,17 +2495,17 @@ void nwipe_gui_config( void )
/* Input buffer. */
int keystroke;
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, selection_footer );
wrefresh( footer_window );
do
{
/* Clear the main window. */
werase( main_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, selection_footer_config );
wrefresh( footer_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_config );
/* Initialize the working row. */
yy = 2;
@@ -2530,19 +2529,17 @@ void nwipe_gui_config( void )
{
case 0:
mvwprintw( main_window, 2, tab2, "PDF Report - Enable/Disable" );
mvwprintw( main_window, 4, tab2, "Enable or Disable creation of the PDF " );
mvwprintw( main_window, 5, tab2, "report/certificate " );
if( nwipe_options.PDF_enable )
{
mvwprintw( main_window, 7, tab2, "Create PDF Report = ENABLED" );
mvwprintw( main_window, 2, tab2, "PDF Report = ENABLED" );
}
else
{
mvwprintw( main_window, 7, tab2, "Create PDF Report = DISABLED" );
mvwprintw( main_window, 2, tab2, "PDF Report = DISABLED" );
}
mvwprintw( main_window, 4, tab2, "Enable or Disable creation of the PDF " );
mvwprintw( main_window, 5, tab2, "report/certificate " );
break;
case 1:
@@ -2612,8 +2609,14 @@ void nwipe_gui_config( void )
case 6:
mvwprintw( main_window, 2, tab2, "PDF Report - Enable Preview at Start " );
if( nwipe_options.PDF_preview_details )
{
mvwprintw( main_window, 2, tab2, "Preview Org. & Customer at start = ENABLED" );
}
else
{
mvwprintw( main_window, 2, tab2, "Preview Org. & Customer at start = DISABLED" );
}
mvwprintw( main_window, 4, tab2, "A preview prior to the drive selection" );
mvwprintw( main_window, 5, tab2, "of the organisation that is performing" );
mvwprintw( main_window, 6, tab2, "the wipe, the customer details and the" );
@@ -2621,15 +2624,6 @@ void nwipe_gui_config( void )
mvwprintw( main_window, 8, tab2, "confirm that the information is " );
mvwprintw( main_window, 9, tab2, "correct on the pdf report prior to " );
mvwprintw( main_window, 10, tab2, "drive selection and starting the erase" );
if( nwipe_options.PDF_preview_details )
{
mvwprintw( main_window, 12, tab2, "Preview at start = ENABLED" );
}
else
{
mvwprintw( main_window, 12, tab2, "Preview at start = DISABLED" );
}
break;
case 8:
@@ -2774,7 +2768,7 @@ void nwipe_gui_config( void )
keystroke = -1;
}
} while( keystroke != KEY_ENTER && keystroke != ' ' && keystroke != 10 && terminate_signal != 1 );
} while( keystroke != KEY_ENTER && /* keystroke != ' ' && */ keystroke != 10 && terminate_signal != 1 );
} /* end of nwipe_config() */
@@ -2810,11 +2804,6 @@ void nwipe_gui_edit_organisation( void )
const char *business_name, *business_address, *contact_name, *contact_phone, *op_tech_name;
extern config_t nwipe_cfg;
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, selection_footer );
wrefresh( footer_window );
do
{
do
@@ -2822,7 +2811,12 @@ void nwipe_gui_edit_organisation( void )
/* Clear the main window. */
werase( main_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, selection_footer_config );
wrefresh( footer_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_config );
/* Initialize the working row. */
yy = 2;
@@ -2941,7 +2935,7 @@ void nwipe_gui_edit_organisation( void )
} /* switch */
} while( keystroke != KEY_ENTER && keystroke != ' ' && keystroke != 10 && terminate_signal != 1 );
} while( keystroke != KEY_ENTER && keystroke != 10 && terminate_signal != 1 );
if( keystroke == KEY_ENTER || keystroke == 10 || keystroke == ' ' )
{
@@ -2974,7 +2968,7 @@ void nwipe_gui_edit_organisation( void )
}
}
} while( keystroke != KEY_ENTER && keystroke != ' ' && keystroke != 10 && terminate_signal != 1 );
} while( keystroke != KEY_ENTER && keystroke != 10 && terminate_signal != 1 );
} /* end of nwipe_gui_edit_organisation( void ) */
@@ -3013,7 +3007,7 @@ void nwipe_gui_organisation_business_name( const char* business_name )
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, rounds_footer );
nwipe_gui_title( footer_window, selection_footer_text_entry );
wrefresh( footer_window );
/* Copy the current business name to the buffer */
@@ -3027,7 +3021,7 @@ void nwipe_gui_organisation_business_name( const char* business_name )
/* Erase the main window. */
werase( main_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_text_entry );
/* Add a border. */
box( main_window, 0, 0 );
@@ -3153,7 +3147,7 @@ void nwipe_gui_organisation_business_address( const char* business_address )
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, rounds_footer );
nwipe_gui_title( footer_window, selection_footer_text_entry );
wrefresh( footer_window );
/* Copy the current business address to the buffer */
@@ -3167,7 +3161,7 @@ void nwipe_gui_organisation_business_address( const char* business_address )
/* Erase the main window. */
werase( main_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_text_entry );
/* Add a border. */
box( main_window, 0, 0 );
@@ -3294,7 +3288,7 @@ void nwipe_gui_organisation_contact_name( const char* contact_name )
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, rounds_footer );
nwipe_gui_title( footer_window, selection_footer_text_entry );
wrefresh( footer_window );
/* Copy the current business address to the buffer */
@@ -3308,7 +3302,7 @@ void nwipe_gui_organisation_contact_name( const char* contact_name )
/* Erase the main window. */
werase( main_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_text_entry );
/* Add a border. */
box( main_window, 0, 0 );
@@ -3434,7 +3428,7 @@ void nwipe_gui_organisation_contact_phone( const char* contact_phone )
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, rounds_footer );
nwipe_gui_title( footer_window, selection_footer_text_entry );
wrefresh( footer_window );
/* Copy the current business address to the buffer */
@@ -3448,7 +3442,7 @@ void nwipe_gui_organisation_contact_phone( const char* contact_phone )
/* Erase the main window. */
werase( main_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_text_entry );
/* Add a border. */
box( main_window, 0, 0 );
@@ -3574,7 +3568,7 @@ void nwipe_gui_organisation_op_tech_name( const char* op_tech_name )
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, rounds_footer );
nwipe_gui_title( footer_window, selection_footer_text_entry );
wrefresh( footer_window );
/* Copy the current op_tech_name to the buffer */
@@ -3588,7 +3582,7 @@ void nwipe_gui_organisation_op_tech_name( const char* op_tech_name )
/* Erase the main window. */
werase( main_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_text_entry );
/* Add a border. */
box( main_window, 0, 0 );
@@ -4094,7 +4088,7 @@ void nwipe_gui_add_customer( void )
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, selection_footer_add_customer );
nwipe_gui_title( footer_window, selection_footer_config );
wrefresh( footer_window );
do
@@ -4118,10 +4112,10 @@ void nwipe_gui_add_customer( void )
{
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, selection_footer_add_customer );
nwipe_gui_title( footer_window, selection_footer_config );
wrefresh( footer_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_add_customer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_config );
}
/* Initialize the working row. */
yy = 2;
@@ -4221,10 +4215,10 @@ void nwipe_gui_add_customer( void )
}
}
} while( save != YES && keystroke != 's' && keystroke != KEY_ENTER && keystroke != ' ' && keystroke != 10
} while( save != YES && keystroke != 's' && keystroke != KEY_ENTER && keystroke != 10
&& terminate_signal != 1 );
if( keystroke == KEY_ENTER || keystroke == 10 || keystroke == ' ' )
if( keystroke == KEY_ENTER || keystroke == 10 )
{
switch( focus )
{
@@ -4730,18 +4724,6 @@ void nwipe_gui_preview_org_customer( int mode )
const char *customer_name, *customer_address, *customer_contact_name, *customer_contact_phone;
extern config_t nwipe_cfg;
/* Update the footer window. */
werase( footer_window );
if( mode == SHOWING_IN_CONFIG_MENUS )
{
nwipe_gui_title( footer_window, selection_footer );
}
else
{
nwipe_gui_title( footer_window, selection_footer_preview_prior_to_drive_selection );
}
wrefresh( footer_window );
do
{
do
@@ -4749,14 +4731,19 @@ void nwipe_gui_preview_org_customer( int mode )
/* Clear the main window. */
werase( main_window );
/* Update the footer window. */
werase( footer_window );
if( mode == SHOWING_IN_CONFIG_MENUS )
{
nwipe_gui_title( footer_window, selection_footer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
}
else
{
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_preview_prior_to_drive_selection );
nwipe_gui_title( footer_window, selection_footer_preview_prior_to_drive_selection );
}
wrefresh( footer_window );
/* Determine size of window */
getmaxyx( main_window, wlines, wcols );
@@ -5070,7 +5057,7 @@ void nwipe_gui_set_date_time( void )
/* Update the footer window. */
werase( footer_window );
nwipe_gui_title( footer_window, selection_footer );
nwipe_gui_title( footer_window, selection_footer_config );
wrefresh( footer_window );
do
@@ -5080,7 +5067,7 @@ void nwipe_gui_set_date_time( void )
/* Clear the main window. */
werase( main_window );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, selection_footer_config );
/* Determine size of window */
getmaxyx( main_window, wlines, wcols );
@@ -6078,6 +6065,53 @@ void* nwipe_gui_status( void* ptr )
/* Spinner character */
char spinner_string[2];
/* Create the finish message, this changes based on whether PDF creation is enabled
* and whether a logfile has been specified
*/
char finish_message[NWIPE_GUI_FOOTER_W + 132];
if( nwipe_options.logfile[0] == 0 && nwipe_options.PDF_enable != 0 )
{
snprintf( finish_message,
sizeof( finish_message ),
"Wipe finished - press enter to create pdfs & exit. Logged to STDOUT" );
}
else
{
if( nwipe_options.logfile[0] != 0 && nwipe_options.PDF_enable != 0 )
{
snprintf( finish_message,
sizeof( finish_message ),
"Wipe finished - press enter to create pdfs & exit. Logged to %s",
nwipe_options.logfile );
}
else
{
if( nwipe_options.logfile[0] != 0 && nwipe_options.PDF_enable == 0 )
{
snprintf( finish_message,
sizeof( finish_message ),
"Wipe finished - press enter to exit (pdfs disabled in config). Logged to %s",
nwipe_options.logfile );
}
else
{
if( nwipe_options.logfile[0] == 0 && nwipe_options.PDF_enable == 0 )
{
snprintf( finish_message,
sizeof( finish_message ),
"Wipe finished - press enter to exit (pdfs disabled in config). Logged to STDOUT" );
}
else
{
/* This is a catch all something unexpected happens with the above logic */
snprintf( finish_message,
sizeof( finish_message ),
"Wipe finished - press enter to exit. Logged to STDOUT" );
}
}
}
}
/* We count time from when this function is first called. */
static time_t nwipe_time_start = 0;
@@ -6235,7 +6269,7 @@ void* nwipe_gui_status( void* ptr )
else
{
/* and if the wipes have finished a different footer is required */
nwipe_gui_create_all_windows_on_terminal_resize( 0, wipes_finished_footer );
nwipe_gui_create_all_windows_on_terminal_resize( 0, finish_message );
}
}
@@ -6253,7 +6287,7 @@ void* nwipe_gui_status( void* ptr )
if( nwipe_active == 0 || terminate_signal == 1 )
{
nwipe_gui_title( footer_window, wipes_finished_footer );
nwipe_gui_title( footer_window, finish_message );
// Refresh the footer_window ;
wnoutrefresh( footer_window );
@@ -6395,250 +6429,248 @@ void* nwipe_gui_status( void* ptr )
}
/* Update data in statistics & main windows only if we're in 'gui' mode and only if a wipe has started */
if( nwipe_gui_blank == 0 && global_wipe_status == 1 )
if( global_wipe_status == 1 )
{
/* Always run compute_stats() as we need to whether any threads are still active */
if( terminate_signal != 1 )
{
nwipe_active = compute_stats( ptr ); // Returns number of active wipe threads
}
/* Print information for the user. */
for( i = offset; i < offset + slots && i < count; i++ )
/* Only print the stats if the user hasn't blanked the screen */
if( nwipe_gui_blank == 0 )
{
/* Print the device details. */
mvwprintw( main_window,
yy++,
2,
"%s %s [%s] ",
c[i]->device_name,
c[i]->device_type_str,
c[i]->device_size_text );
wprintw_temperature( c[i] );
wprintw( main_window, "%s/%s", c[i]->device_model, c[i]->device_serial_no );
/* Check whether the child process is still running the wipe. */
if( c[i]->wipe_status == 1 )
/* Print information for the user. */
for( i = offset; i < offset + slots && i < count; i++ )
{
/* Print percentage and pass information. */
/* Print the device details. */
mvwprintw( main_window,
yy++,
4,
"[%5.2f%%, round %i of %i, pass %i of %i] ",
c[i]->round_percent,
c[i]->round_working,
c[i]->round_count,
c[i]->pass_working,
c[i]->pass_count );
2,
"%s %s [%s] ",
c[i]->device_name,
c[i]->device_type_str,
c[i]->device_size_text );
wprintw_temperature( c[i] );
wprintw( main_window, " %s/%s", c[i]->device_model, c[i]->device_serial_no );
} /* child running */
else
{
if( c[i]->result == 0 )
/* Check whether the child process is still running the wipe. */
if( c[i]->wipe_status == 1 )
{
mvwprintw( main_window, yy++, 4, "[%05.2f%% complete, SUCCESS! ", c[i]->round_percent );
/* Print percentage and pass information. */
mvwprintw( main_window,
yy++,
4,
"[%5.2f%%, round %i of %i, pass %i of %i] ",
c[i]->round_percent,
c[i]->round_working,
c[i]->round_count,
c[i]->pass_working,
c[i]->pass_count );
} /* child running */
else
{
if( c[i]->result == 0 )
{
mvwprintw( main_window, yy++, 4, "[%05.2f%% complete, SUCCESS! ", c[i]->round_percent );
}
else if( c[i]->signal )
{
wattron( main_window, COLOR_PAIR( 9 ) );
mvwprintw( main_window, yy++, 4, "(>>> FAILURE! <<<, signal %i) ", c[i]->signal );
wattroff( main_window, COLOR_PAIR( 9 ) );
}
else
{
wattron( main_window, COLOR_PAIR( 9 ) );
mvwprintw( main_window, yy++, 4, "(>>> IOERROR! <<<, code %i) ", c[i]->result );
wattroff( main_window, COLOR_PAIR( 9 ) );
}
} /* child returned */
if( c[i]->verify_errors )
{
wprintw( main_window, "[verr:%llu] ", c[i]->verify_errors );
}
else if( c[i]->signal )
if( c[i]->pass_errors )
{
wattron( main_window, COLOR_PAIR( 9 ) );
mvwprintw( main_window, yy++, 4, "(>>> FAILURE! <<<, signal %i) ", c[i]->signal );
wattroff( main_window, COLOR_PAIR( 9 ) );
wprintw( main_window, "[perr:%llu] ", c[i]->pass_errors );
}
if( c[i]->wipe_status == 1 )
{
switch( c[i]->pass_type )
{
/* Each text field in square brackets should be the same number of characters
* to retain output in columns */
case NWIPE_PASS_FINAL_BLANK:
if( !c[i]->sync_status )
{
wprintw( main_window, "[ blanking] " );
}
break;
case NWIPE_PASS_FINAL_OPS2:
if( !c[i]->sync_status )
{
wprintw( main_window, "[OPS2final] " );
}
break;
case NWIPE_PASS_WRITE:
if( !c[i]->sync_status )
{
wprintw( main_window, "[ writing ] " );
}
break;
case NWIPE_PASS_VERIFY:
if( !c[i]->sync_status )
{
wprintw( main_window, "[verifying] " );
}
break;
case NWIPE_PASS_NONE:
break;
}
if( c[i]->sync_status )
{
wprintw( main_window, "[ syncing ] " );
}
}
/* Determine throughput nomenclature for this drive and output drives throughput to GUI */
Determine_C_B_nomenclature(
c[i]->throughput, nomenclature_result_str, NOMENCLATURE_RESULT_STR_SIZE );
wprintw( main_window, "[%s/s] ", nomenclature_result_str );
/* Insert whitespace. */
yy += 1;
/* Increment the next spinner character for this context if the thread is active */
if( c[i]->wipe_status == 1 )
{
spinner( c, i );
spinner_string[0] = c[i]->spinner_character[0];
}
else
{
wattron( main_window, COLOR_PAIR( 9 ) );
mvwprintw( main_window, yy++, 4, "(>>> IOERROR! <<<, code %i) ", c[i]->result );
wattroff( main_window, COLOR_PAIR( 9 ) );
}
} /* child returned */
if( c[i]->verify_errors )
{
wprintw( main_window, "[verr:%llu] ", c[i]->verify_errors );
}
if( c[i]->pass_errors )
{
wprintw( main_window, "[perr:%llu] ", c[i]->pass_errors );
}
if( c[i]->wipe_status == 1 )
{
switch( c[i]->pass_type )
{
/* Each text field in square brackets should be the same number of characters
* to retain output in columns */
case NWIPE_PASS_FINAL_BLANK:
if( !c[i]->sync_status )
{
wprintw( main_window, "[ blanking] " );
}
break;
case NWIPE_PASS_FINAL_OPS2:
if( !c[i]->sync_status )
{
wprintw( main_window, "[OPS2final] " );
}
break;
case NWIPE_PASS_WRITE:
if( !c[i]->sync_status )
{
wprintw( main_window, "[ writing ] " );
}
break;
case NWIPE_PASS_VERIFY:
if( !c[i]->sync_status )
{
wprintw( main_window, "[verifying] " );
}
break;
case NWIPE_PASS_NONE:
break;
}
if( c[i]->sync_status )
{
wprintw( main_window, "[ syncing ] " );
/* If the wipe thread is no longer active, replace the spinner with a space */
spinner_string[0] = ' ';
}
spinner_string[1] = 0;
wprintw( main_window, " %s ", spinner_string );
}
/* Determine throughput nomenclature for this drive and output drives throughput to GUI */
Determine_C_B_nomenclature( c[i]->throughput, nomenclature_result_str, NOMENCLATURE_RESULT_STR_SIZE );
wprintw( main_window, "[%s/s] ", nomenclature_result_str );
/* Insert whitespace. */
yy += 1;
/* Increment the next spinner character for this context if the thread is active */
if( c[i]->wipe_status == 1 )
if( offset > 0 )
{
spinner( c, i );
spinner_string[0] = c[i]->spinner_character[0];
mvwprintw( main_window, 1, wcols - 8, " More " );
waddch( main_window, ACS_UARROW );
}
else
if( count - offset > slots )
{
/* If the wipe thread is no longer active, replace the spinner with a space */
spinner_string[0] = ' ';
mvwprintw( main_window, wlines - 2, wcols - 8, " More " );
waddch( main_window, ACS_DARROW );
}
spinner_string[1] = 0;
wprintw( main_window, " %s ", spinner_string );
}
if( offset > 0 )
{
mvwprintw( main_window, 1, wcols - 8, " More " );
waddch( main_window, ACS_UARROW );
}
/* Box the main window. */
box( main_window, 0, 0 );
if( count - offset > slots )
{
mvwprintw( main_window, wlines - 2, wcols - 8, " More " );
waddch( main_window, ACS_DARROW );
}
/* Refresh the main window. */
wnoutrefresh( main_window );
/* Box the main window. */
box( main_window, 0, 0 );
/* Update the load average field, but only if we are still wiping */
if( nwipe_active && terminate_signal != 1 )
{
nwipe_gui_load();
}
/* Refresh the main window. */
wnoutrefresh( main_window );
nwipe_throughput = nwipe_misc_thread_data->throughput;
/* Update the load average field, but only if we are still wiping */
if( nwipe_active && terminate_signal != 1 )
{
nwipe_gui_load();
}
/* Determine the nomenclature for the combined throughput */
Determine_C_B_nomenclature( nwipe_throughput, nomenclature_result_str, NOMENCLATURE_RESULT_STR_SIZE );
nwipe_throughput = nwipe_misc_thread_data->throughput;
/* Print the combined throughput. */
mvwprintw( stats_window, NWIPE_GUI_STATS_THROUGHPUT_Y, NWIPE_GUI_STATS_THROUGHPUT_X, "Throughput:" );
/* Determine the nomenclature for the combined throughput */
Determine_C_B_nomenclature( nwipe_throughput, nomenclature_result_str, NOMENCLATURE_RESULT_STR_SIZE );
mvwprintw(
stats_window, NWIPE_GUI_STATS_THROUGHPUT_Y, NWIPE_GUI_STATS_TAB, "%s/s", nomenclature_result_str );
/* Print the combined throughput. */
mvwprintw( stats_window, NWIPE_GUI_STATS_THROUGHPUT_Y, NWIPE_GUI_STATS_THROUGHPUT_X, "Throughput:" );
/* Change the current time into a delta. */
nwipe_time_now -= nwipe_time_start;
mvwprintw(
stats_window, NWIPE_GUI_STATS_THROUGHPUT_Y, NWIPE_GUI_STATS_TAB, "%s/s", nomenclature_result_str );
/* Put the delta into HH:mm:ss form. */
nwipe_hh = nwipe_time_now / 3600;
nwipe_time_now %= 3600;
nwipe_mm = nwipe_time_now / 60;
nwipe_time_now %= 60;
nwipe_ss = nwipe_time_now;
/* Change the current time into a delta. */
nwipe_time_now -= nwipe_time_start;
/* Put the delta into HH:mm:ss form. */
nwipe_hh = nwipe_time_now / 3600;
nwipe_time_now %= 3600;
nwipe_mm = nwipe_time_now / 60;
nwipe_time_now %= 60;
nwipe_ss = nwipe_time_now;
/* Print the runtime. */
mvwprintw( stats_window, NWIPE_GUI_STATS_RUNTIME_Y, 1, "Runtime:" );
mvwprintw( stats_window,
NWIPE_GUI_STATS_RUNTIME_Y,
NWIPE_GUI_STATS_TAB,
"%02i:%02i:%02i",
nwipe_hh,
nwipe_mm,
nwipe_ss );
mvwprintw( stats_window, NWIPE_GUI_STATS_ETA_Y, 1, "Remaining:" );
time_t nwipe_maxeta = nwipe_misc_thread_data->maxeta;
if( nwipe_maxeta > 0 )
{
/* Do it again for the estimated runtime remaining. */
nwipe_hh = nwipe_maxeta / 3600;
nwipe_maxeta %= 3600;
nwipe_mm = nwipe_maxeta / 60;
nwipe_maxeta %= 60;
nwipe_ss = nwipe_maxeta;
/* Print the estimated runtime remaining. */
/* Print the runtime. */
mvwprintw( stats_window, NWIPE_GUI_STATS_RUNTIME_Y, 1, "Runtime:" );
mvwprintw( stats_window,
NWIPE_GUI_STATS_ETA_Y,
NWIPE_GUI_STATS_RUNTIME_Y,
NWIPE_GUI_STATS_TAB,
"%02i:%02i:%02i",
nwipe_hh,
nwipe_mm,
nwipe_ss );
}
/* Print the error count. */
mvwprintw( stats_window, NWIPE_GUI_STATS_ERRORS_Y, NWIPE_GUI_STATS_ERRORS_X, "Errors:" );
mvwprintw(
stats_window, NWIPE_GUI_STATS_ERRORS_Y, NWIPE_GUI_STATS_TAB, " %llu", nwipe_misc_thread_data->errors );
mvwprintw( stats_window, NWIPE_GUI_STATS_ETA_Y, 1, "Remaining:" );
/* Add a border. */
box( stats_window, 0, 0 );
time_t nwipe_maxeta = nwipe_misc_thread_data->maxeta;
if( nwipe_maxeta > 0 )
{
/* Do it again for the estimated runtime remaining. */
nwipe_hh = nwipe_maxeta / 3600;
nwipe_maxeta %= 3600;
nwipe_mm = nwipe_maxeta / 60;
nwipe_maxeta %= 60;
nwipe_ss = nwipe_maxeta;
/* Add a title. */
mvwprintw( stats_window, 0, ( NWIPE_GUI_STATS_W - strlen( stats_title ) ) / 2, "%s", stats_title );
/* Print the estimated runtime remaining. */
mvwprintw( stats_window,
NWIPE_GUI_STATS_ETA_Y,
NWIPE_GUI_STATS_TAB,
"%02i:%02i:%02i",
nwipe_hh,
nwipe_mm,
nwipe_ss );
}
/* Refresh internal representation of stats window */
wnoutrefresh( stats_window );
/* Print the error count. */
mvwprintw( stats_window, NWIPE_GUI_STATS_ERRORS_Y, NWIPE_GUI_STATS_ERRORS_X, "Errors:" );
mvwprintw( stats_window,
NWIPE_GUI_STATS_ERRORS_Y,
NWIPE_GUI_STATS_TAB,
" %llu",
nwipe_misc_thread_data->errors );
/* Output all windows to screen */
doupdate();
/* Add a border. */
box( stats_window, 0, 0 );
} // end blank screen if
/* Add a title. */
mvwprintw( stats_window, 0, ( NWIPE_GUI_STATS_W - strlen( stats_title ) ) / 2, "%s", stats_title );
/* Refresh internal representation of stats window */
wnoutrefresh( stats_window );
/* Output all windows to screen */
doupdate();
} // end blank screen if
} // end wipes have started if
} /* End of while loop */
if( nwipe_options.logfile[0] == '\0' )
{
nwipe_gui_title( footer_window, wipes_finished_footer );
}
else
{
char finish_message[NWIPE_GUI_FOOTER_W];
snprintf( finish_message,
sizeof( finish_message ),
"Wipe finished - press enter to exit. Logged to %s",
nwipe_options.logfile );
nwipe_gui_title( footer_window, finish_message );
}
nwipe_gui_title( footer_window, finish_message );
terminate_signal = 1;
return NULL;

View File

@@ -464,10 +464,13 @@ int hpa_dco_status( nwipe_context_t* ptr )
nwipe_log( NWIPE_LOG_INFO, "DCO Real max sectors not found" );
}
nwipe_log( NWIPE_LOG_INFO,
"libata: apparent max sectors reported as %lli on %s",
c->device_size_in_sectors,
c->device_name );
nwipe_log(
NWIPE_LOG_INFO,
"libata: apparent max sectors reported as %lli with sector size as %i/%i (logical/physical) on %s",
c->device_size_in_sectors,
c->device_sector_size, // logical
c->device_phys_sector_size, // physical
c->device_name );
/* close */
r = pclose( fp );
@@ -553,8 +556,8 @@ int hpa_dco_status( nwipe_context_t* ptr )
#endif
/* If any of the HPA or DCO values are larger than the apparent size then HPA is enabled. */
if( /*c->HPA_reported_set > c->device_size_in_sectors || */ c->HPA_reported_real > c->device_size_in_sectors
|| c->DCO_reported_real_max_sectors > c->device_size_in_sectors )
if( /*c->HPA_reported_set > c->device_size_in_sectors || */ c->HPA_reported_real > c->device_size_in_512byte_sectors
|| c->DCO_reported_real_max_sectors > c->device_size_in_512byte_sectors )
{
c->HPA_status = HPA_ENABLED;
nwipe_log( NWIPE_LOG_WARNING, " *********************************" );
@@ -602,7 +605,7 @@ int hpa_dco_status( nwipe_context_t* ptr )
/* If the DCO is reporting a real max sectors > the apparent size
* as reported by libata then that is what we will use as the real disc size
*/
if( c->DCO_reported_real_max_size > c->device_size_in_sectors )
if( c->DCO_reported_real_max_size > c->device_size_in_512byte_sectors )
{
c->Calculated_real_max_size_in_bytes = c->DCO_reported_real_max_sectors * c->device_sector_size;
}
@@ -612,13 +615,13 @@ int hpa_dco_status( nwipe_context_t* ptr )
* is the value we need, however if that is zero, then c->HPA_reported_set and if that is zero then
* c->device_size as reported by libata
*/
if( c->HPA_reported_real > c->device_size_in_sectors )
if( c->HPA_reported_real > c->device_size_in_512byte_sectors )
{
c->Calculated_real_max_size_in_bytes = c->HPA_reported_real * c->device_sector_size;
}
else
{
if( c->HPA_reported_set > c->device_size_in_sectors )
if( c->HPA_reported_set > c->device_size_in_512byte_sectors )
{
c->Calculated_real_max_size_in_bytes = c->HPA_reported_set * c->device_sector_size;
}
@@ -674,6 +677,7 @@ int hpa_dco_status( nwipe_context_t* ptr )
"c->DCO_reported_real_max_size=%lli, c->DCO_reported_real_max_sectors=%lli, c->HPA_sectors=%lli, "
"c->HPA_reported_set=%lli, c->HPA_reported_real=%lli, c->device_type=%i, "
"libata:c->device_size_in_sectors=%lli ",
"libata:c->device_size_in_512byte_sectors=%lli ",
c->Calculated_real_max_size_in_bytes,
c->device_size,
c->device_sector_size,
@@ -683,7 +687,8 @@ int hpa_dco_status( nwipe_context_t* ptr )
c->HPA_reported_set,
c->HPA_reported_real,
c->device_type,
c->device_size_in_sectors );
c->device_size_in_sectors,
c->device_size_in_512byte_sectors );
return set_return_value;
}

View File

@@ -666,7 +666,7 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
// char duration[5];
char duration[314];
char model[18];
char serial_no[20];
char serial_no[NWIPE_SERIALNUMBER_LENGTH + 1];
char exclamation_flag[2];
int hours;
int minutes;
@@ -875,7 +875,8 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
model[17] = 0;
/* Serial No. */
strncpy( serial_no, c[i]->device_serial_no, 20 );
strncpy( serial_no, c[i]->device_serial_no, NWIPE_SERIALNUMBER_LENGTH );
serial_no[NWIPE_SERIALNUMBER_LENGTH] = 0;
model[17] = 0;
nwipe_log( NWIPE_LOG_NOTIMESTAMP,
@@ -891,7 +892,8 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
serial_no );
/* Create the PDF report/certificate */
if( strcmp( nwipe_options.PDFreportpath, "noPDF" ) != 0 )
if( nwipe_options.PDF_enable == 1 )
// if( strcmp( nwipe_options.PDFreportpath, "noPDF" ) != 0 )
{
/* to have some progress indication. can help if there are many/slow disks */
fprintf( stderr, "." );

View File

@@ -542,7 +542,8 @@ int main( int argc, char** argv )
nwipe_log( NWIPE_LOG_NOTICE, "%s has serial number %s", c2[i]->device_name, c2[i]->device_serial_no );
}
/* Do sector size and block size checking. */
/* Do sector size and block size checking. I don't think this does anything useful as logical/Physical
* sector sizes are obtained by libparted in check.c */
if( ioctl( c2[i]->device_fd, BLKSSZGET, &c2[i]->device_sector_size ) == 0 )
{
@@ -737,32 +738,6 @@ int main( int argc, char** argv )
}
}
/* Kill the temperature update thread */
if( nwipe_temperature_thread )
{
if( nwipe_options.verbose )
{
nwipe_log( NWIPE_LOG_INFO, "Cancelling the temperature thread." );
}
/* We don't want to use pthread_cancel as our temperature thread is aware of the control-c
* signal and will exit itself we just join the temperature thread and wait for confirmation
*/
r = pthread_join( nwipe_temperature_thread, NULL );
if( r != 0 )
{
nwipe_log( NWIPE_LOG_WARNING,
"main()>pthread_join():Error when waiting for temperature thread to cancel." );
}
else
{
if( nwipe_options.verbose )
{
nwipe_log( NWIPE_LOG_INFO, "temperature thread has been cancelled" );
}
}
}
/* Release the gui. */
if( !nwipe_options.nogui )
{
@@ -839,6 +814,42 @@ int main( int argc, char** argv )
thread_timeout_counter--;
sleep( 1 );
}
/* Now all the wipe threads have finished, we can issue a terminate_signal = 1
* which will cause the temperature update thread to terminate, this is necessary
* because in gui mode the terminate_signal is set when the user presses a key to
* exit on completion of all the wipes, however in non gui mode that code isn't
* active (being in the gui section) so here we need to set the terminate signal
* specifically for a completed wipes/s just for non gui mode.
*/
terminate_signal = 1;
/* Kill the temperature update thread */
if( nwipe_temperature_thread )
{
if( nwipe_options.verbose )
{
nwipe_log( NWIPE_LOG_INFO, "Cancelling the temperature thread." );
}
/* We don't want to use pthread_cancel as our temperature thread is aware of the control-c
* signal and will exit itself we just join the temperature thread and wait for confirmation
*/
r = pthread_join( nwipe_temperature_thread, NULL );
if( r != 0 )
{
nwipe_log( NWIPE_LOG_WARNING,
"main()>pthread_join():Error when waiting for temperature thread to cancel." );
}
else
{
if( nwipe_options.verbose )
{
nwipe_log( NWIPE_LOG_INFO, "temperature thread has been cancelled" );
}
}
}
if( nwipe_options.verbose )
{
for( i = 0; i < nwipe_selected; i++ )

View File

@@ -398,6 +398,23 @@ int nwipe_options_parse( int argc, char** argv )
nwipe_options.PDFreportpath[strlen( optarg )] = '\0';
strncpy( nwipe_options.PDFreportpath, optarg, sizeof( nwipe_options.PDFreportpath ) );
/* Command line options will override what's in nwipe.conf */
if( strcmp( nwipe_options.PDFreportpath, "noPDF" ) == 0 )
{
nwipe_options.PDF_enable = 0;
nwipe_conf_update_setting( "PDF_Certificate.PDF_Enable", "DISABLED" );
}
else
{
if( strcmp( nwipe_options.PDFreportpath, "." ) )
{
/* and if the user has specified a PDF path then enable PDF */
nwipe_options.PDF_enable = 1;
nwipe_conf_update_setting( "PDF_Certificate.PDF_Enable", "ENABLED" );
}
}
break;
case 'e': /* exclude drives option */

View File

@@ -4,14 +4,14 @@
* used by configure to dynamically assign those values
* to documentation files.
*/
const char* version_string = "0.35";
const char* version_string = "0.36";
const char* program_name = "nwipe";
const char* author_name = "Martijn van Brummelen";
const char* email_address = "git@brumit.nl";
const char* years = "2023";
const char* years = "2024";
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.35";
const char* banner = "nwipe 0.36";