hal: Branch 'master' - 2 commits

Danny Kukawka dkukawka at kemper.freedesktop.org
Thu Apr 17 05:25:21 PDT 2008


 doc/spec/hal-spec-properties.xml |   53 ++++++++++++++++++++++++++
 hald/linux/device.c              |   77 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+)

New commits:
commit f9c2a5a31565d4a774b313ac3fefa62c3987cb1b
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Thu Apr 17 11:30:29 2008 +0200

    updated SPEC for VMBus
    
    Updated SPEC for VMBus.

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index f0718b0..264a06a 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -3110,6 +3110,59 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
         </tgroup>
       </informaltable>
     </sect2>
+
+    <sect2 id="device-properties-vmbus">
+      <title>
+        vmbus namespace
+      </title>
+      <para>
+	Virtual devices of the VMBus, which is part of the Hyper-V technologies 
+	(which is a hypervisor based virtualization solution) included in the 
+	Windows Server 2008, are represented by device objects where 
+	<literal>info.subsystem</literal> equals <literal>vmbus</literal>. 
+	The following properties are available for such device objects.
+      </para>
+      <informaltable>
+        <tgroup cols="2">
+          <thead>
+            <row>
+              <entry>Key (type)</entry>
+              <entry>Values</entry>
+              <entry>Mandatory</entry>
+              <entry>Description</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry>
+                <literal>vmbus.bus_id</literal> (string)
+              </entry>
+              <entry></entry>
+              <entry>Yes</entry>
+              <entry>ID of the bus.</entry>
+            </row>
+            <row>
+              <entry>
+                <literal>vmbus.device_id</literal> (string)
+              </entry>
+              <entry></entry>
+              <entry>Yes</entry>
+              <entry>ID of the device.</entry>
+            </row>
+            <row>
+              <entry>
+                <literal>vmbus.class_id</literal> (string)
+              </entry>
+              <entry>example: {f8615163-df3e-46c5-913ff2d2f965ed0e}</entry>
+              <entry>Yes</entry>
+              <entry>Class identifier of the device.</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </informaltable>
+    </sect2>
+
+
   </sect1>
 
   <sect1 id="properties-functional">
commit 7bd07e73f942a191c702337f27b5f7a9b9e63f43
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Thu Apr 17 11:13:13 2008 +0200

    add support for VMBus
    
    Adopted and rewritten version of a patch contributed by Mike Sterling
    <mike.sterling at microsoft.com> (for 0.5.8.1) to add support for the VMBus.
    Contributed via https://bugs.freedesktop.org/show_bug.cgi?id=15227:
    
    > Windows Server 2008 includes the Hyper-V technologies, a hypervisor based
    > virtualization solution. Hyper-V includes a new virtual bus type (called
    > VMBus) where synthetic devices in the VM connect. As Hyper-V will include
    > support for some Linux distributions, we'd like to see native support
    > for VMBus in hald.

diff --git a/hald/linux/device.c b/hald/linux/device.c
index d0e6d81..28894a8 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3719,6 +3719,73 @@ vio_compute_udi (HalDevice *d)
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
+vmbus_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *bus_id;
+	const gchar *class_id;
+	const gchar *device_id;
+
+	HAL_INFO (("vmbus_add: sysfs_path=%s device_file=%s parent_dev=0x%08x parent_path=%s", sysfs_path, device_file, parent_dev, parent_path));
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.subsystem", "vmbus");
+	hal_device_property_set_string (d, "info.vendor", "Microsoft/Citrix");
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+	
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+	hal_device_property_set_string (d, "vmbus.bus_id", bus_id);
+	device_id = hal_util_get_string_from_file (sysfs_path, "device_id");
+	hal_device_property_set_string (d, "vmbus.device_id", device_id);
+	class_id = hal_util_get_string_from_file (sysfs_path, "class_id");
+	hal_device_property_set_string (d, "vmbus.class_id", class_id);
+
+	if (class_id != NULL) {
+		if (strcmp (class_id, "{f8615163-df3e-46c5-913ff2d2f965ed0e}") == 0) {
+			hal_device_property_set_string (d, "info.product", "Network Virtualization Service Client Device");
+		} else if (strcmp (class_id, "{ba6163d9-04a1-4d29-b60572e2ffb1dc7f}") == 0) {
+			hal_device_property_set_string (d, "info.product", "Storage Virtualization Service Client Device");
+		} else if (strcmp (class_id, "{c5295816-f63a-4d5f-8d1a4daf999ca185}") == 0) {
+			// root device of the bus
+			hal_device_property_set_string (d, "info.product", "Vmbus Device");
+		}
+	} 
+
+	if (!hal_device_has_property(d, "info.product")) {
+		char buf[64];
+		g_snprintf (buf, sizeof (buf), "Virtualization Service Client Device (%s)", bus_id);
+		hal_device_property_set_string (d, "info.product", buf);
+	}
+
+	return d;
+}
+
+static gboolean
+vmbus_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+	
+	hal_util_compute_udi (hald_get_gdl(), udi, sizeof (udi),
+			      "/org/freedesktop/Hal/devices/vmbus_%s_%s",
+			      hal_device_property_get_string (d, "vmbus.bus_id"),
+			      hal_device_property_get_string (d, "vmbus.device_id"));
+
+	hal_device_set_udi (d, udi);
+	
+	return TRUE;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
 pseudo_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
 	HalDevice *d;
@@ -4093,6 +4160,15 @@ static DevHandler dev_handler_vio =
 	.remove      = dev_remove
 };
 
+static DevHandler dev_handler_vmbus =
+{
+	.subsystem   = "vmbus",
+	.add         = vmbus_add,
+	.compute_udi = vmbus_compute_udi,
+	.remove      = dev_remove
+};
+
+
 /* SCSI debug, to test thousends of fake devices */
 static DevHandler dev_handler_pseudo = {
 	.subsystem   = "pseudo",
@@ -4141,6 +4217,7 @@ static DevHandler *dev_handlers[] = {
 	&dev_handler_ps3_system_bus,
 	&dev_handler_virtio,
 	&dev_handler_vio,
+	&dev_handler_vmbus,
 	NULL
 };
 


More information about the hal-commit mailing list