Date: Thu, 12 Mar 1998 16:11:10 GMT
From: Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
To: linux-m68k@lists.linux-m68k.org
Subject: L68K: FAT32 support with atari=yes
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: Roman.Hodek@informatik.uni-erlangen.de


The following patch makes FAT32 recognition possible for filesystems
mounted with option atari=yes (default if CONFIG_ATARI is set). The
hacks for 12 bit FATS are omitted if FAT32 has been detected, since
this detection is rather reliable and shouldn't be modified. There
could be floppy disks with FAT32 on it...

Roman

------------------------------------------------------------------------------
--- linux/linux-2.1.85/fs/fat/inode.c~	Thu Feb  5 15:10:42 1998
+++ linux/linux-2.1.85/fs/fat/inode.c	Thu Mar 12 17:08:16 1998
@@ -418,20 +418,20 @@
 		else {
 			int sectors;
 			/* Atari GEMDOS partitions always have 16-bit fat */
-			MSDOS_SB(sb)->fat_bits = fat ? fat : 16;
+			MSDOS_SB(sb)->fat_bits = fat32 ? 32 : (fat ? fat : 16);
 			/* If more clusters than fat entries in 16-bit fat, we assume
 			 * it's a real MSDOS partition with 12-bit fat.
 			 */
-			if (MSDOS_SB(sb)->clusters+2 > MSDOS_SB(sb)->
+			if (!fat32 && MSDOS_SB(sb)->clusters+2 > MSDOS_SB(sb)->
 				fat_length*SECTOR_SIZE*8/MSDOS_SB(sb)->fat_bits)
 				MSDOS_SB(sb)->fat_bits = 12;
 			/* if it's a floppy disk --> 12bit fat */
-			if (MAJOR(sb->s_dev) == FLOPPY_MAJOR)
+			if (!fat32 && MAJOR(sb->s_dev) == FLOPPY_MAJOR)
 				MSDOS_SB(sb)->fat_bits = 12;
 			/* if it's a ramdisk or loopback device and has one of the usual
 			 * floppy sizes -> 12bit FAT  */
 			sectors = data_sectors + MSDOS_SB(sb)->data_start;
-			if ((MAJOR(sb->s_dev) == RAMDISK_MAJOR ||
+			if (!fat32 && (MAJOR(sb->s_dev) == RAMDISK_MAJOR ||
 				 MAJOR(sb->s_dev) == LOOP_MAJOR) &&
 				(sectors == 720 || sectors == 1440 || sectors == 2880))
 				MSDOS_SB(sb)->fat_bits = 12;
