From 4a9f66fc3194f3544b099c5bb13d0f383dcad09e Mon Sep 17 00:00:00 2001 From: Richie Buturla Date: Fri, 22 Aug 2025 17:53:48 +0200 Subject: [PATCH] zipl/boot: Change error codes to enums MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change error codes returned from menu_param to enums. Reviewed-by: Marc Hartmayer Reviewed-by: Steffen Eiden Signed-off-by: Richie Buturla Signed-off-by: Jan Höppner --- zipl/boot/menu.c | 12 +++++++++--- zipl/boot/menu.h | 4 ---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/zipl/boot/menu.c b/zipl/boot/menu.c index 8958f612..48cbf73e 100644 --- a/zipl/boot/menu.c +++ b/zipl/boot/menu.c @@ -98,6 +98,12 @@ static int menu_list(void) return 0; } +enum param_result { + NUMBER_FOUND = 0, + PRINT_PROMPT = 1, + NOTHING_FOUND = 2, +}; + /* * Interpret loadparm * @@ -109,7 +115,7 @@ static int menu_list(void) * 1 - print prompt * 2 - nothing found */ -static int menu_param(unsigned long *value) +static enum param_result menu_param(unsigned long *value) { char loadparm[PARAM_SIZE]; char *endptr; @@ -152,10 +158,10 @@ int menu(void) goto boot; rc = menu_param(&value); - if (rc == 0) { + if (rc == NUMBER_FOUND) { /* got number from loadparm, boot it */ goto boot; - } else if (rc == 1 && value == 0) { + } else if (rc == PRINT_PROMPT && value == 0) { /* keyword "prompt", show menu */ } else if (__stage2_params.flag == 0) { /* menu disabled, boot default */ diff --git a/zipl/boot/menu.h b/zipl/boot/menu.h index c6d688c1..3388f6fa 100644 --- a/zipl/boot/menu.h +++ b/zipl/boot/menu.h @@ -18,10 +18,6 @@ #define PARAM_SIZE 8 #define TEXT_OFFSET 4 -#define NUMBER_FOUND 0 -#define PRINT_PROMPT 1 -#define NOTHING_FOUND 2 - struct boot_stage2_params { uint16_t flag; uint16_t timeout;