summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-05-08 20:36:37 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-05-09 08:35:57 +0800
commitdc77d447920c6af88009ceea8b23a2172701d32b (patch)
treed3cbe41b18bff1f32df3dd2b25f2541e7e95ca56 /discover
parent0a4cb93c1c7c7e6f8c5324314457b96072158975 (diff)
downloadtalos-petitboot-dc77d447920c6af88009ceea8b23a2172701d32b.tar.gz
talos-petitboot-dc77d447920c6af88009ceea8b23a2172701d32b.zip
discover/udev: Setup event params from udev properties
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover')
-rw-r--r--discover/udev.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/discover/udev.c b/discover/udev.c
index cd2a61e..7fc5595 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -50,22 +50,24 @@ static int udev_destructor(void *p)
return 0;
}
-static void print_device_properties(struct udev_device *dev)
+static void udev_setup_event_params(struct udev_device *dev,
+ struct event *event)
{
struct udev_list_entry *list, *entry;
- assert(dev);
+ list = udev_device_get_properties_list_entry(dev);
+ if (!list)
+ return;
- if (1) {
- list = udev_device_get_properties_list_entry(dev);
+ udev_list_entry_foreach(entry, list) {
+ DBG("property: %s - %s\n",
+ udev_list_entry_get_name(entry),
+ udev_device_get_property_value(dev,
+ udev_list_entry_get_name(entry)));
- assert(list);
+ event_set_param(event,udev_list_entry_get_name(entry),
+ udev_list_entry_get_value(entry));
- udev_list_entry_foreach(entry, list)
- DBG("property: %s - %s\n",
- udev_list_entry_get_name(entry),
- udev_device_get_property_value(dev,
- udev_list_entry_get_name(entry)));
}
}
@@ -122,18 +124,17 @@ static int udev_handle_dev_action(struct udev_device *dev, const char *action)
return 0;
}
- print_device_properties(dev);
-
event = talloc(NULL, struct event);
event->type = EVENT_TYPE_UDEV;
event->action = eva;
event->device = devpath;
- event->n_params = 1;
- event->params = talloc(event, struct param);
- event->params->name = "DEVNAME";
- event->params->value = devnode;
+ event->n_params = 0;
+ event->params = NULL;
+ event_set_param(event, "DEVNAME", devnode);
+
+ udev_setup_event_params(dev, event);
udev = udev_get_userdata(udev_device_get_udev(dev));
assert(udev);
OpenPOWER on IntegriCloud