From: Lennart Poettering Date: Wed, 15 Apr 2026 14:19:55 +0000 (+0200) Subject: bootspec: add boot_config_selected_entry() helper X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=acdaececf08fa7653d3d04885ae9eea18127d206;p=thirdparty%2Fsystemd.git bootspec: add boot_config_selected_entry() helper --- diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h index 951a81f08c6..afc5a576c90 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);