Skip to contentSkip to conversation

GSoC #04 Multiple fallback entries

PATCH New Colin D Bennett 1 participant 1 message Aug 31, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GSoC #04 Multiple fallback entries

This patch adds support for multiple fallback entries. The entry numbers in the 'fallback' environment variable should be space-separated.

Regards,
Colin

2008-08-30 Colin D Bennett <[email protected]>

Allow multiple fallback entries.

* include/grub/normal.h (grub_menu_execute_callback_t): New type. (grub_menu_execute_with_fallback): New prototype. (grub_menu_get_timeout): New prototype. (grub_menu_set_timeout): New prototype.

* normal/menu.c (get_timeout): Renamed to grub_menu_get_timeout. (grub_menu_get_timeout): Renamed from get_timeout, and made global. (set_timeout): Renamed to grub_menu_set_timeout. (grub_menu_set_timeout): Renamed from set_timeout, and made global. (get_and_remove_first_entry_number): New function. (run_menu): Call grub_menu_get_timeout and grub_menu_set_timeout instead of the old function names. (grub_menu_execute_with_fallback): New function. (notify_booting): New function.
(notify_fallback): New function. (notify_execution_failure): New function. (execution_callback): New struct definition. (show_menu): Use grub_menu_execute_with_fallback instead of directly handling the fallback here.

=== modified file 'include/grub/normal.h'

grub/normal.h +14 -0
@@ -98,10 +98,24 @@
 
 extern struct grub_menu_viewer grub_normal_terminal_menu_viewer;
 
+typedef struct grub_menu_execute_callback
+{
+  void (*notify_booting) (void *userdata, grub_menu_entry_t entry);
+  void (*notify_fallback) (void *userdata, grub_menu_entry_t entry);
+  void (*notify_failure) (void *userdata);
+} 
+*grub_menu_execute_callback_t;
+
 void grub_enter_normal_mode (const char *config);
 void grub_normal_execute (const char *config, int nested);
+void grub_menu_execute_with_fallback (grub_menu_t menu,
+                                      grub_menu_entry_t entry,
+                                      grub_menu_execute_callback_t callback,
+                                      void *callback_data);
 void grub_menu_entry_run (grub_menu_entry_t entry);
 void grub_menu_execute_entry(grub_menu_entry_t entry);
+int grub_menu_get_timeout (void);
+void grub_menu_set_timeout (int timeout);
 void grub_cmdline_run (int nested);
 int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
 		      int echo_char, int readline);

=== modified file 'normal/menu.c'

menu.c +114 -36

213 lines not on this page · raw message