> On Fri, 15 Jul 2022 at 17:45, Masahisa Kojima <masahisa.koj...@linaro.org> > wrote:
[...] > --- a/cmd/eficonfig.c > +++ b/cmd/eficonfig.c > @@ -89,6 +89,21 @@ struct eficonfig_boot_selection_data { > int *selected; > }; > > +/** > + * struct eficonfig_boot_order - structure to be used to update BootOrder > variable > + * > + * @num: index in the menu entry > + * @description: pointer to the description string > + * @prev_index: index in the BootOrder variable before > changing order > + * @list: list structure > + */ > +struct eficonfig_boot_order { > + u32 num; > + u16 *description; > + u32 prev_index; > + struct list_head list; > +}; [...] > > +/** > + * eficonfig_display_change_boot_order() - display the BootOrder list > + * > + * @bo_list: pointer to the list structure > + * @efi_menu: pointer to the efimenu structure > + * Return: status code > + */ > +/** > + * eficonfig_choice_change_boot_order() - handle the BootOrder update > + * > + * @bo_list: pointer to the list structure > + * @efi_menu: pointer to the efimenu structure > + * Return: status code > + */ > +static efi_status_t eficonfig_choice_change_boot_order(struct list_head > *bo_list, > + struct efimenu > *efi_menu) > +{ > + int esc = 0; > + struct list_head *pos, *n; > + struct eficonfig_boot_order *tmp; > + enum bootmenu_key key = KEY_NONE; > + struct eficonfig_boot_order *entry; > + > + while (1) { > + bootmenu_loop(NULL, &key, &esc); > + > + switch (key) { > + case KEY_PLUS: > + if (efi_menu->active > 0) { > + list_for_each_safe(pos, n, bo_list) { > + entry = list_entry(pos, struct > eficonfig_boot_order, list); > + if (entry->num == efi_menu->active) > + break; > + } > + tmp = list_entry(pos->prev, struct > eficonfig_boot_order, list); > + entry->num--; > + tmp->num++; > + list_del(&tmp->list); > + list_add(&tmp->list, &entry->list); > + } > + fallthrough; > + case KEY_UP: > + if (efi_menu->active > 0) > + --efi_menu->active; > + return EFI_NOT_READY; > + case KEY_MINUS: > + if (efi_menu->active < efi_menu->count - 3) { > + list_for_each_safe(pos, n, bo_list) { > + entry = list_entry(pos, struct > eficonfig_boot_order, list); > + if (entry->num == efi_menu->active) > + break; > + } > + tmp = list_entry(pos->next, struct > eficonfig_boot_order, list); > + entry->num++; > + tmp->num--; > + list_del(&entry->list); > + list_add(&entry->list, &tmp->list); > + > + ++efi_menu->active; > + } > + return EFI_NOT_READY; > + case KEY_DOWN: > + if (efi_menu->active < efi_menu->count - 1) > + ++efi_menu->active; > + return EFI_NOT_READY; > + case KEY_SELECT: > + /* "Save" */ > + if (efi_menu->active == efi_menu->count - 2) > + return EFI_SUCCESS; > + > + /* "Quit" */ > + if (efi_menu->active == efi_menu->count - 1) > + return EFI_ABORTED; > + > + break; > + case KEY_QUIT: > + return EFI_ABORTED; > + default: We need to return something here as well. > + break; > + } > + } > +} > + > +/** [...] Thanks /Ilias