]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/bootspec.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
11 #include "string-util.h"
13 typedef enum BootEntryType
{
14 BOOT_ENTRY_CONF
, /* Type #1 entries: *.conf files */
15 BOOT_ENTRY_UNIFIED
, /* Type #2 entries: *.efi files */
16 BOOT_ENTRY_LOADER
, /* Additional entries augmented from LoaderEntries EFI var */
18 _BOOT_ENTRY_INVALID
= -1,
21 typedef struct BootEntry
{
23 char *id
; /* This is the file basename without extension */
24 char *path
; /* This is the full path to the drop-in file */
25 char *root
; /* The root path in which the drop-in was found, i.e. to which 'kernel', 'efi' and 'initrd' are relative */
32 char *kernel
; /* linux is #defined to 1, yikes! */
38 typedef struct BootConfig
{
39 char *default_pattern
;
51 ssize_t default_entry
;
54 static inline bool boot_config_has_entry(BootConfig
*config
, const char *id
) {
57 for (j
= 0; j
< config
->n_entries
; j
++)
58 if (streq(config
->entries
[j
].id
, id
))
64 static inline BootEntry
* boot_config_default_entry(BootConfig
*config
) {
65 if (config
->default_entry
< 0)
68 return config
->entries
+ config
->default_entry
;
71 void boot_config_free(BootConfig
*config
);
72 int boot_entries_load_config(const char *esp_path
, const char *xbootldr_path
, BootConfig
*config
);
73 int boot_entries_load_config_auto(const char *override_esp_path
, const char *override_xbootldr_path
, BootConfig
*config
);
74 int boot_entries_augment_from_loader(BootConfig
*config
, bool only_auto
);
76 static inline const char* boot_entry_title(const BootEntry
*entry
) {
77 return entry
->show_title
?: entry
->title
?: entry
->id
;
80 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
);
81 int find_xbootldr_and_warn(const char *path
, bool unprivileged_mode
, char **ret_path
,sd_id128_t
*ret_uuid
);
83 const char* boot_entry_type_to_string(BootEntryType t
) _const_
;
84 BootEntryType
boot_entry_type_from_string(const char *s
) _pure_
;