| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "shared-forward.h" |
| 5 |
|
| 6 |
/* represents values for /sys/power/resume & /sys/power/resume_offset and the corresponding path */ |
| 7 |
typedef struct HibernationDevice { |
| 8 |
dev_t devno; |
| 9 |
uint64_t offset; /* in memory pages */ |
| 10 |
char *path; |
| 11 |
} HibernationDevice; |
| 12 |
|
| 13 |
void hibernation_device_done(HibernationDevice *hibernation_device); |
| 14 |
|
| 15 |
int find_suitable_hibernation_device_full(HibernationDevice *ret_device, uint64_t *ret_size, uint64_t *ret_used); |
| 16 |
static inline int find_suitable_hibernation_device(HibernationDevice *ret) { |
| 17 |
return find_suitable_hibernation_device_full(ASSERT_PTR(ret), NULL, NULL); |
| 18 |
} |
| 19 |
|
| 20 |
int hibernation_is_safe(void); |
| 21 |
|
| 22 |
int write_resume_config(dev_t devno, uint64_t offset, const char *device); |
| 23 |
|
| 24 |
int clear_efi_hibernate_location_and_warn(void); |
| 25 |
|
| 26 |
/* Only for test-fiemap */ |
| 27 |
int read_fiemap(int fd, struct fiemap **ret); |