-static int destroy_device(void *arg)
-{
- struct discover_device *dev = arg;
-
- umount_device(dev);
-
- return 0;
-}
-
-static struct discover_device *find_device(struct device_handler *handler,
- const char *id)
-{
- struct discover_device *dev;
- unsigned int i;
-
- for (i = 0; i < handler->n_devices; i++) {
- dev = handler->devices[i];
- if (!strcmp(dev->device->id, id))
- return dev;
- }
-
- return NULL;
-}
-
-static struct discover_device *discover_device_create(
- struct device_handler *handler,
- struct discover_context *ctx,
- struct event *event)
-{
- struct discover_device *dev;
- const char *devname;
-
- dev = find_device(handler, event->device);
- if (dev)
- return dev;
-
- dev = talloc_zero(ctx, struct discover_device);
- dev->device = talloc_zero(dev, struct device);
- list_init(&dev->boot_options);
-
- devname = event_get_param(ctx->event, "DEVNAME");
- if (devname)
- dev->device_path = talloc_strdup(dev, devname);
-
- dev->device->id = talloc_strdup(dev, event->device);
-
- talloc_set_destructor(dev, destroy_device);
-
- return dev;
-}
-
-/**
- * device_handler_remove - Remove a device from the handler device array.
- */
-
-static void device_handler_remove(struct device_handler *handler,
- struct discover_device *device)