[patch] Missing endianness converting in probe_vfat

Sjoerd Simons sjoerd at luon.net
Fri Sep 10 13:00:57 PDT 2004


Hi,

 It seems that probe_vfat is missing some endianness converting in probe_vfat.
 This showed up on my powerbook, where hal didn't find the label of a memory
 stick (it thought it was fat32 while it was fat16). Attached patch fixes this.

  Sjoerd
-- 
1 + 1 = 3, for large values of 1.
-------------- next part --------------
Index: hald/linux/volume_id/volume_id.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.c,v
retrieving revision 1.29
diff -u -r1.29 volume_id.c
--- hald/linux/volume_id/volume_id.c	30 Aug 2004 15:13:17 -0000	1.29
+++ hald/linux/volume_id/volume_id.c	10 Sep 2004 19:48:50 -0000
@@ -885,7 +885,7 @@
 
 	sect_count = le16_to_cpu(vs->sectors);
 	if (sect_count == 0)
-		sect_count = vs->total_sect;
+		sect_count = le32_to_cpu(vs->total_sect);
 	dbg("sect_count 0x%x", sect_count);
 
 	fat_length = le16_to_cpu(vs->fat_length);
@@ -947,7 +947,7 @@
 		__u64 fat_entry_off;
 
 		dbg("next cluster %u", next);
-		next_sect_off = (next - 2) * vs->sectors_per_cluster;
+		next_sect_off = (next - 2) * le16_to_cpu(vs->sectors_per_cluster);
 		next_off = (start_data_sect + next_sect_off) * sector_size;
 		dbg("cluster offset 0x%x", next_off);
 
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list