public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] libswap: Move file & line macros to macros
@ 2024-04-17 12:31 Petr Vorel
  2024-04-17 12:31 ` [LTP] [PATCH 2/2] libswap: Use tst_res_() instead of tst_res() Petr Vorel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Petr Vorel @ 2024-04-17 12:31 UTC (permalink / raw)
  To: ltp

Having __FILE__ and __LINE__ in C function does not help,
they must be in macros to help identify the caller.

Therefore make_swapfile_() wrapper is not needed.

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

diff --git a/include/libswap.h b/include/libswap.h
index 96e718542..87e32328e 100644
--- a/include/libswap.h
+++ b/include/libswap.h
@@ -19,41 +19,35 @@ enum swapfile_method {
 /*
  * Create a swapfile of a specified size or number of blocks.
  */
-int make_swapfile_(const char *file, const int lineno,
+int make_swapfile(const char *file, const int lineno,
 			const char *swapfile, unsigned int num,
 			int safe, enum swapfile_method method);
 
-static inline int make_swapfile(const char *swapfile, unsigned int num,
-			int safe, enum swapfile_method method)
-{
-	return make_swapfile_(__FILE__, __LINE__, swapfile, num, safe, method);
-}
-
 /**
  * Macro to create swapfile size in megabytes (MB).
  */
 #define MAKE_SWAPFILE_SIZE(swapfile, size) \
-    make_swapfile(swapfile, size, 0, SWAPFILE_BY_SIZE)
+    make_swapfile(__FILE__, __LINE__, swapfile, size, 0, SWAPFILE_BY_SIZE)
 
 /**
  * Macro to create swapfile size in block numbers.
  */
 #define MAKE_SWAPFILE_BLKS(swapfile, blocks) \
-    make_swapfile(swapfile, blocks, 0, SWAPFILE_BY_BLKS)
+    make_swapfile(__FILE__, __LINE__, swapfile, blocks, 0, SWAPFILE_BY_BLKS)
 
 /**
  * Macro to safely create swapfile size in megabytes (MB).
  * Includes safety checks to handle potential errors.
  */
 #define SAFE_MAKE_SWAPFILE_SIZE(swapfile, size) \
-    make_swapfile(swapfile, size, 1, SWAPFILE_BY_SIZE)
+    make_swapfile(__FILE__, __LINE__, swapfile, size, 1, SWAPFILE_BY_SIZE)
 
 /**
  * Macro to safely create swapfile size in block numbers.
  * Includes safety checks to handle potential errors.
  */
 #define SAFE_MAKE_SWAPFILE_BLKS(swapfile, blocks) \
-    make_swapfile(swapfile, blocks, 1, SWAPFILE_BY_BLKS)
+    make_swapfile(__FILE__, __LINE__, swapfile, blocks, 1, SWAPFILE_BY_BLKS)
 
 /*
  * Check swapon/swapoff support status of filesystems or files
diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c
index 313a15f24..b4233be0d 100644
--- a/libs/libltpswap/libswap.c
+++ b/libs/libltpswap/libswap.c
@@ -133,7 +133,7 @@ out:
 	return contiguous;
 }
 
-int make_swapfile_(const char *file, const int lineno,
+int make_swapfile(const char *file, const int lineno,
 			const char *swapfile, unsigned int num,
 			int safe, enum swapfile_method method)
 {
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-18 11:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-17 12:31 [LTP] [PATCH 1/2] libswap: Move file & line macros to macros Petr Vorel
2024-04-17 12:31 ` [LTP] [PATCH 2/2] libswap: Use tst_res_() instead of tst_res() Petr Vorel
2024-04-18  5:32   ` Li Wang
2024-04-18 11:24   ` Cyril Hrubis
2024-04-18 11:43     ` Petr Vorel
2024-04-18  5:32 ` [LTP] [PATCH 1/2] libswap: Move file & line macros to macros Li Wang
2024-04-18 11:23 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox