From mboxrd@z Thu Jan 1 00:00:00 1970 From: iSteve Date: Mon, 06 Mar 2006 20:57:04 +0000 Subject: Libvolume incorrectly detects FAT32 Message-Id: <20060306215704.35f12840@silver> MIME-Version: 1 Content-Type: multipart/mixed; boundary="MP__0NVnaDajPE2IfGQsimaXYB" List-Id: To: linux-hotplug@vger.kernel.org --MP__0NVnaDajPE2IfGQsimaXYB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, I'm having one silly partition, which has remnants of previous FAT32 filesystem on it, a LILO bootloader on it and ext2 filesystem spaning all over the partition. The first 512B look exactly like a valid FAT partition header would, except the magic is "LILO". I've looked at the sources for FAT detection, and I noted that when a FAT-like filesystem misses magic, it's still considered valid, since as comment says, some old floppies may lack it. I consider this point valid, however, this causes my partition to be detected, incorrectly, as FAT32. My proposed solution is to compare magic if FAT32 is assumed, and if magic will not match for FAT32, consider it a failure; floppies that old that they lack any magic will most likely not be formatted in FAT32. Trivial patch is attached, comments/complaints?:) -- -- iSteve --MP__0NVnaDajPE2IfGQsimaXYB Content-Type: text/x-patch; name=fat32-magic-required.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=fat32-magic-required.patch --- fat.c.old 2006-01-30 08:51:38.000000000 +0100 +++ fat.c 2006-03-06 21:55:29.000000000 +0100 @@ -281,6 +281,9 @@ goto found; fat32: + if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) != 0) + return -1; + strcpy(id->type_version, "FAT32"); /* FAT32 root dir is a cluster chain like any other directory */ --MP__0NVnaDajPE2IfGQsimaXYB-- ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel