summaryrefslogtreecommitdiff
path: root/src/shared/bootspec.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-01 18:35:26 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-05 16:50:58 +0100
commit93f14ce28d8477ad70ba6a60299b84af794e18b0 (patch)
tree5f1184738ebd9fa92bbd1939bb722d904989ef3f /src/shared/bootspec.h
parent5b1da1ba6da432dc6b120f4ad438aa4a360b2df7 (diff)
downloadsystemd-93f14ce28d8477ad70ba6a60299b84af794e18b0.tar.gz
bootspec: move augmentation of loader-discovered entries into bootspec.c
Previously, bootctl would show boot loader entries discovered by the boot loader which couldn't found locally separately in the output. Let's move this code into bootspec.c, and beef it up a bit. This way we can use it later on for logind, and correctly show automatically discovered windows/macos entries too.
Diffstat (limited to 'src/shared/bootspec.h')
-rw-r--r--src/shared/bootspec.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h
index 695e86d8f7..658905a4cb 100644
--- a/src/shared/bootspec.h
+++ b/src/shared/bootspec.h
@@ -8,7 +8,18 @@
#include "sd-id128.h"
+#include "string-util.h"
+
+typedef enum BootEntryType {
+ BOOT_ENTRY_CONF, /* Type #1 entries: *.conf files */
+ BOOT_ENTRY_UNIFIED, /* Type #2 entries: *.efi files */
+ BOOT_ENTRY_LOADER, /* Additional entries augmented from LoaderEntries EFI var */
+ _BOOT_ENTRY_MAX,
+ _BOOT_ENTRY_INVALID = -1,
+} BootEntryType;
+
typedef struct BootEntry {
+ BootEntryType type;
char *id; /* This is the file basename without extension */
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 */
@@ -40,8 +51,19 @@ typedef struct BootConfig {
ssize_t default_entry;
} BootConfig;
+static inline bool boot_config_has_entry(BootConfig *config, const char *id) {
+ size_t j;
+
+ for (j = 0; j < config->n_entries; j++)
+ if (streq(config->entries[j].id, id))
+ return true;
+
+ return false;
+}
+
void boot_config_free(BootConfig *config);
int boot_entries_load_config(const char *esp_path, const char *xbootldr_path, BootConfig *config);
+int boot_entries_augment_from_loader(BootConfig *config, bool only_auto);
static inline const char* boot_entry_title(const BootEntry *entry) {
return entry->show_title ?: entry->title ?: entry->id;
@@ -51,3 +73,6 @@ int find_esp_and_warn(const char *path, bool unprivileged_mode, char **ret_path,
int find_xbootldr_and_warn(const char *path, bool unprivileged_mode, char **ret_path,sd_id128_t *ret_uuid);
int find_default_boot_entry(BootConfig *config, const BootEntry **e);
+
+const char* boot_entry_type_to_string(BootEntryType t) _const_;
+BootEntryType boot_entry_type_from_string(const char *s) _pure_;