eficonfig: refactor eficonfig_process_common function
Current change boot order implementation does not call
eficonfig_process_common() and call own menu functions
for display_statusline, item_data_print and item_choice.
Change boot order functionality should call
eficonfig_process_common() to improve maintenanceability.
This commit is a preparation to remove the change boot
order specific implementation. The menu functions
(display_statusline, item_data_print and item_choice) are
added as argument of eficonfig_process_common().
The menu description string displayed at the bottom of
the menu is also added as argument.
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff --git a/include/efi_config.h b/include/efi_config.h
index fd69926..cec5715 100644
--- a/include/efi_config.h
+++ b/include/efi_config.h
@@ -9,12 +9,14 @@
#define _EFI_CONFIG_H
#include <efi_loader.h>
+#include <menu.h>
#define EFICONFIG_ENTRY_NUM_MAX 99
#define EFICONFIG_VOLUME_PATH_MAX 512
#define EFICONFIG_FILE_PATH_MAX 512
#define EFICONFIG_FILE_PATH_BUF_SIZE (EFICONFIG_FILE_PATH_MAX * sizeof(u16))
+extern const char *eficonfig_menu_desc;
typedef efi_status_t (*eficonfig_entry_func)(void *data);
/**
@@ -45,6 +47,7 @@
* @active: active menu entry index
* @count: total count of menu entry
* @menu_header: menu header string
+ * @menu_desc: menu description string
* @list: menu entry list structure
*/
struct efimenu {
@@ -52,6 +55,7 @@
int active;
int count;
char *menu_header;
+ const char *menu_desc;
struct list_head list;
};
@@ -86,9 +90,16 @@
};
void eficonfig_print_msg(char *msg);
+void eficonfig_print_entry(void *data);
+void eficonfig_display_statusline(struct menu *m);
+char *eficonfig_choice_entry(void *data);
void eficonfig_destroy(struct efimenu *efi_menu);
efi_status_t eficonfig_process_quit(void *data);
-efi_status_t eficonfig_process_common(struct efimenu *efi_menu, char *menu_header);
+efi_status_t eficonfig_process_common(struct efimenu *efi_menu,
+ char *menu_header, const char *menu_desc,
+ void (*display_statusline)(struct menu *),
+ void (*item_data_print)(void *),
+ char *(*item_choice)(void *));
efi_status_t eficonfig_process_select_file(void *data);
efi_status_t eficonfig_get_unused_bootoption(u16 *buf,
efi_uintn_t buf_size, u32 *index);