[v2,3/3] ui/ncurses: Add system config checkbox to enable kexec_file load

Message ID 1490900184-26327-4-git-send-email-erichte@linux.vnet.ibm.com
State Changes Requested
Headers show

Commit Message

Eric Richter March 30, 2017, 6:56 p.m.
This patch adds an option to the system configuration menu that if
checked, enables the use of kexec_file_load.

Signed-off-by: Eric Richter <erichte@linux.vnet.ibm.com>
---
 ui/ncurses/nc-config.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Patch

diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c
index 8349629..945083d 100644
--- a/ui/ncurses/nc-config.c
+++ b/ui/ncurses/nc-config.c
@@ -33,7 +33,7 @@ 
 #include "nc-config.h"
 #include "nc-widgets.h"
 
-#define N_FIELDS	48
+#define N_FIELDS	50
 
 extern struct help_text config_help_text;
 
@@ -82,6 +82,9 @@  struct config_screen {
 		struct nc_widget_label		*timeout_l;
 		struct nc_widget_label		*timeout_help_l;
 
+		struct nc_widget_label		*kexec_file_l;
+		struct nc_widget_checkbox	*kexec_file_cb;
+
 		struct nc_widget_label		*ipmi_type_l;
 		struct nc_widget_label		*ipmi_clear_l;
 		struct nc_widget_checkbox	*ipmi_clear_cb;
@@ -256,6 +259,8 @@  static int screen_process_form(struct config_screen *screen)
 			config->autoboot_timeout_sec = x;
 	}
 
+	config->kexec_file = widget_checkbox_get_value(screen->widgets.kexec_file_cb);
+
 	if (screen->ipmi_override)
 		if (widget_checkbox_get_value(screen->widgets.ipmi_clear_cb))
 			config->ipmi_bootdev = IPMI_BOOTDEV_INVALID;
@@ -490,6 +495,16 @@  static void config_screen_layout_widgets(struct config_screen *screen)
 	} else
 		y += 1;
 
+
+	wl = widget_label_base(screen->widgets.kexec_file_l);
+	widget_set_visible(wl, true);
+	widget_move(wl, y, screen->label_x);
+
+	wf = widget_checkbox_base(screen->widgets.kexec_file_cb);
+	widget_set_visible(wf, true);
+	widget_move(wf, y, screen->field_x);
+	y += 1;
+
 	if (screen->ipmi_override) {
 		wl = widget_label_base(screen->widgets.ipmi_type_l);
 		widget_set_visible(wl, true);
@@ -927,6 +942,11 @@  static void config_screen_setup_widgets(struct config_screen *screen,
 	widget_textbox_set_fixed_size(screen->widgets.timeout_f);
 	widget_textbox_set_validator_integer(screen->widgets.timeout_f, 0, 999);
 
+	screen->widgets.kexec_file_l = widget_new_label(set, 0, 0,
+					_("Secure kexec:"));
+	screen->widgets.kexec_file_cb = widget_new_checkbox(set, 0, 0,
+					config->kexec_file);
+
 	if (config->ipmi_bootdev) {
 		label = talloc_asprintf(screen,
 				_("%s IPMI boot option: %s"),