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][ 08/35] [Suspend2] Reopen the resume dev_t.
Date
Having processed the resume2= setting once to get the dev_t it refers to,
we can just use the dev_t again afterwards. This routine reopens the bdev
at some later stage, getting afresh the inode and device info - something
might have been modified by the user since our last use, and it would be
wrong to keep the device open all the time anyway.

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

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

diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
index e2ad8dc..7e06a06 100644
--- a/kernel/power/suspend_file.c
+++ b/kernel/power/suspend_file.c
@@ -259,3 +259,22 @@ static void filewriter_cleanup(int finis
}
}

+/*
+ * reopen_resume_devt
+ *
+ * Having opened resume2= once, we remember the major and
+ * minor nodes and use them to reopen the bdev for checking
+ * whether an image exists (possibly when starting a resume).
+ */
+static void reopen_resume_devt(void)
+{
+ filewriter_target_bdev = open_by_devnum(resume_dev_t, FMODE_READ);
+ if (IS_ERR(filewriter_target_bdev)) {
+ printk("Got a dev_num (%lx) but failed to open it.\n",
+ (unsigned long) resume_dev_t);
+ return;
+ }
+ target_inode = filewriter_target_bdev->bd_inode;
+ set_devinfo(filewriter_target_bdev, target_inode->i_blkbits);
+}
+
--
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:09    [W:0.140 / U:0.036 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site