Skip to contentSkip to conversation

Support for devices with FAT32 PBR

PATCH New Igor Luri 2 participants 2 messages May 11, 2010 – Jul 24, 2010 VFAT/FAT/msdos filesystem

lore
Share & tools
lore

Igor Luri

author
#0 lore raw

PATCH v4 1/1 Support for devices with FAT32 PBR

---
 disk/part_dos.c |    3 ++-
 disk/part_dos.h |    1 +
 fs/fat/fat.c    |    7 +++++--
 3 files changed, 8 insertions(+), 3 deletions(-)
disk/part_dos.c +2 -1
index 887b75e..d91f773 100644
@@ -77,7 +77,8 @@ static int test_block_type(unsigned char *buffer)
 	    (buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) {
 		return (-1);
 	} /* no DOS Signature at all */
-	if(strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0)
+	if((strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0) ||
+	   (strncmp((char *)&buffer[DOS_PBR_FAT32_FSTYPE_OFFSET],"FAT32",5)==0)	)
 		return DOS_PBR; /* is PBR */
 	return DOS_MBR;	    /* Is MBR */
 }
disk/part_dos.h +1 -0
index ac93f20..6383c58 100644
@@ -35,6 +35,7 @@
 #define DOS_PART_TBL_OFFSET	0x1be
 #define DOS_PART_MAGIC_OFFSET	0x1fe
 #define DOS_PBR_FSTYPE_OFFSET	0x36
+#define DOS_PBR_FAT32_FSTYPE_OFFSET	0x52
 #define DOS_PBR_MEDIA_TYPE_OFFSET	0x15
 #define DOS_MBR	0
 #define DOS_PBR	1
fs/fat/fat.c +5 -2
index 2445f1e..e4b6747 100644
@@ -50,6 +50,7 @@ static int cur_part = 1;
 #define DOS_PART_TBL_OFFSET	0x1be
 #define DOS_PART_MAGIC_OFFSET	0x1fe
 #define DOS_FS_TYPE_OFFSET	0x36
+#define DOS_FS_FAT32_TYPE_OFFSET	0x52
 
 int disk_read (__u32 startblock, __u32 getsize, __u8 * bufptr)
 {
@@ -94,7 +95,8 @@ fat_register_device(block_dev_desc_t *dev_desc, int part_no)
 	if (!get_partition_info (dev_desc, part_no, &info)) {
 		part_offset = info.start;
 		cur_part = part_no;
-	} else if (!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3)) {
+	} else if (!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3) ||
+		   !strncmp((char *)&buffer[DOS_FS_FAT32_TYPE_OFFSET], "FAT32", 5)) {
 		/* ok, we assume we are on a PBR only */
 		cur_part = 1;
 		part_offset = 0;
@@ -105,7 +107,8 @@ fat_register_device(block_dev_desc_t *dev_desc, int part_no)
 	}
 
 #else
-	if (!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
+	if (!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3) ||
+	    !strncmp((char *)&buffer[DOS_FS_FAT32_TYPE_OFFSET], "FAT32", 5)) {
 		/* ok, we assume we are on a PBR only */
 		cur_part = 1;
 		part_offset = 0;
Signature · 1 line
1.5.4.3
#1 lore raw

PATCH v4 1/1 Support for devices with FAT32 PBR

Dear Igor Luri,

Quoted 7 lines · In message <[email protected]> you wrote:
---
 disk/part_dos.c |    3 ++-
 disk/part_dos.h |    1 +
 fs/fat/fat.c    |    7 +++++--
 3 files changed, 8 insertions(+), 3 deletions(-)

I applied commit 66c2d73c instead as part of a patch series that fixes other bugs with FAT32 file systems as well.

Maybe you can test that this works for you, too.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I don't mind criticism. You know me. I've  never  been  one  to  take
offence  at  criticism. No one could say I'm the sort to take offence
at criticism -- Not twice, anyway. Not without blowing bubbles.
                                  - Terry Pratchett, _Witches Abroad_