Implement support for invalidating an image or marking that we've attempted
to resume from the image before.
Signed-off-by: Nigel Cunningham <[email protected]>
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 [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]