fsys_fat: Fixed calculation of FAT_SUPER->num_clust.

This commit is contained in:
jochen 2000-07-25 14:51:20 +00:00
parent 529a2dc5e0
commit 436fb5ce95
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2000-07-25 Jochen Hoenicke <jochen@gnu.org>
* stage2/fsys_fat.c (fat_mount): Fixed calculation of num_clust.
It was off by two, since the two non existing clusters 0 and 1
were not taken into account.
2000-07-25 OKUJI Yoshinori <okuji@gnu.org> 2000-07-25 OKUJI Yoshinori <okuji@gnu.org>
* stage2/asm.S [!STAGE1_5] (linux_text_len): New variable. * stage2/asm.S [!STAGE1_5] (linux_text_len): New variable.

View file

@ -106,7 +106,8 @@ fat_mount (void)
FAT_SUPER->root_offset FAT_SUPER->root_offset
+ ((FAT_SUPER->root_max - 1) >> FAT_SUPER->sectsize_bits) + 1; + ((FAT_SUPER->root_max - 1) >> FAT_SUPER->sectsize_bits) + 1;
FAT_SUPER->num_clust = FAT_SUPER->num_clust =
(FAT_SUPER->num_sectors - FAT_SUPER->data_offset) / bpb.sects_per_clust; 2 + ((FAT_SUPER->num_sectors - FAT_SUPER->data_offset)
/ bpb.sects_per_clust);
FAT_SUPER->sects_per_clust = bpb.sects_per_clust; FAT_SUPER->sects_per_clust = bpb.sects_per_clust;
if (!bpb.fat_length) if (!bpb.fat_length)
@ -136,7 +137,7 @@ fat_mount (void)
|| FAT_CVT_U16(bpb.bytes_per_sect) != SECTOR_SIZE || FAT_CVT_U16(bpb.bytes_per_sect) != SECTOR_SIZE
|| bpb.sects_per_clust != (1 << (FAT_SUPER->clustsize_bits || bpb.sects_per_clust != (1 << (FAT_SUPER->clustsize_bits
- FAT_SUPER->sectsize_bits)) - FAT_SUPER->sectsize_bits))
|| FAT_SUPER->num_clust <= 0 || FAT_SUPER->num_clust <= 2
|| (FAT_SUPER->fat_size * FAT_SUPER->num_clust / (2 * SECTOR_SIZE) || (FAT_SUPER->fat_size * FAT_SUPER->num_clust / (2 * SECTOR_SIZE)
> FAT_SUPER->fat_length)) > FAT_SUPER->fat_length))
return 0; return 0;