lkml.org 
[lkml]   [2023]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 4/4] PM: hibernate: Support to select compression algorithm
On Tue, Sep 26, 2023 at 02:27:14PM +0530, Nikhil V wrote:
> +static const char * const comp_alg_enabled[] = {
> +#if IS_ENABLED(CONFIG_CRYPTO_LZO)
> + COMPRESSION_ALGO_LZO,
> +#endif
> +#if IS_ENABLED(CONFIG_CRYPTO_LZ4)
> + COMPRESSION_ALGO_LZ4,
> +#endif
> +};
> +
> +static int __init compression_setup(char *str)
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(comp_alg_enabled); i++) {
> + if (!strcmp(str, comp_alg_enabled[i])) {
> + strscpy(hib_comp_algo, str, sizeof(hib_comp_algo));
> + goto setup_done;
> + }
> + }
> + strscpy(hib_comp_algo, default_compressor, sizeof(hib_comp_algo));
> +
> +setup_done:
> + return 1;
> +}
> +
> __setup("noresume", noresume_setup);
> __setup("resume_offset=", resume_offset_setup);
> __setup("resume=", resume_setup);
> @@ -1423,3 +1449,4 @@ __setup("hibernate=", hibernate_setup);
> __setup("resumewait", resumewait_setup);
> __setup("resumedelay=", resumedelay_setup);
> __setup("nohibernate", nohibernate_setup);
> +__setup("hib_compression=", compression_setup);
> --

If I pass hib_compression=lz4 without enabling CONFIG_CRYPTO_LZ4, It
silently makes the compression to lzo which is expected from this code.
It would be good if an error/info message is printed in
compression_setup() which this happens.

Thanks,
Pavan

\
 
 \ /
  Last update: 2023-10-03 10:20    [W:1.708 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site