summaryrefslogtreecommitdiffstats
path: root/src/hpa_dco.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-03-05 18:59:26 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2011-03-05 18:59:26 +0100
commit1554ea46e8846a4e9e061aa992be36764a6d1117 (patch)
tree9bbc4bd9e827116a77469a8dbf292cb8da782121 /src/hpa_dco.c
parent0718628ebaf1d05961aa804a91a0ecc4cd27a010 (diff)
Fix for HPA and DCO detection (again)
Diffstat (limited to 'src/hpa_dco.c')
-rw-r--r--src/hpa_dco.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/hpa_dco.c b/src/hpa_dco.c
index c679757..61d4804 100644
--- a/src/hpa_dco.c
+++ b/src/hpa_dco.c
@@ -327,10 +327,13 @@ void disk_get_hpa_dco(const int fd, disk_t *disk)
disk->user_max = (uint64_t) id_val[61] << 16 | id_val[60];
}
disk->dco=sg_device_configuration_identify(fd);
- if((flags & DISK_HAS_48_SUPPORT)!=0)
- disk->native_max=sg_read_native_max_ext(fd);
- else
- disk->native_max=read_native_max(fd);
+ if(flags & DISK_HAS_HPA_SUPPORT)
+ {
+ if((flags & DISK_HAS_48_SUPPORT)!=0)
+ disk->native_max=sg_read_native_max_ext(fd);
+ else
+ disk->native_max=read_native_max(fd);
+ }
if(disk->sector_size!=0)
log_info("%s: size %llu sectors\n", disk->device, (long long unsigned)(disk->disk_real_size/disk->sector_size));
if(disk->user_max!=0)
@@ -341,6 +344,7 @@ void disk_get_hpa_dco(const int fd, disk_t *disk)
log_info("%s: dco %llu sectors\n", disk->device, (long long unsigned)(disk->dco+1));
#endif
}
+
#else
void disk_get_hpa_dco(const int fd, disk_t *disk)
{