Re: [RFC PATCH 4/4] PM: hibernate: Support to select compression algorithm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux