hal/hald/linux block_class_device.c,1.72,1.73
David Zeuthen
david at freedesktop.org
Mon Sep 20 00:52:44 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv12845/hald/linux
Modified Files:
block_class_device.c
Log Message:
2004-09-20 David Zeuthen <david at fubar.dk>
* hald/linux/block_class_device.c (block_class_pre_process):
Catch up with changes made in volume_id described below
* hald/linux/volume_id/volume_id.h: Remove partition_number
as it's redundant. Rename partition_msdosparttable_type to
partition_type_raw
* hald/linux/volume_id/volume_id.c (probe_msdos_part_table):
Don't set partition_number as it's gone
Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- block_class_device.c 20 Sep 2004 01:25:54 -0000 1.72
+++ block_class_device.c 20 Sep 2004 07:52:42 -0000 1.73
@@ -1264,43 +1264,37 @@
stordev_device_file = hal_device_property_get_string (stordev, "block.device");
vid = volume_id_open_node (stordev_device_file);
if (vid != NULL) {
- unsigned int i;
-
if (volume_id_probe(vid, VOLUME_ID_MSDOSPARTTABLE, 0, size) == 0) {
HAL_INFO (("Number of partitions = %d", vid->partition_count));
- for (i = 0; i < vid->partition_count; i++) {
+ if (partition_number >= 0 && partition_number < vid->partition_count) {
struct volume_id_partition *p;
-
- p = &vid->partitions[i];
-
- HAL_INFO (("%d: partition %d, type 0x%02x", i,
- p->partition_number,
- p->partition_msdosparttable_type));
-
- if (p->partition_number == partition_number) {
- hal_device_property_set_int (
- d, "volume.partition.x86_type",
- p->partition_msdosparttable_type);
-
- /* NOTE: We trust the type from the partition table
- * if it explicitly got correct entries for RAID and
- * LVM partitions.
- *
- * Btw, in general it's not a good idea to trust the
- * partition table type as many geek^Wexpert users use
- * FAT filesystems on type 0x83 which is Linux.
- *
- * Linux RAID autodetect is 0xfd and Linux LVM is 0x8e
- */
- if (p->partition_msdosparttable_type == 0xfd ||
- p->partition_msdosparttable_type == 0x8e ) {
- hal_device_property_set_string (
- d, "volume.fsusage", "raid");
- }
+ p = &vid->partitions[partition_number];
- }
+ hal_device_property_set_int (
+ d, "volume.partition.x86_type",
+ p->partition_type_raw);
+
+ /* NOTE: We trust the type from the partition table
+ * if it explicitly got correct entries for RAID and
+ * LVM partitions.
+ *
+ * Btw, in general it's not a good idea to trust the
+ * partition table type as many geek^Wexpert users use
+ * FAT filesystems on type 0x83 which is Linux.
+ *
+ * Linux RAID autodetect is 0xfd and Linux LVM is 0x8e
+ */
+ if (p->partition_type_raw == 0xfd ||
+ p->partition_type_raw == 0x8e ) {
+ hal_device_property_set_string (
+ d, "volume.fsusage", "raid");
+ }
+
+ } else {
+ HAL_WARNING (("partition_number=%d not in [0;%d[",
+ partition_number, vid->partition_count));
}
}
More information about the hal-commit
mailing list