]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/bootspec.h
Merge pull request #11714 from poettering/final-news-241
[thirdparty/systemd.git] / src / shared / bootspec.h
CommitLineData
58f21e63 1/* SPDX-License-Identifier: LGPL-2.1+ */
7e87c7d9
ZJS
2
3#pragma once
4
195b36cf
LP
5#include <inttypes.h>
6#include <stdbool.h>
7#include <sys/types.h>
8
9#include "sd-id128.h"
7e87c7d9
ZJS
10
11typedef struct BootEntry {
2d3bfb69
ZJS
12 char *id; /* This is the file basename without extension */
13 char *path; /* This is the full path to the file */
7e87c7d9 14 char *title;
64f05708 15 char *show_title;
7e87c7d9
ZJS
16 char *version;
17 char *machine_id;
18 char *architecture;
19 char **options;
20 char *kernel; /* linux is #defined to 1, yikes! */
21 char *efi;
22 char **initrd;
23 char *device_tree;
24} BootEntry;
25
26typedef struct BootConfig {
27 char *default_pattern;
28 char *timeout;
29 char *editor;
c1d4e298
JJ
30 char *auto_entries;
31 char *auto_firmware;
d37b0737 32 char *console_mode;
7e87c7d9
ZJS
33
34 char *entry_oneshot;
35 char *entry_default;
36
37 BootEntry *entries;
38 size_t n_entries;
39 ssize_t default_entry;
40} BootConfig;
41
7e87c7d9
ZJS
42void boot_config_free(BootConfig *config);
43int boot_entries_load_config(const char *esp_path, BootConfig *config);
64f05708
ZJS
44
45static inline const char* boot_entry_title(const BootEntry *entry) {
12580bc3 46 return entry->show_title ?: entry->title ?: entry->id;
64f05708 47}
af918182 48
5caa3167 49int 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);
1b20d889
ZJS
50
51int find_default_boot_entry(const char *esp_path, char **esp_where, BootConfig *config, const BootEntry **e);