summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-01-25 11:34:33 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-01-25 11:34:33 -0800
commit217683b7fca9672293d997829fdbc25d7f667e79 (patch)
tree19837028a0d7dd0d5b797846c0340052dcfcd20a
parent67cd8b349590cc0090dffc6ef7439378d8e71206 (diff)
downloadsyslinux-217683b7fca9672293d997829fdbc25d7f667e79.tar.gz
FAT: deal with non-mirrored FATs for FAT32
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>
-rw-r--r--core/fs/fat/fat.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/fs/fat/fat.c b/core/fs/fat/fat.c
index c89ed78a..b036ead4 100644
--- a/core/fs/fat/fat.c
+++ b/core/fs/fat/fat.c
@@ -743,8 +743,14 @@ static int vfat_fs_init(struct fs_info *fs)
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;