[syslinux:fsc] FAT: deal with non-mirrored FATs for FAT32

syslinux-bot for H. Peter Anvin hpa at zytor.com
Mon Jan 25 11:36:12 PST 2010


Commit-ID:  217683b7fca9672293d997829fdbc25d7f667e79
Gitweb:     http://syslinux.zytor.com/commit/217683b7fca9672293d997829fdbc25d7f667e79
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 25 Jan 2010 11:34:33 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 25 Jan 2010 11:34:33 -0800

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 at zytor.com>


---
 core/fs/fat/fat.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/core/fs/fat/fat.c b/core/fs/fat/fat.c
index c89ed78..b036ead 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;
     



More information about the Syslinux-commits mailing list