[Suspend2][ 08/35] [Suspend2] Reopen the resume dev_t.

From: Nigel Cunningham
Date: Mon Jun 26 2006 - 19:05:33 EST


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@xxxxxxxxxxxx>

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