- boot(handler, handler->default_boot_option, NULL,
- handler->dry_run, boot_status, handler);
+ handler->timeout_waiter = NULL;
+
+ pb_log("Timeout expired, booting default option %s\n", opt->option->id);
+
+ handler->pending_boot = boot(handler, handler->default_boot_option,
+ NULL, handler->dry_run, boot_status, handler);
+ handler->pending_boot_is_default = true;
+ return 0;
+}
+
+static bool priority_match(struct boot_priority *prio,
+ struct discover_boot_option *opt)
+{
+ return prio->type == opt->device->device->type ||
+ prio->type == DEVICE_TYPE_ANY;
+}
+
+static int default_option_priority(struct discover_boot_option *opt)
+{
+ const struct config *config;
+ struct boot_priority *prio;
+ unsigned int i;
+
+ config = config_get();
+
+ for (i = 0; i < config->n_boot_priorities; i++) {
+ prio = &config->boot_priorities[i];
+ if (priority_match(prio, opt))
+ return prio->priority;
+ }
+