hal/hald/linux block_class_device.c,1.59,1.60

Kay Sievers kay at freedesktop.org
Wed Aug 25 13:20:24 PDT 2004


Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv13758/hald/linux

Modified Files:
	block_class_device.c 
Log Message:
2004-08-25  Kay Sievers  <kay.sievers at vrfy.org>

        * hald/linux/block_class_device.c:
        (set_volume_id_values), (get_first_valid_partition),
        (volume_set_size), (detect_media), (block_class_pre_process): Add
        "volume.is_part_of_raid" and pass the size of the volume down to
        volume_id to be able to look for a raid superblock at the end of
        the device.
        * hald/linux/volume_id/volume_id.c:
        (probe_linux_raid) : Add linux_raid detection with reading of the
        raid set uuid
        (probe_msdos_part_table): follow extended partiton while probing
        (vfat_search_label_in_dir), (probe_vfat): Support reding of labels
        stored in the directory of FAT32 and read the whole root directory
        instead of only the first cluster
        (probe_mac_partition_map): return UNUSED and PARTITIONTABLE types
        for know Apple partitions
        (volume_id_probe): Add raid detection, if volume_id is called with
        the size of the volume.



Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- block_class_device.c	23 Aug 2004 20:46:40 -0000	1.59
+++ block_class_device.c	25 Aug 2004 20:20:22 -0000	1.60
@@ -85,6 +85,20 @@
 {
 	char *product;
 
+	switch (vid->type_id) {
+	case VOLUME_ID_FILESYSTEM:
+		hal_device_property_set_bool (d, "volume.is_filesystem", TRUE);
+		break;
+	case VOLUME_ID_RAID:
+		hal_device_property_set_bool (d, "volume.is_part_of_raid", TRUE);
+		break;
+	case VOLUME_ID_UNUSED:
+		hal_device_property_set_string (d, "info.product", "Volume (unused)");
+		return;
+	default:
+		;
+	}
+
 	hal_device_property_set_string (d, "volume.fstype", vid->format);
 	if (vid->format_version[0] != '\0')
 		hal_device_property_set_string (d, "volume.fsversion",
@@ -517,7 +531,7 @@
 			if (len == 0)
 				continue;
 
-			if (volume_id_probe(p, VOLUME_ID_ALL, off) == 0 &&
+			if (volume_id_probe(p, VOLUME_ID_ALL, off, 0) == 0 &&
 			    p->type_id == VOLUME_ID_FILESYSTEM)
 				return p;
 		}
@@ -547,7 +561,7 @@
 	if (force || hal_device_property_get_bool (stordev, "storage.media_check_enabled")) {
 
 		sysfs_path = hal_device_property_get_string (d, "linux.sysfs_path");
-		/* no-partition volumes doesn't have sysfs path */
+		/* no-partition volumes don't have a sysfs path */
 		if (sysfs_path == NULL)
 			sysfs_path = hal_device_property_get_string (stordev, "linux.sysfs_path");
 
@@ -942,7 +956,7 @@
 				return FALSE;
 			}
 			
-			if (volume_id_probe (vid, VOLUME_ID_ALL, 0) != 0) {
+			if (volume_id_probe (vid, VOLUME_ID_ALL, 0, 0) != 0) {
 				if (is_cdrom) {
 					/* volume_id cannot yet probe blank/audio discs etc,
 					 * so don't fail for them, just set vid to NULL */
@@ -1185,10 +1199,21 @@
 		 * or any of it partitions are not mounted causes the loop.
 		 */
 		if (hal_device_property_get_bool (stordev, "storage.media_check_enabled")) {
+			unsigned long long size = 0;
+			int bcount;
+			int bsize;
+
+			volume_set_size (d, FALSE);
+
+			bcount = hal_device_property_get_int (d, "volume.num_blocks");
+			bsize = hal_device_property_get_int (d, "volume.block_size");
+
+			if ((bsize > 0)  && (bcount > 0))
+				size = bcount * bsize;
 
 			vid = volume_id_open_node(device_file);
 			if (vid != NULL) {
-				if (volume_id_probe(vid, VOLUME_ID_ALL, 0) == 0) {
+				if (volume_id_probe(vid, VOLUME_ID_ALL, 0, size) == 0) {
 					set_volume_id_values(d, vid);
 				}
 				volume_id_close(vid);
@@ -1203,9 +1228,6 @@
 			hal_device_property_set_string (d, "volume.fstype", "vfat,auto");
 			hal_device_property_set_bool (d, "volume.is_filesystem", TRUE);
 		}
-
-		volume_set_size (d, FALSE);
-
 		return;
 	}
 




More information about the hal-commit mailing list