[LTP] [PATCH v2 3/7] syscalls/swapon03: use get_maxswapfiles() and GET_USED_SWAPFILES() api

Cyril Hrubis chrubis@suse.cz
Wed Jan 3 16:34:35 CET 2024


Hi!
> +	max_swapfiles = (int)get_maxswapfiles();

We may as well declare the get_maxswapfiles() to return int instead,
it's not going to overflow signed int anytime soon...

> +	used_swapfiles = GET_USED_SWAPFILES();
> +	swapfiles = max_swapfiles - used_swapfiles;
> +	if (swapfiles > max_swapfiles)
> +		swapfiles = max_swapfiles;
>  	pid = SAFE_FORK();
>  	if (pid == 0) {
>  		/*create and turn on remaining swapfiles */
> -- 
> 2.27.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list