hal: Branch 'master' - 5 commits

Danny Kukawka dkukawka at kemper.freedesktop.org
Wed Oct 22 06:52:34 PDT 2008


 doc/spec/hal-spec-properties.xml |  121 +++++++++++++++++++++++++++++++--------
 hald/linux/blockdev.c            |   30 +++++++++
 hald/linux/device.c              |   60 +++++++++++++++++++
 3 files changed, 188 insertions(+), 23 deletions(-)

New commits:
commit a258202f18902be4f0cb0ab4730a74baa891a9f4
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Oct 22 15:51:38 2008 +0200

    fixed storage.bus spec to sort values in alphabetical order
    
    Fixed storage.bus spec to sort values in alphabetical order.

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 334e068..f950c28 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -4350,39 +4350,33 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
             </row>
             <row>
               <entry></entry>
-              <entry>ide</entry>
-              <entry></entry>
-              <entry>IDE or ATA interface</entry>
-            </row>
-            <row>
-              <entry></entry>
-              <entry>usb</entry>
+              <entry>bdi</entry>
               <entry></entry>
-              <entry>USB interface</entry>
+              <entry>BDI (Backing Device Information) interface</entry>
             </row>
             <row>
               <entry></entry>
-              <entry>ieee1394</entry>
+              <entry>ccw</entry>
               <entry></entry>
-              <entry>IEEE 1394 interface</entry>
+              <entry>IBM s390/s390x ccw interface</entry>
             </row>
             <row>
               <entry></entry>
-              <entry>scsi</entry>
+              <entry>ide</entry>
               <entry></entry>
-              <entry>SCSI interface</entry>
+              <entry>IDE or ATA interface</entry>
             </row>
             <row>
               <entry></entry>
-              <entry>sata</entry>
+              <entry>ieee1394</entry>
               <entry></entry>
-              <entry>SATA interface</entry>
+              <entry>IEEE 1394 interface</entry>
             </row>
             <row>
               <entry></entry>
-              <entry>pcmcia</entry>
+              <entry>linux_raid</entry>
               <entry></entry>
-              <entry>PCMCIA interface</entry>
+              <entry>Linux MD (multi disk) RAID device</entry>
             </row>
             <row>
               <entry></entry>
@@ -4392,15 +4386,15 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
             </row>
             <row>
               <entry></entry>
-              <entry>ccw</entry>
+              <entry>pci</entry>
               <entry></entry>
-              <entry>IBM s390/s390x ccw interface</entry>
+              <entry>PCI interface</entry>
             </row>
             <row>
               <entry></entry>
-              <entry>vio</entry>
+              <entry>pcmcia</entry>
               <entry></entry>
-              <entry>IBM pSeries/iSeries Vio interface</entry>
+              <entry>PCMCIA interface</entry>
             </row>
             <row>
               <entry></entry>
@@ -4410,21 +4404,27 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
             </row>
             <row>
               <entry></entry>
-              <entry>linux_raid</entry>
+              <entry>sata</entry>
               <entry></entry>
-              <entry>Linux MD (multi disk) RAID device</entry>
+              <entry>SATA interface</entry>
             </row>
             <row>
               <entry></entry>
-              <entry>pci</entry>
+              <entry>scsi</entry>
               <entry></entry>
-              <entry>PCI interface</entry>
+              <entry>SCSI interface</entry>
             </row>
             <row>
               <entry></entry>
-              <entry>bdi</entry>
+              <entry>usb</entry>
               <entry></entry>
-              <entry>BDI (Backing Device Information) interface</entry>
+              <entry>USB interface</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>vio</entry>
+              <entry></entry>
+              <entry>IBM pSeries/iSeries Vio interface</entry>
             </row>
             <row>
               <entry></entry>
commit 32f8cf992112a04578b89967e13635658c2ba59d
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Oct 22 15:43:55 2008 +0200

    add bdi to storage.bus spec
    
    Added bdi to storage.bus spec.

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 044df99..334e068 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -4422,6 +4422,12 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
             </row>
             <row>
               <entry></entry>
+              <entry>bdi</entry>
+              <entry></entry>
+              <entry>BDI (Backing Device Information) interface</entry>
+            </row>
+            <row>
+              <entry></entry>
               <entry></entry>
               <entry></entry>
               <entry></entry>
commit 52390cd9e5f1ce48eb9b486044369f0e10a7865b
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Oct 22 15:38:25 2008 +0200

    add support for bdi bases block devices
    
    Added support for bdi bases (virtual) block devices as e.g. cciss
    storage devices on newer kernel versions.
    
    Changed device handling to find parent of a virtual bdi block device
    by checking either target of the bdi link (if available) or search
    for existing devices with the parent dir as sysfs path.
    
    Allow bdi as storage bus.

diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
index ab42341..86a72e3 100644
--- a/hald/linux/blockdev.c
+++ b/hald/linux/blockdev.c
@@ -966,6 +966,32 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
 
 	}
 
+	/* handle virtual block devices */
+	if (parent == NULL && !is_fakevolume && !hotplug_event->reposted && (strstr(sysfs_path, "virtual") != NULL) ) {
+		char *link;
+		char *target;
+
+		HAL_INFO (("Check if this is a BDI based device ..."));
+                link = g_strdup_printf ("%s/bdi", sysfs_path);
+                if (g_file_test (link, G_FILE_TEST_IS_SYMLINK)) {
+                	target = resolve_symlink (link);
+	                if (target != NULL) {
+                		HAL_INFO (("Looks like a BDI based block device. Link->target: '%s' -> '%s'", link, target));
+				/* try to find the parent device to this link */
+				parent = hal_device_store_match_key_value_string (hald_get_gdl(), "linux.sysfs_path", target);
+			}
+			g_free (target);
+                } else {
+			char *parent_path = NULL;
+
+			HAL_INFO (("This wasn't a BDI base device. Check now if it is a slave device ..."));
+
+			parent_path = hal_util_get_parent_path (sysfs_path);
+			if (parent_path) 
+				parent = hal_device_store_match_key_value_string (hald_get_gdl(), "linux.sysfs_path", parent_path);
+		}
+	}
+
 	if (parent == NULL) {
 		HAL_INFO (("Ignoring hotplug event - no parent"));
 		goto error;
@@ -1193,6 +1219,10 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
 					physdev = d_it;
 					physdev_udi = udi_it;
 					hal_device_property_set_string (d, "storage.bus", "pci");
+				} else if (strcmp (bus, "bdi") == 0) {
+					physdev = d_it;
+					physdev_udi = udi_it;
+					hal_device_property_set_string (d, "storage.bus", "bdi");
 				}
 			}
 
commit 51b8fcd53c31997d6b6bced7f6d735da12205f87
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Oct 22 15:37:05 2008 +0200

    add bdi namespace to spec
    
    Added bdi namespace to spec.

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index ba25511..044df99 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -3177,6 +3177,77 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
       </informaltable>
     </sect2>
 
+    <sect2 id="device-properties-bdi">
+      <title>
+        bdi namespace
+      </title>
+      <para>
+	Devices backing a memory (mmap) region, called Backing Device 
+	Information (BDI), are represented by device objects where 
+	<literal>info.subsystem</literal> equals <literal>bdi</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>bdi.id</literal> (int)
+              </entry>
+              <entry></entry>
+              <entry>Yes</entry>
+              <entry>Device identification</entry>
+            </row>
+            <row>
+              <entry>
+                <literal>bdi.read_ahead_kb</literal> (int)
+              </entry>
+              <entry></entry>
+              <entry>No</entry>
+              <entry>
+		Size of the read-ahead window in kilobytes
+		For more information check the Linux kernel documentation
+	      </entry>
+            </row>
+            <row>
+              <entry>
+                <literal>bdi.min_ratio</literal> (int)
+              </entry>
+              <entry></entry>
+              <entry>No</entry>
+              <entry>
+		The 'min_ratio' parameter contains information about the 
+		minimum percentage of the write-back cache to a particular 
+		device.
+		For more information check the Linux kernel documentation
+	      </entry>
+            </row>
+            <row>
+              <entry>
+                <literal>bdi.max_ratio</literal> (int)
+              </entry>
+              <entry></entry>
+              <entry>No</entry>
+              <entry>
+		The 'max_ratio' parameter contains information about the 
+		maximum percentage of the write-back cache a particular 
+		device can use. 
+		For more information check the Linux kernel documentation
+	      </entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </informaltable>
+    </sect2>
+
     <sect2 id="device-properties-vio">
       <title>
         vio namespace
commit acae87869d452b989b167acabd09554bab28cc5d
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Oct 22 15:32:10 2008 +0200

    add support for the BDI subsystem
    
    Added support for the linux kernel BDI (Backing Device
    Information) subsystem, needed to support e.g. virtual
    block devices as e.g. cciss in newer kernel versions.

diff --git a/hald/linux/device.c b/hald/linux/device.c
index 11f79cd..9f4ab3d 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -127,6 +127,57 @@ backlight_compute_udi (HalDevice *d)
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
+bdi_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev,
+         const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *id;
+
+	d = NULL;
+
+	if (parent_dev == NULL) {
+	        parent_dev = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer");
+		if (parent_dev == NULL) {
+                	parent_dev = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer");
+			if (parent_dev == NULL) {
+				HAL_ERROR (("Device '%s' has no parent and couldn't find computer root object."));
+				goto error;
+			}
+		}
+        }
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	hal_device_property_set_string (d, "info.category", "bdi");
+	hal_device_add_capability (d, "bdi");
+	hal_device_property_set_string (d, "info.product", "Backing Device Information Device");
+
+	id = hal_util_get_last_element (sysfs_path);
+	hal_device_property_set_string (d, "bdi.id", id);	
+
+	hal_util_set_int_from_file (d, "bdi.read_ahead_kb", sysfs_path, "read_ahead_kb", 10);
+	hal_util_set_int_from_file (d, "bdi.min_ratio", sysfs_path, "min_ratio", 10);
+	hal_util_set_int_from_file (d, "bdi.max_ratio", sysfs_path, "max_ratio", 10);
+
+error:
+	return d;
+}
+
+static gboolean
+bdi_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hald_compute_udi (udi, sizeof (udi), "%s_bdi_%s", hal_device_property_get_string (d, "info.parent"),
+							  hal_device_property_get_string (d, "bdi.id"));
+	hal_device_set_udi (d, udi);
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
 bluetooth_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, 
 	       const gchar *parent_path)
 {
@@ -1390,7 +1441,6 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 	gint flags;
 	gint addr_len;
 
-	d = NULL;
 	d = hal_device_new ();
 
 	if (parent_dev == NULL) {
@@ -4030,6 +4080,13 @@ static DevHandler dev_handler_backlight =
        .remove       = dev_remove
 };
 
+static DevHandler dev_handler_bdi = {
+	.subsystem   = "bdi",
+	.add         = bdi_add,
+	.compute_udi = bdi_compute_udi,
+	.remove      = dev_remove
+};
+
 static DevHandler dev_handler_bluetooth = 
 { 
 	.subsystem    = "bluetooth",
@@ -4374,6 +4431,7 @@ static DevHandler dev_handler_xen = {
 
 static DevHandler *dev_handlers[] = {
 	&dev_handler_backlight,
+	&dev_handler_bdi,
 	&dev_handler_bluetooth,
 	&dev_handler_ccw,
 	&dev_handler_ccwgroup,


More information about the hal-commit mailing list