#include <pb-protocol/pb-protocol.h>
#include "device-handler.h"
+#include "discover-server.h"
+#include "parser.h"
#include "udev.h"
#include "log.h"
#include "paths.h"
struct list contexts;
};
-struct discover_context {
- char *id;
- char *device_path;
- char *mount_path;
- struct udev_event *event;
- struct device *device;
- char **links;
- int n_links;
-
- struct list_item list;
-};
-
struct mount_map {
char *device_path;
char *mount_point;
}
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);
+
+ discover_server_notify_add(handler->server, ctx->device);
+
return 0;
}
if (!ctx)
return 0;
+ discover_server_notify_remove(handler->server, ctx->device);
+
talloc_free(ctx);
return 0;
handler = talloc(NULL, struct device_handler);
handler->devices = NULL;
handler->n_devices = 0;
+ handler->server = server;
list_init(&handler->contexts);