summaryrefslogtreecommitdiff
path: root/src/shared/boot-entry.h
blob: 1d20db602adcebeec5090032067b800d9782770c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once

#include <stdbool.h>

#include "sd-id128.h"

typedef enum BootEntryTokenType {
        BOOT_ENTRY_TOKEN_MACHINE_ID,
        BOOT_ENTRY_TOKEN_OS_IMAGE_ID,
        BOOT_ENTRY_TOKEN_OS_ID,
        BOOT_ENTRY_TOKEN_LITERAL,
        BOOT_ENTRY_TOKEN_AUTO,
} BootEntryTokenType;

bool boot_entry_token_valid(const char *p);

int boot_entry_token_ensure(
                const char *root,
                const char *etc_kernel,   /* will be prefixed with root, typically /etc/kernel. */
                sd_id128_t machine_id,
                bool machine_id_is_random,
                BootEntryTokenType *type, /* input and output */
                char **token);            /* output, but do not pass uninitialized value. */
int boot_entry_token_ensure_at(
                int rfd,
                const char *etc_kernel,
                sd_id128_t machine_id,
                bool machine_id_is_random,
                BootEntryTokenType *type,
                char **token);

int parse_boot_entry_token_type(const char *s, BootEntryTokenType *type, char **token);