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][ 27/35] [Suspend2] Set filewriter resume2, having been given a filename.
Date
Set the resume2= value when the user has echoed to filewriter_target and
we've verified that an image exists in that file. The user can then read
the value and modify their bootloader or initrd to set the value to the
same thing when resuming.

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

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

diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
index 20d0807..2e19aae 100644
--- a/kernel/power/suspend_file.c
+++ b/kernel/power/suspend_file.c
@@ -799,3 +799,32 @@ static void filewriter_mark_resume_attem
filewriter_signature_op(MARK_RESUME_ATTEMPTED);
}

+static void filewriter_set_resume2(void)
+{
+ char *buffer = (char *) get_zeroed_page(GFP_ATOMIC);
+ char *buffer2 = (char *) get_zeroed_page(GFP_ATOMIC);
+ unsigned long sector = bmap(target_inode, 0);
+ int offset = 0;
+
+ if (filewriter_target_bdev) {
+ set_devinfo(filewriter_target_bdev, target_inode->i_blkbits);
+
+ bdevname(filewriter_target_bdev, buffer2);
+ offset += snprintf(buffer + offset, PAGE_SIZE - offset,
+ "/dev/%s", buffer2);
+
+ if (sector)
+ offset += snprintf(buffer + offset, PAGE_SIZE - offset,
+ ":0x%lx", sector << devinfo.bmap_shift);
+ } else
+ offset += snprintf(buffer + offset, PAGE_SIZE - offset,
+ "%s is not a valid target.", filewriter_target);
+
+ sprintf(resume2_file, "file:%s", buffer);
+
+ free_page((unsigned long) buffer);
+ free_page((unsigned long) buffer2);
+
+ suspend_attempt_to_parse_resume_device();
+}
+
--
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:01    [W:0.112 / U:1.352 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site