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

Cyril Hrubis
2024-01-03T15:34:27Z

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