* grub-core/fs/fat.c (grub_fat_mount): Don't add logical_sector_bits

to cluster_bits, since it's already added in.
	(grub_fat_read_data): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-04-25 16:28:06 +02:00
parent 986748ce79
commit daa59f47f6
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2012-04-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/fat.c (grub_fat_mount): Don't add logical_sector_bits
to cluster_bits, since it's already added in.
(grub_fat_read_data): Likewise.
2012-04-25 Vladimir Serbinenko <phcoder@gmail.com> 2012-04-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/ntfs.c (grub_ntfs_mount): Support 256-byte sectors, * grub-core/fs/ntfs.c (grub_ntfs_mount): Support 256-byte sectors,

View file

@ -326,7 +326,7 @@ grub_fat_mount (grub_disk_t disk)
#else #else
data->cluster_sector = data->root_sector + data->num_root_sectors; data->cluster_sector = data->root_sector + data->num_root_sectors;
data->num_clusters = (((data->num_sectors - data->cluster_sector) data->num_clusters = (((data->num_sectors - data->cluster_sector)
>> (data->cluster_bits + data->logical_sector_bits)) >> data->cluster_bits)
+ 2); + 2);
#endif #endif
@ -482,7 +482,6 @@ grub_fat_read_data (grub_disk_t disk, struct grub_fat_data *data,
/* Calculate the logical cluster number and offset. */ /* Calculate the logical cluster number and offset. */
logical_cluster_bits = (data->cluster_bits logical_cluster_bits = (data->cluster_bits
+ data->logical_sector_bits
+ GRUB_DISK_SECTOR_BITS); + GRUB_DISK_SECTOR_BITS);
logical_cluster = offset >> logical_cluster_bits; logical_cluster = offset >> logical_cluster_bits;
offset &= (1ULL << logical_cluster_bits) - 1; offset &= (1ULL << logical_cluster_bits) - 1;
@ -556,7 +555,7 @@ grub_fat_read_data (grub_disk_t disk, struct grub_fat_data *data,
/* Read the data here. */ /* Read the data here. */
sector = (data->cluster_sector sector = (data->cluster_sector
+ ((data->cur_cluster - 2) + ((data->cur_cluster - 2)
<< (data->cluster_bits + data->logical_sector_bits))); << data->cluster_bits));
size = (1 << logical_cluster_bits) - offset; size = (1 << logical_cluster_bits) - offset;
if (size > len) if (size > len)
size = len; size = len;