summaryrefslogtreecommitdiffstats
path: root/src/hibernate-resume/hibernate-resume-config.h
blob: 365d9ccda5934bded24b7c040aee4d488d00aa1e (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once

#include <stdbool.h>

#include "sd-id128.h"

typedef struct KernelHibernateLocation {
        char *device;
        uint64_t offset;
        bool offset_set;
} KernelHibernateLocation;

typedef struct EFIHibernateLocation {
        char *device;

        sd_id128_t uuid;
        uint64_t offset;

        char *kernel_version;
        char *id;
        char *image_id;
        char *version_id;
        char *image_version;
} EFIHibernateLocation;

typedef struct HibernateInfo {
        const char *device;
        uint64_t offset; /* in memory pages */

        KernelHibernateLocation *cmdline;
        EFIHibernateLocation *efi;
} HibernateInfo;

void hibernate_info_done(HibernateInfo *info);

int acquire_hibernate_info(HibernateInfo *ret);

#if ENABLE_EFI

void compare_hibernate_location_and_warn(const HibernateInfo *info);

void clear_efi_hibernate_location(void);

#else

static inline void compare_hibernate_location_and_warn(const HibernateInfo *info) {
        return;
}

static inline void clear_efi_hibernate_location(void) {
        return;
}

#endif