hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Sun Aug 10 01:58:54 PDT 2008


 hald/linux/blockdev.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

New commits:
commit bceab12538b779419c4f4c66bf4c1a5d2ebdd687
Author: Patrick Campbell <plc at novell.com>
Date:   Sun Aug 10 10:57:39 2008 +0200

    set Xen storage drive type
    
    This sets Xen storage drive type based on contents of the devices
    sysfs media file. (Creation of sysfs media file was pushed into
    upstream Xen 07-28-08.)

diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
index 6042558..f00a2c2 100644
--- a/hald/linux/blockdev.c
+++ b/hald/linux/blockdev.c
@@ -1342,6 +1342,27 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
 				}
 			}
 		}
+		else if (strcmp (parent_bus, "xen") == 0) {
+			char buf[256];
+			gchar *media;
+
+			snprintf (buf, sizeof (buf), "%s/%s", sysfs_path_real, "device");
+			if ((media = hal_util_get_string_from_file (buf, "media")) != NULL) {
+				if (strcmp (media, "cdrom") == 0) {
+					hal_device_property_set_string (d, "info.product", "Xen Virtual CD");
+					hal_device_property_set_string (d, "storage.drive_type", media);
+					hal_device_property_set_bool (d, "storage.media_check_enabled", FALSE);
+				} else if (strcmp (media, "floppy") == 0) {
+					hal_device_property_set_string (d, "info.product", "Xen Virtual Floppy");
+					hal_device_property_set_string (d, "storage.drive_type", media);
+					hal_device_property_set_bool (d, "storage.media_check_enabled", FALSE);
+				}
+				else {
+					hal_device_property_set_string (d, "info.product", "Xen Virtual Disk");
+					hal_device_property_set_string (d, "storage.drive_type", "disk");
+				}
+			}
+		}
 
 		hal_device_property_set_string (d, "info.category", "storage");
 		hal_device_add_capability (d, "storage");


More information about the hal-commit mailing list