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][ 21/35] [Suspend2] Make modifications to the filewriter signature.
Date
Implement support for invalidating an image or marking that we've attempted
to resume from the image before.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

kernel/power/suspend_file.c | 51 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
index 8e4431c..4df05c8 100644
--- a/kernel/power/suspend_file.c
+++ b/kernel/power/suspend_file.c
@@ -663,3 +663,54 @@ static int filewriter_read_header_cleanu
return 0;
}

+static int filewriter_signature_op(int op)
+{
+ char *cur;
+ int result = 0, changed = 0;
+ struct filewriter_header *header;
+
+ if(filewriter_target_bdev <= 0)
+ return -1;
+
+ cur = (char *) get_zeroed_page(GFP_ATOMIC);
+ if (!cur) {
+ printk("Unable to allocate a page for reading the image "
+ "signature.\n");
+ return -ENOMEM;
+ }
+
+ suspend_bio_ops.bdev_page_io(READ, filewriter_target_bdev,
+ target_firstblock,
+ virt_to_page(cur));
+
+ header = (struct filewriter_header *) cur;
+ result = parse_signature(header);
+
+ switch (op) {
+ case INVALIDATE:
+ if (result == -1)
+ goto out;
+
+ strcpy(header->sig, NoImage);
+ header->resumed_before = 0;
+ result = changed = 1;
+ break;
+ case MARK_RESUME_ATTEMPTED:
+ if (result == 1) {
+ header->resumed_before = 1;
+ changed = 1;
+ }
+ break;
+ }
+
+ if (changed)
+ suspend_bio_ops.bdev_page_io(WRITE, filewriter_target_bdev,
+ target_firstblock,
+ virt_to_page(cur));
+
+out:
+ suspend_bio_ops.finish_all_io();
+ free_page((unsigned long) cur);
+ return result;
+}
+
--
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 00:43    [W:0.138 / U:8.832 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site