1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

boot: only do boot counting management for some menu entries

Let's do boot counting only for some menu entry types, and carefully
list which types those are.
This commit is contained in:
Lennart Poettering 2025-02-25 12:16:10 +01:00
parent 4801e16401
commit 729f3c21c5

View File

@ -70,6 +70,9 @@ typedef enum LoaderType {
/* Which loader types shall be considered for automatic selection */
#define LOADER_TYPE_MAY_AUTO_SELECT(t) IN_SET(t, LOADER_EFI, LOADER_LINUX, LOADER_UKI, LOADER_UKI_URL, LOADER_TYPE2_UKI)
/* Whether to do boot attempt counting logic (only works if userspace can actually find the selected option later) */
#define LOADER_TYPE_BUMP_COUNTERS(t) IN_SET(t, LOADER_LINUX, LOADER_UKI, LOADER_TYPE2_UKI)
typedef struct BootEntry {
char16_t *id; /* The unique identifier for this entry (typically the filename of the file defining the entry, possibly suffixed with a profile id) */
char16_t *id_without_profile; /* same, but without any profile id suffixed */
@ -1152,6 +1155,9 @@ static EFI_STATUS boot_entry_bump_counters(BootEntry *entry) {
assert(entry);
if (!LOADER_TYPE_BUMP_COUNTERS(entry->type))
return EFI_SUCCESS;
if (entry->tries_left < 0)
return EFI_SUCCESS;