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][ 35/35] [Suspend2] Filewriter load/unload routines.
Date
Load and unload procedures for the filewriter. Set fields in the ops
structure from the block writer, register with the core and register proc
entries. Do the reverse on unload.

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

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

diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
index 56c7a76..1d8b296 100644
--- a/kernel/power/suspend_file.c
+++ b/kernel/power/suspend_file.c
@@ -1095,3 +1095,47 @@ static struct suspend_module_ops filewri
.parse_sig_location = filewriter_parse_sig_location,
};

+/* ---- Registration ---- */
+static __init int filewriter_load(void)
+{
+ int result;
+ int i, numfiles = sizeof(filewriter_proc_data) / sizeof(struct suspend_proc_data);
+
+ printk("Suspend2 FileWriter loading.\n");
+
+ filewriterops.read_chunk = suspend_bio_ops.read_chunk;
+ filewriterops.write_chunk = suspend_bio_ops.write_chunk;
+ filewriterops.rw_init = suspend_bio_ops.rw_init;
+ filewriterops.rw_cleanup = suspend_bio_ops.rw_cleanup;
+ filewriterops.rw_header_chunk =
+ suspend_bio_ops.rw_header_chunk;
+
+ if (!(result = suspend_register_module(&filewriterops))) {
+ for (i=0; i< numfiles; i++)
+ suspend_register_procfile(&filewriter_proc_data[i]);
+ } else
+ printk("Suspend2 FileWriter unable to register!\n");
+
+ return result;
+}
+
+#ifdef MODULE
+static __exit void filewriter_unload(void)
+{
+ int i, numfiles = sizeof(filewriter_proc_data) / sizeof(struct suspend_proc_data);
+
+ printk("Suspend2 FileWriter unloading.\n");
+
+ for (i=0; i< numfiles; i++)
+ suspend_unregister_procfile(&filewriter_proc_data[i]);
+ suspend_unregister_module(&filewriterops);
+}
+
+module_init(filewriter_load);
+module_exit(filewriter_unload);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Nigel Cunningham");
+MODULE_DESCRIPTION("Suspend2 filewriter");
+#else
+late_initcall(filewriter_load);
+#endif
--
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 00:44    [W:0.133 / U:4.368 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site