summaryrefslogtreecommitdiff
path: root/src/shared/bootspec.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-09-02 13:41:09 +0200
committerLennart Poettering <lennart@poettering.net>2022-09-02 18:09:57 +0200
commit7f5780edfbbeb29c7b5062194207580ce7e6ca51 (patch)
tree1caa4e05170b78bc469fb368aac3e85505e08891 /src/shared/bootspec.h
parentf70de82f9f5883ee35baccc70bd3120ebf397385 (diff)
downloadsystemd-7f5780edfbbeb29c7b5062194207580ce7e6ca51.tar.gz
bootspec: properly parse tries done/tries left from bootspec file names
This has been a long-time omission in the userspace parser of bootspec files. Correct that. Fixes: #16457
Diffstat (limited to 'src/shared/bootspec.h')
-rw-r--r--src/shared/bootspec.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h
index 36a3489e87..7f5d496b95 100644
--- a/src/shared/bootspec.h
+++ b/src/shared/bootspec.h
@@ -39,8 +39,17 @@ typedef struct BootEntry {
char **initrd;
char *device_tree;
char **device_tree_overlay;
+ unsigned tries_left;
+ unsigned tries_done;
} BootEntry;
+#define BOOT_ENTRY_INIT(t) \
+ { \
+ .type = (t), \
+ .tries_left = UINT_MAX, \
+ .tries_done = UINT_MAX, \
+ }
+
typedef struct BootConfig {
char *default_pattern;
char *timeout;
@@ -116,3 +125,5 @@ int show_boot_entry(
int show_boot_entries(
const BootConfig *config,
JsonFormatFlags json_format);
+
+int boot_filename_extract_tries(const char *fname, char **ret_stripped, unsigned *ret_tries_left, unsigned *ret_tries_done);