From acdaececf08fa7653d3d04885ae9eea18127d206 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 15 Apr 2026 16:19:55 +0200 Subject: [PATCH] bootspec: add boot_config_selected_entry() helper --- src/shared/bootspec.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h index 951a81f08c..afc5a576c9 100644 --- a/src/shared/bootspec.h +++ b/src/shared/bootspec.h @@ -116,6 +116,16 @@ static inline const BootEntry* boot_config_default_entry(const BootConfig *confi return config->entries + config->default_entry; } +static inline const BootEntry* boot_config_selected_entry(const BootConfig *config) { + assert(config); + + if (config->selected_entry < 0) + return NULL; + + assert((size_t) config->selected_entry < config->n_entries); + return config->entries + config->selected_entry; +} + void boot_config_free(BootConfig *config); int boot_loader_read_conf(BootConfig *config, FILE *file, const char *path);