summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2012-03-26 20:18:32 -0700
committerGeoff Levand <geoff@infradead.org>2012-03-26 20:18:32 -0700
commit7fed96b80c3e81ad73539c90310ab94166ff0229 (patch)
tree2dbf72c2ad30996120b86dcac2612ad568a3f67e /discover
parentf1dad9c1eb7cdc583a56734e9d46a1ce5bb755d5 (diff)
downloadpetitboot-7fed96b80c3e81ad73539c90310ab94166ff0229.zip
petitboot-7fed96b80c3e81ad73539c90310ab94166ff0229.tar.gz
pb-discover: Ignore ram, loop and no-name devices
Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'discover')
-rw-r--r--discover/device-handler.c6
-rw-r--r--discover/udev.c22
2 files changed, 18 insertions, 10 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index 0783181..12bc40f 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -294,11 +294,7 @@ static int handle_add_udev_event(struct device_handler *handler,
ctx->id = talloc_strdup(ctx, event->device);
devname = event_get_param(ctx->event, "DEVNAME");
- if (!devname) {
- pb_log("no devname for %s?\n", event->device);
- return 0;
- }
-
+ assert(devname);
ctx->device_path = talloc_strdup(ctx, devname);
rc = mount_device(ctx);
diff --git a/discover/udev.c b/discover/udev.c
index bd7c6bd..a5d9e03 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -1,17 +1,18 @@
#define _GNU_SOURCE
-#include <stdlib.h>
+#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <sys/un.h>
+#include <log/log.h>
#include <talloc/talloc.h>
#include <waiter/waiter.h>
-#include <log/log.h>
#include "event.h"
#include "udev.h"
@@ -54,6 +55,7 @@ static void udev_handle_message(struct udev *udev, char *buf, int len)
{
int result;
struct event *event;
+ const char *devpath;
event = talloc(udev, struct event);
event->type = EVENT_TYPE_UDEV;
@@ -66,7 +68,17 @@ static void udev_handle_message(struct udev *udev, char *buf, int len)
return;
udev_print_event(event);
- device_handler_event(udev->handler, event);
+
+ /* Ignore ram, loop, and devices with no DEVNAME. */
+
+ devpath = event_get_param(event, "DEVPATH");
+
+ if (event_get_param(event, "DEVNAME")
+ && !strstr(devpath, "virtual/block/loop")
+ && !strstr(devpath, "virtual/block/ram")) {
+ device_handler_event(udev->handler, event);
+ }
+
talloc_free(event);
return;
OpenPOWER on IntegriCloud