mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nigel Cunningham <nigel@suspend2.net>
To: linux-kernel@vger.kernel.org
Subject: [Suspend2][ 02/11] [Suspend2] Get header storage needed for module data.
Date: Tue, 27 Jun 2006 02:53:08 +1000	[thread overview]
Message-ID: <20060626165307.10957.7513.stgit@nigel.suspend2.net> (raw)
In-Reply-To: <20060626165301.10957.62592.stgit@nigel.suspend2.net>

Get the amount of space in the image header required by modules to store
their data. Modules store in image header configuration needed to resume,
such as the name of the cryptoapi modules used for encryption and
compression. The writer may store additional information for bootstrapping,
such as where to find the header's pages on disk, which is not included in
this value. This is only the space required in the image header proper.

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

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

diff --git a/kernel/power/modules.c b/kernel/power/modules.c
index f337208..60c7c7b 100644
--- a/kernel/power/modules.c
+++ b/kernel/power/modules.c
@@ -16,3 +16,36 @@ struct suspend_module_ops *suspend_activ
 static int suspend_num_filters;
 int suspend_num_writers, suspend_num_modules;
        
+/*
+ * suspend_header_storage_for_modules
+ *
+ * Returns the amount of space needed to store configuration
+ * data needed by the modules prior to copying back the original
+ * kernel. We can exclude data for pageset2 because it will be
+ * available anyway once the kernel is copied back.
+ */
+unsigned long suspend_header_storage_for_modules(void)
+{
+	struct suspend_module_ops *this_module;
+	unsigned long bytes = 0;
+	
+	list_for_each_entry(this_module, &suspend_modules, module_list) {
+		this_module->header_requested = 0;
+		this_module->header_used = 0;
+		if (this_module->disabled ||
+		    (this_module->type == WRITER_MODULE &&
+		     suspend_active_writer != this_module))
+			continue;
+		if (this_module->storage_needed) {
+			int this = this_module->storage_needed() +
+				sizeof(struct suspend_module_header) +
+				sizeof(int);
+			this_module->header_requested = this;
+			bytes += this;
+		}
+	}
+
+	/* One more for the empty terminator */
+	return bytes + sizeof(struct suspend_module_header);
+}
+

--
Nigel Cunningham		nigel at suspend2 dot net

  parent reply	other threads:[~2006-06-26 17:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 16:53 [Suspend2][ 00/11 Module support Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 01/11] [Suspend2] Modules.c header Nigel Cunningham
2006-06-26 16:53 ` Nigel Cunningham [this message]
2006-06-26 16:53 ` [Suspend2][ 03/11] [Suspend2] Get memory needed for Suspend2 modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 04/11] [Suspend2] Find a suspend2 module given its name Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 05/11] [Suspend2] Get debugging info from modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 06/11] [Suspend2] Register and unregister suspend2 modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 07/11] [Suspend2] Move a suspend2 module to the tail of its list Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 08/11] [Suspend2] Initialise and cleanup routines for suspend2 modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 09/11] [Suspend2] Get next suspend2 module in the pipeline Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 10/11] [Suspend2] Get and put references to Suspend2 modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 11/11] [Suspend2] Header file for " Nigel Cunningham
2006-06-26 21:15 ` [Suspend2][ 00/11 Module support Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060626165307.10957.7513.stgit@nigel.suspend2.net \
    --to=nigel@suspend2.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®