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][ 07/11] [Suspend2] Move a suspend2 module to the tail of its list.
    Date
    When suspend2 modules are built as kernel modules, they may be loaded in a
    different order when resuming to the order used when suspending. This could
    result in decryption and decompression being done in the wrong order. We
    avoid this by remembering the order used when suspending, and reordering at
    resume-time to match. This routine provides the primitive used in that
    reordering.

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

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

    diff --git a/kernel/power/modules.c b/kernel/power/modules.c
    index 6305fa2..af237b6 100644
    --- a/kernel/power/modules.c
    +++ b/kernel/power/modules.c
    @@ -187,3 +187,38 @@ void suspend_unregister_module(struct su
    list_del(&module->module_list);
    suspend_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_MODULE:
    + if (suspend_num_filters > 1)
    + list_move_tail(&module->type_list,
    + &suspend_filters);
    + break;
    +
    + case WRITER_MODULE:
    + if (suspend_num_writers > 1)
    + list_move_tail(&module->type_list,
    + &suspend_writers);
    + break;
    +
    + case MISC_MODULE:
    + break;
    + default:
    + printk("Hmmm. Module '%s' has an invalid type."
    + " It has been ignored.\n", module->name);
    + return;
    + }
    + if ((suspend_num_filters + suspend_num_writers) > 1)
    + list_move_tail(&module->module_list, &suspend_modules);
    +}
    +
    + return len;
    +}
    +
    --
    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:02    [W:0.034 / U:90.680 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site