X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fdevice-handler.c;h=730be857f5e564fdfea8938dbfc134d1f3c679be;hp=a73a7ce590abe65c7463899f369d7d3c7b549195;hb=5314cebf5fe766bdca6c779e785b8dfaa3808142;hpb=78819395e5aa0dbd0c484f7a2512fcf04b87bbf2 diff --git a/discover/device-handler.c b/discover/device-handler.c index a73a7ce..730be85 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -321,7 +322,7 @@ struct device_handler *device_handler_init(struct discover_server *server, handler->server = server; handler->waitset = waitset; handler->dry_run = dry_run; - handler->autoboot_enabled = config_get()->autoboot_enabled; + handler->autoboot_enabled = config_autoboot_active(config_get()); list_init(&handler->unresolved_boot_options); @@ -351,6 +352,16 @@ void device_handler_reinit(struct device_handler *handler) unsigned int i; device_handler_cancel_default(handler); + /* Cancel any pending non-default boot */ + if (handler->pending_boot) { + boot_cancel(handler->pending_boot); + handler->pending_boot = NULL; + handler->pending_boot_is_default = false; + } + + /* Cancel any remaining async jobs */ + process_stop_async_all(); + pending_network_jobs_cancel(); /* free unresolved boot options */ list_for_each_entry_safe(&handler->unresolved_boot_options, @@ -442,6 +453,7 @@ static void _device_handler_vstatus(struct device_handler *handler, status.type = type; status.message = talloc_vasprintf(handler, fmt, ap); + status.backlog = false; device_handler_status(handler, &status); @@ -617,6 +629,7 @@ static void countdown_status(struct device_handler *handler, status.type = STATUS_INFO; status.message = talloc_asprintf(handler, _("Booting in %d sec: %s"), sec, opt->option->name); + status.backlog = false; device_handler_status(handler, &status); @@ -1037,8 +1050,6 @@ int device_handler_discover(struct device_handler *handler, _("Processing new %s device"), device_type_display_name(dev->device->type)); - process_boot_option_queue(handler); - /* create our context */ ctx = device_handler_discover_context_create(handler, dev); @@ -1056,6 +1067,7 @@ int device_handler_discover(struct device_handler *handler, /* add discovered stuff to the handler */ device_handler_discover_context_commit(handler, ctx); + process_boot_option_queue(handler); out: talloc_unlink(handler, ctx); @@ -1072,6 +1084,8 @@ int device_handler_dhcp(struct device_handler *handler, _("Processing DHCP lease response (ip: %s)"), event_get_param(event, "ip")); + pending_network_jobs_start(); + /* create our context */ ctx = device_handler_discover_context_create(handler, dev); talloc_steal(ctx, event); @@ -1396,6 +1410,8 @@ static void device_handler_reinit_sources(struct device_handler *handler) return; } + system_info_reinit(); + udev_reinit(handler->udev); network_shutdown(handler->network);