diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2008-12-15 17:51:44 +1100 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-12-15 17:51:44 +1100 |
commit | 1a44c3bf2503b12c78c205676d903fbb05fb7ef0 (patch) | |
tree | fb47fe2392320929041e15d88ed448581730465e /discover/udev.c | |
parent | 898665e37e7e373f9a54ce288debbe365b28b60b (diff) | |
download | talos-petitboot-1a44c3bf2503b12c78c205676d903fbb05fb7ef0.tar.gz talos-petitboot-1a44c3bf2503b12c78c205676d903fbb05fb7ef0.zip |
Hook up udev events to device handler
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/udev.c')
-rw-r--r-- | discover/udev.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/discover/udev.c b/discover/udev.c index 9c1b399..16d050e 100644 --- a/discover/udev.c +++ b/discover/udev.c @@ -15,12 +15,14 @@ #include "log.h" #include "waiter.h" #include "pb-discover.h" +#include "device-handler.h" #define PBOOT_DEVICE_SOCKET "/tmp/petitboot.udev" #define max(a, b) ((a) > (b) ? (a) : (b)) struct udev { + struct device_handler *handler; int socket; }; @@ -132,6 +134,8 @@ static void handle_udev_message(struct udev *udev, char *buf, int len) print_event(event); + device_handler_event(udev->handler, event); + talloc_free(event); return; @@ -168,7 +172,7 @@ static int udev_destructor(void *p) return 0; } -struct udev *udev_init(void) +struct udev *udev_init(struct device_handler *handler) { struct sockaddr_un addr; struct udev *udev; @@ -177,6 +181,8 @@ struct udev *udev_init(void) udev = talloc(NULL, struct udev); + udev->handler = handler; + udev->socket = socket(PF_UNIX, SOCK_DGRAM, 0); if (udev->socket < 0) { pb_log("Error creating udev socket: %s\n", strerror(errno)); |