- if (task->state == BOOT_STATE_INITIAL) {
- update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_INFO, "loading kernel");
- task->local_image = load_url_async(task, task->image,
- &task->clean_image, boot_process);
- if (!task->local_image) {
- update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
- "Couldn't load kernel image");
- goto no_load;
- }
- task->state = BOOT_STATE_IMAGE_LOADING;
+static int check_load(struct boot_task *task, const char *name,
+ struct load_url_result *result)
+{
+ if (!result)
+ return 0;
+ if (result->status != LOAD_ERROR)
+ return 0;
+
+ update_status(task->status_fn, task->status_arg,
+ BOOT_STATUS_ERROR,
+ "Couldn't load %s", name);
+ return -1;
+}
+
+static void cleanup_load(struct load_url_result *result)
+{
+ if (!result)