diff mbox series

[2/2] libswap: Use tst_res_() instead of tst_res()

Message ID 20240417123113.731780-2-pvorel@suse.cz
State Accepted
Headers show
Series [1/2] libswap: Move file & line macros to macros | expand

Commit Message

Petr Vorel April 17, 2024, 12:31 p.m. UTC
That allows to identify the caller of the function. That is the reason
why tst_brk_() was already used instead of tst_brk().

Fixes: f987ffff5 ("libswap: add two methods to create swapfile")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 libs/libltpswap/libswap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Li Wang April 18, 2024, 5:32 a.m. UTC | #1
On Wed, Apr 17, 2024 at 8:31 PM Petr Vorel <pvorel@suse.cz> wrote:

> That allows to identify the caller of the function. That is the reason
> why tst_brk_() was already used instead of tst_brk().
>
> Fixes: f987ffff5 ("libswap: add two methods to create swapfile")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
>

Reviewed-by: Li Wang <liwang@redhat.com>

---
>  libs/libltpswap/libswap.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c
> index b4233be0d..aed76dfe2 100644
> --- a/libs/libltpswap/libswap.c
> +++ b/libs/libltpswap/libswap.c
> @@ -149,18 +149,18 @@ int make_swapfile(const char *file, const int lineno,
>         blk_size = fs_info.f_bsize;
>
>         if (method == SWAPFILE_BY_SIZE) {
> -               tst_res(TINFO, "create a swapfile size of %u megabytes
> (MB)", num);
> +               tst_res_(file, lineno, TINFO, "create a swapfile size of
> %u megabytes (MB)", num);
>                 blocks = num * 1024 * 1024 / blk_size;
>         } else if (method == SWAPFILE_BY_BLKS) {
>                 blocks = num;
> -               tst_res(TINFO, "create a swapfile with %u block numbers",
> blocks);
> +               tst_res_(file, lineno, TINFO, "create a swapfile with %u
> block numbers", blocks);
>         } else {
>                 tst_brk_(file, lineno, TBROK, "Invalid method, please see
> include/libswap.h");
>         }
>
>         /* To guarantee at least one page can be swapped out */
>         if (blk_size * blocks < pg_size) {
> -               tst_res(TWARN, "Swapfile size is less than the system page
> size. "
> +               tst_res_(file, lineno, TWARN, "Swapfile size is less than
> the system page size. "
>                         "Using page size (%lu bytes) instead of block size
> (%lu bytes).",
>                         (unsigned long)pg_size, blk_size);
>                 blk_size = pg_size;
> --
> 2.43.0
>
>
Cyril Hrubis April 18, 2024, 11:24 a.m. UTC | #2
Hi!
Reviewed-by; Cyril Hrubis <chrubis@suse.cz>
Petr Vorel April 18, 2024, 11:43 a.m. UTC | #3
Hi Li, Cyril,

thanks, patchset merged!

I'll send fix for too low block size on 64K shortly.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c
index b4233be0d..aed76dfe2 100644
--- a/libs/libltpswap/libswap.c
+++ b/libs/libltpswap/libswap.c
@@ -149,18 +149,18 @@  int make_swapfile(const char *file, const int lineno,
 	blk_size = fs_info.f_bsize;
 
 	if (method == SWAPFILE_BY_SIZE) {
-		tst_res(TINFO, "create a swapfile size of %u megabytes (MB)", num);
+		tst_res_(file, lineno, TINFO, "create a swapfile size of %u megabytes (MB)", num);
 		blocks = num * 1024 * 1024 / blk_size;
 	} else if (method == SWAPFILE_BY_BLKS) {
 		blocks = num;
-		tst_res(TINFO, "create a swapfile with %u block numbers", blocks);
+		tst_res_(file, lineno, TINFO, "create a swapfile with %u block numbers", blocks);
 	} else {
 		tst_brk_(file, lineno, TBROK, "Invalid method, please see include/libswap.h");
 	}
 
 	/* To guarantee at least one page can be swapped out */
 	if (blk_size * blocks < pg_size) {
-		tst_res(TWARN, "Swapfile size is less than the system page size. "
+		tst_res_(file, lineno, TWARN, "Swapfile size is less than the system page size. "
 			"Using page size (%lu bytes) instead of block size (%lu bytes).",
 			(unsigned long)pg_size, blk_size);
 		blk_size = pg_size;