lkml.org 
[lkml]   [2006]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[ 03/10] [Suspend2] Move module to the tail of lists.
Date

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@suspend2.net>

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@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-02-01 12:45    [W:0.245 / U:6.964 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site