summaryrefslogtreecommitdiffstats
path: root/usr/kinit/fstype/swap_fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'usr/kinit/fstype/swap_fs.h')
-rw-r--r--usr/kinit/fstype/swap_fs.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/usr/kinit/fstype/swap_fs.h b/usr/kinit/fstype/swap_fs.h
new file mode 100644
index 0000000..7b7fddb
--- /dev/null
+++ b/usr/kinit/fstype/swap_fs.h
@@ -0,0 +1,25 @@
+#ifndef __LINUX_SWAP_FS_H
+#define __LINUX_SWAP_FS_H
+
+/* The basic structures of the swap super block */
+#define SWAP_MAGIC_L 10
+#define SWAP_RESERVED_L (1024 - SWAP_MAGIC_L)
+#define SWAP_MAGIC_1 "SWAP-SPACE"
+#define SWAP_MAGIC_2 "SWAPSPACE2"
+
+/* Suspend signatures, located at same addr as swap magic */
+#define SUSP_MAGIC_L 9
+#define SUSP_MAGIC_1 "S1SUSPEND"
+#define SUSP_MAGIC_2 "S2SUSPEND"
+#define SUSP_MAGIC_U "ULSUSPEND"
+
+/* The superblock is the last block in the first page */
+#define SWAP_OFFSET() ((getpagesize() - 1024) >> 10)
+
+/* On-disk "super block" */
+struct swap_super_block {
+ char reserved[SWAP_RESERVED_L];
+ char magic[SWAP_MAGIC_L];
+};
+
+#endif