hal/hald/linux hald_helper.h, 1.4, 1.5 net_class_device.c, 1.17,
1.18 osspec.c, 1.42, 1.43
David Zeuthen
david at freedesktop.org
Thu Sep 16 15:04:17 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv3493/hald/linux
Modified Files:
hald_helper.h net_class_device.c osspec.c
Log Message:
2004-09-16 David Zeuthen <david at fubar.dk>
Revisit networking. Basically a) split ethernet and wireless into
net.80203 and net.80211 properties; b) support renaming of
devices; c) use uint64 datatype; d) add property for whether an
interface is up and track this; and e) general cleanups when
properties are available and not
* doc/spec/hal-spec.xml.in: Update spec with changes made. Also
add uint64 property type
* hald/device_store.c (hal_device_store_match_key_value_int): New
function
* hald/device_store.h: Add prototype for function
hal_device_store_match_key_value_int
* hald/linux/hald_helper.h: Add net_ifindex member
* hald/linux/net_class_device.c:
(mii_get_rate): Rename net.ethernet.rate to net.80203.rate and make
the type uint64
(mii_get_link): Rename net.ethernet.link to net.80203.link
(set_device_link_status): Remove function
(link_detection_handle_message): Also listen for interface up/down
messages on the netlink socket; maintains net.interface_up. Also
handle renaming messages. Remove net.80203.* properties if the
interface is down. Remove net.80203.rate if net.80203.link is FALSE.
Only check rate for net.80203 devices (fixes crasher for my new
Atheros card; remember?)
(net_class_pre_process): Rename from net.ethernet to net.80203 and
also have separate net.80211 namespace. Add net.interface_up and
net.linux.ifindex properties. Set net.{80203,80211}.mac_address
as a uint64 rather than net.ethernet.{mac_addr,mac_addr_upper24,
mac_addr_lower24}.
(net_class_accept): Small reorg of code
(net_class_post_merge): Always start listening to netlink socket
* hald/linux/osspec.c:
(process_coldplug_list): Use NULL for hotplug_msg when invoking
add_device
(recover_net_device): New function
(add_device): Use net_ifindex and recover net device to handle
renaming of networking devices by udev and/or initscripts. Now
optionally uses the hotplug msg which may be NULL.
(rem_device): Optionally use the hotplug msg which may be NULL.
(hald_helper_hotplug): Pass on hotplug msg
(hald_helper_device_name): Pass on hotplug msg
(hald_helper_hotplug_process_queue): Pass on hotplug msg
(hald_helper_data): Pass on hotplug msg
* tools/linux/hal_hotplug.c:
(wait_for_sysfs_info): Wait for ifindex for net devices and
extract the value
(main): pass on net_ifindex value to hotplug msg
Index: hald_helper.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/hald_helper.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- hald_helper.h 14 Sep 2004 12:26:24 -0000 1.4
+++ hald_helper.h 16 Sep 2004 22:04:15 -0000 1.5
@@ -44,6 +44,7 @@
char subsystem[HALD_HELPER_STRLEN]; /**< subsystem e.g. usb, pci (only for hotplug msg) */
char sysfs_path[HALD_HELPER_STRLEN]; /**< path into sysfs without sysfs mountpoint, e.g. /block/sda */
char device_name[HALD_HELPER_STRLEN]; /**< absolute path of device node (only for device msg) */
+ int net_ifindex; /**< For networking class devices only; the value of the ifindex file */
};
#endif /* HALD_HELPER_H */
Index: net_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/net_class_device.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- net_class_device.c 1 Sep 2004 17:38:58 -0000 1.17
+++ net_class_device.c 16 Sep 2004 22:04:15 -0000 1.18
@@ -53,6 +53,7 @@
#include "../logger.h"
#include "../device_store.h"
#include "../hald.h"
+#include "../hald_dbus.h"
#include "class_device.h"
#include "common.h"
@@ -187,11 +188,11 @@
if (res < 0) {
HAL_WARNING (("Error reading rate info"));
} else if (link_word & 0x380) {
- hal_device_property_set_int (d, "net.ethernet.rate",
- 100 * 1000 * 1000);
+ hal_device_property_set_uint64 (d, "net.80203.rate",
+ 100 * 1000 * 1000);
} else if (link_word & 0x60) {
- hal_device_property_set_int (d, "net.ethernet.rate",
- 10 * 1000 * 1000);
+ hal_device_property_set_uint64 (d, "net.80203.rate",
+ 10 * 1000 * 1000);
}
close (sockfd);
@@ -251,9 +252,9 @@
if (res < 0)
HAL_WARNING (("Error reading link info"));
else if ((status_word & 0x0016) == 0x0004)
- hal_device_property_set_bool (d, "net.ethernet.link", TRUE);
+ hal_device_property_set_bool (d, "net.80203.link", TRUE);
else
- hal_device_property_set_bool (d, "net.ethernet.link", FALSE);
+ hal_device_property_set_bool (d, "net.80203.link", FALSE);
/* Also get the link rate */
mii_get_rate (d);
@@ -261,45 +262,6 @@
close (sockfd);
}
-
-struct FindDevInfo {
- gboolean link_up;
- char *ifname;
-};
-
-static gboolean
-set_device_link_status (HalDeviceStore *store, HalDevice *device,
- gpointer user_data)
-{
- struct FindDevInfo *info = user_data;
- const char * dev_value;
-
- /* no link check on 802.11x devices */
- if (hal_device_has_capability (device, "net.ethernet.80211"))
- return TRUE;
-
- if (hal_device_property_get_type (device,
- "net.interface") != DBUS_TYPE_STRING)
- return TRUE;
-
- dev_value = hal_device_property_get_string (device, "net.interface");
-
- if (dev_value != NULL && strcmp (dev_value, info->ifname) == 0) {
- hal_device_property_set_bool (device, "net.ethernet.link",
- info->link_up);
-
- /*
- * Check the MII registers to set our link rate if we haven't
- * set it previously.
- */
- if (!hal_device_has_property (device, "net.ethernet.rate"))
- mii_get_rate (device);
- }
-
- return TRUE;
-}
-
-
static void
link_detection_handle_message (struct nlmsghdr *hdr)
{
@@ -307,7 +269,8 @@
char ifname[1024];
struct rtattr *attr;
int attr_len;
- struct FindDevInfo dev_info;
+ HalDevice *d;
+ const char *hal_ifname;
ifinfo = NLMSG_DATA (hdr);
@@ -323,10 +286,10 @@
while (RTA_OK (attr, attr_len)) {
if (attr->rta_type == IFLA_IFNAME) {
- int l = RTA_PAYLOAD (attr);
+ unsigned int l = RTA_PAYLOAD (attr);
- if (l > 1023)
- l = 1023;
+ if (l > sizeof (ifname) - 1)
+ l = sizeof (ifname) - 1;
strncpy (ifname, RTA_DATA (attr), l);
}
@@ -334,15 +297,83 @@
attr = RTA_NEXT (attr, attr_len);
}
- if (strlen (ifname) > 0) {
- dev_info.link_up =
- ifinfo->ifi_flags & IFF_RUNNING ? TRUE : FALSE;
- dev_info.ifname = &ifname[0];
+ /* bail out if there is no interface name */
+ if (strlen (ifname) == 0)
+ goto out;
- hal_device_store_foreach (hald_get_gdl (),
- set_device_link_status,
- &dev_info);
+ HAL_INFO (("type=0x%02x, SEQ=%d, ifi_flags=0x%04x, ifi_change=0x%04x, ifi_index=%d, ifname='%s'",
+ hdr->nlmsg_type,
+ hdr->nlmsg_seq,
+ ifinfo->ifi_flags,
+ ifinfo->ifi_change,
+ ifinfo->ifi_index,
+ ifname));
+
+ /* find hal device object this event applies to */
+ d = hal_device_store_match_key_value_int (hald_get_gdl (), "net.linux.ifindex", ifinfo->ifi_index);
+ if (d == NULL) {
+ HAL_WARNING (("No HAL device object corresponding to ifindex=%d, ifname='%s'",
+ ifinfo->ifi_index, ifname));
+ goto out;
}
+
+ device_property_atomic_update_begin ();
+ {
+
+ /* handle link changes */
+ if (ifinfo->ifi_flags & IFF_RUNNING) {
+ if (hal_device_has_capability (d, "net.80203")) {
+ if (!hal_device_property_get_bool (d, "net.80203.link")) {
+ hal_device_property_set_bool (d, "net.80203.link", TRUE);
+ mii_get_rate (d);
+ }
+ }
+ } else {
+ if (hal_device_has_capability (d, "net.80203")) {
+ if (hal_device_property_get_bool (d, "net.80203.link")) {
+ hal_device_property_set_bool (d, "net.80203.link", FALSE);
+ /* only have rate when we have a link */
+ hal_device_property_remove (d, "net.80203.rate");
+ }
+ }
+ }
+
+ /* handle events for renaming */
+ hal_ifname = hal_device_property_get_string (d, "net.interface");
+ if (hal_ifname != NULL && strcmp (hal_ifname, ifname) != 0) {
+ char new_sysfs_path[256];
+ const char *sysfs_path;
+ char *p;
+
+ HAL_INFO (("Net interface '%s' renamed to '%s'", hal_ifname, ifname));
+
+ hal_device_property_set_string (d, "net.interface", ifname);
+
+ sysfs_path = hal_device_property_get_string (d, "net.linux.sysfs_path");
+ strncpy (new_sysfs_path, sysfs_path, sizeof (new_sysfs_path) - 1);
+ p = strrchr (new_sysfs_path, '/');
+ if (p != NULL) {
+ strncpy (p + 1, ifname, sizeof (new_sysfs_path) - 1 - (p + 1 - new_sysfs_path));
+ hal_device_property_set_string (d, "net.linux.sysfs_path", new_sysfs_path);
+ }
+ }
+
+ /* handle up/down status */
+ if (ifinfo->ifi_flags & IFF_UP) {
+ if (!hal_device_property_get_bool (d, "net.interface_up")) {
+ hal_device_property_set_bool (d, "net.interface_up", TRUE);
+ }
+ } else {
+ if (hal_device_property_get_bool (d, "net.interface_up")) {
+ hal_device_property_set_bool (d, "net.interface_up", FALSE);
+ }
+ }
+
+ }
+ device_property_atomic_update_end ();
+
+out:
+ return;
}
#define VALID_NLMSG(h, s) ((NLMSG_OK (h, s) && \
@@ -387,6 +418,7 @@
while (offset < total_read &&
VALID_NLMSG (hdr, total_read - offset)) {
+
if (hdr->nlmsg_type == NLMSG_DONE)
break;
@@ -469,6 +501,8 @@
char wireless_path[SYSFS_PATH_MAX];
struct sysfs_directory *wireless_dir;
dbus_bool_t is_80211 = FALSE;
+ int ifindex;
+ int flags;
hal_device_property_set_string (d, "net.linux.sysfs_path", sysfs_path);
hal_device_property_set_string (d, "net.interface",
@@ -481,7 +515,7 @@
if (sysfs_read_directory (wireless_dir) >= 0) {
if (wireless_dir->attributes != NULL) {
- hal_device_add_capability (d, "net.ethernet.80211");
+ hal_device_add_capability (d, "net.80211");
is_80211 = TRUE;
}
@@ -490,93 +524,124 @@
attr = sysfs_get_classdev_attr (class_device, "address");
-
if (attr != NULL) {
address = g_strstrip (g_strdup (attr->value));
hal_device_property_set_string (d, "net.address", address);
}
attr = sysfs_get_classdev_attr (class_device, "type");
-
- if (attr != NULL)
+ if (attr != NULL) {
media_type = parse_dec (attr->value);
+ }
+
+ attr = sysfs_get_classdev_attr (class_device, "flags");
+ if (attr != NULL) {
+ flags = parse_hex (attr->value);
+ hal_device_property_set_bool (d, "net.interface_up", flags & IFF_UP);
+ if (!is_80211) {
+ /* TODO: for some reason IFF_RUNNING isn't exported in flags */
+ /*hal_device_property_set_bool (d, "net.80203.link", flags & IFF_RUNNING);*/
+ mii_get_link (d);
+ }
+ }
+
+ attr = sysfs_get_classdev_attr (class_device, "ifindex");
+ if (attr != NULL) {
+ ifindex = parse_dec (attr->value);
+ hal_device_property_set_int (d, "net.linux.ifindex", ifindex);
+ }
/* FIXME: Other address types for non-ethernet devices */
if (address != NULL && media_type == ARPHRD_ETHER) {
unsigned int a5, a4, a3, a2, a1, a0;
- hal_device_property_set_string (d, "net.ethernet.mac_addr",
- address);
-
if (sscanf (address, "%x:%x:%x:%x:%x:%x",
&a5, &a4, &a3, &a2, &a1, &a0) == 6) {
- dbus_uint32_t mac_upper, mac_lower;
-
- mac_upper = (a5 << 16) | (a4 << 8) | a3;
- mac_lower = (a2 << 16) | (a1 << 8) | a0;
+ dbus_uint64_t mac_address;
- hal_device_property_set_int (d, "net.ethernet.mac_addr_upper24",
- (dbus_int32_t) mac_upper);
- hal_device_property_set_int (d, "net.ethernet.mac_addr_lower24",
- (dbus_int32_t) mac_lower);
+ mac_address =
+ ((dbus_uint64_t)a5<<40) |
+ ((dbus_uint64_t)a4<<32) |
+ ((dbus_uint64_t)a3<<24) |
+ ((dbus_uint64_t)a2<<16) |
+ ((dbus_uint64_t)a1<< 8) |
+ ((dbus_uint64_t)a0<< 0);
/* TODO: comment out when 64-bit python patch is in dbus */
- /*hal_device_property_set_uint64 (d, "net.ethernet.address",
- (dbus_uint64_t) ((mac_upper<<24) | mac_lower));*/
+ hal_device_property_set_uint64 (d, is_80211 ? "net.80211.mac_address" : "net.80203.mac_address",
+ mac_address);
}
- /* Get the initial link state from the MII registers */
- if (!is_80211)
- mii_get_link (d);
}
-
g_free (address);
+ if (hal_device_has_property (d, "net.80203.link") &&
+ hal_device_property_get_bool (d, "net.80203.link")) {
+ mii_get_rate (d);
+ }
+
hal_device_property_set_int (d, "net.arp_proto_hw_id", media_type);
media = media_type_to_string (media_type);
hal_device_property_set_string (d, "net.media", media);
hal_device_add_capability (d, "net");
- hal_device_add_capability (d, "net.ethernet");
- hal_device_property_set_string (d, "info.category", "net.ethernet");
+ if (is_80211) {
+ hal_device_property_set_string (d, "info.category", "net.80211");
+ hal_device_add_capability (d, "net.80211");
+ } else {
+ hal_device_property_set_string (d, "info.category", "net.80203");
+ hal_device_add_capability (d, "net.80203");
+ }
}
static dbus_bool_t
net_class_accept (ClassDeviceHandler *self, const char *path,
struct sysfs_class_device *class_device)
{
- struct sysfs_attribute *attr;
+ gboolean accept;
+ struct sysfs_attribute *attr = NULL;
+
+ accept = TRUE;
/* If the class name isn't 'net', deny it. */
- if (strcmp (class_device->classname, self->sysfs_class_name) != 0)
- return FALSE;
+ if (strcmp (class_device->classname, self->sysfs_class_name) != 0) {
+ accept = FALSE;
+ goto out;
+ }
/* If we have a sysdevice, allow it. */
- if (class_device->sysdevice != NULL)
- return TRUE;
+ if (class_device->sysdevice != NULL) {
+ accept = TRUE;
+ goto out;
+ }
/*
* Get the "type" attribute from sysfs to see if this is a
* network device we're interested in.
*/
attr = sysfs_get_classdev_attr (class_device, "type");
-
- if (attr == NULL || attr->value == NULL)
- return FALSE;
+ if (attr == NULL || attr->value == NULL) {
+ accept = FALSE;
+ goto out;
+ }
/* 1 is the type for ethernet (incl. wireless) devices */
- if (attr->value[0] == '1')
- return TRUE;
- else
- return FALSE;
+ if (attr->value[0] == '1') {
+ accept = TRUE;
+ goto out;
+ } else {
+ accept = FALSE;
+ }
+
+out:
+ return accept;
}
static void
net_class_post_merge (ClassDeviceHandler *self, HalDevice *d)
{
- if (hal_device_has_capability (d, "net.ethernet"))
- link_detection_init (d);
+ link_detection_init (d);
}
static char *
Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/osspec.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- osspec.c 14 Sep 2004 12:26:24 -0000 1.42
+++ osspec.c 16 Sep 2004 22:04:15 -0000 1.43
@@ -117,11 +117,13 @@
static void hotplug_sem_up (void);
static void hotplug_sem_down (void);
-static void hald_helper_hotplug (gchar *action, guint64 seqnum, gchar *subsystem, gchar *sysfs_path);
-static void hald_helper_device_name (gchar *action, guint64 seqnum, gchar *subsystem, gchar *sysfs_path, gchar *device_name);
+static void hald_helper_hotplug (gchar *action, guint64 seqnum, gchar *subsystem,
+ gchar *sysfs_path, struct hald_helper_msg *msg);
+static void hald_helper_device_name (gchar *action, guint64 seqnum, gchar *subsystem,
+ gchar *sysfs_path, gchar *device_name, struct hald_helper_msg *msg);
static gboolean hald_helper_data (GIOChannel *source, GIOCondition condition, gpointer user_data);
-static HalDevice *add_device (const char *sysfs_path, const char *subsystem);
+static HalDevice *add_device (const char *sysfs_path, const char *subsystem, struct hald_helper_msg *msg);
/** Mount path for sysfs */
char sysfs_mount_path[SYSFS_PATH_MAX];
@@ -750,7 +752,7 @@
coldplug_list = g_slist_delete_link (coldplug_list, coldplug_list);
HAL_INFO (("handling %s %s", path, subsystem));
- device = add_device (path, subsystem);//visit_device (path, NULL, FALSE, 0);
+ device = add_device (path, subsystem, NULL);//visit_device (path, NULL, FALSE, 0);
g_free (path);
g_free (subsystem);
g_free (pair);
@@ -837,16 +839,63 @@
hal_callout_device (root, TRUE);
}
+static gboolean
+recover_net_device (int net_ifindex, char *sysfs_path, size_t sysfs_path_size)
+{
+ GDir *dir;
+ char path[SYSFS_PATH_MAX];
+ char path1[SYSFS_PATH_MAX];
+ GError *err = NULL;
+ const gchar *f;
+
+ g_snprintf (path, SYSFS_PATH_MAX, "%s/class/net" , sysfs_mount_path);
+ if ((dir = g_dir_open (path, 0, &err)) == NULL) {
+ HAL_ERROR (("Unable to open %/class/net: %s", sysfs_mount_path, err->message));
+ g_error_free (err);
+ return FALSE;
+ }
+ while ((f = g_dir_read_name (dir)) != NULL) {
+ FILE *file;
+
+ g_snprintf (path1, SYSFS_PATH_MAX, "%s/class/net/%s/ifindex" , sysfs_mount_path, f);
+ HAL_INFO (("Looking at %s", path1));
+
+ file = fopen (path1, "r");
+ if (file != NULL) {
+ char buf[80];
+ int found_ifindex;
+
+ memset (buf, 0, sizeof (buf));
+ fread (buf, sizeof (buf) - 1, 1, file);
+ fclose (file);
+
+ found_ifindex = atoi(buf);
+ if (found_ifindex == net_ifindex) {
+ g_snprintf (sysfs_path, sysfs_path_size, "%s/class/net/%s" , sysfs_mount_path, f);
+ g_dir_close (dir);
+ return TRUE;
+ }
+ }
+
+ }
+ g_dir_close (dir);
+
+ return FALSE;
+}
+
static HalDevice *
-add_device (const char *sysfs_path, const char *subsystem)
+add_device (const char *given_sysfs_path, const char *subsystem, struct hald_helper_msg *msg) /* msg may be NULL */
{
int i;
int len1;
int len2;
char buf1[SYSFS_PATH_MAX];
char buf2[SYSFS_PATH_MAX];
+ char sysfs_path[SYSFS_PATH_MAX];
HalDevice *hal_device = NULL;
+ strncpy (sysfs_path, given_sysfs_path, SYSFS_PATH_MAX);
+
len1 = snprintf (buf1, SYSFS_PATH_MAX, "%s/block", sysfs_mount_path);
len2 = snprintf (buf2, SYSFS_PATH_MAX, "%s/class", sysfs_mount_path);
if (strncmp (sysfs_path, buf1, len1) == 0 || strncmp (sysfs_path, buf2, len2) == 0) {
@@ -856,9 +905,32 @@
class_device = sysfs_open_class_device_path (sysfs_path);
if (class_device == NULL) {
- HAL_WARNING (("Coulnd't get sysfs class device object at "
- "path %s", sysfs_path));
- return NULL;
+
+ if (msg != NULL && msg->net_ifindex >= 0 && strcmp (subsystem, "net") == 0) {
+ /* Hey, special case net devices; some hotplug script might have renamed it..
+ * So, our hotplug helper reads the ifindex file for us so we can recover it.
+ *
+ * This is quite a hack; once hotplug and netlink networking messages are
+ * properly interleaved (with SEQNUM and stuff) this problem will go away;
+ * until then we need to live with this hack :-/
+ */
+ HAL_INFO (("Attempting to recover renamed netdevice with ifindex=%d",
+ msg->net_ifindex));
+ /* traverse all /sys/class/net/<netdevice> and check ifindex file */
+ if (recover_net_device (msg->net_ifindex, sysfs_path, sizeof (sysfs_path))) {
+ class_device = sysfs_open_class_device_path (sysfs_path);
+ if (class_device == NULL) {
+ HAL_INFO (("%s didn't work...", sysfs_path));
+ return NULL;
+ } else {
+ HAL_INFO (("%s worked!", sysfs_path));
+ }
+ }
+
+ } else {
+ HAL_WARNING (("Coulnd't get sysfs class device object at path %s", sysfs_path));
+ return NULL;
+ }
}
sysfs_get_classdev_device(class_device);
sysfs_get_classdev_driver(class_device);
@@ -906,7 +978,7 @@
}
static HalDevice *
-rem_device (const char *sysfs_path, const char *subsystem)
+rem_device (const char *sysfs_path, const char *subsystem, struct hald_helper_msg *msg) /* msg may be NULL */
{
int i;
int len1;
@@ -1145,7 +1217,7 @@
static void
-hald_helper_hotplug (gchar *action, guint64 seqnum, gchar *subsystem, gchar *sysfs_path)
+hald_helper_hotplug (gchar *action, guint64 seqnum, gchar *subsystem, gchar *sysfs_path, struct hald_helper_msg *msg)
{
HalDevice *d = NULL;
char sysfs_path_full[SYSFS_PATH_MAX];
@@ -1156,7 +1228,7 @@
action, seqnum, subsystem, sysfs_path_full));
if (strcmp(action, "add") == 0) {
- d = add_device (sysfs_path_full, subsystem);
+ d = add_device (sysfs_path_full, subsystem, msg);
/* if device is not already added, disable hotplug processing
* and enable it again when the device has processed all the
@@ -1182,7 +1254,8 @@
}
}
} else if (strcmp(action, "remove") == 0){
- d = rem_device (sysfs_path_full, subsystem);
+ d = rem_device (sysfs_path_full, subsystem, msg);
+
/* if device is not already removed, disable hotplug processing
* and enable it again when the device has processed all the
* callouts
@@ -1203,7 +1276,8 @@
}
static void
-hald_helper_device_name (gchar *action, guint64 seqnum, gchar *subsystem, gchar *sysfs_path, gchar *device_name)
+hald_helper_device_name (gchar *action, guint64 seqnum, gchar *subsystem,
+ gchar *sysfs_path, gchar *device_name, struct hald_helper_msg *msg)
{
char sysfs_path_full[SYSFS_PATH_MAX];
@@ -1267,7 +1341,7 @@
/* yup, found it */
last_hotplug_seqnum = msg->seqnum;
hald_helper_hotplug (msg->action, msg->seqnum, g_strdup (msg->subsystem),
- g_strdup (msg->sysfs_path));
+ g_strdup (msg->sysfs_path), msg);
g_free (msg);
hotplug_queue = g_list_delete_link (hotplug_queue, i);
goto trynext;
@@ -1390,7 +1464,7 @@
switch (msg.type) {
case HALD_DEVD:
hald_helper_device_name (msg.action, msg.seqnum, g_strdup (msg.subsystem),
- g_strdup (msg.sysfs_path), g_strdup (msg.device_name));
+ g_strdup (msg.sysfs_path), g_strdup (msg.device_name), &msg);
break;
case HALD_HOTPLUG:
/* need to process hotplug events in proper sequence */
@@ -1422,14 +1496,15 @@
/* have to process immediately other we may deadlock due to
* the hotplug semaphore */
hald_helper_hotplug (msg.action, msg.seqnum, g_strdup (msg.subsystem),
- g_strdup (msg.sysfs_path));
+ g_strdup (msg.sysfs_path), &msg);
/* still need to process the queue though */
hald_helper_hotplug_process_queue ();
goto out;
}
/* Queue up this hotplug event and process the queue */
- HAL_INFO (("Queing up seqnum=%llu, sysfspath=%s, subsys=%s", msg.seqnum, msg.sysfs_path, msg.subsystem));
+ HAL_INFO (("Queing up seqnum=%llu, sysfspath=%s, subsys=%s",
+ msg.seqnum, msg.sysfs_path, msg.subsystem));
hotplug_queue = g_list_append (hotplug_queue, g_memdup (&msg, sizeof (struct hald_helper_msg)));
hald_helper_hotplug_process_queue ();
break;
More information about the hal-commit
mailing list