lkml.org 
[lkml]   [2006]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[Suspend2][ 03/13] [Suspend2] Compression cryptoapi initialisation and cleanup.
    Date
    Add the routines for preparing cryptoapi for suspend2 use and cleaning it
    up.

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

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

    diff --git a/kernel/power/compression.c b/kernel/power/compression.c
    index 3d222b3..470644f 100644
    --- a/kernel/power/compression.c
    +++ b/kernel/power/compression.c
    @@ -92,3 +92,40 @@ static inline void suspend_compress_free
    page_buffer = NULL;
    }

    +/*
    + * suspend_compress_cleanup
    + *
    + * Frees memory allocated for our labours.
    + */
    +static void suspend_compress_cleanup(void)
    +{
    + if (suspend_compressor_transform) {
    + crypto_free_tfm(suspend_compressor_transform);
    + suspend_compressor_transform = NULL;
    + }
    +}
    +
    +/*
    + * suspend_crypto_prepare
    + *
    + * Prepare to do some work by allocating buffers and transforms.
    + * Returns: Int: Zero. Even if we can't set up compression, we still
    + * seek to suspend.
    + */
    +static int suspend_compress_crypto_prepare(void)
    +{
    + if (!*suspend_compressor_name) {
    + printk("Suspend2: Compression enabled but no compressor name set.\n");
    + suspend_compression_ops.disabled = 1;
    + return 0;
    + }
    +
    + if (!(suspend_compressor_transform = crypto_alloc_tfm(suspend_compressor_name, 0))) {
    + printk("Suspend2: Failed to initialise the %s compression transform.\n",
    + suspend_compressor_name);
    + return 1;
    + }
    +
    + return 0;
    +}
    +
    --
    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 07:18    [W:0.019 / U:90.828 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site