summaryrefslogtreecommitdiffstats
path: root/src/hdaccess.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-08-09 13:03:40 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2012-08-09 13:03:40 +0200
commit5c5f3c68450732370248085178dfde00d3688983 (patch)
treea9dcb6fcdef57230eb10c55f1be7a5fef9436634 /src/hdaccess.c
parenta904c5a049d9a8b31ac1707c1563b881b9e67006 (diff)
List the number of sectors when head per cylinder and sector per head are 1
TestDisk: Display the sector size
Diffstat (limited to 'src/hdaccess.c')
-rw-r--r--src/hdaccess.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/hdaccess.c b/src/hdaccess.c
index 0f84267..7b0c6a3 100644
--- a/src/hdaccess.c
+++ b/src/hdaccess.c
@@ -149,8 +149,6 @@ struct info_file_struct
};
static void autoset_geometry(disk_t * disk_car, const unsigned char *buffer, const int verbose);
-static const char *file_description(disk_t *disk_car);
-static const char *file_description_short(disk_t *disk_car);
static int file_clean(disk_t *disk_car);
static int file_pread(disk_t *disk_car, void *buf, const unsigned int count, const uint64_t offset);
static void *file_pread_fast(disk_t *disk, void *buf, const unsigned int count, const uint64_t offset);
@@ -1057,16 +1055,24 @@ static uint64_t compute_device_size(const int hd_h, const char *device, const in
}
#endif
-static const char *file_description(disk_t *disk_car)
+static const char *file_description(disk_t *disk)
{
- const struct info_file_struct *data=(const struct info_file_struct *)disk_car->data;
+ const struct info_file_struct *data=(const struct info_file_struct *)disk->data;
char buffer_disk_size[100];
- size_to_unit(disk_car->disk_size, buffer_disk_size);
- snprintf(disk_car->description_txt, sizeof(disk_car->description_txt),"Disk %s - %s - CHS %lu %u %u%s",
- disk_car->device, buffer_disk_size,
- disk_car->geom.cylinders, disk_car->geom.heads_per_cylinder, disk_car->geom.sectors_per_head,
- ((data->mode&O_RDWR)==O_RDWR?"":" (RO)"));
- return disk_car->description_txt;
+ size_to_unit(disk->disk_size, buffer_disk_size);
+ if(disk->geom.heads_per_cylinder == 1 && disk->geom.sectors_per_head == 1)
+ snprintf(disk->description_txt, sizeof(disk->description_txt),
+ "Disk %s - %s - %lu sectors%s",
+ disk->device, buffer_disk_size,
+ disk->geom.cylinders,
+ ((data->mode&O_RDWR)==O_RDWR?"":" (RO)"));
+ else
+ snprintf(disk->description_txt, sizeof(disk->description_txt),
+ "Disk %s - %s - CHS %lu %u %u%s",
+ disk->device, buffer_disk_size,
+ disk->geom.cylinders, disk->geom.heads_per_cylinder, disk->geom.sectors_per_head,
+ ((data->mode&O_RDWR)==O_RDWR?"":" (RO)"));
+ return disk->description_txt;
}
static const char *file_description_short(disk_t *disk_car)