818bf54632
This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
53 lines
1.4 KiB
C
53 lines
1.4 KiB
C
/***
|
|
Copyright 2017 Zbigniew Jędrzejewski-Szmek
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
#include <stdlib.h>
|
|
|
|
typedef struct BootEntry {
|
|
char *filename;
|
|
|
|
char *title;
|
|
char *show_title;
|
|
char *version;
|
|
char *machine_id;
|
|
char *architecture;
|
|
char **options;
|
|
char *kernel; /* linux is #defined to 1, yikes! */
|
|
char *efi;
|
|
char **initrd;
|
|
char *device_tree;
|
|
} BootEntry;
|
|
|
|
typedef struct BootConfig {
|
|
char *default_pattern;
|
|
char *timeout;
|
|
char *editor;
|
|
char *auto_entries;
|
|
char *auto_firmware;
|
|
char *console_mode;
|
|
|
|
char *entry_oneshot;
|
|
char *entry_default;
|
|
|
|
BootEntry *entries;
|
|
size_t n_entries;
|
|
ssize_t default_entry;
|
|
} BootConfig;
|
|
|
|
void boot_entry_free(BootEntry *entry);
|
|
int boot_entry_load(const char *path, BootEntry *entry);
|
|
int boot_entries_find(const char *dir, BootEntry **entries, size_t *n_entries);
|
|
|
|
int boot_loader_read_conf(const char *path, BootConfig *config);
|
|
void boot_config_free(BootConfig *config);
|
|
int boot_entries_load_config(const char *esp_path, BootConfig *config);
|
|
|
|
static inline const char* boot_entry_title(const BootEntry *entry) {
|
|
return entry->show_title ?: entry->title ?: entry->filename;
|
|
}
|
|
|
|
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);
|