summaryrefslogtreecommitdiffstats
path: root/src/fat.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-07-18 22:16:08 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2008-07-18 22:16:08 +0200
commit8585ef8e51b492783c7d4a3125beeacac1d4314a (patch)
treeec8cbc98265f903e2ca2063b78f93eb3c358ad23 /src/fat.c
parentcc3bc11be8d37123b2165510fe510c8ca5944385 (diff)
Store disk geometry in cylinders/heads_per_cylinder/sectors_per_head instead of CHS
Diffstat (limited to 'src/fat.c')
-rw-r--r--src/fat.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/fat.c b/src/fat.c
index b39bf3d..11c0713 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -761,15 +761,19 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
}
if(fat_header->fats>1)
comp_FAT(disk_car,partition,fat_length,le16(fat_header->reserved));
- if(le16(fat_header->heads)!=disk_car->CHS.head+1)
+ if(le16(fat_header->heads)!=disk_car->geom.heads_per_cylinder)
{
- screen_buffer_add("Warning: Incorrect number of heads/cylinder %u (FAT) != %u (HD)\n",le16(fat_header->heads),disk_car->CHS.head+1);
- log_warning("heads/cylinder %u (FAT) != %u (HD)\n",le16(fat_header->heads),disk_car->CHS.head+1);
+ screen_buffer_add("Warning: Incorrect number of heads/cylinder %u (FAT) != %u (HD)\n",
+ le16(fat_header->heads), disk_car->geom.heads_per_cylinder);
+ log_warning("heads/cylinder %u (FAT) != %u (HD)\n",
+ le16(fat_header->heads), disk_car->geom.heads_per_cylinder);
}
- if(le16(fat_header->secs_track)!=disk_car->CHS.sector)
+ if(le16(fat_header->secs_track)!=disk_car->geom.sectors_per_head)
{
- screen_buffer_add("Warning: Incorrect number of sectors per track %u (FAT) != %u (HD)\n",le16(fat_header->secs_track),disk_car->CHS.sector);
- log_warning("sect/track %u (FAT) != %u (HD)\n",le16(fat_header->secs_track),disk_car->CHS.sector);
+ screen_buffer_add("Warning: Incorrect number of sectors per track %u (FAT) != %u (HD)\n",
+ le16(fat_header->secs_track), disk_car->geom.sectors_per_head);
+ log_warning("sect/track %u (FAT) != %u (HD)\n",
+ le16(fat_header->secs_track), disk_car->geom.sectors_per_head);
}
return 0;
}
@@ -1039,7 +1043,8 @@ int recover_OS2MB(disk_t *disk_car, const struct fat_boot_sector*fat_header, par
{
if(test_OS2MB(disk_car, fat_header, partition, verbose, dump_ind))
return 1;
- partition->part_size=(uint64_t)(disk_car->CHS.head+1) * disk_car->CHS.sector*disk_car->sector_size; /* 1 cylinder */
+ /* 1 cylinder */
+ partition->part_size=(uint64_t)disk_car->geom.heads_per_cylinder * disk_car->geom.sectors_per_head * disk_car->sector_size;
partition->part_type_i386=P_OS2MB;
partition->fsname[0]='\0';
partition->info[0]='\0';