char *mount_point;
};
-
-static struct boot_option options[] = {
- {
- .id = "1.1",
- .name = "meep one",
- .description = "meep description one",
- .icon_file = "meep.one.png",
- .boot_args = "root=/dev/sda1",
- },
-};
-
-static struct device device = {
- .id = "1",
- .name = "meep",
- .description = "meep description",
- .icon_file = "meep.png",
-};
-
-int device_handler_get_current_devices(
- struct device_handler *handler __attribute__((unused)),
- const struct device **devices)
-
+int device_handler_get_current_devices(struct device_handler *handler,
+ const struct device **devices)
{
- *devices = &device;
- return 1;
+ *devices = handler->devices;
+ return handler->n_devices;
}
static int mkdir_recursive(const char *dir)
goto out_rmdir;
}
- if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+ pb_log("%s: mount failed (%d): %s\n", __func__,
+ WEXITSTATUS(status), ctx->event->device);
goto out_rmdir;
+ }
setup_device_links(ctx);
return 0;
return NULL;
}
-
static int destroy_context(void *arg)
{
struct discover_context *ctx = arg;
rc = mount_device(ctx);
if (rc) {
- pb_log("mount_device failed for %s\n", event->device);
talloc_free(ctx);
return 0;
}
struct device_handler *device_handler_init(struct discover_server *server)
{
struct device_handler *handler;
- unsigned int i;
handler = talloc(NULL, struct device_handler);
handler->devices = NULL;
/* set up our mount point base */
mkdir_recursive(mount_base());
- /* setup out test objects */
- list_init(&device.boot_options);
-
- for (i = 0; i < sizeof(options) / sizeof(options[0]); i++)
- list_add(&device.boot_options, &options[i].list);
-
parser_init();
return handler;
{
talloc_free(handler);
}
-