[LTP] [PATCH v2 1/2] libswap: add two methods to create swapfile

Petr Vorel pvorel@suse.cz
Thu Mar 21 13:41:41 CET 2024


...
> > > -int make_swapfile(const char *swapfile, int blocks, int safe);
> > > +int make_swapfile(const char *swapfile, unsigned int num,
> > > +                     int safe, enum swapfile_method method);
> > I wonder if it would help to add const char *file, const int lineno here.

> > > +
> > > +#define MAKE_SWAPFILE_SIZE(swapfile, size, safe) \
> > > +    make_swapfile(swapfile, size, safe, SWAPFILE_BY_SIZE)
> > nit: I like the name but one have to search which units (kB vs. MB vs. GB)
> > are used.


> Maybe we can add code comments like:

> +/**
> + * Macro to create swapfile size in megabytes (MB)
> + */
>  #define MAKE_SWAPFILE_SIZE(swapfile, size, safe) \
>     ...

> +/**
> + * Macro to create swapfile size in block numbers
> + */
>  #define MAKE_SWAPFILE_BLKS(swapfile, blocks, safe) \
>       ...

Sure, that's enough.

Kind regards,
Petr


More information about the ltp mailing list