]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/bootspec.h
tree-wide: drop 'This file is part of systemd' blurb
[thirdparty/systemd.git] / src / shared / bootspec.h
1 /***
2 Copyright 2017 Zbigniew Jędrzejewski-Szmek
3 ***/
4
5 #pragma once
6
7 #include <stdlib.h>
8
9 typedef struct BootEntry {
10 char *filename;
11
12 char *title;
13 char *show_title;
14 char *version;
15 char *machine_id;
16 char *architecture;
17 char **options;
18 char *kernel; /* linux is #defined to 1, yikes! */
19 char *efi;
20 char **initrd;
21 char *device_tree;
22 } BootEntry;
23
24 typedef struct BootConfig {
25 char *default_pattern;
26 char *timeout;
27 char *editor;
28 char *auto_entries;
29 char *auto_firmware;
30 char *console_mode;
31
32 char *entry_oneshot;
33 char *entry_default;
34
35 BootEntry *entries;
36 size_t n_entries;
37 ssize_t default_entry;
38 } BootConfig;
39
40 void boot_entry_free(BootEntry *entry);
41 int boot_entry_load(const char *path, BootEntry *entry);
42 int boot_entries_find(const char *dir, BootEntry **entries, size_t *n_entries);
43
44 int boot_loader_read_conf(const char *path, BootConfig *config);
45 void boot_config_free(BootConfig *config);
46 int boot_entries_load_config(const char *esp_path, BootConfig *config);
47
48 static inline const char* boot_entry_title(const BootEntry *entry) {
49 return entry->show_title ?: entry->title ?: entry->filename;
50 }
51
52 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);