lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Suspend2][ 10/35] [Suspend2] Parse filewriter signature.
Date
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 <nigel@suspend2.net>

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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-27 01:10    [W:0.110 / U:0.248 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site