hal/volume_id fat.c,1.9,1.10 volume_id.h,1.12,1.13

Kay Sievers kay at freedesktop.org
Mon Nov 21 09:55:15 PST 2005


Update of /cvs/hal/hal/volume_id
In directory gabe:/tmp/cvs-serv1098/volume_id

Modified Files:
	fat.c volume_id.h 
Log Message:
2005-11-21  Kay Sievers  <kay.sievers at vrfy.org>

        * volume_id/fat.c: (volume_id_probe_vfat): fix recognition of weird
        FAT volumes.
        * volume_id/volume_id.h: Version 55


Index: fat.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/fat.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- fat.c	15 Nov 2005 03:32:36 -0000	1.9
+++ fat.c	21 Nov 2005 17:55:13 -0000	1.10
@@ -161,48 +161,45 @@
 		return -1;
 
 	if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0)
-		goto valid;
+		goto magic;
 
 	if (memcmp(vs->type.fat32.magic, "FAT32   ", 8) == 0)
-		goto valid;
+		goto magic;
 
 	if (memcmp(vs->type.fat.magic, "FAT16   ", 8) == 0)
-		goto valid;
+		goto magic;
 
 	if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0)
-		goto valid;
+		goto magic;
 
 	if (memcmp(vs->type.fat.magic, "FAT12   ", 8) == 0)
-		goto valid;
+		goto magic;
 
-	/*
-	 * There are old floppies out there without a magic, so we check
-	 * for well known values and guess if it's a fat volume
-	 */
+	/* some old floppies don't have a magic, so we expect the boot code to match */
 
 	/* boot jump address check */
 	if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) &&
 	     vs->boot_jump[0] != 0xe9)
 		return -1;
 
-	/* heads check */
-	if (vs->heads == 0)
+magic:
+	/* reserverd sector count */
+	if (!vs->reserved)
 		return -1;
 
-	/* cluster size check*/	
-	if (vs->sectors_per_cluster == 0 ||
-	    (vs->sectors_per_cluster & (vs->sectors_per_cluster-1)))
+	/* fat count*/
+	if (!vs->fats)
 		return -1;
 
 	/* media check */
 	if (vs->media < 0xf8 && vs->media != 0xf0)
 		return -1;
 
-	/* fat count*/
-	if (vs->fats != 2)
+	/* cluster size check*/	
+	if (vs->sectors_per_cluster == 0 ||
+	    (vs->sectors_per_cluster & (vs->sectors_per_cluster-1)))
 		return -1;
 
-valid:
 	/* sector size check */
 	sector_size = le16_to_cpu(vs->sector_size);
 	if (sector_size != 0x200 && sector_size != 0x400 &&

Index: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- volume_id.h	15 Nov 2005 03:32:36 -0000	1.12
+++ volume_id.h	21 Nov 2005 17:55:13 -0000	1.13
@@ -14,7 +14,7 @@
 #include <stdint.h>
 #include <stddef.h>
 
-#define VOLUME_ID_VERSION		54
+#define VOLUME_ID_VERSION		55
 
 #define VOLUME_ID_LABEL_SIZE		64
 #define VOLUME_ID_UUID_SIZE		36




More information about the hal-commit mailing list