Skip to contentSkip to conversation

PATCH: fix FAT32 filesystems on 64-bit platforms

PATCH Bill Nottingham 2 participants 2 messages Dec 15, 2000 VFAT/FAT/msdos filesystem

lore
Share & tools
lore
#0 lore raw

This fixes FAT32 on 64-bit platforms (notably, IA-64 and Alpha); without this you can't mount any FAT32 filesystems. A similar patch is already in 2.2.18.

Bill

fs/fat/cache.c renamed from fs/fat/cache.c.foo +6 -6
@@ -70,7 +70,7 @@
 	}
 	if (MSDOS_SB(sb)->fat_bits == 32) {
 		p_first = p_last = NULL; /* GCC needs that stuff */
-		next = CF_LE_L(((unsigned long *) bh->b_data)[(first &
+		next = CF_LE_L(((__u32 *) bh->b_data)[(first &
 		    (SECTOR_SIZE-1)) >> 2]);
 		/* Fscking Microsoft marketing department. Their "32" is 28. */
 		next &= 0xfffffff;
@@ -79,12 +79,12 @@
 
 	} else if (MSDOS_SB(sb)->fat_bits == 16) {
 		p_first = p_last = NULL; /* GCC needs that stuff */
-		next = CF_LE_W(((unsigned short *) bh->b_data)[(first &
+		next = CF_LE_W(((__u16 *) bh->b_data)[(first &
 		    (SECTOR_SIZE-1)) >> 1]);
 		if (next >= 0xfff7) next = -1;
 	} else {
-		p_first = &((unsigned char *) bh->b_data)[first & (SECTOR_SIZE-1)];
-		p_last = &((unsigned char *) bh2->b_data)[(first+1) &
+		p_first = &((__u8 *) bh->b_data)[first & (SECTOR_SIZE-1)];
+		p_last = &((__u8 *) bh2->b_data)[(first+1) &
 		    (SECTOR_SIZE-1)];
 		if (nr & 1) next = ((*p_first >> 4) | (*p_last << 4)) & 0xfff;
 		else next = (*p_first+(*p_last << 8)) & 0xfff;
@@ -92,10 +92,10 @@
 	}
 	if (new_value != -1) {
 		if (MSDOS_SB(sb)->fat_bits == 32) {
-			((unsigned long *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
+			((__u32 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
 			    2] = CT_LE_L(new_value);
 		} else if (MSDOS_SB(sb)->fat_bits == 16) {
-			((unsigned short *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
+			((__u16 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >>
 			    1] = CT_LE_W(new_value);
 		} else {
 			if (nr & 1) {
#1 lore raw
Quoted 3 lines

This fixes FAT32 on 64-bit platforms (notably, IA-64 and Alpha); without this you can't mount any FAT32 filesystems. A similar patch is already in 2.2.18.

...

Quoted 2 lines
fs/fat/cache.c renamed from fs/fat/cache.c.foo +1 -1
-		next = CF_LE_L(((unsigned long *) bh->b_data)[(first &
+		next = CF_LE_L(((__u32 *) bh->b_data)[(first &

...

fs/fat/cache.c line 82

Quoted 2 lines
fs/fat/cache.c renamed from fs/fat/cache.c.foo +1 -1
-		next = CF_LE_W(((unsigned short *) bh->b_data)[(first &
+		next = CF_LE_W(((__u16 *) bh->b_data)[(first &

These macros really ought to be replaced with the standard le32_to_cpu() and le16_to_cpu() ones.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/