summaryrefslogtreecommitdiffstats
path: root/src/shared/hibernate-util.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:49:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:49:52 +0000
commit55944e5e40b1be2afc4855d8d2baf4b73d1876b5 (patch)
tree33f869f55a1b149e9b7c2b7e201867ca5dd52992 /src/shared/hibernate-util.h
parentInitial commit. (diff)
downloadsystemd-55944e5e40b1be2afc4855d8d2baf4b73d1876b5.tar.xz
systemd-55944e5e40b1be2afc4855d8d2baf4b73d1876b5.zip
Adding upstream version 255.4.upstream/255.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/shared/hibernate-util.h')
-rw-r--r--src/shared/hibernate-util.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/shared/hibernate-util.h b/src/shared/hibernate-util.h
new file mode 100644
index 0000000..2ae10fb
--- /dev/null
+++ b/src/shared/hibernate-util.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include <linux/fiemap.h>
+#include <sys/types.h>
+
+/* represents values for /sys/power/resume & /sys/power/resume_offset and the corresponding path */
+typedef struct HibernationDevice {
+ dev_t devno;
+ uint64_t offset; /* in memory pages */
+ char *path;
+} HibernationDevice;
+
+void hibernation_device_done(HibernationDevice *hibernation_device);
+
+int find_suitable_hibernation_device_full(HibernationDevice *ret_device, uint64_t *ret_size, uint64_t *ret_used);
+static inline int find_suitable_hibernation_device(HibernationDevice *ret) {
+ return find_suitable_hibernation_device_full(ASSERT_PTR(ret), NULL, NULL);
+}
+
+int hibernation_is_safe(void);
+
+int write_resume_config(dev_t devno, uint64_t offset, const char *device);
+
+/* Only for test-fiemap */
+int read_fiemap(int fd, struct fiemap **ret);