summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys-apps/hal/ChangeLog7
-rw-r--r--sys-apps/hal/files/fix-scsi-fake-host-event.patch107
-rw-r--r--sys-apps/hal/hal-0.5.9_rc2.ebuild3
3 files changed, 115 insertions, 2 deletions
diff --git a/sys-apps/hal/ChangeLog b/sys-apps/hal/ChangeLog
index c0f5e5b6cd90..94f37c0587e9 100644
--- a/sys-apps/hal/ChangeLog
+++ b/sys-apps/hal/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for sys-apps/hal
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/ChangeLog,v 1.136 2007/03/30 14:37:01 cardoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/ChangeLog,v 1.137 2007/03/30 23:25:44 steev Exp $
+
+ 30 Mar 2007; Steev Klimaszewski <steev@gentoo.org>
+ +files/fix-scsi-fake-host-event.patch, hal-0.5.9_rc2.ebuild:
+ Patch for scsi devices that don't have parents... this will fix the "hald
+ won't start" errors.
30 Mar 2007; Doug Goldstein <cardoe@gentoo.org> metadata.xml,
-hal-0.5.7-r3.ebuild, -hal-0.5.7.1-r4.ebuild:
diff --git a/sys-apps/hal/files/fix-scsi-fake-host-event.patch b/sys-apps/hal/files/fix-scsi-fake-host-event.patch
new file mode 100644
index 000000000000..8101a788f7d4
--- /dev/null
+++ b/sys-apps/hal/files/fix-scsi-fake-host-event.patch
@@ -0,0 +1,107 @@
+diff --git a/hald/linux/device.c b/hald/linux/device.c
+index d109e9b..1211535 100644
+--- a/hald/linux/device.c
++++ b/hald/linux/device.c
+@@ -533,27 +533,52 @@ missing_scsi_host (const gchar *sysfs_pa
+ gchar path[HAL_PATH_MAX];
+ HalDevice *d;
+ HotplugEvent *host_event;
++ const gchar *last_elem;
++ gint host_num, bus_num, target_num, lun_num;
++ int max;
++ gint num = -1;
+ int rc = FALSE;
+
+- g_strlcpy(path, sysfs_path, sizeof(path));
+- /* skip device */
+- if (!hal_util_path_ascend (path))
++ /* catch only scsi-devices */
++ last_elem = hal_util_get_last_element (sysfs_path);
++ if (sscanf (last_elem, "%d:%d:%d:%d", &host_num, &bus_num, &target_num, &lun_num) != 4)
+ goto out;
+- /* skip target */
+- if (!hal_util_path_ascend (path))
++
++ /* avoid loops */
++ if (device_event->reposted)
+ goto out;
+- if (strstr (path, "/host") == NULL)
++
++ /* search devpath for missing host */
++ g_strlcpy(path, sysfs_path, sizeof(path));
++ max = 100;
++ while (max--) {
++ if (!hal_util_path_ascend (path))
++ goto out;
++
++ last_elem = hal_util_get_last_element (path);
++ if (sscanf (last_elem, "host%d", &num) == 1)
++ break;
++ }
++
++ /* the device must belong to this host */
++ if (host_num != num)
+ goto out;
+
++ /* look if host is present */
+ d = hal_device_store_match_key_value_string (hald_get_gdl (),
+ "linux.sysfs_path",
+ path);
++
++ /* skip "add" if host is already created */
+ if (action == HOTPLUG_ACTION_ADD && d != NULL)
+ goto out;
++
++ /* skip "remove" if host does not exist */
+ if (action == HOTPLUG_ACTION_REMOVE && d == NULL)
+ goto out;
+- rc = TRUE;
+
++ /* fake host event */
++ rc = TRUE;
+ host_event = g_new0 (HotplugEvent, 1);
+ host_event->action = action;
+ host_event->type = HOTPLUG_EVENT_SYSFS_DEVICE;
+@@ -561,15 +586,17 @@ missing_scsi_host (const gchar *sysfs_pa
+ g_strlcpy (host_event->sysfs.sysfs_path, path, sizeof (host_event->sysfs.sysfs_path));
+ host_event->sysfs.net_ifindex = -1;
+
++ /* insert host before our event, so we can see it as parent */
+ if (action == HOTPLUG_ACTION_ADD) {
+ hotplug_event_enqueue_at_front (device_event);
+ hotplug_event_enqueue_at_front (host_event);
+ hotplug_event_reposted (device_event);
+ goto out;
+ }
++
++ /* remove host */
+ if (action == HOTPLUG_ACTION_REMOVE)
+ hotplug_event_enqueue (host_event);
+-
+ out:
+ return rc;
+ }
+diff --git a/hald/linux/hotplug.c b/hald/linux/hotplug.c
+index 986b96c..96c8540 100644
+--- a/hald/linux/hotplug.c
++++ b/hald/linux/hotplug.c
+@@ -74,6 +74,7 @@ hotplug_event_reposted (void *end_token)
+ {
+ HotplugEvent *hotplug_event = (HotplugEvent *) end_token;
+
++ hotplug_event->reposted = TRUE;
+ hotplug_events_in_progress = g_slist_remove (hotplug_events_in_progress, hotplug_event);
+ }
+
+diff --git a/hald/linux/hotplug.h b/hald/linux/hotplug.h
+index 2daf982..b9c3501 100644
+--- a/hald/linux/hotplug.h
++++ b/hald/linux/hotplug.h
+@@ -54,6 +54,7 @@ typedef struct
+ {
+ HotplugActionType action; /* Whether the event is add or remove */
+ HotplugEventType type; /* Type of event */
++ gboolean reposted; /* Avoid loops */
+
+ void (*free_function) (gpointer data);
+
diff --git a/sys-apps/hal/hal-0.5.9_rc2.ebuild b/sys-apps/hal/hal-0.5.9_rc2.ebuild
index eeb222595b7f..667333fbcc82 100644
--- a/sys-apps/hal/hal-0.5.9_rc2.ebuild
+++ b/sys-apps/hal/hal-0.5.9_rc2.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/hal-0.5.9_rc2.ebuild,v 1.1 2007/03/30 05:46:53 steev Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/hal-0.5.9_rc2.ebuild,v 1.2 2007/03/30 23:25:44 steev Exp $
inherit eutils linux-info autotools flag-o-matic
@@ -89,6 +89,7 @@ src_unpack() {
unpack ${A}
cd ${S}
epatch ${FILESDIR}/${PN}-0.5.7-plugdev-allow-send.patch
+ epatch ${FILESDIR}/fix-scsi-fake-host-event.patch
}
src_compile() {