Given a pointer to what we expect to be a filewriter signature, return
whether it is unrecognised (-1), a file without an image (0) or a file with
an image to resume from (1).
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/suspend_file.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
index 6851977..d5f0310 100644
--- a/kernel/power/suspend_file.c
+++ b/kernel/power/suspend_file.c
@@ -365,3 +365,23 @@ cleanup:
target_storage_available = 0;
}
+int parse_signature(struct filewriter_header *header)
+{
+ int have_image = !memcmp(HaveImage, header->sig, sizeof(HaveImage) - 1);
+ int no_image_header = !memcmp(NoImage, header->sig, sizeof(NoImage) - 1);
+
+ if (no_image_header)
+ return 0;
+
+ if (!have_image)
+ return -1;
+
+ if (header->resumed_before)
+ set_suspend_state(SUSPEND_RESUMED_BEFORE);
+ else
+ clear_suspend_state(SUSPEND_RESUMED_BEFORE);
+
+ target_header_start = header->first_header_block;
+ return 1;
+}
+
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]