[Suspend2][ 13/28] [Suspend2] Initialise/cleanup swapwriter

From: Nigel Cunningham
Date: Mon Jun 26 2006 - 18:47:08 EST


Initialise and cleanup routines, called when we're going to do something.
It may be just modifying a setting, but some of these result in I/O being
done to (eg) check whether an image exists.

Signed-off-by: Nigel Cunningham <nigel@xxxxxxxxxxxx>

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

diff --git a/kernel/power/suspend_swap.c b/kernel/power/suspend_swap.c
index 792bcc8..ae0dfad 100644
--- a/kernel/power/suspend_swap.c
+++ b/kernel/power/suspend_swap.c
@@ -429,3 +429,26 @@ static int swapwriter_storage_available(
return swapinfo.freeswap + swapwriter_storage_allocated();
}

+static int swapwriter_initialise(int starting_cycle)
+{
+ if (!starting_cycle)
+ return 0;
+
+ enable_swapfile();
+
+ if (resume_dev_t && !resume_block_device &&
+ IS_ERR(resume_block_device =
+ open_bdev(MAX_SWAPFILES, resume_dev_t)))
+ return 1;
+
+ return 0;
+}
+
+static void swapwriter_cleanup(int ending_cycle)
+{
+ if (ending_cycle)
+ disable_swapfile();
+
+ close_bdevs();
+}
+

--
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/