bootspec: store 'root' field in each bootspec entry we load

This 'root' field contains the root path of the partition we found the
snippet in. The 'kernel', 'initrd', 'efi', … fields are relative to this
path.

This becomes particularly useful later when we add support for loading
snippets from both the ESP and XBOOTLDR, but already simplifies the code
for us a bit in systemctl.
This commit is contained in:
Lennart Poettering
2019-03-01 12:41:32 +01:00
parent 15cb6c9897
commit 43b736a84b
3 changed files with 27 additions and 14 deletions
+3 -2
View File
@@ -10,7 +10,8 @@
typedef struct BootEntry {
char *id; /* This is the file basename without extension */
char *path; /* This is the full path to the file */
char *path; /* This is the full path to the drop-in file */
char *root; /* The root path in which the drop-in was found, i.e. to which 'kernel', 'efi' and 'initrd' are relative */
char *title;
char *show_title;
char *version;
@@ -49,4 +50,4 @@ static inline const char* boot_entry_title(const BootEntry *entry) {
int find_esp_and_warn(const char *path, bool unprivileged_mode, char **ret_path, uint32_t *ret_part, uint64_t *ret_pstart, uint64_t *ret_psize, sd_id128_t *ret_uuid);
int find_xbootldr_and_warn(const char *path, bool unprivileged_mode, char **ret_path,sd_id128_t *ret_uuid);
int find_default_boot_entry(const char *esp_path, char **esp_where, BootConfig *config, const BootEntry **e);
int find_default_boot_entry(const char *esp_path, BootConfig *config, const BootEntry **e);