From 5b45fad4fcfa2dd81f25b13fe8d7717f62fa5843 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 12 Oct 2023 16:24:12 +0100 Subject: [PATCH] bootctl, sd-boot: cross document the menu-hidden/force ABI Document the current state and how we got here. v2: - rewrap command to 109 columns Signed-off-by: Emil Velikov --- src/boot/bootctl-set-efivar.c | 4 ++++ src/boot/efi/boot.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/boot/bootctl-set-efivar.c b/src/boot/bootctl-set-efivar.c index 9feb0e3d2ea..71507c1e1da 100644 --- a/src/boot/bootctl-set-efivar.c +++ b/src/boot/bootctl-set-efivar.c @@ -20,6 +20,10 @@ static int parse_timeout(const char *arg1, char16_t **ret_timeout, size_t *ret_t assert(ret_timeout); assert(ret_timeout_size); + /* Note: Since there is no way to query if the booloader supports the string tokens, we explicitly + * set their numerical value(s) instead. This means that some of the sd-boot internal ABI has leaked + * although the ship has sailed and the side-effects are self-contained. + */ if (streq(arg1, "menu-force")) timeout = USEC_INFINITY; else if (streq(arg1, "menu-hidden")) diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 41814535b43..43891df9348 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -101,9 +101,16 @@ typedef struct { int64_t console_mode_efivar; } Config; -/* These values have been chosen so that the transitions the user sees could - * employ unsigned over-/underflow like this: - * efivar unset ↔ force menu ↔ no timeout/skip menu ↔ 1 s ↔ 2 s ↔ … */ +/* These values have been chosen so that the transitions the user sees could employ unsigned over-/underflow + * like this: + * efivar unset ↔ force menu ↔ no timeout/skip menu ↔ 1 s ↔ 2 s ↔ … + * + * Note: all the values below are ABI, so they are not allowed to change. The bootctl tool sets the numerical + * value of TIMEOUT_MENU_FORCE and TIMEOUT_MENU_HIDDEN, instead of the string for compatibility reasons. + * + * The other values may be set by systemd-boot itself and changing those will lead to functional regression + * when new version of systemd-boot is installed. + */ enum { TIMEOUT_MIN = 1, TIMEOUT_MAX = UINT32_MAX - 2U, -- 2.47.3