FAT32 has the option of non-mirrored FATs, used to improve atomicity
of some operations. If we have non-mirrored FATs, we need to make
sure to read the one FAT which is currently marked active.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
sbi->fat_type = FAT16;
} else {
sbi->fat_type = FAT32;
+
if (clusters > 0x0ffffff4)
clusters = 0x0ffffff4; /* Maximum possible */
+
+ if (fat.fat32.extended_flags & 0x80) {
+ /* Non-mirrored FATs, we need to read the active one */
+ sbi->fat += (fat.fat32.extended_flags & 0x0f) * sectors_per_fat;
+ }
}
sbi->clusters = clusters;