summaryrefslogtreecommitdiffstats
path: root/contrib/syslinux-4.02/com32/gpllib/disk/swsusp.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/syslinux-4.02/com32/gpllib/disk/swsusp.c')
-rw-r--r--contrib/syslinux-4.02/com32/gpllib/disk/swsusp.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/syslinux-4.02/com32/gpllib/disk/swsusp.c b/contrib/syslinux-4.02/com32/gpllib/disk/swsusp.c
new file mode 100644
index 0000000..ef782fd
--- /dev/null
+++ b/contrib/syslinux-4.02/com32/gpllib/disk/swsusp.c
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include <disk/swsusp.h>
+#include <disk/read.h>
+#include <disk/geom.h>
+
+/**
+ * swsusp_check - check if a (swap) partition contains the swsusp signature
+ * @drive_info: driveinfo struct describing the disk containing the partition
+ * @ptab; Partition table of the partition
+ **/
+int swsusp_check(struct driveinfo *drive_info, struct part_entry *ptab)
+{
+ struct swsusp_header header_p;
+ int offset;
+ int found;
+
+ /* Read first page of the swap device */
+ offset = ptab->start_lba;
+ if (read_sectors(drive_info, &header_p, offset, PAGE_SIZE / SECTOR) == -1) {
+ return -1;
+ } else {
+ found = !memcmp(SWSUSP_SIG, header_p.sig, 10);
+ return found;
+ }
+}