Merge pull request #463 from PartialVolume/HPA_DCO_011

HPA_DCO_011 Continuation of HPA/DCO integration.
This commit is contained in:
PartialVolume
2023-04-05 22:58:02 +01:00
committed by GitHub
2 changed files with 32 additions and 16 deletions

View File

@@ -533,38 +533,54 @@ int hpa_dco_status( nwipe_context_t* ptr )
}
else
{
if( c->HPA_reported_set == c->HPA_reported_real && c->DCO_reported_real_max_sectors == 0 )
if( c->DCO_reported_real_max_sectors > 0 && c->DCO_reported_real_max_sectors == ( c->device_size / 512 ) )
{
c->HPA_status = HPA_NOT_APPLICABLE;
c->HPA_status = HPA_DISABLED;
}
else
{
if( c->HPA_reported_set != c->DCO_reported_real_max_sectors && c->HPA_reported_set != 0 )
if( c->DCO_reported_real_max_sectors > 0
&& c->DCO_reported_real_max_sectors != ( c->device_size / 512 ) )
{
c->HPA_status = HPA_ENABLED;
}
else
{
/* This occurs when a SG_IO error occurs with USB devices that don't support ATA pass through */
if( c->HPA_reported_set == 0 && c->HPA_reported_real == 1 )
if( c->HPA_reported_set == c->HPA_reported_real && c->DCO_reported_real_max_sectors == 0 )
{
c->HPA_status = HPA_UNKNOWN;
c->HPA_status = HPA_NOT_APPLICABLE;
}
else
{
/* NVMe drives don't support HPA/DCO */
if( c->device_type == NWIPE_DEVICE_NVME || c->device_type == NWIPE_DEVICE_VIRT
|| ( c->HPA_reported_set > 1 && c->DCO_reported_real_max_sectors < 2 ) )
if( c->HPA_reported_set != c->DCO_reported_real_max_sectors && c->HPA_reported_set != 0 )
{
c->HPA_status = HPA_NOT_APPLICABLE;
c->HPA_status = HPA_ENABLED;
}
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 )
/* This occurs when a SG_IO error occurs with USB devices that don't support ATA pass
* through */
if( c->HPA_reported_set == 0 && c->HPA_reported_real == 1 )
{
c->HPA_status = HPA_NOT_APPLICABLE;
c->HPA_status = HPA_UNKNOWN;
}
else
{
/* NVMe drives don't support HPA/DCO */
if( c->device_type == NWIPE_DEVICE_NVME || c->device_type == NWIPE_DEVICE_VIRT
|| ( 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;
}
}
}
}
}

View File

@@ -4,7 +4,7 @@
* used by configure to dynamically assign those values
* to documentation files.
*/
const char* version_string = "0.34.83 Development code, not for production use!";
const char* version_string = "0.34.84 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 <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.34.83 Development code, not for production use!";
const char* banner = "nwipe 0.34.84 Development code, not for production use!";