Adding upstream version 6.02~pre8+dfsg.
[syslinux-debian/hramrach.git] / com32 / gpllib / disk / swsusp.c
blobef782fd5f506a8610789dfc05279d5cc069edba3
1 #include <stdlib.h>
2 #include <string.h>
4 #include <disk/swsusp.h>
5 #include <disk/read.h>
6 #include <disk/geom.h>
8 /**
9 * swsusp_check - check if a (swap) partition contains the swsusp signature
10 * @drive_info: driveinfo struct describing the disk containing the partition
11 * @ptab; Partition table of the partition
12 **/
13 int swsusp_check(struct driveinfo *drive_info, struct part_entry *ptab)
15 struct swsusp_header header_p;
16 int offset;
17 int found;
19 /* Read first page of the swap device */
20 offset = ptab->start_lba;
21 if (read_sectors(drive_info, &header_p, offset, PAGE_SIZE / SECTOR) == -1) {
22 return -1;
23 } else {
24 found = !memcmp(SWSUSP_SIG, header_p.sig, 10);
25 return found;