+ list_add(&handler->contexts, &ctx->list);
+ talloc_set_destructor(ctx, destroy_context);
+
+ /* set up the top-level device */
+ ctx->device = talloc_zero(ctx, struct device);
+ ctx->device->id = talloc_strdup(ctx->device, ctx->id);
+ list_init(&ctx->device->boot_options);
+
+ /* run the parsers */
+ iterate_parsers(ctx);
+
+ /* add device to handler device array */
+ device_handler_add(handler, ctx->device);
+
+ discover_server_notify_add(handler->server, ctx->device);
+
+ return 0;
+}
+
+static int handle_remove_udev_event(struct device_handler *handler,
+ struct event *event)
+{
+ struct discover_context *ctx;
+
+ ctx = find_context(handler, event->device);
+ if (!ctx)
+ return 0;
+
+ discover_server_notify_remove(handler->server, ctx->device);
+
+ /* remove device from handler device array */
+ device_handler_remove(handler, ctx->device);
+