[ 03/10] [Suspend2] Move module to the tail of lists.

From: Nigel Cunningham
Date: Wed Feb 01 2006 - 06:41:14 EST



This function moves a module to the tail of lists in which it appears. This
is used at resume time, to make the order in which modules are used match
the order used when suspending. It wouldn't do to compress and then encrypt
while suspending, but try to decompress before decrypting at resume.

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

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

diff --git a/kernel/power/modules.c b/kernel/power/modules.c
index 227e320..f7e9ab0 100644
--- a/kernel/power/modules.c
+++ b/kernel/power/modules.c
@@ -85,3 +85,34 @@ void suspend_unregister_module(struct su
list_del(&module->module_list);
num_modules--;
}
+
+/*
+ * suspend_move_module_tail
+ *
+ * Rearrange modules when reloading the config.
+ */
+void suspend_move_module_tail(struct suspend_module_ops *module)
+{
+ switch (module->type) {
+ case FILTER_PLUGIN:
+ if (num_filters > 1)
+ list_move_tail(&module->ops.filter.filter_list,
+ &suspend_filters);
+ break;
+
+ case WRITER_PLUGIN:
+ if (num_writers > 1)
+ list_move_tail(&module->ops.writer.writer_list,
+ &suspend_writers);
+ break;
+
+ case MISC_PLUGIN:
+ break;
+ default:
+ printk("Hmmm. Plugin '%s' has an invalid type."
+ " It has been ignored.\n", module->name);
+ return;
+ }
+ if ((num_filters + num_writers + num_ui) > 1)
+ list_move_tail(&module->module_list, &suspend_modules);
+}

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