| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "sd-id128.h" |
| 5 |
|
| 6 |
#include "shared-forward.h" |
| 7 |
|
| 8 |
typedef enum BootEntryTokenType { |
| 9 |
BOOT_ENTRY_TOKEN_MACHINE_ID, |
| 10 |
BOOT_ENTRY_TOKEN_OS_IMAGE_ID, |
| 11 |
BOOT_ENTRY_TOKEN_OS_ID, |
| 12 |
BOOT_ENTRY_TOKEN_LITERAL, |
| 13 |
BOOT_ENTRY_TOKEN_AUTO, |
| 14 |
_BOOT_ENTRY_TOKEN_TYPE_MAX, |
| 15 |
_BOOT_ENTRY_TOKEN_TYPE_INVALID = -EINVAL, |
| 16 |
} BootEntryTokenType; |
| 17 |
|
| 18 |
bool boot_entry_token_valid(const char *p); |
| 19 |
|
| 20 |
int boot_entry_token_ensure( |
| 21 |
const char *root, |
| 22 |
const char *conf_root, /* will be prefixed with root, typically /etc/kernel. */ |
| 23 |
sd_id128_t machine_id, |
| 24 |
bool machine_id_is_random, |
| 25 |
BootEntryTokenType *type, /* input and output */ |
| 26 |
char **token); /* output, but do not pass uninitialized value. */ |
| 27 |
int boot_entry_token_ensure_at( |
| 28 |
int rfd, |
| 29 |
const char *conf_root, |
| 30 |
sd_id128_t machine_id, |
| 31 |
bool machine_id_is_random, |
| 32 |
BootEntryTokenType *type, |
| 33 |
char **token); |
| 34 |
|
| 35 |
int parse_boot_entry_token_type(const char *s, BootEntryTokenType *type, char **token); |
| 36 |
|
| 37 |
DECLARE_STRING_TABLE_LOOKUP(boot_entry_token_type, BootEntryTokenType); |