mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-25 00:29:23 +00:00
* stage2/fsys_fat.c: Fix missdetection of ext2fs as fatfs.
This commit is contained in:
1 parent
2e08dad5a8
commit
3c9fc981a2
2 files changed
+30
No files matched your search
@@ -67,6 +67,7 @@ int
|
||||
fat_mount (void)
|
||||
{
|
||||
struct fat_bpb bpb;
|
||||
__u32 magic, first_fat;
|
||||
|
||||
/* Check partition type for harddisk */
|
||||
if (((current_drive & 0x80) || (current_slice != 0))
|
||||
@@ -161,6 +162,31 @@ fat_mount (void)
|
||||
> FAT_SUPER->fat_length))
|
||||
return 0;
|
||||
|
||||
/* kbs: Media check on first FAT entry [ported from PUPA] */
|
||||
|
||||
if (!devread(FAT_SUPER->fat_offset, 0,
|
||||
sizeof(first_fat), (char *)&first_fat))
|
||||
return 0;
|
||||
|
||||
if (FAT_SUPER->fat_size == 8)
|
||||
{
|
||||
first_fat &= 0x0fffffff;
|
||||
magic = 0x0fffff00;
|
||||
}
|
||||
else if (FAT_SUPER->fat_size == 4)
|
||||
{
|
||||
first_fat &= 0x0000ffff;
|
||||
magic = 0xff00;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_fat &= 0x00000fff;
|
||||
magic = 0x0f00;
|
||||
}
|
||||
|
||||
if (first_fat != (magic | bpb.media))
|
||||
return 0;
|
||||
|
||||
FAT_SUPER->cached_fat = - 2 * FAT_CACHE_SIZE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user