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][ 02/11] [Suspend2] Get header storage needed for module data.
    Date
    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
    -
    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-26 19:06    [W:0.025 / U:29.768 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site