]> git.proxmox.com Git - systemd.git/blob - src/shared/bootspec.h
New upstream version 240
[systemd.git] / src / shared / bootspec.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2
3 #pragma once
4
5 #include <inttypes.h>
6 #include <stdbool.h>
7 #include <sys/types.h>
8
9 #include "sd-id128.h"
10
11 typedef struct BootEntry {
12 char *id; /* This is the file basename without extension */
13 char *path; /* This is the full path to the file */
14 char *title;
15 char *show_title;
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
26 typedef struct BootConfig {
27 char *default_pattern;
28 char *timeout;
29 char *editor;
30 char *auto_entries;
31 char *auto_firmware;
32 char *console_mode;
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
42 void boot_config_free(BootConfig *config);
43 int boot_entries_load_config(const char *esp_path, BootConfig *config);
44
45 static inline const char* boot_entry_title(const BootEntry *entry) {
46 return entry->show_title ?: entry->title ?: entry->id;
47 }
48
49 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);
50
51 int find_default_boot_entry(const char *esp_path, char **esp_where, BootConfig *config, const BootEntry **e);